summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-03-09 10:00:26 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-09 10:00:26 +0000
commitf3b28a0aafd83a57d42afbf23c9f6fbe6f546db3 (patch)
tree5ecb2b2a78ab3139828db18de5f2a76d76c77519
parent8d0b9eb56af520d28c423da76c0f0be02cb453c7 (diff)
parent327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e (diff)
Merge "Reduce log noise/warnings format to conventions"
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java235
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java108
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java224
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java77
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java3
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java42
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java51
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java14
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java22
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java2
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java713
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java1
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java1
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java554
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java655
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java92
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java31
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java37
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java33
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java33
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java51
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java42
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java40
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java45
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java861
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java17
-rw-r--r--asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCConfigurationTest.java618
-rw-r--r--asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCControllerTest.java628
-rw-r--r--asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java175
-rw-r--r--asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCGlobalControllerTest.java288
-rw-r--r--asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/BigDecimalVersionTest.java28
-rw-r--r--asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/YamlTest.java249
-rw-r--r--asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/ToscaResourceInstallerTest.java942
-rw-r--r--asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/VfResourceInstallerTest.java393
-rw-r--r--asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java274
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java388
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java353
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java193
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java75
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java454
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java190
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DecomposeServiceTest.java80
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java1203
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java384
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java401
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java237
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java920
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java285
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java181
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/HomingTest.java797
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ManualHandlingTest.java121
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java336
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/RainyDayHandlerTest.java63
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ReceiveWorkflowMessageTest.java194
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java70
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java826
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java260
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java194
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java688
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java117
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java110
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java3880
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java86
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java278
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java29
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java199
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java192
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java2077
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java150
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java159
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java115
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java230
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java54
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java249
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java216
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java218
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java240
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java218
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java218
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java55
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java108
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java98
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java1
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java102
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java436
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java1
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java136
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java152
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java1220
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java495
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java594
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java312
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java120
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java565
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java1037
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java226
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java291
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java306
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java132
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java221
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java490
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java336
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java723
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java624
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java151
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java114
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java265
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java996
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java310
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java316
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java159
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java345
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java328
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java374
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java279
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java871
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java200
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java128
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java201
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java232
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java28
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java606
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java392
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java586
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java450
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java586
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java462
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java230
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java230
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/CryptoTest.java51
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoAlarmLoggerTest.java166
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java516
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryConcurrencyTest.java252
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java1154
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertyInitializerTest.java85
-rw-r--r--common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java38
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java102
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java18
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java67
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java32
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java94
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java1388
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java40
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java512
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java349
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java309
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java1460
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java190
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java71
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java46
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java396
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java46
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java330
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java67
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java167
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java421
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java62
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java162
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java64
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java62
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java98
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java141
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java591
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java88
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java66
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java296
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java44
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java52
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java50
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java46
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java60
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java36
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java20
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java52
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceTest.java52
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToAllottedResourcesTest.java26
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToResourceCustomizationTest.java26
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/TempNetworkHeatTemplateLookupTest.java32
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java200
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToscaCsarTest.java42
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleCustomizationTest.java56
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java54
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java50
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java74
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/filesearching/LogFileSearching.java196
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/ArquillianPackagerForITCases.java66
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/ASDCITCase.java711
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java194
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfo.java174
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfoDeserializer.java25
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonNotificationData.java170
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java136
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfoDeserializer.java17
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonVfModuleMetaData.java84
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/jmeter/JMeterITCase.java162
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/logging/LogsCheckerITCase.java100
-rw-r--r--packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/soapui/SoapUiITCase.java324
-rw-r--r--status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java171
211 files changed, 28672 insertions, 28398 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java
index 250211845f..045b62df85 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import org.junit.Test;
import org.openecomp.mso.entity.MsoRequest;
import org.openecomp.mso.openstack.beans.MsoTenant;
@@ -35,125 +36,125 @@ import org.openecomp.mso.openstack.beans.Subnet;
import org.openecomp.mso.openstack.beans.VnfRollback;
public class AdapterBeansTest {
- @Test
- public final void msoTenantTest() {
- MsoTenant tenant = new MsoTenant();
- tenant.setTenantId("1");
- assertTrue(tenant.getTenantId().equalsIgnoreCase("1"));
- tenant.setTenantName("TenantName");
- assertTrue(tenant.getTenantName().equalsIgnoreCase("TenantName"));
- Map<String, String> hm = new HashMap<>();
- hm.put("Key1", "value1");
- tenant.setMetadata(hm);
- assertTrue(tenant.getMetadata() != null);
- new MsoTenant("1", "TenantName", hm);
- // assertTrue(tenant.toString() != null);
- }
+ @Test
+ public final void msoTenantTest() {
+ MsoTenant tenant = new MsoTenant();
+ tenant.setTenantId("1");
+ assertTrue(tenant.getTenantId().equalsIgnoreCase("1"));
+ tenant.setTenantName("TenantName");
+ assertTrue(tenant.getTenantName().equalsIgnoreCase("TenantName"));
+ Map<String, String> hm = new HashMap<>();
+ hm.put("Key1", "value1");
+ tenant.setMetadata(hm);
+ assertTrue(tenant.getMetadata() != null);
+ new MsoTenant("1", "TenantName", hm);
+ // assertTrue(tenant.toString() != null);
+ }
- @Test
- public final void networkRollbackTest() {
- NetworkRollback networkRollback = new NetworkRollback();
- networkRollback.setCloudId("cloudId");
- assertTrue(networkRollback.getCloudId().equalsIgnoreCase("cloudId"));
- networkRollback.setModelCustomizationUuid("modelCustomizationUuid");
- assertTrue(networkRollback.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid"));
- MsoRequest msoRequest = new MsoRequest();
- networkRollback.setMsoRequest(msoRequest);
- networkRollback.getMsoRequest();
- // assertTrue(networkRollback.getMsoRequest() == null);
- networkRollback.setNetworkCreated(Boolean.TRUE);
- assertTrue(networkRollback.getNetworkCreated());
- networkRollback.setNetworkId("networkId");
- assertTrue(networkRollback.getNetworkId().equalsIgnoreCase("networkId"));
- networkRollback.setNetworkName("networkName");
- assertTrue(networkRollback.getNetworkName().equalsIgnoreCase("networkName"));
- networkRollback.setNetworkStackId("networkStackId");
- assertTrue(networkRollback.getNetworkStackId().equalsIgnoreCase("networkStackId"));
- networkRollback.setNetworkType("networkType");
- assertTrue(networkRollback.getNetworkType().equalsIgnoreCase("networkType"));
- networkRollback.setNeutronNetworkId("neutronNetworkId");
- assertTrue(networkRollback.getNeutronNetworkId().equalsIgnoreCase("neutronNetworkId"));
- networkRollback.setPhysicalNetwork("physicalNetwork");
- assertTrue(networkRollback.getPhysicalNetwork().equalsIgnoreCase("physicalNetwork"));
- networkRollback.setTenantId("tenantId");
- assertTrue(networkRollback.getTenantId().equalsIgnoreCase("tenantId"));
- List<Integer> al = new ArrayList<>();
- al.add(1);
- al.add(2);
- networkRollback.setVlans(al);
- assertTrue(networkRollback.getVlans() != null);
- assertTrue(networkRollback.toString() != null);
- }
+ @Test
+ public final void networkRollbackTest() {
+ NetworkRollback networkRollback = new NetworkRollback();
+ networkRollback.setCloudId("cloudId");
+ assertTrue(networkRollback.getCloudId().equalsIgnoreCase("cloudId"));
+ networkRollback.setModelCustomizationUuid("modelCustomizationUuid");
+ assertTrue(networkRollback.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid"));
+ MsoRequest msoRequest = new MsoRequest();
+ networkRollback.setMsoRequest(msoRequest);
+ networkRollback.getMsoRequest();
+ // assertTrue(networkRollback.getMsoRequest() == null);
+ networkRollback.setNetworkCreated(Boolean.TRUE);
+ assertTrue(networkRollback.getNetworkCreated());
+ networkRollback.setNetworkId("networkId");
+ assertTrue(networkRollback.getNetworkId().equalsIgnoreCase("networkId"));
+ networkRollback.setNetworkName("networkName");
+ assertTrue(networkRollback.getNetworkName().equalsIgnoreCase("networkName"));
+ networkRollback.setNetworkStackId("networkStackId");
+ assertTrue(networkRollback.getNetworkStackId().equalsIgnoreCase("networkStackId"));
+ networkRollback.setNetworkType("networkType");
+ assertTrue(networkRollback.getNetworkType().equalsIgnoreCase("networkType"));
+ networkRollback.setNeutronNetworkId("neutronNetworkId");
+ assertTrue(networkRollback.getNeutronNetworkId().equalsIgnoreCase("neutronNetworkId"));
+ networkRollback.setPhysicalNetwork("physicalNetwork");
+ assertTrue(networkRollback.getPhysicalNetwork().equalsIgnoreCase("physicalNetwork"));
+ networkRollback.setTenantId("tenantId");
+ assertTrue(networkRollback.getTenantId().equalsIgnoreCase("tenantId"));
+ List<Integer> al = new ArrayList<>();
+ al.add(1);
+ al.add(2);
+ networkRollback.setVlans(al);
+ assertTrue(networkRollback.getVlans() != null);
+ assertTrue(networkRollback.toString() != null);
+ }
- @Test
- public final void poolTest() {
- Pool p = new Pool();
- p.setStart("start");
- p.getStart();
- p.setEnd("end");
- p.getEnd();
- p.toString();
- }
+ @Test
+ public final void poolTest() {
+ Pool p = new Pool();
+ p.setStart("start");
+ p.getStart();
+ p.setEnd("end");
+ p.getEnd();
+ p.toString();
+ }
- @Test
- public final void subnetTest() {
- Subnet subnet = new Subnet();
- subnet.setAllocationPools(new ArrayList<>());
- subnet.getAllocationPools();
- subnet.setCidr("cidr");
- subnet.getCidr();
- subnet.setDnsNameServers(new ArrayList<>());
- subnet.getDnsNameServers();
- subnet.setEnableDHCP(true);
- subnet.getEnableDHCP();
- subnet.setGatewayIp("gatewayIp");
- subnet.getGatewayIp();
- subnet.setHostRoutes(new ArrayList<>());
- subnet.getHostRoutes();
- subnet.setIpVersion("ipVersion");
- subnet.getIpVersion();
- subnet.setNeutronId("neutronId");
- subnet.getNeutronId();
- subnet.setSubnetId("subnetId");
- subnet.getSubnetId();
- subnet.setSubnetName("subnetName");
- subnet.getSubnetName();
- subnet.toString();
- }
+ @Test
+ public final void subnetTest() {
+ Subnet subnet = new Subnet();
+ subnet.setAllocationPools(new ArrayList<>());
+ subnet.getAllocationPools();
+ subnet.setCidr("cidr");
+ subnet.getCidr();
+ subnet.setDnsNameServers(new ArrayList<>());
+ subnet.getDnsNameServers();
+ subnet.setEnableDHCP(true);
+ subnet.getEnableDHCP();
+ subnet.setGatewayIp("gatewayIp");
+ subnet.getGatewayIp();
+ subnet.setHostRoutes(new ArrayList<>());
+ subnet.getHostRoutes();
+ subnet.setIpVersion("ipVersion");
+ subnet.getIpVersion();
+ subnet.setNeutronId("neutronId");
+ subnet.getNeutronId();
+ subnet.setSubnetId("subnetId");
+ subnet.getSubnetId();
+ subnet.setSubnetName("subnetName");
+ subnet.getSubnetName();
+ subnet.toString();
+ }
- @Test
- public final void vnfRollbackTest() {
- VnfRollback vnfRollback = new VnfRollback();
- new VnfRollback("vnfId", "tenantId", "cloudSiteId", true, true, new MsoRequest(), "volumeGroupName",
- "volumeGroupId", "requestType", "modelCustomizationUuid");
- vnfRollback.setBaseGroupHeatStackId("baseGroupHeatStackId");
- vnfRollback.getBaseGroupHeatStackId();
- vnfRollback.setCloudSiteId("cloudId");
- vnfRollback.getCloudSiteId();
- vnfRollback.setIsBase(false);
- vnfRollback.isBase();
- vnfRollback.setModelCustomizationUuid("modelCustomizationUuid");
- vnfRollback.getModelCustomizationUuid();
- vnfRollback.setMsoRequest(new MsoRequest());
- vnfRollback.getMsoRequest();
- vnfRollback.setRequestType("requestType");
- vnfRollback.getRequestType();
- vnfRollback.setTenantCreated(true);
- vnfRollback.getTenantCreated();
- vnfRollback.setTenantId("tenantId");
- vnfRollback.getTenantId();
- vnfRollback.setVfModuleStackId("vfModuleStackId");
- vnfRollback.getVfModuleStackId();
- vnfRollback.setVnfCreated(true);
- vnfRollback.getVnfCreated();
- vnfRollback.setVnfId("vnfId");
- vnfRollback.getVnfId();
- vnfRollback.setVolumeGroupHeatStackId("volumeGroupHeatStackId");
- vnfRollback.getVolumeGroupHeatStackId();
- vnfRollback.setVolumeGroupId("volumeGroupId");
- vnfRollback.getVolumeGroupId();
- vnfRollback.setVolumeGroupName("volumeGroupName");
- vnfRollback.getVolumeGroupName();
- vnfRollback.toString();
- }
+ @Test
+ public final void vnfRollbackTest() {
+ VnfRollback vnfRollback = new VnfRollback();
+ new VnfRollback("vnfId", "tenantId", "cloudSiteId", true, true, new MsoRequest(), "volumeGroupName",
+ "volumeGroupId", "requestType", "modelCustomizationUuid");
+ vnfRollback.setBaseGroupHeatStackId("baseGroupHeatStackId");
+ vnfRollback.getBaseGroupHeatStackId();
+ vnfRollback.setCloudSiteId("cloudId");
+ vnfRollback.getCloudSiteId();
+ vnfRollback.setIsBase(false);
+ vnfRollback.isBase();
+ vnfRollback.setModelCustomizationUuid("modelCustomizationUuid");
+ vnfRollback.getModelCustomizationUuid();
+ vnfRollback.setMsoRequest(new MsoRequest());
+ vnfRollback.getMsoRequest();
+ vnfRollback.setRequestType("requestType");
+ vnfRollback.getRequestType();
+ vnfRollback.setTenantCreated(true);
+ vnfRollback.getTenantCreated();
+ vnfRollback.setTenantId("tenantId");
+ vnfRollback.getTenantId();
+ vnfRollback.setVfModuleStackId("vfModuleStackId");
+ vnfRollback.getVfModuleStackId();
+ vnfRollback.setVnfCreated(true);
+ vnfRollback.getVnfCreated();
+ vnfRollback.setVnfId("vnfId");
+ vnfRollback.getVnfId();
+ vnfRollback.setVolumeGroupHeatStackId("volumeGroupHeatStackId");
+ vnfRollback.getVolumeGroupHeatStackId();
+ vnfRollback.setVolumeGroupId("volumeGroupId");
+ vnfRollback.getVolumeGroupId();
+ vnfRollback.setVolumeGroupName("volumeGroupName");
+ vnfRollback.getVolumeGroupName();
+ vnfRollback.toString();
+ }
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java
index 73bd67723d..0316e4b74c 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java
@@ -47,84 +47,82 @@ import com.woorea.openstack.base.client.OpenStackResponseException;
/**
* This class implements test methods of the MsoCommonUtils
- *
- *
*/
public class MsoCommonUtilsTest extends MsoCommonUtils {
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- @Test
- public final void testExecuteAndRecordOpenstackRequest () {
- OpenStackRequest openstackRequest = Mockito.mock(OpenStackRequest.class);
- Mockito.when(openstackRequest.endpoint()).thenReturn("localhost");
- Mockito.when(openstackRequest.path()).thenReturn("/test");
- //TODO:Must try a real connection
- assertNull(super.executeAndRecordOpenstackRequest (openstackRequest));
+ public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- }
+ @Test
+ public final void testExecuteAndRecordOpenstackRequest() {
+ OpenStackRequest openstackRequest = Mockito.mock(OpenStackRequest.class);
+ Mockito.when(openstackRequest.endpoint()).thenReturn("localhost");
+ Mockito.when(openstackRequest.path()).thenReturn("/test");
+ //TODO:Must try a real connection
+ assertNull(super.executeAndRecordOpenstackRequest(openstackRequest));
- @Test
- public final void testKeystoneErrorToMsoException () {
- OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect");
+ }
- OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1);
+ @Test
+ public final void testKeystoneErrorToMsoException() {
+ OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect");
- MsoException me = super.keystoneErrorToMsoException (openStackConnectException,"ContextError");
+ OpenStackBaseException openStackResponseException = new OpenStackResponseException("response", 1);
- assertTrue(me instanceof MsoIOException);
- assertTrue("connect".equals(me.getMessage()));
+ MsoException me = super.keystoneErrorToMsoException(openStackConnectException, "ContextError");
+ assertTrue(me instanceof MsoIOException);
+ assertTrue("connect".equals(me.getMessage()));
- MsoException me2 = super.keystoneErrorToMsoException (openStackResponseException,"ContextError");
- assertTrue(me2 instanceof MsoOpenstackException);
- assertTrue("ContextError".equals(me2.getContext()));
- assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
- }
+ MsoException me2 = super.keystoneErrorToMsoException(openStackResponseException, "ContextError");
+ assertTrue(me2 instanceof MsoOpenstackException);
+ assertTrue("ContextError".equals(me2.getContext()));
+ assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
- @Test
- public final void testHeatExceptionToMsoException () {
- OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect");
+ }
- OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1);
+ @Test
+ public final void testHeatExceptionToMsoException() {
+ OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect");
- MsoException me = super.heatExceptionToMsoException (openStackConnectException,"ContextError");
+ OpenStackBaseException openStackResponseException = new OpenStackResponseException("response", 1);
- assertTrue(me instanceof MsoIOException);
- assertTrue("connect".equals(me.getMessage()));
+ MsoException me = super.heatExceptionToMsoException(openStackConnectException, "ContextError");
+ assertTrue(me instanceof MsoIOException);
+ assertTrue("connect".equals(me.getMessage()));
- MsoException me2 = super.heatExceptionToMsoException (openStackResponseException,"ContextError");
- assertTrue(me2 instanceof MsoOpenstackException);
- assertTrue("ContextError".equals(me2.getContext()));
- assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
- }
- @Test
- public final void testNeutronExceptionToMsoException () {
- OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect");
+ MsoException me2 = super.heatExceptionToMsoException(openStackResponseException, "ContextError");
+ assertTrue(me2 instanceof MsoOpenstackException);
+ assertTrue("ContextError".equals(me2.getContext()));
+ assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
+ }
- OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1);
+ @Test
+ public final void testNeutronExceptionToMsoException() {
+ OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect");
- MsoException me = super.neutronExceptionToMsoException (openStackConnectException,"ContextError");
+ OpenStackBaseException openStackResponseException = new OpenStackResponseException("response", 1);
- assertTrue(me instanceof MsoIOException);
- assertTrue("connect".equals(me.getMessage()));
+ MsoException me = super.neutronExceptionToMsoException(openStackConnectException, "ContextError");
- MsoException me2 = super.neutronExceptionToMsoException (openStackResponseException,"ContextError");
- assertTrue(me2 instanceof MsoOpenstackException);
- assertTrue("ContextError".equals(me2.getContext()));
- assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
- }
+ assertTrue(me instanceof MsoIOException);
+ assertTrue("connect".equals(me.getMessage()));
- @Test
- public final void testRuntimeExceptionToMsoException () {
- RuntimeException re = new RuntimeException ("runtime");
- MsoException me = super.runtimeExceptionToMsoException (re, "ContextError");
+ MsoException me2 = super.neutronExceptionToMsoException(openStackResponseException, "ContextError");
+ assertTrue(me2 instanceof MsoOpenstackException);
+ assertTrue("ContextError".equals(me2.getContext()));
+ assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
+ }
- assertTrue (me instanceof MsoAdapterException);
- assertTrue("ContextError".equals(me.getContext()));
+ @Test
+ public final void testRuntimeExceptionToMsoException() {
+ RuntimeException re = new RuntimeException("runtime");
+ MsoException me = super.runtimeExceptionToMsoException(re, "ContextError");
+
+ assertTrue(me instanceof MsoAdapterException);
+ assertTrue("ContextError".equals(me.getContext()));
assertTrue(MsoExceptionCategory.INTERNAL.equals(me.getCategory()));
- }
+ }
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
index c2d4f9ba60..84b3fb4f91 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
@@ -40,119 +40,117 @@ import com.woorea.openstack.heat.model.CreateStackParam;
/**
* This class implements test methods of the MsoHeatUtils
- *
- *
*/
public class MsoHeatUtilsTest extends MsoCommonUtils {
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
- public static MsoHeatUtils msoHeatUtils;
-
- @BeforeClass
- public static final void loadClasses() throws MsoCloudIdentityNotFound {
- ClassLoader classLoader = CloudConfigTest.class.getClassLoader();
- String config = classLoader.getResource("cloud_config.json").toString().substring(5);
- cloudConfigFactory.initializeCloudConfig(config, 1);
- msoHeatUtils = new MsoHeatUtils("NO_PROP", msoPropertiesFactory, cloudConfigFactory);
- }
-
- @Test
- public final void testCreateStackBadCloudConfig()
- throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
- try {
- msoHeatUtils.createStack("DOESNOTEXIST", "test", "stackName", "test", new HashMap<>(),
- Boolean.TRUE, 10);
- } catch (MsoCloudSiteNotFound e) {
-
- } catch (java.lang.NullPointerException npe) {
-
- }
-
- }
-
- @Test
- public final void testCreateStackFailedConnectionHeatClient()
- throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
- try {
- msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE,
- 10);
- } catch (MsoIOException e) {
-
- }
-
- }
-
- @Test
- public final void testCreateStackFailedConnection()
- throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
- try {
- msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE,
- 10);
- } catch (MsoIOException e) {
-
- }
-
- }
-
- @Test
- public final void createStackSuccessWithEnvironment() throws MsoException {
- try {
- msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10,
- "environment");
- } catch (MsoIOException e) {
-
- }
-
- }
-
- @Test
- public final void createStackSuccessWithFiles() throws MsoException {
- try {
- msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10,
- "environment", new HashMap<>());
- } catch (MsoIOException e) {
-
- }
-
- }
-
- @Test
- public final void createStackSuccessWithHeatFiles() throws MsoException {
- try {
- msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10,
- "environment", new HashMap<>(), new HashMap<>());
- } catch (MsoIOException e) {
-
- }
- }
-
- @Test
- public final void requestToStringBuilderTest() {
- CreateStackParam param = new CreateStackParam();
- param.setDisableRollback(false);
- param.setEnvironment("environment");
- param.setFiles(new HashMap<>());
- param.setParameters(new HashMap<>());
- param.setStackName("stackName");
- param.setTemplate("template");
- param.setTemplateUrl("http://templateUrl");
- param.setTimeoutMinutes(1);
-
- msoHeatUtils.requestToStringBuilder(param);
- }
-
- @Test
- public final void heatCacheResetTest() {
- msoHeatUtils.heatCacheReset();
- }
-
- @Test
- public final void expireHeatClientTest() {
- msoHeatUtils.expireHeatClient("tenantId", "cloudId");
- }
-
- @Test
- public final void heatCacheCleanupTest() {
- msoHeatUtils.heatCacheCleanup();
- }
+ public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
+ public static MsoHeatUtils msoHeatUtils;
+
+ @BeforeClass
+ public static final void loadClasses() throws MsoCloudIdentityNotFound {
+ ClassLoader classLoader = CloudConfigTest.class.getClassLoader();
+ String config = classLoader.getResource("cloud_config.json").toString().substring(5);
+ cloudConfigFactory.initializeCloudConfig(config, 1);
+ msoHeatUtils = new MsoHeatUtils("NO_PROP", msoPropertiesFactory, cloudConfigFactory);
+ }
+
+ @Test
+ public final void testCreateStackBadCloudConfig()
+ throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
+ try {
+ msoHeatUtils.createStack("DOESNOTEXIST", "test", "stackName", "test", new HashMap<>(),
+ Boolean.TRUE, 10);
+ } catch (MsoCloudSiteNotFound e) {
+
+ } catch (java.lang.NullPointerException npe) {
+
+ }
+
+ }
+
+ @Test
+ public final void testCreateStackFailedConnectionHeatClient()
+ throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
+ try {
+ msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE,
+ 10);
+ } catch (MsoIOException e) {
+
+ }
+
+ }
+
+ @Test
+ public final void testCreateStackFailedConnection()
+ throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
+ try {
+ msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE,
+ 10);
+ } catch (MsoIOException e) {
+
+ }
+
+ }
+
+ @Test
+ public final void createStackSuccessWithEnvironment() throws MsoException {
+ try {
+ msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10,
+ "environment");
+ } catch (MsoIOException e) {
+
+ }
+
+ }
+
+ @Test
+ public final void createStackSuccessWithFiles() throws MsoException {
+ try {
+ msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10,
+ "environment", new HashMap<>());
+ } catch (MsoIOException e) {
+
+ }
+
+ }
+
+ @Test
+ public final void createStackSuccessWithHeatFiles() throws MsoException {
+ try {
+ msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10,
+ "environment", new HashMap<>(), new HashMap<>());
+ } catch (MsoIOException e) {
+
+ }
+ }
+
+ @Test
+ public final void requestToStringBuilderTest() {
+ CreateStackParam param = new CreateStackParam();
+ param.setDisableRollback(false);
+ param.setEnvironment("environment");
+ param.setFiles(new HashMap<>());
+ param.setParameters(new HashMap<>());
+ param.setStackName("stackName");
+ param.setTemplate("template");
+ param.setTemplateUrl("http://templateUrl");
+ param.setTimeoutMinutes(1);
+
+ msoHeatUtils.requestToStringBuilder(param);
+ }
+
+ @Test
+ public final void heatCacheResetTest() {
+ msoHeatUtils.heatCacheReset();
+ }
+
+ @Test
+ public final void expireHeatClientTest() {
+ msoHeatUtils.expireHeatClient("tenantId", "cloudId");
+ }
+
+ @Test
+ public final void heatCacheCleanupTest() {
+ msoHeatUtils.heatCacheCleanup();
+ }
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java
index 62043e83b8..47ffff8941 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java
@@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
+
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -50,86 +51,86 @@ import com.woorea.openstack.base.client.OpenStackConnectException;
@RunWith(MockitoJUnitRunner.class)
public class MsoHeatUtilsWithUpdateTest {
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
-
+ public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
+
@Mock
CloudConfig cloudConfig;
@InjectMocks
- MsoHeatUtilsWithUpdate util=new MsoHeatUtilsWithUpdate("NO_PROP",msoPropertiesFactory,cloudConfigFactory);
+ MsoHeatUtilsWithUpdate util = new MsoHeatUtilsWithUpdate("NO_PROP", msoPropertiesFactory, cloudConfigFactory);
private CloudSite cloudSite;
@Before
- public void init () {
- cloudSite = new CloudSite ();
- cloudSite.setId ("cloud");
- CloudIdentity cloudIdentity = new CloudIdentity ();
+ public void init() {
+ cloudSite = new CloudSite();
+ cloudSite.setId("cloud");
+ CloudIdentity cloudIdentity = new CloudIdentity();
cloudIdentity.setIdentityServerType(IdentityServerType.KEYSTONE);
- cloudIdentity.setKeystoneUrl ("toto");
- cloudIdentity.setMsoPass (CloudIdentity.encryptPassword ("mockId"));
- cloudSite.setIdentityService (cloudIdentity);
- when(cloudConfig.getCloudSite("cloud")).thenReturn (Optional.of(cloudSite));
- when(cloudConfig.getCloudSite("none")).thenReturn (Optional.empty());
+ cloudIdentity.setKeystoneUrl("toto");
+ cloudIdentity.setMsoPass(CloudIdentity.encryptPassword("mockId"));
+ cloudSite.setIdentityService(cloudIdentity);
+ when(cloudConfig.getCloudSite("cloud")).thenReturn(Optional.of(cloudSite));
+ when(cloudConfig.getCloudSite("none")).thenReturn(Optional.empty());
}
@Test
@Ignore
- public void testUpdateStack () {
+ public void testUpdateStack() {
// Heat heat = Mockito.mock (Heat.class);
- Map <String, Object> stackInputs = new HashMap <> ();
+ Map<String, Object> stackInputs = new HashMap<>();
try {
- util.updateStack ("none", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1);
+ util.updateStack("none", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1);
} catch (MsoException e) {
if (e instanceof MsoCloudSiteNotFound) {
// Ok
} else {
- e.printStackTrace ();
- fail ("Exception caught");
+ e.printStackTrace();
+ fail("Exception caught");
}
}
try {
- util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1);
+ util.updateStack("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1);
} catch (MsoException e) {
- if (e instanceof MsoIOException && e.getCause () != null
- && e.getCause () instanceof OpenStackConnectException) {
+ if (e instanceof MsoIOException && e.getCause() != null
+ && e.getCause() instanceof OpenStackConnectException) {
// Ok, we were able to go up to the connection to OpenStack
} else {
- e.printStackTrace ();
- fail ("Exception caught");
+ e.printStackTrace();
+ fail("Exception caught");
}
}
try {
- util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment");
+ util.updateStack("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment");
} catch (MsoException e) {
- if (e instanceof MsoIOException && e.getCause () != null
- && e.getCause () instanceof OpenStackConnectException) {
+ if (e instanceof MsoIOException && e.getCause() != null
+ && e.getCause() instanceof OpenStackConnectException) {
// Ok, we were able to go up to the connection to OpenStack
} else {
- e.printStackTrace ();
- fail ("Exception caught");
+ e.printStackTrace();
+ fail("Exception caught");
}
}
try {
- util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null);
+ util.updateStack("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null);
} catch (MsoException e) {
- if (e instanceof MsoIOException && e.getCause () != null
- && e.getCause () instanceof OpenStackConnectException) {
+ if (e instanceof MsoIOException && e.getCause() != null
+ && e.getCause() instanceof OpenStackConnectException) {
// Ok, we were able to go up to the connection to OpenStack
} else {
- e.printStackTrace ();
- fail ("Exception caught");
+ e.printStackTrace();
+ fail("Exception caught");
}
}
try {
- util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null, null);
+ util.updateStack("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null, null);
} catch (MsoException e) {
- if (e instanceof MsoIOException && e.getCause () != null
- && e.getCause () instanceof OpenStackConnectException) {
+ if (e instanceof MsoIOException && e.getCause() != null
+ && e.getCause() instanceof OpenStackConnectException) {
// Ok, we were able to go up to the connection to OpenStack
} else {
- e.printStackTrace ();
- fail ("Exception caught");
+ e.printStackTrace();
+ fail("Exception caught");
}
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java
index 1c2501e8e4..b213bbd90b 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java
@@ -27,10 +27,13 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
+
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+
import java.util.Map;
+
import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound;
public class CloudConfigTest {
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java
index eef45b7164..0033be80fd 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java
@@ -29,36 +29,36 @@ import org.junit.Test;
public class CloudIdentityTest {
@Test
- public final void testCloudIdentity () {
- CloudIdentity id = new CloudIdentity ();
- id.setAdminTenant ("AdminTenant");
- id.setId ("id");
+ public final void testCloudIdentity() {
+ CloudIdentity id = new CloudIdentity();
+ id.setAdminTenant("AdminTenant");
+ id.setId("id");
// id.setKeystoneUrl ("keystone");
- id.setIdentityUrl ("keystone");
- id.setMemberRole ("member");
- id.setMsoId ("msoId");
- id.setMsoPass (CloudIdentity.encryptPassword ("password"));
- id.setTenantMetadata (true);
+ id.setIdentityUrl("keystone");
+ id.setMemberRole("member");
+ id.setMsoId("msoId");
+ id.setMsoPass(CloudIdentity.encryptPassword("password"));
+ id.setTenantMetadata(true);
id.setIdentityServerType(null);
id.setIdentityAuthenticationType(null);
-
- assertTrue (id.getAdminTenant ().equals ("AdminTenant"));
- assertTrue (id.getId ().equals ("id"));
+
+ assertTrue(id.getAdminTenant().equals("AdminTenant"));
+ assertTrue(id.getId().equals("id"));
// assertTrue (id.getKeystoneUrl ().equals ("keystone"));
- assertTrue (id.getMemberRole ().equals ("member"));
- assertTrue (id.getMsoId ().equals ("msoId"));
- assertTrue (id.getMsoPass ().equals ("password"));
- assertTrue (id.hasTenantMetadata ());
+ assertTrue(id.getMemberRole().equals("member"));
+ assertTrue(id.getMsoId().equals("msoId"));
+ assertTrue(id.getMsoPass().equals("password"));
+ assertTrue(id.hasTenantMetadata());
// assertTrue (id.toString ().contains ("keystone"));
assertTrue(id.toString().contains("null"));
}
@Test
- public final void testEncryption () {
- String encrypted = CloudIdentity.encryptPassword ("password");
- assertTrue (encrypted != null);
- assertTrue (!encrypted.equals ("password"));
+ public final void testEncryption() {
+ String encrypted = CloudIdentity.encryptPassword("password");
+ assertTrue(encrypted != null);
+ assertTrue(!encrypted.equals("password"));
}
-
+
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java
index b6c1c7373f..08a8c3b9cd 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java
@@ -35,34 +35,33 @@ import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication;
* A few JUnit tests to evaluate the new factory that manages authentication
* types and their associated wrapper classes. Here it is assumed that core types
* only are tested.
- *
*/
public class AuthenticationMethodTest {
- /**
- *
- */
- public AuthenticationMethodTest() {
- // TODO Auto-generated constructor stub
- }
+ /**
+ *
+ */
+ public AuthenticationMethodTest() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Test
+ public void testCustomRackspaceAuthFromCloudIdentity() {
+ CloudIdentity ci = new CloudIdentity();
+ ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY);
+ ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
+ ci.setMsoId("test");
+ Authentication auth = ci.getAuthentication();
+ assertTrue(RackspaceAuthentication.class.equals(auth.getClass()));
+ }
- @Test
- public void testCustomRackspaceAuthFromCloudIdentity() {
- CloudIdentity ci = new CloudIdentity();
- ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY);
- ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
- ci.setMsoId("test");
- Authentication auth = ci.getAuthentication();
- assertTrue(RackspaceAuthentication.class.equals(auth.getClass()));
- }
-
- @Test
- public void testCoreUsernamePasswordAuthFromCloudIdentity() {
- CloudIdentity ci = new CloudIdentity();
- ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD);
- ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
- ci.setMsoId("someuser");
- Authentication auth = ci.getAuthentication();
- assertTrue(UsernamePassword.class.equals(auth.getClass()));
- }
+ @Test
+ public void testCoreUsernamePasswordAuthFromCloudIdentity() {
+ CloudIdentity ci = new CloudIdentity();
+ ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD);
+ ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
+ ci.setMsoId("someuser");
+ Authentication auth = ci.getAuthentication();
+ assertTrue(UsernamePassword.class.equals(auth.getClass()));
+ }
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java
index aaa732c9a3..94a224d5e3 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java
@@ -31,14 +31,14 @@ import org.openecomp.mso.openstack.utils.MsoTenantUtils;
public class NewServerTypeUtils extends MsoTenantUtils {
- /**
- * @param msoPropID
- */
- public NewServerTypeUtils(String msoPropID) {
- super(msoPropID);
- }
+ /**
+ * @param msoPropID
+ */
+ public NewServerTypeUtils(String msoPropID) {
+ super(msoPropID);
+ }
- @Override
+ @Override
public String createTenant(String tenantName, String cloudSiteId, Map<String, String> metadata, boolean backout)
throws MsoException {
// TODO Auto-generated method stub
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java
index 4aaf379512..df853426ad 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java
@@ -39,20 +39,20 @@ public class ServerTypeTest {
IdentityServerTypeAbstract keystoneServerType = IdentityServerType.valueOf("KEYSTONE");
assertNotNull(keystoneServerType);
}
-
+
@Test
public void testNewServerType() {
IdentityServerTypeAbstract customServerType = null;
try {
customServerType = new IdentityServerType("NewServerType", NewServerTypeUtils.class);
-
+
} catch (IllegalArgumentException e) {
fail("An exception should not be raised when we register a new server type for the first time");
} finally {
System.out.println(IdentityServerType.values().toString());
assertEquals(customServerType, IdentityServerType.valueOf("NewServerType"));
}
-
+
// Create it a second time
IdentityServerTypeAbstract customServerType2 = null;
try {
@@ -60,23 +60,25 @@ public class ServerTypeTest {
fail("An exception should be raised as server type does not exist");
} catch (IllegalArgumentException e) {
// Fail silently -- it simply indicates we already registered it
- customServerType2 = IdentityServerType.valueOf("NewServerType");
+ customServerType2 = IdentityServerType.valueOf("NewServerType");
} finally {
System.out.println(IdentityServerType.values().toString());
assertEquals(customServerType2, IdentityServerType.valueOf("NewServerType"));
}
-
+
// Check the KeystoneURL for this custom TenantUtils
CloudIdentity cloudIdentity = new CloudIdentity();
cloudIdentity.setIdentityUrl("LocalIdentity");
cloudIdentity.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY);
- cloudIdentity.setIdentityServerType((CloudIdentity.IdentityServerType) CloudIdentity.IdentityServerType.valueOf("NewServerType"));
+ cloudIdentity.setIdentityServerType((CloudIdentity.IdentityServerType) CloudIdentity.IdentityServerType.
+ valueOf("NewServerType"));
String regionId = "RegionA";
String msoPropID = "12345";
try {
- assertEquals(cloudIdentity.getKeystoneUrl(regionId, msoPropID), msoPropID + ":" + regionId + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl());
- } catch (MsoException e) {
- fail("No MSO Exception should have occured here");
- }
+ assertEquals(cloudIdentity.getKeystoneUrl(regionId, msoPropID), msoPropID + ":" + regionId +
+ ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl());
+ } catch (MsoException e) {
+ fail("No MSO Exception should have occured here");
+ }
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java
index 0f357e5555..2f58f1d964 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java
@@ -24,8 +24,10 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.woorea.openstack.quantum.model.Network;
import com.woorea.openstack.quantum.model.Segment;
+
import java.util.ArrayList;
import java.util.List;
+
import org.junit.Test;
public class NetworkInfoTest {
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java
index 9c7911ef89..f289f38843 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java
@@ -23,7 +23,9 @@ package org.openecomp.mso.openstack.beans;
import static org.assertj.core.api.Assertions.assertThat;
import com.woorea.openstack.heat.model.Stack;
+
import java.io.IOException;
+
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java
index 9efaee921f..60026b0cd6 100644
--- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java
@@ -23,6 +23,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
+
import org.junit.Test;
import org.openecomp.mso.adapters.nwrest.ContrailNetwork;
import org.openecomp.mso.adapters.nwrest.CreateNetworkError;
@@ -76,377 +77,377 @@ import org.openecomp.mso.entity.MsoRequest;
public class BeanTest {
- // Test cases for code coverage
- @Test
- public void testCreateNetworkRequest() {
- CreateNetworkRequest n = new CreateNetworkRequest();
- n.setBackout(true);
- n.setCloudSiteId("test");
- ContrailNetwork contrailNetwork = new ContrailNetwork("shared", "external", new ArrayList<>(),
- new ArrayList<>(), new ArrayList<>());
- contrailNetwork.setExternal("dgddb");
- contrailNetwork.setPolicyFqdns(new ArrayList<>());
- contrailNetwork.setRouteTableFqdns(new ArrayList<>());
- contrailNetwork.setRouteTargets(new ArrayList<>());
- contrailNetwork.setShared("test");
- n.setContrailNetwork(contrailNetwork);
- n.setFailIfExists(true);
- n.setMessageId("38829");
- n.setModelCustomizationUuid("4u838282");
- MsoRequest req = new MsoRequest();
- req.setRequestId("38849");
- req.setServiceInstanceId("3884839");
- n.setMsoRequest(req);
- n.setNetworkId("478383");
- n.setNetworkName("tetet");
- n.setNetworkParams(new HashMap<>());
- n.setNetworkTechnology("VMWARE");
- n.setNetworkType("tete");
- n.setNetworkTypeVersion("v1");
- n.setNotificationUrl("test");
- ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork("test", new ArrayList<>());
- providerVlanNetwork.setPhysicalNetworkName("physicalNetworkName");
- providerVlanNetwork.setVlans(new ArrayList<>());
- n.setProviderVlanNetwork(providerVlanNetwork);
- n.setSkipAAI(false);
- n.setSubnets(new ArrayList<>());
- n.setTenantId("tenantId");
- n.getBackout();
- n.getCloudSiteId();
- ContrailNetwork cn = n.getContrailNetwork();
- cn.getExternal();
- cn.getPolicyFqdns();
- cn.getRouteTableFqdns();
- cn.getRouteTargets();
- cn.getShared();
- n.getFailIfExists();
- n.getMessageId();
- n.getModelCustomizationUuid();
- n.getMsoRequest();
- n.getNetworkId();
- n.getNetworkName();
- n.getNetworkParams();
- n.getNetworkTechnology();
- n.getNetworkType();
- n.getNetworkTypeVersion();
- n.getNotificationUrl();
- n.getProviderVlanNetwork();
- n.getSkipAAI();
- n.getSubnets();
- n.getTenantId();
- n.isContrailRequest();
- n.isSynchronous();
- n.toJsonString();
- n.toXmlString();
- }
+ // Test cases for code coverage
+ @Test
+ public void testCreateNetworkRequest() {
+ CreateNetworkRequest n = new CreateNetworkRequest();
+ n.setBackout(true);
+ n.setCloudSiteId("test");
+ ContrailNetwork contrailNetwork = new ContrailNetwork("shared", "external", new ArrayList<>(),
+ new ArrayList<>(), new ArrayList<>());
+ contrailNetwork.setExternal("dgddb");
+ contrailNetwork.setPolicyFqdns(new ArrayList<>());
+ contrailNetwork.setRouteTableFqdns(new ArrayList<>());
+ contrailNetwork.setRouteTargets(new ArrayList<>());
+ contrailNetwork.setShared("test");
+ n.setContrailNetwork(contrailNetwork);
+ n.setFailIfExists(true);
+ n.setMessageId("38829");
+ n.setModelCustomizationUuid("4u838282");
+ MsoRequest req = new MsoRequest();
+ req.setRequestId("38849");
+ req.setServiceInstanceId("3884839");
+ n.setMsoRequest(req);
+ n.setNetworkId("478383");
+ n.setNetworkName("tetet");
+ n.setNetworkParams(new HashMap<>());
+ n.setNetworkTechnology("VMWARE");
+ n.setNetworkType("tete");
+ n.setNetworkTypeVersion("v1");
+ n.setNotificationUrl("test");
+ ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork("test", new ArrayList<>());
+ providerVlanNetwork.setPhysicalNetworkName("physicalNetworkName");
+ providerVlanNetwork.setVlans(new ArrayList<>());
+ n.setProviderVlanNetwork(providerVlanNetwork);
+ n.setSkipAAI(false);
+ n.setSubnets(new ArrayList<>());
+ n.setTenantId("tenantId");
+ n.getBackout();
+ n.getCloudSiteId();
+ ContrailNetwork cn = n.getContrailNetwork();
+ cn.getExternal();
+ cn.getPolicyFqdns();
+ cn.getRouteTableFqdns();
+ cn.getRouteTargets();
+ cn.getShared();
+ n.getFailIfExists();
+ n.getMessageId();
+ n.getModelCustomizationUuid();
+ n.getMsoRequest();
+ n.getNetworkId();
+ n.getNetworkName();
+ n.getNetworkParams();
+ n.getNetworkTechnology();
+ n.getNetworkType();
+ n.getNetworkTypeVersion();
+ n.getNotificationUrl();
+ n.getProviderVlanNetwork();
+ n.getSkipAAI();
+ n.getSubnets();
+ n.getTenantId();
+ n.isContrailRequest();
+ n.isSynchronous();
+ n.toJsonString();
+ n.toXmlString();
+ }
+
+ @Test
+ public void testDeleteNetworkRequest() {
+ DeleteNetworkRequest r = new DeleteNetworkRequest();
+ r.setCloudSiteId("test");
+ r.setMessageId("messageId");
+ r.setModelCustomizationUuid("modelCustomizationUuid");
+ r.setMsoRequest(null);
+ r.setNetworkId("networkId");
+ r.setNetworkStackId("networkStackId");
+ r.setNetworkType("networkType");
+ r.setNotificationUrl("notificationUrl");
+ r.setSkipAAI(true);
+ r.setTenantId("tenantId");
+ r.getCloudSiteId();
+ r.getMessageId();
+ r.getModelCustomizationUuid();
+ r.getMsoRequest();
+ r.getNetworkId();
+ r.getNetworkStackId();
+ r.getNetworkType();
+ r.getNotificationUrl();
+ r.getSkipAAI();
+ r.getTenantId();
+ }
- @Test
- public void testDeleteNetworkRequest() {
- DeleteNetworkRequest r = new DeleteNetworkRequest();
- r.setCloudSiteId("test");
- r.setMessageId("messageId");
- r.setModelCustomizationUuid("modelCustomizationUuid");
- r.setMsoRequest(null);
- r.setNetworkId("networkId");
- r.setNetworkStackId("networkStackId");
- r.setNetworkType("networkType");
- r.setNotificationUrl("notificationUrl");
- r.setSkipAAI(true);
- r.setTenantId("tenantId");
- r.getCloudSiteId();
- r.getMessageId();
- r.getModelCustomizationUuid();
- r.getMsoRequest();
- r.getNetworkId();
- r.getNetworkStackId();
- r.getNetworkType();
- r.getNotificationUrl();
- r.getSkipAAI();
- r.getTenantId();
- }
+ @Test
+ public void testCreateNetworkError() {
+ CreateNetworkError e = new CreateNetworkError("message");
+ e = new CreateNetworkError("message", null, true, "messageid");
+ DeleteNetworkError d = new DeleteNetworkError("message");
+ d = new DeleteNetworkError("message", null, false, "29102");
+ }
- @Test
- public void testCreateNetworkError() {
- CreateNetworkError e = new CreateNetworkError("message");
- e = new CreateNetworkError("message", null, true, "messageid");
- DeleteNetworkError d = new DeleteNetworkError("message");
- d = new DeleteNetworkError("message", null, false, "29102");
- }
+ @Test
+ public void testCreatenetworkResponse() {
+ CreateNetworkResponse cnr = new CreateNetworkResponse("networkId", "neutronNetworkId", "networkStackId",
+ "networkFqdn", false, null, null, "messageId");
+ cnr.setMessageId("messageId");
+ cnr.setNetworkCreated(true);
+ cnr.setNetworkFqdn(null);
+ cnr.setNetworkStackId(null);
+ cnr.setNeutronNetworkId(null);
+ cnr.setRollback(null);
+ cnr.setNetworkStackId(null);
+ cnr.setSubnetMap(null);
+ cnr.getMessageId();
+ cnr.getNetworkCreated();
+ cnr.getNetworkFqdn();
+ cnr.getNetworkId();
+ cnr.getNetworkStackId();
+ cnr.getNeutronNetworkId();
+ cnr.getRollback();
+ cnr.getSubnetMap();
- @Test
- public void testCreatenetworkResponse() {
- CreateNetworkResponse cnr = new CreateNetworkResponse("networkId", "neutronNetworkId", "networkStackId",
- "networkFqdn", false, null, null, "messageId");
- cnr.setMessageId("messageId");
- cnr.setNetworkCreated(true);
- cnr.setNetworkFqdn(null);
- cnr.setNetworkStackId(null);
- cnr.setNeutronNetworkId(null);
- cnr.setRollback(null);
- cnr.setNetworkStackId(null);
- cnr.setSubnetMap(null);
- cnr.getMessageId();
- cnr.getNetworkCreated();
- cnr.getNetworkFqdn();
- cnr.getNetworkId();
- cnr.getNetworkStackId();
- cnr.getNeutronNetworkId();
- cnr.getRollback();
- cnr.getSubnetMap();
+ DeleteNetworkResponse dr = new DeleteNetworkResponse("networkId", true, "messageId");
+ dr.setMessageId(null);
+ dr.setNetworkDeleted(null);
+ dr.setNetworkId(null);
+ dr.getMessageId();
+ dr.getNetworkDeleted();
+ dr.getNetworkId();
- DeleteNetworkResponse dr = new DeleteNetworkResponse("networkId", true, "messageId");
- dr.setMessageId(null);
- dr.setNetworkDeleted(null);
- dr.setNetworkId(null);
- dr.getMessageId();
- dr.getNetworkDeleted();
- dr.getNetworkId();
+ NetworkExceptionResponse ner = new NetworkExceptionResponse("message");
+ ner = new NetworkExceptionResponse(null, null, false, null);
+ ner.setCategory(null);
+ ner.setMessage(null);
+ ner.setRolledBack(null);
+ ner.setMessageId(null);
+ ner.getCategory();
+ ner.getMessage();
+ ner.getMessageId();
+ ner.getRolledBack();
- NetworkExceptionResponse ner = new NetworkExceptionResponse("message");
- ner = new NetworkExceptionResponse(null, null, false, null);
- ner.setCategory(null);
- ner.setMessage(null);
- ner.setRolledBack(null);
- ner.setMessageId(null);
- ner.getCategory();
- ner.getMessage();
- ner.getMessageId();
- ner.getRolledBack();
+ ner.toJsonString();
+ ner.toXmlString();
+ NetworkTechnology nt = NetworkTechnology.NEUTRON;
+ ProviderVlanNetwork pvn = new ProviderVlanNetwork(null, null);
+ pvn.setPhysicalNetworkName(null);
+ pvn.setVlans(null);
+ pvn.getPhysicalNetworkName();
+ pvn.getVlans();
- ner.toJsonString();
- ner.toXmlString();
- NetworkTechnology nt = NetworkTechnology.NEUTRON;
- ProviderVlanNetwork pvn = new ProviderVlanNetwork(null, null);
- pvn.setPhysicalNetworkName(null);
- pvn.setVlans(null);
- pvn.getPhysicalNetworkName();
- pvn.getVlans();
+ QueryNetworkResponse qnr = new QueryNetworkResponse(null, null, null, null, null);
+ qnr.setNetworkExists(null);
+ qnr.setNetworkId(null);
+ qnr.setNetworkOutputs(null);
+ qnr.setNetworkStackId(null);
+ qnr.setNetworkStatus(null);
+ qnr.setNeutronNetworkId(null);
+ qnr.setRouteTargets(null);
+ qnr.setSubnetIdMap(null);
+ qnr.setVlans(null);
+ qnr.getNetworkExists();
+ qnr.getNetworkId();
+ qnr.getNetworkOutputs();
+ qnr.getNetworkStatus();
+ qnr.getNeutronNetworkId();
+ qnr.getRouteTargets();
+ qnr.getSubnetIdMap();
+ qnr.getVlans();
+ qnr.toJsonString();
- QueryNetworkResponse qnr = new QueryNetworkResponse(null, null, null, null, null);
- qnr.setNetworkExists(null);
- qnr.setNetworkId(null);
- qnr.setNetworkOutputs(null);
- qnr.setNetworkStackId(null);
- qnr.setNetworkStatus(null);
- qnr.setNeutronNetworkId(null);
- qnr.setRouteTargets(null);
- qnr.setSubnetIdMap(null);
- qnr.setVlans(null);
- qnr.getNetworkExists();
- qnr.getNetworkId();
- qnr.getNetworkOutputs();
- qnr.getNetworkStatus();
- qnr.getNeutronNetworkId();
- qnr.getRouteTargets();
- qnr.getSubnetIdMap();
- qnr.getVlans();
- qnr.toJsonString();
+ UpdateNetworkRequest unr = new UpdateNetworkRequest();
+ unr.setBackout(null);
+ unr.setCloudSiteId(null);
+ unr.setContrailNetwork(null);
+ unr.setMessageId(null);
+ unr.setModelCustomizationUuid(null);
+ unr.setMsoRequest(null);
+ unr.setNetworkId(null);
+ unr.setNetworkName(null);
+ unr.setNetworkParams(null);
+ unr.setNetworkStackId(null);
+ unr.setNetworkTechnology("VMWARE");
+ unr.setNetworkType(null);
+ unr.setNetworkTypeVersion(null);
+ unr.setNotificationUrl(null);
+ unr.setProviderVlanNetwork(null);
+ unr.setSkipAAI(null);
+ unr.setSubnets(null);
+ unr.setTenantId(null);
+ unr.getBackout();
+ unr.getCloudSiteId();
+ unr.getContrailNetwork();
+ unr.getMessageId();
+ unr.getModelCustomizationUuid();
+ unr.getMsoRequest();
+ unr.getNetworkId();
+ unr.getNetworkName();
+ unr.getNetworkParams();
+ unr.getNetworkStackId();
+ unr.getNetworkTechnology();
+ unr.getNetworkType();
+ unr.getNetworkTypeVersion();
+ unr.getNotificationUrl();
+ unr.getProviderVlanNetwork();
+ unr.getSkipAAI();
+ unr.getSubnets();
+ unr.getTenantId();
+ unr.isContrailRequest();
- UpdateNetworkRequest unr = new UpdateNetworkRequest();
- unr.setBackout(null);
- unr.setCloudSiteId(null);
- unr.setContrailNetwork(null);
- unr.setMessageId(null);
- unr.setModelCustomizationUuid(null);
- unr.setMsoRequest(null);
- unr.setNetworkId(null);
- unr.setNetworkName(null);
- unr.setNetworkParams(null);
- unr.setNetworkStackId(null);
- unr.setNetworkTechnology("VMWARE");
- unr.setNetworkType(null);
- unr.setNetworkTypeVersion(null);
- unr.setNotificationUrl(null);
- unr.setProviderVlanNetwork(null);
- unr.setSkipAAI(null);
- unr.setSubnets(null);
- unr.setTenantId(null);
- unr.getBackout();
- unr.getCloudSiteId();
- unr.getContrailNetwork();
- unr.getMessageId();
- unr.getModelCustomizationUuid();
- unr.getMsoRequest();
- unr.getNetworkId();
- unr.getNetworkName();
- unr.getNetworkParams();
- unr.getNetworkStackId();
- unr.getNetworkTechnology();
- unr.getNetworkType();
- unr.getNetworkTypeVersion();
- unr.getNotificationUrl();
- unr.getProviderVlanNetwork();
- unr.getSkipAAI();
- unr.getSubnets();
- unr.getTenantId();
- unr.isContrailRequest();
+ RollbackNetworkError err = new RollbackNetworkError("message");
+ err = new RollbackNetworkError(null, null, false, null);
+ RollbackNetworkRequest req = new RollbackNetworkRequest();
+ req.setNetworkRollback(null);
+ req.getNetworkRollback();
+ req.setMessageId(null);
+ req.getMessageId();
+ req.setNotificationUrl(null);
+ req.getNotificationUrl();
+ req.setSkipAAI(null);
+ req.getSkipAAI();
- RollbackNetworkError err = new RollbackNetworkError("message");
- err = new RollbackNetworkError(null, null, false, null);
- RollbackNetworkRequest req = new RollbackNetworkRequest();
- req.setNetworkRollback(null);
- req.getNetworkRollback();
- req.setMessageId(null);
- req.getMessageId();
- req.setNotificationUrl(null);
- req.getNotificationUrl();
- req.setSkipAAI(null);
- req.getSkipAAI();
+ RollbackNetworkResponse rnr = new RollbackNetworkResponse(true, null);
+ rnr.setMessageId(null);
+ rnr.getMessageId();
+ rnr.setNetworkRolledBack(null);
+ rnr.getNetworkRolledBack();
- RollbackNetworkResponse rnr = new RollbackNetworkResponse(true, null);
- rnr.setMessageId(null);
- rnr.getMessageId();
- rnr.setNetworkRolledBack(null);
- rnr.getNetworkRolledBack();
+ UpdateNetworkError error = new UpdateNetworkError(null);
+ error = new UpdateNetworkError("test", null, false, null);
- UpdateNetworkError error = new UpdateNetworkError(null);
- error = new UpdateNetworkError("test", null, false, null);
+ UpdateVfModuleRequest uvmr = new UpdateVfModuleRequest();
+ uvmr.setBackout(null);
+ uvmr.setBaseVfModuleId(null);
+ uvmr.setBaseVfModuleStackId(null);
+ uvmr.setFailIfExists(null);
+ uvmr.setMessageId(null);
+ uvmr.setModelCustomizationUuid(null);
+ uvmr.setMsoRequest(null);
+ uvmr.setNotificationUrl(null);
+ uvmr.setRequestType(null);
+ uvmr.setSkipAAI(true);
+ uvmr.setTenantId(null);
+ uvmr.setVfModuleId(null);
+ uvmr.setVfModuleName(null);
+ uvmr.setVfModuleParams(null);
+ uvmr.setVfModuleStackId(null);
+ uvmr.setVfModuleType(null);
+ uvmr.setVnfId(null);
+ uvmr.setVnfType(null);
+ uvmr.setVnfVersion(null);
+ uvmr.setVolumeGroupId(null);
+ uvmr.setVolumeGroupStackId(null);
+ uvmr.getBackout();
+ uvmr.getBaseVfModuleId();
+ uvmr.getBaseVfModuleStackId();
+ uvmr.getCloudSiteId();
+ uvmr.getFailIfExists();
+ uvmr.getMessageId();
+ uvmr.getModelCustomizationUuid();
+ uvmr.getMsoRequest();
+ uvmr.getNotificationUrl();
+ uvmr.getRequestType();
+ uvmr.getSkipAAI();
+ uvmr.getTenantId();
+ uvmr.getVfModuleId();
+ uvmr.getVfModuleName();
+ uvmr.getVfModuleParams();
+ uvmr.getVfModuleStackId();
+ uvmr.getVfModuleType();
+ uvmr.getVnfId();
+ uvmr.getVnfType();
+ uvmr.getVnfVersion();
+ uvmr.getVolumeGroupId();
+ uvmr.getVolumeGroupStackId();
+ uvmr.setCloudSiteId(null);
- UpdateVfModuleRequest uvmr = new UpdateVfModuleRequest();
- uvmr.setBackout(null);
- uvmr.setBaseVfModuleId(null);
- uvmr.setBaseVfModuleStackId(null);
- uvmr.setFailIfExists(null);
- uvmr.setMessageId(null);
- uvmr.setModelCustomizationUuid(null);
- uvmr.setMsoRequest(null);
- uvmr.setNotificationUrl(null);
- uvmr.setRequestType(null);
- uvmr.setSkipAAI(true);
- uvmr.setTenantId(null);
- uvmr.setVfModuleId(null);
- uvmr.setVfModuleName(null);
- uvmr.setVfModuleParams(null);
- uvmr.setVfModuleStackId(null);
- uvmr.setVfModuleType(null);
- uvmr.setVnfId(null);
- uvmr.setVnfType(null);
- uvmr.setVnfVersion(null);
- uvmr.setVolumeGroupId(null);
- uvmr.setVolumeGroupStackId(null);
- uvmr.getBackout();
- uvmr.getBaseVfModuleId();
- uvmr.getBaseVfModuleStackId();
- uvmr.getCloudSiteId();
- uvmr.getFailIfExists();
- uvmr.getMessageId();
- uvmr.getModelCustomizationUuid();
- uvmr.getMsoRequest();
- uvmr.getNotificationUrl();
- uvmr.getRequestType();
- uvmr.getSkipAAI();
- uvmr.getTenantId();
- uvmr.getVfModuleId();
- uvmr.getVfModuleName();
- uvmr.getVfModuleParams();
- uvmr.getVfModuleStackId();
- uvmr.getVfModuleType();
- uvmr.getVnfId();
- uvmr.getVnfType();
- uvmr.getVnfVersion();
- uvmr.getVolumeGroupId();
- uvmr.getVolumeGroupStackId();
- uvmr.setCloudSiteId(null);
+ CreateVfModuleRequest cvmr = new CreateVfModuleRequest();
+ cvmr.setBackout(null);
+ cvmr.setBaseVfModuleId(null);
+ cvmr.setBaseVfModuleStackId(null);
+ cvmr.setCloudSiteId(null);
+ cvmr.setFailIfExists(null);
- CreateVfModuleRequest cvmr = new CreateVfModuleRequest();
- cvmr.setBackout(null);
- cvmr.setBaseVfModuleId(null);
- cvmr.setBaseVfModuleStackId(null);
- cvmr.setCloudSiteId(null);
- cvmr.setFailIfExists(null);
+ coverCode(CreateVfModuleRequest.class);
+ CreateVfModuleResponse resp = new CreateVfModuleResponse(null, null, null, true, null, null, null);
+ resp.toJsonString();
+ resp.toXmlString();
+ coverCode(CreateVfModuleResponse.class);
- coverCode(CreateVfModuleRequest.class);
- CreateVfModuleResponse resp = new CreateVfModuleResponse(null, null, null, true, null, null, null);
- resp.toJsonString();
- resp.toXmlString();
- coverCode(CreateVfModuleResponse.class);
+ coverCode(CreateVolumeGroupRequest.class);
- coverCode(CreateVolumeGroupRequest.class);
+ CreateVolumeGroupResponse cvgr = new CreateVolumeGroupResponse(null, null, true, null, null, null);
+ coverCode(CreateVolumeGroupResponse.class);
+ coverCode(DeleteVfModuleRequest.class);
+ coverCode(DeleteVfModuleResponse.class);
+ coverCode(DeleteVolumeGroupRequest.class);
+ coverCode(DeleteVolumeGroupResponse.class);
+ QueryVfModuleResponse vfmr = new QueryVfModuleResponse(null, null, null, null, null);
+ coverCode(QueryVfModuleResponse.class);
+ QueryVolumeGroupResponse qvgr = new QueryVolumeGroupResponse(null, null, null, null);
+ coverCode(QueryVolumeGroupResponse.class);
+ UpdateVfModuleResponse uvfmr = new UpdateVfModuleResponse(null, null, null, null, null);
+ coverCode(UpdateVfModuleResponse.class);
+ coverCode(UpdateVolumeGroupRequest.class);
+ UpdateVolumeGroupResponse uvgr = new UpdateVolumeGroupResponse(null, null, null, null);
+ coverCode(UpdateVolumeGroupResponse.class);
+ VfModuleExceptionResponse vfmer = new VfModuleExceptionResponse(null, null, false, null);
+ coverCode(VfModuleExceptionResponse.class);
+ //VfModuleRollback vfmrb = new VfModuleRollback(null, null, null, null);
+ VfModuleRollback vfmrb = new VfModuleRollback(null, null, null, false, null, null, null, null);
+ coverCode(VfModuleRollback.class);
+ //VolumeGroupRollback vgrback = new VolumeGroupRollback(null, null, null);
+ VolumeGroupRollback vgrback = new VolumeGroupRollback(null, null, false, null, null, null, null);
+ coverCode(VolumeGroupRollback.class);
+ RollbackVolumeGroupResponse rvgresp = new RollbackVolumeGroupResponse(null, null);
+ coverCode(RollbackVolumeGroupResponse.class);
+ }
- CreateVolumeGroupResponse cvgr = new CreateVolumeGroupResponse(null, null, true, null, null, null);
- coverCode(CreateVolumeGroupResponse.class);
- coverCode(DeleteVfModuleRequest.class);
- coverCode(DeleteVfModuleResponse.class);
- coverCode(DeleteVolumeGroupRequest.class);
- coverCode(DeleteVolumeGroupResponse.class);
- QueryVfModuleResponse vfmr = new QueryVfModuleResponse(null, null, null, null, null);
- coverCode(QueryVfModuleResponse.class);
- QueryVolumeGroupResponse qvgr = new QueryVolumeGroupResponse(null, null, null, null);
- coverCode(QueryVolumeGroupResponse.class);
- UpdateVfModuleResponse uvfmr = new UpdateVfModuleResponse(null, null, null, null, null);
- coverCode(UpdateVfModuleResponse.class);
- coverCode(UpdateVolumeGroupRequest.class);
- UpdateVolumeGroupResponse uvgr = new UpdateVolumeGroupResponse(null, null, null, null);
- coverCode(UpdateVolumeGroupResponse.class);
- VfModuleExceptionResponse vfmer = new VfModuleExceptionResponse(null, null, false, null);
- coverCode(VfModuleExceptionResponse.class);
- //VfModuleRollback vfmrb = new VfModuleRollback(null, null, null, null);
- VfModuleRollback vfmrb = new VfModuleRollback(null, null, null, false, null, null, null, null);
- coverCode(VfModuleRollback.class);
- //VolumeGroupRollback vgrback = new VolumeGroupRollback(null, null, null);
- VolumeGroupRollback vgrback = new VolumeGroupRollback(null, null, false, null, null, null, null);
- coverCode(VolumeGroupRollback.class);
- RollbackVolumeGroupResponse rvgresp = new RollbackVolumeGroupResponse(null, null);
- coverCode(RollbackVolumeGroupResponse.class);
- }
-
- @Test
- public void testTenantRestPackage(){
- CreateTenantError cte = new CreateTenantError(null, null, false);
- coverCode(CreateTenantError.class);
- CreateTenantRequest ctreq = new CreateTenantRequest();
- ctreq.toJsonString();
- ctreq.toXmlString();
- ctreq.toString();
- coverCode(CreateTenantRequest.class);
- CreateTenantResponse ctresp = new CreateTenantResponse(null, null, null, new TenantRollback());
- ctresp.toString();
- coverCode(CreateTenantResponse.class);
- DeleteTenantError dterr = new DeleteTenantError(null, null, false);
- coverCode(DeleteTenantError.class);
- coverCode(DeleteTenantRequest.class);
- coverCode(DeleteTenantResponse.class);
- coverCode(HealthCheckHandler.class);
- QueryTenantError qnerr = new QueryTenantError(null, null);
- coverCode(QueryTenantError.class);
- QueryTenantResponse qtresp = new QueryTenantResponse(null, null, null);
- coverCode(QueryTenantResponse.class);
- coverCode(RollbackTenantError.class);
- RollbackTenantError rollTer = new RollbackTenantError(null, null, false);
- coverCode(RollbackTenantRequest.class);
- coverCode(RollbackTenantResponse.class);
- TenantExceptionResponse resp = new TenantExceptionResponse(null, null, false);
- coverCode(TenantExceptionResponse.class);
- coverCode(TenantRollback.class);
- }
+ @Test
+ public void testTenantRestPackage() {
+ CreateTenantError cte = new CreateTenantError(null, null, false);
+ coverCode(CreateTenantError.class);
+ CreateTenantRequest ctreq = new CreateTenantRequest();
+ ctreq.toJsonString();
+ ctreq.toXmlString();
+ ctreq.toString();
+ coverCode(CreateTenantRequest.class);
+ CreateTenantResponse ctresp = new CreateTenantResponse(null, null, null, new TenantRollback());
+ ctresp.toString();
+ coverCode(CreateTenantResponse.class);
+ DeleteTenantError dterr = new DeleteTenantError(null, null, false);
+ coverCode(DeleteTenantError.class);
+ coverCode(DeleteTenantRequest.class);
+ coverCode(DeleteTenantResponse.class);
+ coverCode(HealthCheckHandler.class);
+ QueryTenantError qnerr = new QueryTenantError(null, null);
+ coverCode(QueryTenantError.class);
+ QueryTenantResponse qtresp = new QueryTenantResponse(null, null, null);
+ coverCode(QueryTenantResponse.class);
+ coverCode(RollbackTenantError.class);
+ RollbackTenantError rollTer = new RollbackTenantError(null, null, false);
+ coverCode(RollbackTenantRequest.class);
+ coverCode(RollbackTenantResponse.class);
+ TenantExceptionResponse resp = new TenantExceptionResponse(null, null, false);
+ coverCode(TenantExceptionResponse.class);
+ coverCode(TenantRollback.class);
+ }
- private void coverCode(Class cls) {
- try {
- Object obj = cls.newInstance();
- Method[] methods = cls.getDeclaredMethods();
- for (Method m : methods) {
- try {
- m.setAccessible(true);
- Type[] types = m.getGenericParameterTypes();
- Object[] objs = { new Object(), new Object(), new Object(), new Object() };
- if (types.length < 1) {
- m.invoke(obj);
- } else if (types.length == 1) {
- String type = types[0].getTypeName();
- if (type.contains("<")) {
- type = type.substring(0, type.indexOf("<"));
- }
- Class paramCls = Class.forName(type);
- Object paramobj = paramCls.newInstance();
- m.invoke(obj, paramobj);
- } else if (types.length == 2) {
- // m.invoke(obj,null,null);
- }
- } catch (Exception ex) {
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
+ private void coverCode(Class cls) {
+ try {
+ Object obj = cls.newInstance();
+ Method[] methods = cls.getDeclaredMethods();
+ for (Method m : methods) {
+ try {
+ m.setAccessible(true);
+ Type[] types = m.getGenericParameterTypes();
+ Object[] objs = {new Object(), new Object(), new Object(), new Object()};
+ if (types.length < 1) {
+ m.invoke(obj);
+ } else if (types.length == 1) {
+ String type = types[0].getTypeName();
+ if (type.contains("<")) {
+ type = type.substring(0, type.indexOf("<"));
+ }
+ Class paramCls = Class.forName(type);
+ Object paramobj = paramCls.newInstance();
+ m.invoke(obj, paramobj);
+ } else if (types.length == 2) {
+ // m.invoke(obj,null,null);
+ }
+ } catch (Exception ex) {
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
}
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java
index 897c69d144..b3bf2b8c25 100644
--- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java
@@ -24,6 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import java.util.Map;
+
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.ObjectMapper;
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java
index f903f21441..b97496d05b 100644
--- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.verify;
import java.util.HashMap;
import java.util.Map;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.map.SerializerProvider;
import org.junit.Test;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java
index 31594905fd..f3ee941641 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java
@@ -29,7 +29,9 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
+
import javax.json.*;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openecomp.mso.adapters.catalogdb.CatalogDbAdapterRest;
@@ -55,50 +57,50 @@ import static org.hamcrest.CoreMatchers.instanceOf;
public class CatalogDbAdapterRestClassTest {
@Mock
private static CatalogDatabase dbMock;
-
+
private static List<VnfResourceCustomization> paramList;
-
+
@Before
- public void prepare () {
- /*
- * 1. for non routing related methods/classes, use mockito
- * 2. for routing methods, use TJWSEmbeddedJaxrsServer
- */
-
- /*
- * in the setup portion, create a mock db object
- *
- */
- // set up mock return value
+ public void prepare() {
+ /*
+ * 1. for non routing related methods/classes, use mockito
+ * 2. for routing methods, use TJWSEmbeddedJaxrsServer
+ */
+
+ /*
+ * in the setup portion, create a mock db object
+ *
+ */
+ // set up mock return value
paramList = new ArrayList<>();
VnfResourceCustomization d1 = new VnfResourceCustomization();
d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
d1.setModelInstanceName("ciVFOnboarded-FNAT-aab06c41 1");
paramList.add(d1);
// end
-
- PowerMockito.mockStatic(CatalogDatabase.class);
- dbMock = PowerMockito.mock(CatalogDatabase.class);
- PowerMockito.when(CatalogDatabase.getInstance()).thenReturn(dbMock);
- try {
-
- PowerMockito.whenNew(CatalogDatabase.class).withAnyArguments().thenReturn(dbMock);
- PowerMockito.spy (dbMock);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
+
+ PowerMockito.mockStatic(CatalogDatabase.class);
+ dbMock = PowerMockito.mock(CatalogDatabase.class);
+ PowerMockito.when(CatalogDatabase.getInstance()).thenReturn(dbMock);
+ try {
+
+ PowerMockito.whenNew(CatalogDatabase.class).withAnyArguments().thenReturn(dbMock);
+ PowerMockito.spy(dbMock);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
-
+
@Test
- public void respond_Test(){
- QueryServiceVnfs qryResp = new QueryServiceVnfs(paramList);
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
- CatalogDbAdapterRest spyAdapter = Mockito.spy(adapter);
-
- Response resp = spyAdapter.respond("v1", HttpStatus.SC_OK, false, qryResp);
- Mockito.verify(spyAdapter,Mockito.times(1)).respond("v1", HttpStatus.SC_OK, false, qryResp);
-
+ public void respond_Test() {
+ QueryServiceVnfs qryResp = new QueryServiceVnfs(paramList);
+ CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
+ CatalogDbAdapterRest spyAdapter = Mockito.spy(adapter);
+
+ Response resp = spyAdapter.respond("v1", HttpStatus.SC_OK, false, qryResp);
+ Mockito.verify(spyAdapter, Mockito.times(1)).respond("v1", HttpStatus.SC_OK, false, qryResp);
+
String s = resp.getEntity().toString();
// System.out.println(s);
@@ -108,225 +110,218 @@ public class CatalogDbAdapterRestClassTest {
reader.close();
// end
JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ }
+
+
+ @Test
+ public void serviceVnfsImpl_vnfUuid_ver_Test() {
+ PowerMockito.when(dbMock.getAllVnfsByVnfModelCustomizationUuid(Mockito.anyString())).thenReturn(paramList);
+
+ try {
+ CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
+
+ // Run
+ Response resp = adapter.serviceVnfsImpl("v1", true, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null, null);
+ String s = resp.getEntity().toString();
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ // end
+ JsonArray jArray = respObj.getJsonArray("serviceVnfs");
+
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ //
+ Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByVnfModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void serviceVnfsImpl_smiUuid_NoVer_Test() {
+ PowerMockito.when(dbMock.getAllVnfsByServiceModelInvariantUuid(Mockito.anyString())).thenReturn(paramList);
+
+ try {
+ CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
+
+ // Run
+ Response resp = adapter.serviceVnfsImpl("v1", true, null, null, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null);
+ String s = resp.getEntity().toString();
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ // end
+ JsonArray jArray = respObj.getJsonArray("serviceVnfs");
+
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceModelInvariantUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void serviceVnfsImpl_smUuid_ver_Test() {
+ PowerMockito.when(dbMock.getAllVnfsByServiceModelUuid(Mockito.anyString())).thenReturn(paramList);
+
+ try {
+ CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
+
+ // Run
+ Response resp = adapter.serviceVnfsImpl("v1", true, null, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null);
+ String s = resp.getEntity().toString();
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ // end
+ JsonArray jArray = respObj.getJsonArray("serviceVnfs");
+
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceModelUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void serviceVnfsImpl_smiUuid_ver_Test() {
+ PowerMockito.when(dbMock.getAllVnfsByServiceModelInvariantUuid(Mockito.anyString(), Mockito.anyString())).thenReturn(paramList);
+
+ try {
+ CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
+
+ // Run
+ Response resp = adapter.serviceVnfsImpl("v1", true, null, null, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", "v1", null);
+ String s = resp.getEntity().toString();
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ JsonArray jArray = respObj.getJsonArray("serviceVnfs");
+ // end
+
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceModelInvariantUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391", "v1");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
-
-
- @Test
- public void serviceVnfsImpl_vnfUuid_ver_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByVnfModelCustomizationUuid(Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null, null);
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- //
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByVnfModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
+
+ @Test
+ public void serviceVnfsImpl_smName_ver_Test() {
+ PowerMockito.when(dbMock.getAllVnfsByServiceName(Mockito.anyString(), Mockito.anyString())).thenReturn(paramList);
+
+ try {
+ CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
+
+ // Run
+ Response resp = adapter.serviceVnfsImpl("v1", true, null, null, null, "v1", "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ String s = resp.getEntity().toString();
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ // end
+ JsonArray jArray = respObj.getJsonArray("serviceVnfs");
+
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceName("16ea3e56-a8ce-4ad7-8edd-4d2eae095391", "v1");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
- @Test
- public void serviceVnfsImpl_smiUuid_NoVer_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceModelInvariantUuid(Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null, null, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null);
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceModelInvariantUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_smUuid_ver_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceModelUuid(Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null,"16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null);
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceModelUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_smiUuid_ver_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceModelInvariantUuid(Mockito.anyString(),Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null, null, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", "v1", null);
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
- // end
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceModelInvariantUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391","v1");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_smName_ver_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceName(Mockito.anyString(),Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null, null, null, "v1", "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceName("16ea3e56-a8ce-4ad7-8edd-4d2eae095391","v1");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_smName_NoVer_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceName(Mockito.anyString())).thenReturn (paramList);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null, null, null, null, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- String s = resp.getEntity().toString();
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- // end
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceName("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void serviceVnfsImpl_Exception_Test()
- {
- PowerMockito.when(dbMock.getAllVnfsByServiceName(Mockito.anyString())).thenReturn (null);
-
- try {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
-
- // Run
- Response resp = adapter.serviceVnfsImpl("v1", true, null, null, null, null, null);
-
- assertEquals(resp.getStatus(), HttpStatus.SC_INTERNAL_SERVER_ERROR);
- assertThat(resp.getEntity(), instanceOf(CatalogQueryException.class));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
@Test
- public void serviceNetworksImpl_nUuid_ver_Test(){
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
- CatalogDbAdapterRest spyAdapter = Mockito.spy(adapter);
-
- Response resp = Response
- .status(HttpStatus.SC_OK)
- .entity("{\"serviceVnfs\":[{\"version\":\"v1\",\"modelCustomizationUuid\":\"16ea3e56-a8ce-4ad7-8edd-4d2eae095391\",\"modelInstanceName\":\"ciVFOnboarded-FNAT-aab06c41 1\",\"created\":null,\"vnfResourceModelUuid\":null,\"vnfResourceModelUUID\":null,\"minInstances\":null,\"maxInstances\":null,\"availabilityZoneMaxCount\":null,\"vnfResource\":null,\"nfFunction\":null,\"nfType\":null,\"nfRole\":null,\"nfNamingCode\":null,\"multiStageDesign\":null,\"vfModuleCustomizations\":null,\"serviceResourceCustomizations\":null,\"creationTimestamp\":null}]}")
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
-
- Mockito.doReturn(resp).when(spyAdapter).serviceNetworksImpl(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
-
- // Run
-
- Response ret = spyAdapter.serviceNetworksImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391",null, null, null, null);
- Mockito.verify(spyAdapter).serviceNetworksImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null, null);
-
- assertTrue(ret.getStatus() == HttpStatus.SC_OK);
+ public void serviceVnfsImpl_smName_NoVer_Test() {
+ PowerMockito.when(dbMock.getAllVnfsByServiceName(Mockito.anyString())).thenReturn(paramList);
+
+ try {
+ CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
+
+ // Run
+ Response resp = adapter.serviceVnfsImpl("v1", true, null, null, null, null, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ String s = resp.getEntity().toString();
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ // end
+ JsonArray jArray = respObj.getJsonArray("serviceVnfs");
+
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ Mockito.verify(dbMock, Mockito.times(1)).getAllVnfsByServiceName("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void serviceVnfsImpl_Exception_Test() {
+ PowerMockito.when(dbMock.getAllVnfsByServiceName(Mockito.anyString())).thenReturn(null);
+
+ try {
+ CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
+
+ // Run
+ Response resp = adapter.serviceVnfsImpl("v1", true, null, null, null, null, null);
+
+ assertEquals(resp.getStatus(), HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ assertThat(resp.getEntity(), instanceOf(CatalogQueryException.class));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void serviceNetworksImpl_nUuid_ver_Test() {
+ CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
+ CatalogDbAdapterRest spyAdapter = Mockito.spy(adapter);
+
+ Response resp = Response
+ .status(HttpStatus.SC_OK)
+ .entity("{\"serviceVnfs\":[{\"version\":\"v1\",\"modelCustomizationUuid\":\"16ea3e56-a8ce-4ad7-8edd-4d2eae095391\",\"modelInstanceName\":\"ciVFOnboarded-FNAT-aab06c41 1\",\"created\":null,\"vnfResourceModelUuid\":null,\"vnfResourceModelUUID\":null,\"minInstances\":null,\"maxInstances\":null,\"availabilityZoneMaxCount\":null,\"vnfResource\":null,\"nfFunction\":null,\"nfType\":null,\"nfRole\":null,\"nfNamingCode\":null,\"multiStageDesign\":null,\"vfModuleCustomizations\":null,\"serviceResourceCustomizations\":null,\"creationTimestamp\":null}]}")
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .build();
+
+ Mockito.doReturn(resp).when(spyAdapter).serviceNetworksImpl(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
+
+ // Run
+
+ Response ret = spyAdapter.serviceNetworksImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null, null);
+ Mockito.verify(spyAdapter).serviceNetworksImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null, null);
+
+ assertTrue(ret.getStatus() == HttpStatus.SC_OK);
String s = resp.getEntity().toString();
// prepare to inspect response
@@ -335,33 +330,32 @@ public class CatalogDbAdapterRestClassTest {
reader.close();
// end
JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
+
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+
}
-
+
@Test
- public void serviceAllottedResourcesImpl_Test()
- {
- CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
- CatalogDbAdapterRest spyAdapter = Mockito.spy(adapter);
-
- Response resp = Response
- .status(HttpStatus.SC_OK)
- .entity("{\"serviceVnfs\":[{\"version\":\"v1\",\"modelCustomizationUuid\":\"16ea3e56-a8ce-4ad7-8edd-4d2eae095391\",\"modelInstanceName\":\"ciVFOnboarded-FNAT-aab06c41 1\",\"created\":null,\"vnfResourceModelUuid\":null,\"vnfResourceModelUUID\":null,\"minInstances\":null,\"maxInstances\":null,\"availabilityZoneMaxCount\":null,\"vnfResource\":null,\"nfFunction\":null,\"nfType\":null,\"nfRole\":null,\"nfNamingCode\":null,\"multiStageDesign\":null,\"vfModuleCustomizations\":null,\"serviceResourceCustomizations\":null,\"creationTimestamp\":null}]}")
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
-
- Mockito.doReturn(resp).when(spyAdapter).serviceAllottedResourcesImpl(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
-
- // Run
-
- Response ret = spyAdapter.serviceAllottedResourcesImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391",null, null, null);
- Mockito.verify(spyAdapter).serviceAllottedResourcesImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null);
-
- assertTrue(ret.getStatus() == HttpStatus.SC_OK);
+ public void serviceAllottedResourcesImpl_Test() {
+ CatalogDbAdapterRest adapter = new CatalogDbAdapterRest();
+ CatalogDbAdapterRest spyAdapter = Mockito.spy(adapter);
+
+ Response resp = Response
+ .status(HttpStatus.SC_OK)
+ .entity("{\"serviceVnfs\":[{\"version\":\"v1\",\"modelCustomizationUuid\":\"16ea3e56-a8ce-4ad7-8edd-4d2eae095391\",\"modelInstanceName\":\"ciVFOnboarded-FNAT-aab06c41 1\",\"created\":null,\"vnfResourceModelUuid\":null,\"vnfResourceModelUUID\":null,\"minInstances\":null,\"maxInstances\":null,\"availabilityZoneMaxCount\":null,\"vnfResource\":null,\"nfFunction\":null,\"nfType\":null,\"nfRole\":null,\"nfNamingCode\":null,\"multiStageDesign\":null,\"vfModuleCustomizations\":null,\"serviceResourceCustomizations\":null,\"creationTimestamp\":null}]}")
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .build();
+
+ Mockito.doReturn(resp).when(spyAdapter).serviceAllottedResourcesImpl(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
+
+ // Run
+
+ Response ret = spyAdapter.serviceAllottedResourcesImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null);
+ Mockito.verify(spyAdapter).serviceAllottedResourcesImpl("v1", false, "16ea3e56-a8ce-4ad7-8edd-4d2eae095391", null, null, null);
+
+ assertTrue(ret.getStatus() == HttpStatus.SC_OK);
String s = resp.getEntity().toString();
// prepare to inspect response
@@ -370,11 +364,11 @@ public class CatalogDbAdapterRestClassTest {
reader.close();
// end
JsonArray jArray = respObj.getJsonArray("serviceVnfs");
-
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
-
+
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+
}
-
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java
index ae5e663777..1f80227514 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java
@@ -29,6 +29,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.jboss.resteasy.plugins.server.tjws.TJWSEmbeddedJaxrsServer;
+
import static org.junit.Assert.*;
import java.io.StringReader;
@@ -73,7 +74,7 @@ public class CatalogDbAdapterRestHttpTest {
private static final int PORT = 3099;
private static Registry registry;
private static ResteasyProviderFactory factory;
-
+
@BeforeClass
public static void beforeClass() throws Exception {
server = new TJWSEmbeddedJaxrsServer();
@@ -84,76 +85,75 @@ public class CatalogDbAdapterRestHttpTest {
registry.addPerRequestResource(CatalogDbAdapterRest.class);
factory.registerProvider(CatalogDbAdapterRest.class);
}
-
+
@Before
- public void before(){
- PowerMockito.mockStatic(CatalogDatabase.class);
- dbMock = PowerMockito.mock(CatalogDatabase.class);
- PowerMockito.when(CatalogDatabase.getInstance()).thenReturn(dbMock);
-
- try {
- PowerMockito.whenNew(CatalogDatabase.class).withAnyArguments().thenReturn(dbMock);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
+ public void before() {
+ PowerMockito.mockStatic(CatalogDatabase.class);
+ dbMock = PowerMockito.mock(CatalogDatabase.class);
+ PowerMockito.when(CatalogDatabase.getInstance()).thenReturn(dbMock);
+
+ try {
+ PowerMockito.whenNew(CatalogDatabase.class).withAnyArguments().thenReturn(dbMock);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
-
+
@Test
- public void healthCheck_Test(){
+ public void healthCheck_Test() {
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target("http://localhost:3099/v1/healthcheck");
Response response = target.request().get();
String value = response.readEntity(String.class);
assertTrue(value.contains("Application v1 ready"));
}
-
+
@Test
- public void vnfResourcesUrl_Test()
- {
- try {
- List<VnfResourceCustomization> paramList;
- // set up mock return value
+ public void vnfResourcesUrl_Test() {
+ try {
+ List<VnfResourceCustomization> paramList;
+ // set up mock return value
paramList = new ArrayList<>();
VnfResourceCustomization d1 = new VnfResourceCustomization();
d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
d1.setModelInstanceName("RG_6-26_mog11 0");
d1.setVersion("v1");
paramList.add(d1);
- PowerMockito.when(dbMock.getAllVnfsByVnfModelCustomizationUuid(Mockito.anyString())).thenReturn (paramList);
+ PowerMockito.when(dbMock.getAllVnfsByVnfModelCustomizationUuid(Mockito.anyString())).thenReturn(paramList);
+ // end
+
+ // Run
+ ResteasyClient client = new ResteasyClientBuilder().build();
+ ResteasyWebTarget target = client.target("http://localhost:3099/v1/vnfResources/16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ Response response = target.request().get();
+ String value = response.readEntity(String.class);
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ JsonArray jArray = respObj.getJsonArray("serviceVnfs");
+ assertTrue(jArray.size() == 1);
+ if (jArray.size() == 1) {
+ JsonObject rec = jArray.getJsonObject(0);
+ String version = rec.getString("version");
+ String uuid = rec.getString("modelCustomizationUuid");
+
+ assertTrue(version.equals("v1"));
+ assertTrue(uuid.equals("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"));
+ }
// end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/vnfResources/16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String version = rec.getString("version");
- String uuid = rec.getString("modelCustomizationUuid");
-
- assertTrue(version.equals("v1"));
- assertTrue(uuid.equals("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"));
- }
- // end
- } catch (Exception e) {
- e.printStackTrace();
- }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
-
+
@Test
- public void serviceVnfsUrl_smiUuid_smVer_Test(){
- try {
- List<VnfResourceCustomization> paramList;
- // set up mock return value
+ public void serviceVnfsUrl_smiUuid_smVer_Test() {
+ try {
+ List<VnfResourceCustomization> paramList;
+ // set up mock return value
paramList = new ArrayList<>();
VnfResourceCustomization d1 = new VnfResourceCustomization();
d1.setVnfResourceModelUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
@@ -161,330 +161,327 @@ public class CatalogDbAdapterRestHttpTest {
d1.setVersion("v1");
d1.setMaxInstances(50);
paramList.add(d1);
- PowerMockito.when(dbMock.getAllVnfsByServiceModelInvariantUuid(Mockito.anyString(),Mockito.anyString())).thenReturn (paramList);
+ PowerMockito.when(dbMock.getAllVnfsByServiceModelInvariantUuid(Mockito.anyString(), Mockito.anyString())).thenReturn(paramList);
// end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceVnfs?serviceModelInvariantUuid=16ea3e56-a8ce-4ad7-8edd-4d2eae095391&serviceModelVersion=ver1");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String version = rec.getString("version");
- String uuid = rec.getString("vnfResourceModelUuid");
- int maxInstance = rec.getInt("maxInstances");
-
- assertTrue(version.equals("v1"));
- assertTrue(uuid.equals("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"));
- assertTrue(maxInstance == 50);
- }
- // end
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+
+ // Run
+ ResteasyClient client = new ResteasyClientBuilder().build();
+ ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceVnfs?serviceModelInvariantUuid=16ea3e56-a8ce-4ad7-8edd-4d2eae095391&serviceModelVersion=ver1");
+ Response response = target.request().get();
+ String value = response.readEntity(String.class);
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ JsonArray jArray = respObj.getJsonArray("serviceVnfs");
+ assertTrue(jArray.size() == 1);
+ if (jArray.size() == 1) {
+ JsonObject rec = jArray.getJsonObject(0);
+ String version = rec.getString("version");
+ String uuid = rec.getString("vnfResourceModelUuid");
+ int maxInstance = rec.getInt("maxInstances");
+
+ assertTrue(version.equals("v1"));
+ assertTrue(uuid.equals("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"));
+ assertTrue(maxInstance == 50);
+ }
+ // end
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
}
-
+
@Test
- public void serviceVnfsUrl_vnfUuid_Test(){
- try {
- List<VnfResourceCustomization> paramList;
- // set up mock return value
+ public void serviceVnfsUrl_vnfUuid_Test() {
+ try {
+ List<VnfResourceCustomization> paramList;
+ // set up mock return value
paramList = new ArrayList<>();
VnfResourceCustomization d1 = new VnfResourceCustomization();
d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
d1.setModelInstanceName("RG_6-26_mog11 0");
d1.setVersion("v1");
paramList.add(d1);
- PowerMockito.when(dbMock.getAllVnfsByVnfModelCustomizationUuid(Mockito.anyString())).thenReturn (paramList);
+ PowerMockito.when(dbMock.getAllVnfsByVnfModelCustomizationUuid(Mockito.anyString())).thenReturn(paramList);
+ // end
+
+ // Run
+ ResteasyClient client = new ResteasyClientBuilder().build();
+ ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceVnfs?vnfModelCustomizationUuid=16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ Response response = target.request().get();
+ String value = response.readEntity(String.class);
+
+ // System.out.println(value);
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ JsonArray jArray = respObj.getJsonArray("serviceVnfs");
+ assertTrue(jArray.size() == 1);
+ if (jArray.size() == 1) {
+ JsonObject rec = jArray.getJsonObject(0);
+ String version = rec.getString("version");
+ String uuid = rec.getString("modelCustomizationUuid");
+
+ assertTrue(version.equals("v1"));
+ assertTrue(uuid.equals("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"));
+ }
// end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceVnfs?vnfModelCustomizationUuid=16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceVnfs");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String version = rec.getString("version");
- String uuid = rec.getString("modelCustomizationUuid");
-
- assertTrue(version.equals("v1"));
- assertTrue(uuid.equals("16ea3e56-a8ce-4ad7-8edd-4d2eae095391"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
@Test
- public void networkResourcesUrl_nUuid_Ver_Test(){
- try {
- List<NetworkResourceCustomization> paramList;
- // set up mock return value
+ public void networkResourcesUrl_nUuid_Ver_Test() {
+ try {
+ List<NetworkResourceCustomization> paramList;
+ // set up mock return value
paramList = new ArrayList<>();
NetworkResourceCustomization d1 = new NetworkResourceCustomization();
d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
paramList.add(d1);
- PowerMockito.when(dbMock.getAllNetworksByNetworkModelCustomizationUuid(Mockito.anyString())).thenReturn (paramList);
+ PowerMockito.when(dbMock.getAllNetworksByNetworkModelCustomizationUuid(Mockito.anyString())).thenReturn(paramList);
+ // end
+
+ // Run
+ ResteasyClient client = new ResteasyClientBuilder().build();
+ ResteasyWebTarget target = client.target("http://localhost:3099/v1/networkResources/0cb9b26a-9820-48a7-86e5-16c510e993d9");
+ Response response = target.request().get();
+ String value = response.readEntity(String.class);
+
+ // System.out.println(value);
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ JsonArray jArray = respObj.getJsonArray("serviceNetworks");
+ assertTrue(jArray.size() == 1);
+ if (jArray.size() == 1) {
+ JsonObject rec = jArray.getJsonObject(0);
+ String uuid = rec.getString("networkResourceModelUuid");
+
+ assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
+ }
// end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/networkResources/0cb9b26a-9820-48a7-86e5-16c510e993d9");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceNetworks");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String uuid = rec.getString("networkResourceModelUuid");
-
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
}
-
+
@Test
- public void serviceNetworksUrl_nType_Test(){
- try {
- List<NetworkResourceCustomization> paramList;
- // set up mock return value
+ public void serviceNetworksUrl_nType_Test() {
+ try {
+ List<NetworkResourceCustomization> paramList;
+ // set up mock return value
paramList = new ArrayList<>();
NetworkResourceCustomization d1 = new NetworkResourceCustomization();
d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
paramList.add(d1);
- PowerMockito.when(dbMock.getAllNetworksByNetworkType(Mockito.anyString())).thenReturn (paramList);
+ PowerMockito.when(dbMock.getAllNetworksByNetworkType(Mockito.anyString())).thenReturn(paramList);
// end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceNetworks?networkModelName=0cb9b26a-9820-48a7-86e5-16c510e993d9");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceNetworks");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String uuid = rec.getString("networkResourceModelUuid");
-
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
+
+ // Run
+ ResteasyClient client = new ResteasyClientBuilder().build();
+ ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceNetworks?networkModelName=0cb9b26a-9820-48a7-86e5-16c510e993d9");
+ Response response = target.request().get();
+ String value = response.readEntity(String.class);
+
+ // System.out.println(value);
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ JsonArray jArray = respObj.getJsonArray("serviceNetworks");
+ assertTrue(jArray.size() == 1);
+ if (jArray.size() == 1) {
+ JsonObject rec = jArray.getJsonObject(0);
+ String uuid = rec.getString("networkResourceModelUuid");
+
+ assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
+ }
+ // end
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
@Test
- public void serviceResourcesUrl_smiUuid_Ver_Test(){
- try {
- ArrayList<NetworkResourceCustomization> paramList;
- // set up mock return value
+ public void serviceResourcesUrl_smiUuid_Ver_Test() {
+ try {
+ ArrayList<NetworkResourceCustomization> paramList;
+ // set up mock return value
paramList = new ArrayList<>();
NetworkResourceCustomization d1 = new NetworkResourceCustomization();
d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
paramList.add(d1);
- ServiceMacroHolder ret = new ServiceMacroHolder();
- ret.setNetworkResourceCustomization(paramList);
- PowerMockito.when(dbMock.getAllResourcesByServiceModelInvariantUuid(Mockito.anyString(),Mockito.anyString())).thenReturn (ret);
+ ServiceMacroHolder ret = new ServiceMacroHolder();
+ ret.setNetworkResourceCustomization(paramList);
+ PowerMockito.when(dbMock.getAllResourcesByServiceModelInvariantUuid(Mockito.anyString(), Mockito.anyString())).thenReturn(ret);
+ // end
+
+ // Run
+ ResteasyClient client = new ResteasyClientBuilder().build();
+ ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceResources?serviceModelInvariantUuid=0cb9b26a-9820-48a7-86e5-16c510e993d9&serviceModelVersion=ver1");
+ Response response = target.request().get();
+ String value = response.readEntity(String.class);
+
+ // System.out.println(value);
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ JsonObject obj = respObj.getJsonObject("serviceResources");
+ JsonArray jArray = obj.getJsonArray("networkResourceCustomization");
+ assertTrue(jArray.size() == 1);
+
+ if (jArray.size() == 1) {
+ JsonObject rec = jArray.getJsonObject(0);
+ String uuid = rec.getString("networkResourceModelUuid");
+
+ assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
+ }
// end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceResources?serviceModelInvariantUuid=0cb9b26a-9820-48a7-86e5-16c510e993d9&serviceModelVersion=ver1");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonObject obj = respObj.getJsonObject("serviceResources");
- JsonArray jArray = obj.getJsonArray("networkResourceCustomization");
- assertTrue(jArray.size() == 1);
-
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String uuid = rec.getString("networkResourceModelUuid");
-
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
@Test
- public void allottedResourcesUrl_aUuid_Test()
- {
- try {
- List<AllottedResourceCustomization> paramList;
- // set up mock return value
+ public void allottedResourcesUrl_aUuid_Test() {
+ try {
+ List<AllottedResourceCustomization> paramList;
+ // set up mock return value
paramList = new ArrayList<>();
AllottedResourceCustomization d1 = new AllottedResourceCustomization();
d1.setArModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
paramList.add(d1);
- PowerMockito.when(dbMock.getAllAllottedResourcesByArModelCustomizationUuid(Mockito.anyString())).thenReturn (paramList);
+ PowerMockito.when(dbMock.getAllAllottedResourcesByArModelCustomizationUuid(Mockito.anyString())).thenReturn(paramList);
+ // end
+
+ // Run
+ ResteasyClient client = new ResteasyClientBuilder().build();
+ ResteasyWebTarget target = client.target("http://localhost:3099/v1/allottedResources/0cb9b26a-9820-48a7-86e5-16c510e993d9");
+ Response response = target.request().get();
+ String value = response.readEntity(String.class);
+
+ // System.out.println(value);
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ JsonArray jArray = respObj.getJsonArray("serviceAllottedResources");
+ assertTrue(jArray.size() == 1);
+ if (jArray.size() == 1) {
+ JsonObject rec = jArray.getJsonObject(0);
+ String uuid = rec.getString("arModelUuid");
+
+ assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
+ }
// end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/allottedResources/0cb9b26a-9820-48a7-86e5-16c510e993d9");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceAllottedResources");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String uuid = rec.getString("arModelUuid");
-
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
-
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
}
-
+
@Test
- public void serviceAllottedResourcesUrl_smiUuid_Test()
- {
- try {
- List<AllottedResourceCustomization> paramList;
- // set up mock return value
+ public void serviceAllottedResourcesUrl_smiUuid_Test() {
+ try {
+ List<AllottedResourceCustomization> paramList;
+ // set up mock return value
paramList = new ArrayList<>();
AllottedResourceCustomization d1 = new AllottedResourceCustomization();
d1.setArModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
paramList.add(d1);
- PowerMockito.when(dbMock.getAllAllottedResourcesByServiceModelInvariantUuid(Mockito.anyString(), Mockito.anyString())).thenReturn (paramList);
+ PowerMockito.when(dbMock.getAllAllottedResourcesByServiceModelInvariantUuid(Mockito.anyString(), Mockito.anyString())).thenReturn(paramList);
// end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceAllottedResources?serviceModelInvariantUuid=0cb9b26a-9820-48a7-86e5-16c510e993d9&serviceModelVersion=ver1");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonArray jArray = respObj.getJsonArray("serviceAllottedResources");
- assertTrue(jArray.size() == 1);
- if(jArray.size() == 1){
- JsonObject rec = jArray.getJsonObject(0);
- String uuid = rec.getString("arModelUuid");
-
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- }
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
+
+ // Run
+ ResteasyClient client = new ResteasyClientBuilder().build();
+ ResteasyWebTarget target = client.target("http://localhost:3099/v1/serviceAllottedResources?serviceModelInvariantUuid=0cb9b26a-9820-48a7-86e5-16c510e993d9&serviceModelVersion=ver1");
+ Response response = target.request().get();
+ String value = response.readEntity(String.class);
+
+ // System.out.println(value);
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ JsonArray jArray = respObj.getJsonArray("serviceAllottedResources");
+ assertTrue(jArray.size() == 1);
+ if (jArray.size() == 1) {
+ JsonObject rec = jArray.getJsonObject(0);
+ String uuid = rec.getString("arModelUuid");
+
+ assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
+ }
+ // end
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
}
@Test
- public void vfModulesUrl_modelName_Test()
- {
- try {
- // set up mock return value
- VfModule vfm = new VfModule();
- vfm.setModelName("test Model");
- vfm.setModelUUID("0cb9b26a-9820-48a7-86e5-16c510e993d9");
-
- VfModuleCustomization ret = new VfModuleCustomization();
- ret.setVfModule(vfm);
- PowerMockito.when(dbMock.getVfModuleCustomizationByModelName(Mockito.anyString())).thenReturn (ret);
+ public void vfModulesUrl_modelName_Test() {
+ try {
+ // set up mock return value
+ VfModule vfm = new VfModule();
+ vfm.setModelName("test Model");
+ vfm.setModelUUID("0cb9b26a-9820-48a7-86e5-16c510e993d9");
+
+ VfModuleCustomization ret = new VfModuleCustomization();
+ ret.setVfModule(vfm);
+ PowerMockito.when(dbMock.getVfModuleCustomizationByModelName(Mockito.anyString())).thenReturn(ret);
+ // end
+
+ // Run
+ ResteasyClient client = new ResteasyClientBuilder().build();
+ ResteasyWebTarget target = client.target("http://localhost:3099/v1/vfModules?vfModuleModelName=0cb9b26a-9820-48a7-86e5-16c510e993d9");
+ Response response = target.request().get();
+ String value = response.readEntity(String.class);
+
+ // System.out.println(value);
+
+ // prepare to inspect response
+ JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
+ JsonObject respObj = reader.readObject();
+ reader.close();
+ JsonObject jObj = respObj.getJsonObject("modelInfo");
+ String uuid = jObj.getString("modelUuid");
+ String name = jObj.getString("modelName");
+ assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
+ assertTrue(name.equals("test Model"));
// end
-
- // Run
- ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target("http://localhost:3099/v1/vfModules?vfModuleModelName=0cb9b26a-9820-48a7-86e5-16c510e993d9");
- Response response = target.request().get();
- String value = response.readEntity(String.class);
-
- // System.out.println(value);
-
- // prepare to inspect response
- JsonReader reader = Json.createReader(new StringReader(value.replaceAll("\r?\n", "")));
- JsonObject respObj = reader.readObject();
- reader.close();
- JsonObject jObj = respObj.getJsonObject("modelInfo");
- String uuid = jObj.getString("modelUuid");
- String name = jObj.getString("modelName");
- assertTrue(uuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- assertTrue(name.equals("test Model"));
- // end
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
@AfterClass
public static void afterClass() throws Exception {
- server.stop();
+ server.stop();
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java
index ee2c8db577..a7ee7f5ac7 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java
@@ -43,70 +43,68 @@ import static org.junit.Assert.*;
@RunWith(MockitoJUnitRunner.class)
public class CatalogQueryTest {
-
- @Test
- public void catalogQuerySetTemplateImpl_Test(){
- CatalogQuery mockCatalogQuery = Mockito.mock(CatalogQuery.class);
- Mockito.doCallRealMethod().when(mockCatalogQuery).setTemplate(Mockito.anyString(), Mockito.anyMapOf(String.class, String.class));
-
- Map<String,String> valueMap = new HashMap<>();
- valueMap.put("somekey", "somevalue");
-
- String ret = mockCatalogQuery.setTemplate("<somekey>", valueMap);
-
- assertTrue(ret.equalsIgnoreCase("somevalue"));
- }
-
- @Test
- public void smartToJson_Test()
- {
+
+ @Test
+ public void catalogQuerySetTemplateImpl_Test() {
+ CatalogQuery mockCatalogQuery = Mockito.mock(CatalogQuery.class);
+ Mockito.doCallRealMethod().when(mockCatalogQuery).setTemplate(Mockito.anyString(), Mockito.anyMapOf(String.class, String.class));
+
+ Map<String, String> valueMap = new HashMap<>();
+ valueMap.put("somekey", "somevalue");
+
+ String ret = mockCatalogQuery.setTemplate("<somekey>", valueMap);
+
+ assertTrue(ret.equalsIgnoreCase("somevalue"));
+ }
+
+ @Test
+ public void smartToJson_Test() {
List<VnfResourceCustomization> paramList = new ArrayList<>();
VnfResourceCustomization d1 = new VnfResourceCustomization();
d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
d1.setModelInstanceName("RG_6-26_mog11 0");
d1.setVersion("v1");
paramList.add(d1);
-
+
QueryServiceVnfs qryResp = new QueryServiceVnfs(paramList);
QueryServiceVnfs mockCatalogQuery = Mockito.spy(qryResp);
Mockito.doCallRealMethod().when(mockCatalogQuery).smartToJSON();
- String ret = qryResp.smartToJSON();
- // System.out.println(ret);
-
+ String ret = qryResp.smartToJSON();
+ // System.out.println(ret);
+
JsonReader reader = Json.createReader(new StringReader(ret.replaceAll("\r?\n", "")));
JsonObject respObj = reader.readObject();
reader.close();
JsonArray jArray = respObj.getJsonArray("serviceVnfs");
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- }
-
- @Test
- public void toJsonString_Test()
- {
- CatalogQueryExtendedTest mockCatalogQuery = Mockito.mock(CatalogQueryExtendedTest.class);
- Mockito.doCallRealMethod().when(mockCatalogQuery).JSON2(Mockito.anyBoolean(), Mockito.anyBoolean());
- String ret = mockCatalogQuery.JSON2(true, true);
-
- // System.out.println(ret);
-
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ }
+
+ @Test
+ public void toJsonString_Test() {
+ CatalogQueryExtendedTest mockCatalogQuery = Mockito.mock(CatalogQueryExtendedTest.class);
+ Mockito.doCallRealMethod().when(mockCatalogQuery).JSON2(Mockito.anyBoolean(), Mockito.anyBoolean());
+ String ret = mockCatalogQuery.JSON2(true, true);
+
+ // System.out.println(ret);
+
JsonReader reader = Json.createReader(new StringReader(ret.replaceAll("\r?\n", "")));
JsonObject respObj = reader.readObject();
reader.close();
JsonArray jArray = respObj.getJsonArray("serviceVnfs");
- assertEquals(jArray.size(), 1);
- assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- assertEquals(jArray.getJsonObject(0).getString("version"), "v2");
- }
-
- class CatalogQueryExtendedTest extends CatalogQuery{
- @Override
- public String JSON2(boolean isArray, boolean isEmbed) {
- return "{\"serviceVnfs\":[{\"version\":\"v2\",\"modelCustomizationUuid\":\"16ea3e56-a8ce-4ad7-8edd-4d2eae095391\",\"modelInstanceName\":\"ciVFOnboarded-FNAT-aab06c41 1\",\"created\":null,\"vnfResourceModelUuid\":null,\"vnfResourceModelUUID\":null,\"minInstances\":null,\"maxInstances\":null,\"availabilityZoneMaxCount\":null,\"vnfResource\":null,\"nfFunction\":null,\"nfType\":null,\"nfRole\":null,\"nfNamingCode\":null,\"multiStageDesign\":null,\"vfModuleCustomizations\":null,\"serviceResourceCustomizations\":null,\"creationTimestamp\":null}]}";
- }
-
- }
-
+ assertEquals(jArray.size(), 1);
+ assertEquals(jArray.getJsonObject(0).getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ assertEquals(jArray.getJsonObject(0).getString("version"), "v2");
+ }
+
+ class CatalogQueryExtendedTest extends CatalogQuery {
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ return "{\"serviceVnfs\":[{\"version\":\"v2\",\"modelCustomizationUuid\":\"16ea3e56-a8ce-4ad7-8edd-4d2eae095391\",\"modelInstanceName\":\"ciVFOnboarded-FNAT-aab06c41 1\",\"created\":null,\"vnfResourceModelUuid\":null,\"vnfResourceModelUUID\":null,\"minInstances\":null,\"maxInstances\":null,\"availabilityZoneMaxCount\":null,\"vnfResource\":null,\"nfFunction\":null,\"nfType\":null,\"nfRole\":null,\"nfNamingCode\":null,\"multiStageDesign\":null,\"vfModuleCustomizations\":null,\"serviceResourceCustomizations\":null,\"creationTimestamp\":null}]}";
+ }
+
+ }
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java
index 0d86a6cf10..fd9e23e9f0 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java
@@ -39,29 +39,28 @@ import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
@RunWith(MockitoJUnitRunner.class)
public class QueryAllottedResourceCustomizationTest {
- @Test
- public void JSON2_Test()
- {
- List<AllottedResourceCustomization> paramList;
+ @Test
+ public void JSON2_Test() {
+ List<AllottedResourceCustomization> paramList;
paramList = new ArrayList<>();
AllottedResourceCustomization d1 = new AllottedResourceCustomization();
d1.setModelInstanceName("0cb9b26a-9820-48a7-86e5-16c510e993d9");
d1.setModelCustomizationUuid("16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
paramList.add(d1);
-
- QueryAllottedResourceCustomization qarcObj = new QueryAllottedResourceCustomization(paramList);
- String ret = qarcObj.JSON2(true, true);
- System.out.println(ret);
- ret = "{" + ret + "}";
-
+
+ QueryAllottedResourceCustomization qarcObj = new QueryAllottedResourceCustomization(paramList);
+ String ret = qarcObj.JSON2(true, true);
+ System.out.println(ret);
+ ret = "{" + ret + "}";
+
JsonReader reader = Json.createReader(new StringReader(ret.replaceAll("\r?\n", "")));
JsonObject respObj = reader.readObject();
reader.close();
JsonArray jArray = respObj.getJsonArray("serviceAllottedResources");
- assertEquals(jArray.size(), 1);
-
- assertEquals(jArray.getJsonObject(0).getJsonObject("modelInfo").getString("modelInstanceName"), "0cb9b26a-9820-48a7-86e5-16c510e993d9");
- assertEquals(jArray.getJsonObject(0).getJsonObject("modelInfo").getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
- }
-
+ assertEquals(jArray.size(), 1);
+
+ assertEquals(jArray.getJsonObject(0).getJsonObject("modelInfo").getString("modelInstanceName"), "0cb9b26a-9820-48a7-86e5-16c510e993d9");
+ assertEquals(jArray.getJsonObject(0).getJsonObject("modelInfo").getString("modelCustomizationUuid"), "16ea3e56-a8ce-4ad7-8edd-4d2eae095391");
+ }
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java
index 3a767a8609..01bb570090 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java
@@ -40,25 +40,24 @@ import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder;
@RunWith(MockitoJUnitRunner.class)
public class QueryServiceMarcoHolderTest {
- @Test
- public void JSON2_Test()
- {
- Service svc = new Service();
- svc.setModelUUID("0cb9b26a-9820-48a7-86e5-16c510e993d9");
- svc.setModelName("Testing Model One");
- ArrayList<NetworkResourceCustomization> paramList;
+ @Test
+ public void JSON2_Test() {
+ Service svc = new Service();
+ svc.setModelUUID("0cb9b26a-9820-48a7-86e5-16c510e993d9");
+ svc.setModelName("Testing Model One");
+ ArrayList<NetworkResourceCustomization> paramList;
paramList = new ArrayList<>();
NetworkResourceCustomization d1 = new NetworkResourceCustomization();
d1.setNetworkResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
paramList.add(d1);
- ServiceMacroHolder ret = new ServiceMacroHolder(svc);
- ret.setNetworkResourceCustomization(paramList);
- QueryServiceMacroHolder holder = new QueryServiceMacroHolder(ret);
- String s = holder.JSON2(true, true);
-
- // System.out.println(s);
+ ServiceMacroHolder ret = new ServiceMacroHolder(svc);
+ ret.setNetworkResourceCustomization(paramList);
+ QueryServiceMacroHolder holder = new QueryServiceMacroHolder(ret);
+ String s = holder.JSON2(true, true);
- // prepare to inspect response
+ // System.out.println(s);
+
+ // prepare to inspect response
JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
JsonObject respObj = reader.readObject();
reader.close();
@@ -66,9 +65,9 @@ public class QueryServiceMarcoHolderTest {
JsonObject obj2 = obj.getJsonObject("modelInfo");
String modelName = obj2.getString("modelName");
String modelUuid = obj2.getString("modelUuid");
-
- assertTrue(modelName.equals("Testing Model One"));
- assertTrue(modelUuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- // end
- }
+
+ assertTrue(modelName.equals("Testing Model One"));
+ assertTrue(modelUuid.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
+ // end
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java
index 1c855eaa72..0d4a4f9254 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java
@@ -40,33 +40,32 @@ import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder;
@RunWith(MockitoJUnitRunner.class)
public class QueryServiceNetworksTest {
-
- @Test
- public void JSON2_Test()
- {
- ArrayList<NetworkResourceCustomization> paramList;
+
+ @Test
+ public void JSON2_Test() {
+ ArrayList<NetworkResourceCustomization> paramList;
paramList = new ArrayList<>();
NetworkResourceCustomization d1 = new NetworkResourceCustomization();
d1.setModelInstanceName("0cb9b26a-9820-48a7-86e5-16c510e993d9");
paramList.add(d1);
QueryServiceNetworks qsn = new QueryServiceNetworks(paramList);
-
- String s = qsn.JSON2(true, true);
- s = "{" + s + "}";
- System.out.println(s);
-
- // prepare to inspect response
+
+ String s = qsn.JSON2(true, true);
+ s = "{" + s + "}";
+ System.out.println(s);
+
+ // prepare to inspect response
JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
JsonObject respObj = reader.readObject();
reader.close();
JsonArray objArr = respObj.getJsonArray("serviceNetworks");
-
+
assertTrue(objArr.size() == 1);
-
+
JsonObject obj2 = objArr.getJsonObject(0).getJsonObject("modelInfo");
String modelName = obj2.getString("modelInstanceName");
-
- assertTrue(modelName.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- // end
- }
+
+ assertTrue(modelName.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
+ // end
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java
index 8c8fc967da..b48d8af66e 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java
@@ -40,34 +40,33 @@ import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
@RunWith(MockitoJUnitRunner.class)
public class QueryServiceVnfsTest {
- @Test
- public void JSON2_Test()
- {
- List<VnfResourceCustomization> paramList;
+ @Test
+ public void JSON2_Test() {
+ List<VnfResourceCustomization> paramList;
paramList = new ArrayList<>();
VnfResourceCustomization d1 = new VnfResourceCustomization();
d1.setModelInstanceName("0cb9b26a-9820-48a7-86e5-16c510e993d9");
d1.setVnfResourceModelUuid("0cb9b26a-9820-48a7-86e5-16c510e993d9");
paramList.add(d1);
QueryServiceVnfs qsn = new QueryServiceVnfs(paramList);
-
- String s = qsn.JSON2(true, true);
- s = "{" + s + "}";
- System.out.println(s);
-
- // prepare to inspect response
+
+ String s = qsn.JSON2(true, true);
+ s = "{" + s + "}";
+ System.out.println(s);
+
+ // prepare to inspect response
JsonReader reader = Json.createReader(new StringReader(s.replaceAll("\r?\n", "")));
JsonObject respObj = reader.readObject();
reader.close();
JsonArray objArr = respObj.getJsonArray("serviceVnfs");
-
+
assertTrue(objArr.size() == 1);
-
+
JsonObject obj2 = objArr.getJsonObject(0).getJsonObject("modelInfo");
String modelName = obj2.getString("modelInstanceName");
-
- assertTrue(modelName.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
- // end
-
- }
+
+ assertTrue(modelName.equals("0cb9b26a-9820-48a7-86e5-16c510e993d9"));
+ // end
+
+ }
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java
index 5e3f79add6..8b64f9325e 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java
@@ -43,45 +43,44 @@ public class ObjectFactoryTest {
* Test method for {@link org.openecomp.mso.adapters.sdnc.ObjectFactory#createRequestHeader()}.
*/
@Test
- public final void testCreateRequestHeader () {
- ObjectFactory of = new ObjectFactory ();
- RequestHeader rh = of.createRequestHeader ();
- rh.setCallbackUrl ("callback");
- rh.setMsoAction ("action");
- rh.setRequestId ("reqid");
- rh.setSvcAction ("svcAction");
- rh.setSvcInstanceId ("svcId");
- rh.setSvcOperation ("op");
-
+ public final void testCreateRequestHeader() {
+ ObjectFactory of = new ObjectFactory();
+ RequestHeader rh = of.createRequestHeader();
+ rh.setCallbackUrl("callback");
+ rh.setMsoAction("action");
+ rh.setRequestId("reqid");
+ rh.setSvcAction("svcAction");
+ rh.setSvcInstanceId("svcId");
+ rh.setSvcOperation("op");
+
try {
JAXBContext jaxbContext = JAXBContext.newInstance(RequestHeader.class);
jaxbMarshaller = jaxbContext.createMarshaller();
-
+
JAXBContext jaxbContext2 = JAXBContext.newInstance(RequestHeader.class);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
- }
- catch (JAXBException e) {
- e.printStackTrace ();
+ } catch (JAXBException e) {
+ e.printStackTrace();
fail();
return;
}
StringWriter writer = new StringWriter();
try {
- jaxbMarshaller.marshal (rh, writer);
+ jaxbMarshaller.marshal(rh, writer);
} catch (JAXBException e) {
e.printStackTrace();
- fail ();
+ fail();
}
- String marshalled = writer.toString ();
- assert(marshalled.contains ("<RequestId>reqid</RequestId>"));
-
+ String marshalled = writer.toString();
+ assert (marshalled.contains("<RequestId>reqid</RequestId>"));
+
InputStream inputStream = new ByteArrayInputStream(marshalled.getBytes(Charset.forName("UTF-8")));
try {
- RequestHeader res2 = (RequestHeader) jaxbUnmarshaller.unmarshal (inputStream);
- assert(res2.getCallbackUrl ().equals ("callback"));
- assert(res2.getMsoAction ().equals ("action"));
- assert(res2.getSvcOperation ().equals ("op"));
+ RequestHeader res2 = (RequestHeader) jaxbUnmarshaller.unmarshal(inputStream);
+ assert (res2.getCallbackUrl().equals("callback"));
+ assert (res2.getMsoAction().equals("action"));
+ assert (res2.getSvcOperation().equals("op"));
} catch (JAXBException e) {
e.printStackTrace();
fail();
@@ -92,9 +91,9 @@ public class ObjectFactoryTest {
* Test method for {@link org.openecomp.mso.adapters.sdnc.ObjectFactory#createSDNCAdapterResponse()}.
*/
@Test
- public final void testCreateSDNCAdapterResponse () {
- ObjectFactory of = new ObjectFactory ();
- SDNCAdapterResponse ar = of.createSDNCAdapterResponse ();
+ public final void testCreateSDNCAdapterResponse() {
+ ObjectFactory of = new ObjectFactory();
+ SDNCAdapterResponse ar = of.createSDNCAdapterResponse();
assert (ar != null);
}
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java
index fa96b7983e..5fd2c84f1c 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java
@@ -29,26 +29,26 @@ import org.openecomp.mso.adapters.sdnc.RequestHeader;
public class SDNCAdapterRequestTest {
- static Object sd= new SDNCAdapterRequest();
- static RequestHeader rh=new RequestHeader();
-
- @BeforeClass
- public static final void RHeader()
- {
- rh.setCallbackUrl("callback");
- rh.setMsoAction ("action");
- rh.setRequestId ("reqid");
- rh.setSvcAction ("svcAction");
- rh.setSvcInstanceId ("svcId");
- rh.setSvcOperation ("op");
- }
- @Test
- public final void testtoString(){
- ((SDNCAdapterRequest) sd).setRequestData("data");
- ((SDNCAdapterRequest) sd).setRequestHeader(rh);
- assert (((SDNCAdapterRequest) sd).getRequestData()!= null) ;
- assert(((SDNCAdapterRequest) sd).getRequestData().equals("data"));
- assert(((SDNCAdapterRequest) sd).getRequestHeader().equals(rh));
- }
+ static Object sd = new SDNCAdapterRequest();
+ static RequestHeader rh = new RequestHeader();
+
+ @BeforeClass
+ public static final void RHeader() {
+ rh.setCallbackUrl("callback");
+ rh.setMsoAction("action");
+ rh.setRequestId("reqid");
+ rh.setSvcAction("svcAction");
+ rh.setSvcInstanceId("svcId");
+ rh.setSvcOperation("op");
+ }
+
+ @Test
+ public final void testtoString() {
+ ((SDNCAdapterRequest) sd).setRequestData("data");
+ ((SDNCAdapterRequest) sd).setRequestHeader(rh);
+ assert (((SDNCAdapterRequest) sd).getRequestData() != null);
+ assert (((SDNCAdapterRequest) sd).getRequestData().equals("data"));
+ assert (((SDNCAdapterRequest) sd).getRequestHeader().equals(rh));
+ }
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java
index 63aa49cf54..cb64528e78 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java
@@ -27,27 +27,25 @@ import org.openecomp.mso.adapters.sdnc.client.SDNCAdapterCallbackRequest;
public class SDNCAdapterCallbackRequestTest {
- static SDNCAdapterCallbackRequest sdc = new SDNCAdapterCallbackRequest();
- static CallbackHeader ch = new CallbackHeader("413658f4-7f42-482e-b834-23a5c15657da-1474471336781","200","OK");
-
- @Test
- public void testSDNCAdapterCallbackRequest()
- {
- sdc.setCallbackHeader(ch);
- sdc.setRequestData("data");
- assert(sdc.getCallbackHeader()!=null);
- assert(sdc.getRequestData()!=null);
- assert(sdc.getCallbackHeader().equals(ch));
- assert(sdc.getRequestData().equals("data"));
-
- }
-
- @Test
- public void testtoString()
- {
- assert(ch.toString()!=null);
- }
-
+ static SDNCAdapterCallbackRequest sdc = new SDNCAdapterCallbackRequest();
+ static CallbackHeader ch = new CallbackHeader("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", "200", "OK");
+
+ @Test
+ public void testSDNCAdapterCallbackRequest() {
+ sdc.setCallbackHeader(ch);
+ sdc.setRequestData("data");
+ assert (sdc.getCallbackHeader() != null);
+ assert (sdc.getRequestData() != null);
+ assert (sdc.getCallbackHeader().equals(ch));
+ assert (sdc.getRequestData().equals("data"));
+
+ }
+
+ @Test
+ public void testtoString() {
+ assert (ch.toString() != null);
+ }
+
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java
index 55295fc3ea..0845315f67 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java
@@ -33,20 +33,21 @@ import org.openecomp.mso.properties.MsoPropertiesFactory;
public class RequestTunablesTest {
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
+ public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+
/**
* This method is called before any test occurs.
* It creates a fake tree from scratch
- * @throws MsoPropertiesException
+ *
+ * @throws MsoPropertiesException
*/
@BeforeClass
- public static final void prepare () throws MsoPropertiesException {
- ClassLoader classLoader = RequestTunablesTest.class.getClassLoader ();
- String path = classLoader.getResource ("mso.properties").toString ().substring (5);
-
+ public static final void prepare() throws MsoPropertiesException {
+ ClassLoader classLoader = RequestTunablesTest.class.getClassLoader();
+ String path = classLoader.getResource("mso.properties").toString().substring(5);
+
msoPropertiesFactory.initializeMsoProperties(RequestTunables.MSO_PROP_SDNC_ADAPTER, path);
-
+
}
/**
@@ -55,20 +56,20 @@ public class RequestTunablesTest {
* .
*/
@Test
- public final void testRequestTunables () {
- RequestTunables rt = new RequestTunables (null, null, "op", null,msoPropertiesFactory);
- assert(rt.getReqId ().length ()==0);
- rt = new RequestTunables ("reqId", "msoAction", null, "query",msoPropertiesFactory);
- rt.setTunables ();
- System.out.println(rt.toString ());
- // assert (rt.getReqMethod ().equals ("toto"));
- assert (rt.getTimeout () != null);
- assert (rt.getAction ().equals ("query"));
- assert (rt.getMsoAction ().equals ("msoAction"));
- assert (rt.getHeaderName ().equals ("sdnc-request-header"));
- assert (rt.getOperation ().length () == 0);
- assert (rt.getAsyncInd ().equals ("N"));
- assert (rt.getReqId ().equals ("reqId"));
+ public final void testRequestTunables() {
+ RequestTunables rt = new RequestTunables(null, null, "op", null, msoPropertiesFactory);
+ assert (rt.getReqId().length() == 0);
+ rt = new RequestTunables("reqId", "msoAction", null, "query", msoPropertiesFactory);
+ rt.setTunables();
+ System.out.println(rt.toString());
+ // assert (rt.getReqMethod ().equals ("toto"));
+ assert (rt.getTimeout() != null);
+ assert (rt.getAction().equals("query"));
+ assert (rt.getMsoAction().equals("msoAction"));
+ assert (rt.getHeaderName().equals("sdnc-request-header"));
+ assert (rt.getOperation().length() == 0);
+ assert (rt.getAsyncInd().equals("N"));
+ assert (rt.getReqId().equals("reqId"));
}
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java
index 1921a9961a..3b7eef5f42 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java
@@ -39,439 +39,438 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
-
/**
* JSON object mapping tests.
*/
public class ObjectMappingTest {
- private static final String EOL = "\n";
-
- private final String SDNC_SERVICE_REQUEST =
- "{" + EOL +
- " \"SDNCServiceRequest\": {" + EOL +
- " \"requestInformation\": {" + EOL +
- " \"requestId\": \"413658f4-7f42-482e-b834-23a5c15657da\"," + EOL +
- " \"source\": \"CCD\"," + EOL +
- " \"notificationUrl\": \"https://ccd-host:8080/notifications\"" + EOL +
- " }," + EOL +
- " \"serviceInformation\": {" + EOL +
- " \"serviceType\": \"vHNFaaS\"," + EOL +
- " \"serviceInstanceId\": \"74e65b2b637441bca078e63e44bb511b\"," + EOL +
- " \"subscriberName\": \"IST_SG_0902_3003\"," + EOL +
- " \"subscriberGlobalId\": \"IST15_0902_3003\"" + EOL +
- " }," + EOL +
- " \"bpNotificationUrl\": \"http://localhost:8080/mso/SDNCAdapterCallbackService\"," + EOL +
- "((BP-TIMEOUT))" +
- " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL +
- " \"sdncService\": \"vhnf\"," + EOL +
- " \"sdncOperation\": \"service-topology-cust-assign-operation\"," + EOL +
- " \"sdncServiceDataType\": \"XML\"," + EOL +
- " \"sdncServiceData\": \"<vhnf-cust-stage-information><dhv-service-instance-id>c26dfed652164d60a17461734422b085</dhv-service-instance-id><hnportal-primary-vnf-host-name>HOSTNAME</hnportal-primary-vnf-host-name></vhnf-cust-stage-information>\"" + EOL +
- " }" + EOL +
- "}" + EOL;
-
- private final String SDNC_SERVICE_RESPONSE =
- "{" + EOL +
- " \"SDNCServiceResponse\": {" + EOL +
- " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL +
- " \"responseCode\": \"200\"," + EOL +
- "((RESPONSE-MESSAGE))" +
- " \"ackFinalIndicator\": \"Y\"" + EOL +
- "((RESPONSE-PARAMS))" +
- " }" + EOL +
- "}" + EOL;
-
- private final String SDNC_SERVICE_ERROR =
- "{" + EOL +
- " \"SDNCServiceError\": {" + EOL +
- " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL +
- " \"responseCode\": \"500\"," + EOL +
- "((RESPONSE-MESSAGE))" +
- " \"ackFinalIndicator\": \"Y\"" + EOL +
- " }" + EOL +
- "}" + EOL;
-
- private final String SDNC_EVENT =
- "{" + EOL +
- " \"SDNCEvent\": {" + EOL +
- " \"eventType\": \"ACTIVATION\"," + EOL +
- " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL +
- " \"eventCorrelator\": \"USOSTCDALTX0101UJZZ31\"" + EOL +
- "((EVENT-PARAMS))" +
- " }" + EOL +
- "}" + EOL;
-
- private final String PARAMS =
- "{\"entry\":[{\"key\":\"P1\",\"value\":\"V1\"},{\"key\":\"P2\",\"value\":\"V2\"},{\"key\":\"P3\",\"value\":\"V3\"}]}";
-
- @Test
- public final void jsonToSDNCServiceRequest() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- String json = SDNC_SERVICE_REQUEST;
- json = json.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL);
-
- SDNCServiceRequest object = mapper.readValue(json, SDNCServiceRequest.class);
- assertEquals("413658f4-7f42-482e-b834-23a5c15657da", object.getRequestInformation().getRequestId());
- assertEquals("CCD", object.getRequestInformation().getSource());
- assertEquals("https://ccd-host:8080/notifications", object.getRequestInformation().getNotificationUrl());
- assertEquals("vHNFaaS", object.getServiceInformation().getServiceType());
- assertEquals("74e65b2b637441bca078e63e44bb511b", object.getServiceInformation().getServiceInstanceId());
- assertEquals("IST_SG_0902_3003", object.getServiceInformation().getSubscriberName());
- assertEquals("IST15_0902_3003", object.getServiceInformation().getSubscriberGlobalId());
- assertEquals("http://localhost:8080/mso/SDNCAdapterCallbackService", object.getBPNotificationUrl());
- assertEquals("PT5M", object.getBPTimeout());
- assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
- assertEquals("vhnf", object.getSDNCService());
- assertEquals("service-topology-cust-assign-operation", object.getSDNCOperation());
- assertEquals("XML", object.getSDNCServiceDataType());
- assertTrue(object.getSDNCServiceData().startsWith("<vhnf-cust-stage-information>"));
- }
-
- @Test
- public final void jsonToSDNCServiceRequestWithoutOptionalFields() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // bpTimeout is optional.
- String json = SDNC_SERVICE_REQUEST;
- json = json.replace("((BP-TIMEOUT))", "");
-
- SDNCServiceRequest object = mapper.readValue(json, SDNCServiceRequest.class);
- assertEquals("413658f4-7f42-482e-b834-23a5c15657da", object.getRequestInformation().getRequestId());
- assertEquals("CCD", object.getRequestInformation().getSource());
- assertEquals("https://ccd-host:8080/notifications", object.getRequestInformation().getNotificationUrl());
- assertEquals("vHNFaaS", object.getServiceInformation().getServiceType());
- assertEquals("74e65b2b637441bca078e63e44bb511b", object.getServiceInformation().getServiceInstanceId());
- assertEquals("IST_SG_0902_3003", object.getServiceInformation().getSubscriberName());
- assertEquals("IST15_0902_3003", object.getServiceInformation().getSubscriberGlobalId());
- assertEquals("http://localhost:8080/mso/SDNCAdapterCallbackService", object.getBPNotificationUrl());
- assertNull(object.getBPTimeout());
- assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
- assertEquals("vhnf", object.getSDNCService());
- assertEquals("service-topology-cust-assign-operation", object.getSDNCOperation());
- assertEquals("XML", object.getSDNCServiceDataType());
- assertTrue(object.getSDNCServiceData().startsWith("<vhnf-cust-stage-information>"));
- }
-
- @Test
- public final void jsonFromSDNCServiceRequest() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // Convert source json string to object.
- String json1 = SDNC_SERVICE_REQUEST;
- json1 = json1.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL);
- SDNCServiceRequest object1 = mapper.readValue(json1, SDNCServiceRequest.class);
-
- // Convert resulting object back to json.
- String json2 = object1.toJson();
- System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
- + ":" + System.lineSeparator() + json2);
- assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceRequest\":{"));
-
- // Convert generated json string to another object.
- SDNCServiceRequest object2 = mapper.readValue(json2, SDNCServiceRequest.class);
-
- // Compare the first object to the second object.
- assertTrue(serializedEquals(object1, object2));
- }
-
- @Test
- public final void jsonFromSDNCServiceRequestWithoutOptionalFields() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // Convert source json string to object.
- String json1 = SDNC_SERVICE_REQUEST;
- json1 = json1.replace("((BP-TIMEOUT))", "");
- SDNCServiceRequest object1 = mapper.readValue(json1, SDNCServiceRequest.class);
-
- // Convert resulting object back to json.
- String json2 = object1.toJson();
- System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
- + ":" + System.lineSeparator() + json2);
- assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceRequest\":{"));
-
- // Convert generated json string to another object.
- SDNCServiceRequest object2 = mapper.readValue(json2, SDNCServiceRequest.class);
-
- // Compare the first object to the second object.
- assertTrue(serializedEquals(object1, object2));
- }
-
- @Test
- public final void jsonToSDNCServiceResponse() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- String json = SDNC_SERVICE_RESPONSE;
- json = json.replace("((RESPONSE-MESSAGE))", " \"responseMessage\": \"" + "OK" + "\"," + EOL);
- json = json.replace(EOL + "((RESPONSE-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL);
-
- SDNCServiceResponse object = mapper.readValue(json, SDNCServiceResponse.class);
- assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
- assertEquals("200", object.getResponseCode());
- assertEquals("OK", object.getResponseMessage());
- assertEquals("Y", object.getAckFinalIndicator());
- assertEquals("V1", object.getParams().get("P1"));
- assertEquals("V2", object.getParams().get("P2"));
- assertEquals("V3", object.getParams().get("P3"));
- }
-
- @Test
- public final void jsonToSDNCServiceResponseWithoutOptionalFields() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // responseMessage is optional.
- String json = SDNC_SERVICE_RESPONSE;
- json = json.replace("((RESPONSE-MESSAGE))", "");
- json = json.replace("((RESPONSE-PARAMS))", "");
-
- SDNCServiceResponse object = mapper.readValue(json, SDNCServiceResponse.class);
- assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
- assertEquals("200", object.getResponseCode());
- assertNull(object.getResponseMessage());
- assertEquals("Y", object.getAckFinalIndicator());
- assertNull(object.getParams());
- }
-
- @Test
- public final void jsonFromSDNCServiceResponse() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // Convert source json string to object.
- String json1 = SDNC_SERVICE_RESPONSE;
- json1 = json1.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "OK" + "\"," + EOL);
- json1 = json1.replace(EOL + "((RESPONSE-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL);
- SDNCServiceResponse object1 = mapper.readValue(json1, SDNCServiceResponse.class);
-
- // Convert resulting object back to json.
- String json2 = object1.toJson();
- System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
- + ":" + System.lineSeparator() + json2);
- assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceResponse\":{"));
-
- // Convert generated json string to another object.
- SDNCServiceResponse object2 = mapper.readValue(json2, SDNCServiceResponse.class);
-
- // Compare the first object to the second object.
- assertTrue(serializedEquals(object1, object2));
- }
-
- @Test
- public final void jsonFromSDNCServiceResponseWithoutOptionalFields() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // Convert source json string to object.
- String json1 = SDNC_SERVICE_RESPONSE;
- json1 = json1.replace("((RESPONSE-MESSAGE))", "");
- json1 = json1.replace("((RESPONSE-PARAMS))", "");
- SDNCServiceResponse object1 = mapper.readValue(json1, SDNCServiceResponse.class);
-
- // Convert resulting object back to json.
- String json2 = object1.toJson();
- System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
- + ":" + System.lineSeparator() + json2);
- assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceResponse\":{"));
-
- // Convert generated json string to another object.
- SDNCServiceResponse object2 = mapper.readValue(json2, SDNCServiceResponse.class);
-
- // Compare the first object to the second object.
- assertTrue(serializedEquals(object1, object2));
- }
-
- @Test
- public final void jsonToSDNCServiceError() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- String json = SDNC_SERVICE_ERROR;
- json = json.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "SOMETHING BAD" + "\"," + EOL);
-
- SDNCServiceError object = mapper.readValue(json, SDNCServiceError.class);
- assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
- assertEquals("500", object.getResponseCode());
- assertEquals("SOMETHING BAD", object.getResponseMessage());
- assertEquals("Y", object.getAckFinalIndicator());
- }
-
- @Test
- public final void jsonToSDNCServiceErrorWithoutOptionalFields() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // responseMessage is optional.
- String json = SDNC_SERVICE_ERROR;
- json = json.replace("((RESPONSE-MESSAGE))", "");
-
- SDNCServiceError object = mapper.readValue(json, SDNCServiceError.class);
- assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
- assertEquals("500", object.getResponseCode());
- assertNull(object.getResponseMessage());
- assertEquals("Y", object.getAckFinalIndicator());
- }
-
- @Test
- public final void jsonFromSDNCServiceError() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // Convert source json string to object.
- String json1 = SDNC_SERVICE_ERROR;
- json1 = json1.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "OK" + "\"," + EOL);
- SDNCServiceError object1 = mapper.readValue(json1, SDNCServiceError.class);
-
- // Convert resulting object back to json.
- String json2 = object1.toJson();
- System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
- + ":" + System.lineSeparator() + json2);
- assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceError\":{"));
-
- // Convert generated json string to another object.
- SDNCServiceError object2 = mapper.readValue(json2, SDNCServiceError.class);
-
- // Compare the first object to the second object.
- assertTrue(serializedEquals(object1, object2));
- }
-
- @Test
- public final void jsonFromSDNCServiceErrorWithoutOptionalFields() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // Convert source json string to object.
- String json1 = SDNC_SERVICE_ERROR;
- json1 = json1.replace("((RESPONSE-MESSAGE))", "");
- SDNCServiceError object1 = mapper.readValue(json1, SDNCServiceError.class);
-
- // Convert resulting object back to json.
- String json2 = object1.toJson();
- System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
- + ":" + System.lineSeparator() + json2);
- assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceError\":{"));
-
- // Convert generated json string to another object.
- SDNCServiceError object2 = mapper.readValue(json2, SDNCServiceError.class);
-
- // Compare the first object to the second object.
- assertTrue(serializedEquals(object1, object2));
- }
-
- @Test
- public final void jsonToSDNCEvent() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- String json = SDNC_EVENT;
- json = json.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL);
-
- SDNCEvent object = mapper.readValue(json, SDNCEvent.class);
- assertEquals("ACTIVATION", object.getEventType());
- assertEquals("HOST-NAME", object.getEventCorrelatorType());
- assertEquals("USOSTCDALTX0101UJZZ31", object.getEventCorrelator());
- assertEquals("V1", object.getParams().get("P1"));
- assertEquals("V2", object.getParams().get("P2"));
- assertEquals("V3", object.getParams().get("P3"));
- }
-
- @Test
- public final void jsonToSDNCEventWithoutOptionalFields() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // params are optional.
- String json = SDNC_EVENT;
- json = json.replace("((EVENT-PARAMS))", "");
-
- SDNCEvent object = mapper.readValue(json, SDNCEvent.class);
- assertEquals("ACTIVATION", object.getEventType());
- assertEquals("HOST-NAME", object.getEventCorrelatorType());
- assertEquals("USOSTCDALTX0101UJZZ31", object.getEventCorrelator());
- assertNull(object.getParams());
- }
-
- @Test
- public final void jsonFromSDNCEvent() throws Exception {
- logTest();
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
-
- // Convert source json string to object.
- String json1 = SDNC_EVENT;
- json1 = json1.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL);
- SDNCEvent object1 = mapper.readValue(json1, SDNCEvent.class);
-
- // Convert resulting object back to json.
- String json2 = object1.toJson();
- System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
- + ":" + System.lineSeparator() + json2);
- assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCEvent\":{"));
-
- // Convert generated json string to another object.
- SDNCEvent object2 = mapper.readValue(json2, SDNCEvent.class);
-
- // Compare the first object to the second object.
- assertTrue(serializedEquals(object1, object2));
- }
-
- /**
- * Tests equality of two objects by comparing their serialized form.
- * WARNING: this works pretty well as long as the objects don't contain
- * collections like maps and sets that are semantically equal, but have
- * different internal ordering of elements.
- */
- private boolean serializedEquals(Serializable object1, Serializable object2) throws IOException {
- ByteArrayOutputStream byteStream1 = new ByteArrayOutputStream();
- ObjectOutputStream objectStream1 = new ObjectOutputStream(byteStream1);
- objectStream1.writeObject(object1);
- objectStream1.close();
-
- ByteArrayOutputStream byteStream2 = new ByteArrayOutputStream();
- ObjectOutputStream objectStream2 = new ObjectOutputStream(byteStream2);
- objectStream2.writeObject(object2);
- objectStream2.close();
-
- return Arrays.equals(byteStream1.toByteArray(), byteStream2.toByteArray());
- }
-
- private void logTest() {
- StackTraceElement[] st = Thread.currentThread().getStackTrace();
- String method = st[2].getMethodName();
- System.out.println("RUNNING TEST: " + method);
- }
+ private static final String EOL = "\n";
+
+ private final String SDNC_SERVICE_REQUEST =
+ "{" + EOL +
+ " \"SDNCServiceRequest\": {" + EOL +
+ " \"requestInformation\": {" + EOL +
+ " \"requestId\": \"413658f4-7f42-482e-b834-23a5c15657da\"," + EOL +
+ " \"source\": \"CCD\"," + EOL +
+ " \"notificationUrl\": \"https://ccd-host:8080/notifications\"" + EOL +
+ " }," + EOL +
+ " \"serviceInformation\": {" + EOL +
+ " \"serviceType\": \"vHNFaaS\"," + EOL +
+ " \"serviceInstanceId\": \"74e65b2b637441bca078e63e44bb511b\"," + EOL +
+ " \"subscriberName\": \"IST_SG_0902_3003\"," + EOL +
+ " \"subscriberGlobalId\": \"IST15_0902_3003\"" + EOL +
+ " }," + EOL +
+ " \"bpNotificationUrl\": \"http://localhost:8080/mso/SDNCAdapterCallbackService\"," + EOL +
+ "((BP-TIMEOUT))" +
+ " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL +
+ " \"sdncService\": \"vhnf\"," + EOL +
+ " \"sdncOperation\": \"service-topology-cust-assign-operation\"," + EOL +
+ " \"sdncServiceDataType\": \"XML\"," + EOL +
+ " \"sdncServiceData\": \"<vhnf-cust-stage-information><dhv-service-instance-id>c26dfed652164d60a17461734422b085</dhv-service-instance-id><hnportal-primary-vnf-host-name>HOSTNAME</hnportal-primary-vnf-host-name></vhnf-cust-stage-information>\"" + EOL +
+ " }" + EOL +
+ "}" + EOL;
+
+ private final String SDNC_SERVICE_RESPONSE =
+ "{" + EOL +
+ " \"SDNCServiceResponse\": {" + EOL +
+ " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL +
+ " \"responseCode\": \"200\"," + EOL +
+ "((RESPONSE-MESSAGE))" +
+ " \"ackFinalIndicator\": \"Y\"" + EOL +
+ "((RESPONSE-PARAMS))" +
+ " }" + EOL +
+ "}" + EOL;
+
+ private final String SDNC_SERVICE_ERROR =
+ "{" + EOL +
+ " \"SDNCServiceError\": {" + EOL +
+ " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL +
+ " \"responseCode\": \"500\"," + EOL +
+ "((RESPONSE-MESSAGE))" +
+ " \"ackFinalIndicator\": \"Y\"" + EOL +
+ " }" + EOL +
+ "}" + EOL;
+
+ private final String SDNC_EVENT =
+ "{" + EOL +
+ " \"SDNCEvent\": {" + EOL +
+ " \"eventType\": \"ACTIVATION\"," + EOL +
+ " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL +
+ " \"eventCorrelator\": \"USOSTCDALTX0101UJZZ31\"" + EOL +
+ "((EVENT-PARAMS))" +
+ " }" + EOL +
+ "}" + EOL;
+
+ private final String PARAMS =
+ "{\"entry\":[{\"key\":\"P1\",\"value\":\"V1\"},{\"key\":\"P2\",\"value\":\"V2\"},{\"key\":\"P3\",\"value\":\"V3\"}]}";
+
+ @Test
+ public final void jsonToSDNCServiceRequest() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ String json = SDNC_SERVICE_REQUEST;
+ json = json.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL);
+
+ SDNCServiceRequest object = mapper.readValue(json, SDNCServiceRequest.class);
+ assertEquals("413658f4-7f42-482e-b834-23a5c15657da", object.getRequestInformation().getRequestId());
+ assertEquals("CCD", object.getRequestInformation().getSource());
+ assertEquals("https://ccd-host:8080/notifications", object.getRequestInformation().getNotificationUrl());
+ assertEquals("vHNFaaS", object.getServiceInformation().getServiceType());
+ assertEquals("74e65b2b637441bca078e63e44bb511b", object.getServiceInformation().getServiceInstanceId());
+ assertEquals("IST_SG_0902_3003", object.getServiceInformation().getSubscriberName());
+ assertEquals("IST15_0902_3003", object.getServiceInformation().getSubscriberGlobalId());
+ assertEquals("http://localhost:8080/mso/SDNCAdapterCallbackService", object.getBPNotificationUrl());
+ assertEquals("PT5M", object.getBPTimeout());
+ assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
+ assertEquals("vhnf", object.getSDNCService());
+ assertEquals("service-topology-cust-assign-operation", object.getSDNCOperation());
+ assertEquals("XML", object.getSDNCServiceDataType());
+ assertTrue(object.getSDNCServiceData().startsWith("<vhnf-cust-stage-information>"));
+ }
+
+ @Test
+ public final void jsonToSDNCServiceRequestWithoutOptionalFields() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // bpTimeout is optional.
+ String json = SDNC_SERVICE_REQUEST;
+ json = json.replace("((BP-TIMEOUT))", "");
+
+ SDNCServiceRequest object = mapper.readValue(json, SDNCServiceRequest.class);
+ assertEquals("413658f4-7f42-482e-b834-23a5c15657da", object.getRequestInformation().getRequestId());
+ assertEquals("CCD", object.getRequestInformation().getSource());
+ assertEquals("https://ccd-host:8080/notifications", object.getRequestInformation().getNotificationUrl());
+ assertEquals("vHNFaaS", object.getServiceInformation().getServiceType());
+ assertEquals("74e65b2b637441bca078e63e44bb511b", object.getServiceInformation().getServiceInstanceId());
+ assertEquals("IST_SG_0902_3003", object.getServiceInformation().getSubscriberName());
+ assertEquals("IST15_0902_3003", object.getServiceInformation().getSubscriberGlobalId());
+ assertEquals("http://localhost:8080/mso/SDNCAdapterCallbackService", object.getBPNotificationUrl());
+ assertNull(object.getBPTimeout());
+ assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
+ assertEquals("vhnf", object.getSDNCService());
+ assertEquals("service-topology-cust-assign-operation", object.getSDNCOperation());
+ assertEquals("XML", object.getSDNCServiceDataType());
+ assertTrue(object.getSDNCServiceData().startsWith("<vhnf-cust-stage-information>"));
+ }
+
+ @Test
+ public final void jsonFromSDNCServiceRequest() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // Convert source json string to object.
+ String json1 = SDNC_SERVICE_REQUEST;
+ json1 = json1.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL);
+ SDNCServiceRequest object1 = mapper.readValue(json1, SDNCServiceRequest.class);
+
+ // Convert resulting object back to json.
+ String json2 = object1.toJson();
+ System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
+ + ":" + System.lineSeparator() + json2);
+ assertTrue(json2.replaceAll("\\s+", "").startsWith("{\"SDNCServiceRequest\":{"));
+
+ // Convert generated json string to another object.
+ SDNCServiceRequest object2 = mapper.readValue(json2, SDNCServiceRequest.class);
+
+ // Compare the first object to the second object.
+ assertTrue(serializedEquals(object1, object2));
+ }
+
+ @Test
+ public final void jsonFromSDNCServiceRequestWithoutOptionalFields() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // Convert source json string to object.
+ String json1 = SDNC_SERVICE_REQUEST;
+ json1 = json1.replace("((BP-TIMEOUT))", "");
+ SDNCServiceRequest object1 = mapper.readValue(json1, SDNCServiceRequest.class);
+
+ // Convert resulting object back to json.
+ String json2 = object1.toJson();
+ System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
+ + ":" + System.lineSeparator() + json2);
+ assertTrue(json2.replaceAll("\\s+", "").startsWith("{\"SDNCServiceRequest\":{"));
+
+ // Convert generated json string to another object.
+ SDNCServiceRequest object2 = mapper.readValue(json2, SDNCServiceRequest.class);
+
+ // Compare the first object to the second object.
+ assertTrue(serializedEquals(object1, object2));
+ }
+
+ @Test
+ public final void jsonToSDNCServiceResponse() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ String json = SDNC_SERVICE_RESPONSE;
+ json = json.replace("((RESPONSE-MESSAGE))", " \"responseMessage\": \"" + "OK" + "\"," + EOL);
+ json = json.replace(EOL + "((RESPONSE-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL);
+
+ SDNCServiceResponse object = mapper.readValue(json, SDNCServiceResponse.class);
+ assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
+ assertEquals("200", object.getResponseCode());
+ assertEquals("OK", object.getResponseMessage());
+ assertEquals("Y", object.getAckFinalIndicator());
+ assertEquals("V1", object.getParams().get("P1"));
+ assertEquals("V2", object.getParams().get("P2"));
+ assertEquals("V3", object.getParams().get("P3"));
+ }
+
+ @Test
+ public final void jsonToSDNCServiceResponseWithoutOptionalFields() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // responseMessage is optional.
+ String json = SDNC_SERVICE_RESPONSE;
+ json = json.replace("((RESPONSE-MESSAGE))", "");
+ json = json.replace("((RESPONSE-PARAMS))", "");
+
+ SDNCServiceResponse object = mapper.readValue(json, SDNCServiceResponse.class);
+ assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
+ assertEquals("200", object.getResponseCode());
+ assertNull(object.getResponseMessage());
+ assertEquals("Y", object.getAckFinalIndicator());
+ assertNull(object.getParams());
+ }
+
+ @Test
+ public final void jsonFromSDNCServiceResponse() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // Convert source json string to object.
+ String json1 = SDNC_SERVICE_RESPONSE;
+ json1 = json1.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "OK" + "\"," + EOL);
+ json1 = json1.replace(EOL + "((RESPONSE-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL);
+ SDNCServiceResponse object1 = mapper.readValue(json1, SDNCServiceResponse.class);
+
+ // Convert resulting object back to json.
+ String json2 = object1.toJson();
+ System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
+ + ":" + System.lineSeparator() + json2);
+ assertTrue(json2.replaceAll("\\s+", "").startsWith("{\"SDNCServiceResponse\":{"));
+
+ // Convert generated json string to another object.
+ SDNCServiceResponse object2 = mapper.readValue(json2, SDNCServiceResponse.class);
+
+ // Compare the first object to the second object.
+ assertTrue(serializedEquals(object1, object2));
+ }
+
+ @Test
+ public final void jsonFromSDNCServiceResponseWithoutOptionalFields() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // Convert source json string to object.
+ String json1 = SDNC_SERVICE_RESPONSE;
+ json1 = json1.replace("((RESPONSE-MESSAGE))", "");
+ json1 = json1.replace("((RESPONSE-PARAMS))", "");
+ SDNCServiceResponse object1 = mapper.readValue(json1, SDNCServiceResponse.class);
+
+ // Convert resulting object back to json.
+ String json2 = object1.toJson();
+ System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
+ + ":" + System.lineSeparator() + json2);
+ assertTrue(json2.replaceAll("\\s+", "").startsWith("{\"SDNCServiceResponse\":{"));
+
+ // Convert generated json string to another object.
+ SDNCServiceResponse object2 = mapper.readValue(json2, SDNCServiceResponse.class);
+
+ // Compare the first object to the second object.
+ assertTrue(serializedEquals(object1, object2));
+ }
+
+ @Test
+ public final void jsonToSDNCServiceError() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ String json = SDNC_SERVICE_ERROR;
+ json = json.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "SOMETHING BAD" + "\"," + EOL);
+
+ SDNCServiceError object = mapper.readValue(json, SDNCServiceError.class);
+ assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
+ assertEquals("500", object.getResponseCode());
+ assertEquals("SOMETHING BAD", object.getResponseMessage());
+ assertEquals("Y", object.getAckFinalIndicator());
+ }
+
+ @Test
+ public final void jsonToSDNCServiceErrorWithoutOptionalFields() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // responseMessage is optional.
+ String json = SDNC_SERVICE_ERROR;
+ json = json.replace("((RESPONSE-MESSAGE))", "");
+
+ SDNCServiceError object = mapper.readValue(json, SDNCServiceError.class);
+ assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId());
+ assertEquals("500", object.getResponseCode());
+ assertNull(object.getResponseMessage());
+ assertEquals("Y", object.getAckFinalIndicator());
+ }
+
+ @Test
+ public final void jsonFromSDNCServiceError() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // Convert source json string to object.
+ String json1 = SDNC_SERVICE_ERROR;
+ json1 = json1.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "OK" + "\"," + EOL);
+ SDNCServiceError object1 = mapper.readValue(json1, SDNCServiceError.class);
+
+ // Convert resulting object back to json.
+ String json2 = object1.toJson();
+ System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
+ + ":" + System.lineSeparator() + json2);
+ assertTrue(json2.replaceAll("\\s+", "").startsWith("{\"SDNCServiceError\":{"));
+
+ // Convert generated json string to another object.
+ SDNCServiceError object2 = mapper.readValue(json2, SDNCServiceError.class);
+
+ // Compare the first object to the second object.
+ assertTrue(serializedEquals(object1, object2));
+ }
+
+ @Test
+ public final void jsonFromSDNCServiceErrorWithoutOptionalFields() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // Convert source json string to object.
+ String json1 = SDNC_SERVICE_ERROR;
+ json1 = json1.replace("((RESPONSE-MESSAGE))", "");
+ SDNCServiceError object1 = mapper.readValue(json1, SDNCServiceError.class);
+
+ // Convert resulting object back to json.
+ String json2 = object1.toJson();
+ System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
+ + ":" + System.lineSeparator() + json2);
+ assertTrue(json2.replaceAll("\\s+", "").startsWith("{\"SDNCServiceError\":{"));
+
+ // Convert generated json string to another object.
+ SDNCServiceError object2 = mapper.readValue(json2, SDNCServiceError.class);
+
+ // Compare the first object to the second object.
+ assertTrue(serializedEquals(object1, object2));
+ }
+
+ @Test
+ public final void jsonToSDNCEvent() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ String json = SDNC_EVENT;
+ json = json.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL);
+
+ SDNCEvent object = mapper.readValue(json, SDNCEvent.class);
+ assertEquals("ACTIVATION", object.getEventType());
+ assertEquals("HOST-NAME", object.getEventCorrelatorType());
+ assertEquals("USOSTCDALTX0101UJZZ31", object.getEventCorrelator());
+ assertEquals("V1", object.getParams().get("P1"));
+ assertEquals("V2", object.getParams().get("P2"));
+ assertEquals("V3", object.getParams().get("P3"));
+ }
+
+ @Test
+ public final void jsonToSDNCEventWithoutOptionalFields() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // params are optional.
+ String json = SDNC_EVENT;
+ json = json.replace("((EVENT-PARAMS))", "");
+
+ SDNCEvent object = mapper.readValue(json, SDNCEvent.class);
+ assertEquals("ACTIVATION", object.getEventType());
+ assertEquals("HOST-NAME", object.getEventCorrelatorType());
+ assertEquals("USOSTCDALTX0101UJZZ31", object.getEventCorrelator());
+ assertNull(object.getParams());
+ }
+
+ @Test
+ public final void jsonFromSDNCEvent() throws Exception {
+ logTest();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+
+ // Convert source json string to object.
+ String json1 = SDNC_EVENT;
+ json1 = json1.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL);
+ SDNCEvent object1 = mapper.readValue(json1, SDNCEvent.class);
+
+ // Convert resulting object back to json.
+ String json2 = object1.toJson();
+ System.out.println("Generated JSON for " + object1.getClass().getSimpleName()
+ + ":" + System.lineSeparator() + json2);
+ assertTrue(json2.replaceAll("\\s+", "").startsWith("{\"SDNCEvent\":{"));
+
+ // Convert generated json string to another object.
+ SDNCEvent object2 = mapper.readValue(json2, SDNCEvent.class);
+
+ // Compare the first object to the second object.
+ assertTrue(serializedEquals(object1, object2));
+ }
+
+ /**
+ * Tests equality of two objects by comparing their serialized form.
+ * WARNING: this works pretty well as long as the objects don't contain
+ * collections like maps and sets that are semantically equal, but have
+ * different internal ordering of elements.
+ */
+ private boolean serializedEquals(Serializable object1, Serializable object2) throws IOException {
+ ByteArrayOutputStream byteStream1 = new ByteArrayOutputStream();
+ ObjectOutputStream objectStream1 = new ObjectOutputStream(byteStream1);
+ objectStream1.writeObject(object1);
+ objectStream1.close();
+
+ ByteArrayOutputStream byteStream2 = new ByteArrayOutputStream();
+ ObjectOutputStream objectStream2 = new ObjectOutputStream(byteStream2);
+ objectStream2.writeObject(object2);
+ objectStream2.close();
+
+ return Arrays.equals(byteStream1.toByteArray(), byteStream2.toByteArray());
+ }
+
+ private void logTest() {
+ StackTraceElement[] st = Thread.currentThread().getStackTrace();
+ String method = st[2].getMethodName();
+ System.out.println("RUNNING TEST: " + method);
+ }
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java
index 275c2acd14..a4b4d891d4 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java
@@ -21,6 +21,7 @@
package org.openecomp.mso.adapters.sdnc.util;
import java.util.UUID;
+
import org.junit.Test;
@@ -30,14 +31,14 @@ public class SDNCRequestIdUtilTest {
* Test method for {@link org.openecomp.mso.adapters.sdnc.SDNCRequestIdUtil#getSDNCOriginalRequestId()}.
*/
@Test
- public final void testGetSDNCOriginalRequestId () {
- String originalRequestId = UUID.randomUUID().toString();
- String postfixedRequestId = originalRequestId + "-1466203712068";
- String postfixedRequestId2 = originalRequestId + "-1466203712068-2";
-
- assert(SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId).equals(originalRequestId));
- assert(SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId2).equals(postfixedRequestId2));
-
+ public final void testGetSDNCOriginalRequestId() {
+ String originalRequestId = UUID.randomUUID().toString();
+ String postfixedRequestId = originalRequestId + "-1466203712068";
+ String postfixedRequestId2 = originalRequestId + "-1466203712068-2";
+
+ assert (SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId).equals(originalRequestId));
+ assert (SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId2).equals(postfixedRequestId2));
+
}
}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCConfigurationTest.java
index ff2486276b..abab8dd076 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCConfigurationTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCConfigurationTest.java
@@ -41,316 +41,314 @@ import org.openecomp.mso.properties.MsoPropertiesFactory;
/**
* THis class tests the ASDC Controller by using the ASDC Mock CLient
- *
- *
*/
public class ASDCConfigurationTest {
-
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- public final String ASDC_PROP = ASDCConfigurationTest.class.getClassLoader().getResource("mso.json").toString().substring(5);
- public final String ASDC_PROP2 = ASDCConfigurationTest.class.getClassLoader().getResource("mso2.json").toString().substring(5);
- public final String ASDC_PROP3 = ASDCConfigurationTest.class.getClassLoader().getResource("mso3.json").toString().substring(5);
- public final String ASDC_PROP_BAD = ASDCConfigurationTest.class.getClassLoader().getResource("mso-bad.json").toString().substring(5);
- public final String ASDC_PROP_WITH_NULL = ASDCConfigurationTest.class.getClassLoader().getResource("mso-with-NULL.json").toString().substring(5);
- public final String ASDC_PROP_DOUBLE_CONFIG = ASDCConfigurationTest.class.getClassLoader().getResource("mso-two-configs.json").toString().substring(5);
- public final String ASDC_PROP4_WITH_TLS = ASDCConfigurationTest.class.getClassLoader().getResource("mso4-with-TLS.json").toString().substring(5);
-
- @BeforeClass
- public static final void prepareBeforeAllTests() {
- msoPropertiesFactory.removeAllMsoProperties();
- }
-
- @Before
- public final void prepareBeforeEachTest () throws MsoPropertiesException {
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
-
- @After
- public final void cleanAfterEachTest () {
- msoPropertiesFactory.removeAllMsoProperties();
- }
-
- @Test
- public final void testTheInit() throws ASDCParametersException, IOException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
- assertNotNull(asdcConfig.getUser());
- assertTrue("User".equals(asdcConfig.getUser()));
-
- assertNotNull(asdcConfig.getPassword());
- assertTrue("ThePassword".equals(asdcConfig.getPassword()));
-
- assertNotNull(asdcConfig.getConsumerGroup());
- assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
-
- assertNotNull(asdcConfig.getConsumerID());
- assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
-
- assertNotNull(asdcConfig.getEnvironmentName());
- assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
-
- assertNotNull(asdcConfig.getAsdcAddress());
- assertTrue("hostname".equals(asdcConfig.getAsdcAddress()));
-
- assertNotNull(asdcConfig.getPollingInterval());
- assertTrue(asdcConfig.getPollingInterval() == 10);
-
- assertNotNull(asdcConfig.getPollingTimeout());
- assertTrue(asdcConfig.getPollingTimeout() == 30);
-
- assertNotNull(asdcConfig.getRelevantArtifactTypes());
- assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
-
- assertFalse(asdcConfig.activateServerTLSAuth());
-
- }
-
- @Test
- public final void testAllParametersMethod() throws ASDCParametersException, IOException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
-
- // No exception should be raised
- asdcConfig.testAllParameters();
- }
-
- @Test
- public final void testTheRefreshConfigFalseCase() throws ASDCParametersException, IOException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
-
- // No update should be done as we use the mso.properties located in the resource folder for testing
- assertFalse(asdcConfig.hasASDCConfigChanged());
- assertFalse(asdcConfig.refreshASDCConfig());
-
- assertNotNull(asdcConfig.getUser());
- assertTrue("User".equals(asdcConfig.getUser()));
-
- assertNotNull(asdcConfig.getPassword());
- assertTrue("ThePassword".equals(asdcConfig.getPassword()));
-
- assertNotNull(asdcConfig.getConsumerGroup());
- assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
-
- assertNotNull(asdcConfig.getConsumerID());
- assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
-
- assertNotNull(asdcConfig.getEnvironmentName());
- assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
-
- assertNotNull(asdcConfig.getAsdcAddress());
- assertTrue("hostname".equals(asdcConfig.getAsdcAddress()));
-
- assertNotNull(asdcConfig.getPollingInterval());
- assertTrue(asdcConfig.getPollingInterval() == 10);
-
- assertNotNull(asdcConfig.getPollingTimeout());
- assertTrue(asdcConfig.getPollingTimeout() == 30);
-
- assertNotNull(asdcConfig.getRelevantArtifactTypes());
- assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
-
- msoPropertiesFactory.removeAllMsoProperties();
-
- try {
- asdcConfig.refreshASDCConfig();
- fail("Should have thrown an ASDCParametersException because config does not exist anymore!");
- } catch (ASDCParametersException e) {
- assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be reloaded")));
- }
-
- try {
- asdcConfig.hasASDCConfigChanged();
- fail("Should have thrown an ASDCParametersException because config does not exist anymore!");
- } catch (ASDCParametersException e) {
- assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be read")));
- }
-
- }
-
-
- @Test
- public final void testToChangeTheFileAndRefresh () throws ASDCParametersException, IOException, MsoPropertiesException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP2);
- msoPropertiesFactory.reloadMsoProperties();
-
- // SHould be the same file untouched just a different file name, there should be no difference between them
- // In a normal case a different Filename should force the system to reload the config but not here as we have changed the filename by reflection
- assertFalse(asdcConfig.hasASDCConfigChanged());
- assertFalse(asdcConfig.refreshASDCConfig());
-
- assertNotNull(asdcConfig.getUser());
- assertTrue("User".equals(asdcConfig.getUser()));
-
- assertNotNull(asdcConfig.getPassword());
- assertTrue("ThePassword".equals(asdcConfig.getPassword()));
-
- assertNotNull(asdcConfig.getConsumerGroup());
- assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
-
- assertNotNull(asdcConfig.getConsumerID());
- assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
-
- assertNotNull(asdcConfig.getEnvironmentName());
- assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
-
- assertNotNull(asdcConfig.getAsdcAddress());
- assertTrue("hostname".equals(asdcConfig.getAsdcAddress()));
-
- assertNotNull(asdcConfig.getPollingInterval());
- assertTrue(asdcConfig.getPollingInterval() == 10);
-
- assertNotNull(asdcConfig.getPollingTimeout());
- assertTrue(asdcConfig.getPollingTimeout() == 30);
-
- assertNotNull(asdcConfig.getRelevantArtifactTypes());
- assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
-
- // Set another file that has some attributes changed
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP3);
- msoPropertiesFactory.reloadMsoProperties();
-
- // SHould be the same file untouched just a different file name, so new config
- assertTrue(asdcConfig.hasASDCConfigChanged());
- assertTrue(asdcConfig.refreshASDCConfig());
-
- assertNotNull(asdcConfig.getUser());
- assertTrue("User".equals(asdcConfig.getUser()));
-
- assertNotNull(asdcConfig.getPassword());
- assertTrue("ThePassword".equals(asdcConfig.getPassword()));
-
- assertNotNull(asdcConfig.getConsumerGroup());
- assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
-
- assertNotNull(asdcConfig.getConsumerID());
- assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
-
- assertNotNull(asdcConfig.getEnvironmentName());
- assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
-
- // only this field has been changed
- assertNotNull(asdcConfig.getAsdcAddress());
- assertTrue("hostname1".equals(asdcConfig.getAsdcAddress()));
-
- assertNotNull(asdcConfig.getPollingInterval());
- assertTrue(asdcConfig.getPollingInterval() == 10);
-
- assertNotNull(asdcConfig.getPollingTimeout());
- assertTrue(asdcConfig.getPollingTimeout() == 30);
-
- assertNotNull(asdcConfig.getRelevantArtifactTypes());
- assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
-
-
- // reload the good property file for other test cases
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
-
- }
-
- @Test
- public final void testAllParametersCheck () throws ASDCParametersException, IOException, MsoPropertiesException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_BAD);
- msoPropertiesFactory.reloadMsoProperties();
- // SHould be a bad file, it should raise an exception
- try {
- asdcConfig.refreshASDCConfig();
- fail("Should have thrown an ASDCControllerException because one param is missing!");
- } catch (ASDCParametersException e) {
- assertTrue(e.getMessage().contains(("consumerGroup parameter cannot be found in config mso.properties")));
- }
-
-
- // reload the good property file for other test cases
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
-
- assertTrue(asdcConfig.refreshASDCConfig());
-
- }
-
- @Test
- public final void testConsumerGroupWithNULL () throws MsoPropertiesException, ASDCParametersException, IOException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_WITH_NULL);
- msoPropertiesFactory.reloadMsoProperties();
-
- asdcConfig.refreshASDCConfig();
- assertTrue(asdcConfig.getConsumerGroup()==null);
-
- // reload the good property file for other test cases
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
-
- assertTrue(asdcConfig.refreshASDCConfig());
-
-
- }
-
- @Test
- public final void testGetAllDefinedControllers() throws MsoPropertiesException, ASDCParametersException, IOException {
- List<String> listControllers = ASDCConfiguration.getAllDefinedControllers();
-
- assertTrue(listControllers.size()==1);
- assertTrue("asdc-controller1".equals(listControllers.get(0)));
-
- ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
- assertTrue(asdcConfiguration.getAsdcControllerName().equals("asdc-controller1"));
-
-
- // Try to reload a wrong Json file
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_BAD);
- msoPropertiesFactory.reloadMsoProperties();
-
- listControllers = ASDCConfiguration.getAllDefinedControllers();
- assertTrue(listControllers.size()==0);
-
- }
-
- @Test
- public final void testABadInit() throws MsoPropertiesException {
- msoPropertiesFactory.removeAllMsoProperties();
-
- try {
- ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
- fail("Should have thrown an ASDCParametersException because prop factory is empty!");
- } catch (ASDCParametersException e) {
- assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be reloaded")));
- } catch (IOException e) {
- fail("Should have thrown an ASDCParametersException, not IOException because file is corrupted!");
- }
- }
-
- @Test
- public final void testFileDoesNotExist() throws MsoPropertiesException, ASDCParametersException, IOException {
-
- ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
-
- msoPropertiesFactory.removeAllMsoProperties();
-
- try {
- asdcConfiguration.refreshASDCConfig();
- fail("Should have thrown an ASDCParametersException because factory is empty!");
- } catch (ASDCParametersException e) {
- assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be reloaded")));
- }
- }
-
- @Test
- public final void testWithTLS () throws ASDCParametersException, IOException, MsoPropertiesException {
- ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP4_WITH_TLS);
- msoPropertiesFactory.reloadMsoProperties();
-
- asdcConfiguration.refreshASDCConfig();
-
- assertTrue(asdcConfiguration.activateServerTLSAuth());
- assertTrue("/test".equals(asdcConfiguration.getKeyStorePath()));
- assertTrue("ThePassword".equals(asdcConfiguration.getKeyStorePassword()));
- }
-
+
+ public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ public final String ASDC_PROP = ASDCConfigurationTest.class.getClassLoader().getResource("mso.json").toString().substring(5);
+ public final String ASDC_PROP2 = ASDCConfigurationTest.class.getClassLoader().getResource("mso2.json").toString().substring(5);
+ public final String ASDC_PROP3 = ASDCConfigurationTest.class.getClassLoader().getResource("mso3.json").toString().substring(5);
+ public final String ASDC_PROP_BAD = ASDCConfigurationTest.class.getClassLoader().getResource("mso-bad.json").toString().substring(5);
+ public final String ASDC_PROP_WITH_NULL = ASDCConfigurationTest.class.getClassLoader().getResource("mso-with-NULL.json").toString().substring(5);
+ public final String ASDC_PROP_DOUBLE_CONFIG = ASDCConfigurationTest.class.getClassLoader().getResource("mso-two-configs.json").toString().substring(5);
+ public final String ASDC_PROP4_WITH_TLS = ASDCConfigurationTest.class.getClassLoader().getResource("mso4-with-TLS.json").toString().substring(5);
+
+ @BeforeClass
+ public static final void prepareBeforeAllTests() {
+ msoPropertiesFactory.removeAllMsoProperties();
+ }
+
+ @Before
+ public final void prepareBeforeEachTest() throws MsoPropertiesException {
+ msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ }
+
+ @After
+ public final void cleanAfterEachTest() {
+ msoPropertiesFactory.removeAllMsoProperties();
+ }
+
+ @Test
+ public final void testTheInit() throws ASDCParametersException, IOException {
+ ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
+ assertNotNull(asdcConfig.getUser());
+ assertTrue("User".equals(asdcConfig.getUser()));
+
+ assertNotNull(asdcConfig.getPassword());
+ assertTrue("ThePassword".equals(asdcConfig.getPassword()));
+
+ assertNotNull(asdcConfig.getConsumerGroup());
+ assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
+
+ assertNotNull(asdcConfig.getConsumerID());
+ assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
+
+ assertNotNull(asdcConfig.getEnvironmentName());
+ assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
+
+ assertNotNull(asdcConfig.getAsdcAddress());
+ assertTrue("hostname".equals(asdcConfig.getAsdcAddress()));
+
+ assertNotNull(asdcConfig.getPollingInterval());
+ assertTrue(asdcConfig.getPollingInterval() == 10);
+
+ assertNotNull(asdcConfig.getPollingTimeout());
+ assertTrue(asdcConfig.getPollingTimeout() == 30);
+
+ assertNotNull(asdcConfig.getRelevantArtifactTypes());
+ assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
+
+ assertFalse(asdcConfig.activateServerTLSAuth());
+
+ }
+
+ @Test
+ public final void testAllParametersMethod() throws ASDCParametersException, IOException {
+ ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
+
+ // No exception should be raised
+ asdcConfig.testAllParameters();
+ }
+
+ @Test
+ public final void testTheRefreshConfigFalseCase() throws ASDCParametersException, IOException {
+ ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
+
+ // No update should be done as we use the mso.properties located in the resource folder for testing
+ assertFalse(asdcConfig.hasASDCConfigChanged());
+ assertFalse(asdcConfig.refreshASDCConfig());
+
+ assertNotNull(asdcConfig.getUser());
+ assertTrue("User".equals(asdcConfig.getUser()));
+
+ assertNotNull(asdcConfig.getPassword());
+ assertTrue("ThePassword".equals(asdcConfig.getPassword()));
+
+ assertNotNull(asdcConfig.getConsumerGroup());
+ assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
+
+ assertNotNull(asdcConfig.getConsumerID());
+ assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
+
+ assertNotNull(asdcConfig.getEnvironmentName());
+ assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
+
+ assertNotNull(asdcConfig.getAsdcAddress());
+ assertTrue("hostname".equals(asdcConfig.getAsdcAddress()));
+
+ assertNotNull(asdcConfig.getPollingInterval());
+ assertTrue(asdcConfig.getPollingInterval() == 10);
+
+ assertNotNull(asdcConfig.getPollingTimeout());
+ assertTrue(asdcConfig.getPollingTimeout() == 30);
+
+ assertNotNull(asdcConfig.getRelevantArtifactTypes());
+ assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
+
+ msoPropertiesFactory.removeAllMsoProperties();
+
+ try {
+ asdcConfig.refreshASDCConfig();
+ fail("Should have thrown an ASDCParametersException because config does not exist anymore!");
+ } catch (ASDCParametersException e) {
+ assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be reloaded")));
+ }
+
+ try {
+ asdcConfig.hasASDCConfigChanged();
+ fail("Should have thrown an ASDCParametersException because config does not exist anymore!");
+ } catch (ASDCParametersException e) {
+ assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be read")));
+ }
+
+ }
+
+
+ @Test
+ public final void testToChangeTheFileAndRefresh() throws ASDCParametersException, IOException, MsoPropertiesException {
+ ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
+
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP2);
+ msoPropertiesFactory.reloadMsoProperties();
+
+ // SHould be the same file untouched just a different file name, there should be no difference between them
+ // In a normal case a different Filename should force the system to reload the config but not here as we have changed the filename by reflection
+ assertFalse(asdcConfig.hasASDCConfigChanged());
+ assertFalse(asdcConfig.refreshASDCConfig());
+
+ assertNotNull(asdcConfig.getUser());
+ assertTrue("User".equals(asdcConfig.getUser()));
+
+ assertNotNull(asdcConfig.getPassword());
+ assertTrue("ThePassword".equals(asdcConfig.getPassword()));
+
+ assertNotNull(asdcConfig.getConsumerGroup());
+ assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
+
+ assertNotNull(asdcConfig.getConsumerID());
+ assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
+
+ assertNotNull(asdcConfig.getEnvironmentName());
+ assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
+
+ assertNotNull(asdcConfig.getAsdcAddress());
+ assertTrue("hostname".equals(asdcConfig.getAsdcAddress()));
+
+ assertNotNull(asdcConfig.getPollingInterval());
+ assertTrue(asdcConfig.getPollingInterval() == 10);
+
+ assertNotNull(asdcConfig.getPollingTimeout());
+ assertTrue(asdcConfig.getPollingTimeout() == 30);
+
+ assertNotNull(asdcConfig.getRelevantArtifactTypes());
+ assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
+
+ // Set another file that has some attributes changed
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP3);
+ msoPropertiesFactory.reloadMsoProperties();
+
+ // SHould be the same file untouched just a different file name, so new config
+ assertTrue(asdcConfig.hasASDCConfigChanged());
+ assertTrue(asdcConfig.refreshASDCConfig());
+
+ assertNotNull(asdcConfig.getUser());
+ assertTrue("User".equals(asdcConfig.getUser()));
+
+ assertNotNull(asdcConfig.getPassword());
+ assertTrue("ThePassword".equals(asdcConfig.getPassword()));
+
+ assertNotNull(asdcConfig.getConsumerGroup());
+ assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
+
+ assertNotNull(asdcConfig.getConsumerID());
+ assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
+
+ assertNotNull(asdcConfig.getEnvironmentName());
+ assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
+
+ // only this field has been changed
+ assertNotNull(asdcConfig.getAsdcAddress());
+ assertTrue("hostname1".equals(asdcConfig.getAsdcAddress()));
+
+ assertNotNull(asdcConfig.getPollingInterval());
+ assertTrue(asdcConfig.getPollingInterval() == 10);
+
+ assertNotNull(asdcConfig.getPollingTimeout());
+ assertTrue(asdcConfig.getPollingTimeout() == 30);
+
+ assertNotNull(asdcConfig.getRelevantArtifactTypes());
+ assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
+
+
+ // reload the good property file for other test cases
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ msoPropertiesFactory.reloadMsoProperties();
+
+ }
+
+ @Test
+ public final void testAllParametersCheck() throws ASDCParametersException, IOException, MsoPropertiesException {
+ ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
+
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_BAD);
+ msoPropertiesFactory.reloadMsoProperties();
+ // SHould be a bad file, it should raise an exception
+ try {
+ asdcConfig.refreshASDCConfig();
+ fail("Should have thrown an ASDCControllerException because one param is missing!");
+ } catch (ASDCParametersException e) {
+ assertTrue(e.getMessage().contains(("consumerGroup parameter cannot be found in config mso.properties")));
+ }
+
+
+ // reload the good property file for other test cases
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ msoPropertiesFactory.reloadMsoProperties();
+
+ assertTrue(asdcConfig.refreshASDCConfig());
+
+ }
+
+ @Test
+ public final void testConsumerGroupWithNULL() throws MsoPropertiesException, ASDCParametersException, IOException {
+ ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
+
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_WITH_NULL);
+ msoPropertiesFactory.reloadMsoProperties();
+
+ asdcConfig.refreshASDCConfig();
+ assertTrue(asdcConfig.getConsumerGroup() == null);
+
+ // reload the good property file for other test cases
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ msoPropertiesFactory.reloadMsoProperties();
+
+ assertTrue(asdcConfig.refreshASDCConfig());
+
+
+ }
+
+ @Test
+ public final void testGetAllDefinedControllers() throws MsoPropertiesException, ASDCParametersException, IOException {
+ List<String> listControllers = ASDCConfiguration.getAllDefinedControllers();
+
+ assertTrue(listControllers.size() == 1);
+ assertTrue("asdc-controller1".equals(listControllers.get(0)));
+
+ ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
+ assertTrue(asdcConfiguration.getAsdcControllerName().equals("asdc-controller1"));
+
+
+ // Try to reload a wrong Json file
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_BAD);
+ msoPropertiesFactory.reloadMsoProperties();
+
+ listControllers = ASDCConfiguration.getAllDefinedControllers();
+ assertTrue(listControllers.size() == 0);
+
+ }
+
+ @Test
+ public final void testABadInit() throws MsoPropertiesException {
+ msoPropertiesFactory.removeAllMsoProperties();
+
+ try {
+ ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
+ fail("Should have thrown an ASDCParametersException because prop factory is empty!");
+ } catch (ASDCParametersException e) {
+ assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be reloaded")));
+ } catch (IOException e) {
+ fail("Should have thrown an ASDCParametersException, not IOException because file is corrupted!");
+ }
+ }
+
+ @Test
+ public final void testFileDoesNotExist() throws MsoPropertiesException, ASDCParametersException, IOException {
+
+ ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
+
+ msoPropertiesFactory.removeAllMsoProperties();
+
+ try {
+ asdcConfiguration.refreshASDCConfig();
+ fail("Should have thrown an ASDCParametersException because factory is empty!");
+ } catch (ASDCParametersException e) {
+ assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be reloaded")));
+ }
+ }
+
+ @Test
+ public final void testWithTLS() throws ASDCParametersException, IOException, MsoPropertiesException {
+ ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
+
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP4_WITH_TLS);
+ msoPropertiesFactory.reloadMsoProperties();
+
+ asdcConfiguration.refreshASDCConfig();
+
+ assertTrue(asdcConfiguration.activateServerTLSAuth());
+ assertTrue("/test".equals(asdcConfiguration.getKeyStorePath()));
+ assertTrue("ThePassword".equals(asdcConfiguration.getKeyStorePassword()));
+ }
+
}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCControllerTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCControllerTest.java
index 5026b51bd1..bb869bb324 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCControllerTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCControllerTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
+
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URISyntaxException;
@@ -63,350 +64,347 @@ import org.openecomp.mso.properties.MsoPropertiesException;
import org.openecomp.mso.properties.MsoPropertiesFactory;
-
/**
* THis class tests the ASDC Controller by using the ASDC Mock CLient
- *
- *
*/
public class ASDCControllerTest {
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+
+ private static String heatExample;
+ private static String heatExampleMD5HashBase64;
+
+ private static INotificationData iNotif;
+
+ private static IDistributionClientDownloadResult downloadResult;
+ private static IDistributionClientDownloadResult downloadCorruptedResult;
+
+ private static IDistributionClientResult successfulClientInitResult;
+ private static IDistributionClientResult unsuccessfulClientInitResult;
+
+ private static IArtifactInfo artifactInfo1;
+
+ private static IResourceInstance resource1;
+
+ private static VfResourceInstaller vnfInstaller;
+
+ public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString().substring(5);
+ public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString().substring(5);
+ public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString().substring(5);
+ public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json").toString().substring(5);
+ public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader().getResource("mso-with-NULL.json").toString().substring(5);
+
+ @BeforeClass
+ public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException, NoSuchAlgorithmException, ArtifactInstallerException {
+
+ heatExample = new String(Files.readAllBytes(Paths.get(ASDCControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ byte[] md5Hash = md.digest(heatExample.getBytes());
+ heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
+
+ iNotif = Mockito.mock(INotificationData.class);
+
+ // Create fake ArtifactInfo
+ artifactInfo1 = Mockito.mock(IArtifactInfo.class);
+ Mockito.when(artifactInfo1.getArtifactChecksum()).thenReturn(ASDCControllerTest.heatExampleMD5HashBase64);
+
+ Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
+ Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
+ Mockito.when(artifactInfo1.getArtifactURL()).thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
+ Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
+ Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
+
+ // Now provision the NotificationData mock
+ List<IArtifactInfo> listArtifact = new ArrayList<>();
+ listArtifact.add(artifactInfo1);
+
+ // Create fake resource Instance
+ resource1 = Mockito.mock(IResourceInstance.class);
+ Mockito.when(resource1.getResourceType()).thenReturn("VF");
+ Mockito.when(resource1.getResourceName()).thenReturn("resourceName");
+ Mockito.when(resource1.getArtifacts()).thenReturn(listArtifact);
+
+ List<IResourceInstance> resources = new ArrayList<>();
+ resources.add(resource1);
+
+ Mockito.when(iNotif.getResources()).thenReturn(resources);
+ Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
+ Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
+ Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
+ Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
+
+ downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
+ Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
+ Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
+ Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
+
+ downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
+ Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample + "badone").getBytes());
+ Mockito.when(downloadCorruptedResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
+ Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
+
+ vnfInstaller = Mockito.mock(VfResourceInstaller.class);
+
+ // Mock now the ASDC distribution client behavior
+ successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
+ Mockito.when(successfulClientInitResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
+
+ unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
+ Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
+
+ }
+
+ @Before
+ public final void initBeforeEachTest() throws MsoPropertiesException {
+ // load the config
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ }
+
+ @AfterClass
+ public static final void kill() throws MsoPropertiesException {
+
+ msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
+
+ }
+
+ @Test
+ public final void testTheInitWithASDCStub() throws ASDCControllerException, ASDCParametersException, IOException {
+
+ ASDCController asdcController = new ASDCController("asdc-controller1", new DistributionClientStubImpl());
+ asdcController.initASDC();
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.IDLE);
+ assertTrue(asdcController.getNbOfNotificationsOngoing() == 0);
+ }
+
+ @Test
+ public final void testTheNotificationWithASDCStub() throws ASDCControllerException, ASDCParametersException, IOException {
+
+ ASDCController asdcController = new ASDCController("asdc-controller1", new DistributionClientStubImpl(), vnfInstaller);
+ asdcController.initASDC();
+ // try to send a notif, this should fail internally, we just want to ensure that in case of crash, controller status goes to IDLE
+ asdcController.treatNotification(iNotif);
+
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.IDLE);
+ assertTrue(asdcController.getNbOfNotificationsOngoing() == 0);
+
+ }
+
+ @Test
+ public final void testASecondInit() throws ASDCControllerException, ASDCParametersException, IOException {
+ ASDCController asdcController = new ASDCController("asdc-controller1", new DistributionClientStubImpl(), vnfInstaller);
+ asdcController.initASDC();
+ // try to send a notif, this should fail internally, we just want to ensure that in case of crash, controller status goes to IDLE
+
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.IDLE);
+ assertTrue(asdcController.getNbOfNotificationsOngoing() == 0);
+
+ try {
+ asdcController.initASDC();
+ fail("ASDCControllerException should have been raised for the init");
+ } catch (ASDCControllerException e) {
+ assertTrue("The controller is already initialized, call the closeASDC method first".equals(e.getMessage()));
+ }
+
+ // No changes expected on the controller state
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.IDLE);
+ assertTrue(asdcController.getNbOfNotificationsOngoing() == 0);
+ }
+
+ @Test
+ public final void testInitCrashWithMockitoClient() throws ASDCParametersException, IOException {
+
+ IDistributionClient distributionClient;
+ // First case for init method
+ distributionClient = Mockito.mock(IDistributionClient.class);
+ Mockito.when(distributionClient.download(artifactInfo1)).thenThrow(new RuntimeException("ASDC Client not initialized"));
+ Mockito.when(distributionClient.init(any(ASDCConfiguration.class), any(INotificationCallback.class))).thenReturn(unsuccessfulClientInitResult);
+ Mockito.when(distributionClient.start()).thenReturn(unsuccessfulClientInitResult);
+
+ ASDCController asdcController = new ASDCController("asdc-controller1", distributionClient, vnfInstaller);
+
+ // This should return an exception
+ try {
+ asdcController.initASDC();
+ fail("ASDCControllerException should have been raised for the init");
+ } catch (ASDCControllerException e) {
+ assertTrue("Initialization of the ASDC Controller failed with reason: null".equals(e.getMessage()));
+ }
+
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.STOPPED);
+ assertTrue(asdcController.getNbOfNotificationsOngoing() == 0);
+
+ // Second case for start method
+
+ Mockito.when(distributionClient.init(any(ASDCConfiguration.class), any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
+ Mockito.when(distributionClient.start()).thenReturn(unsuccessfulClientInitResult);
+
+ // This should return an exception
+ try {
+ asdcController.initASDC();
+ fail("ASDCControllerException should have been raised for the init");
+ } catch (ASDCControllerException e) {
+ assertTrue("Startup of the ASDC Controller failed with reason: null".equals(e.getMessage()));
+ }
+
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.STOPPED);
+ assertTrue(asdcController.getNbOfNotificationsOngoing() == 0);
+ }
+
+ @Test
+ public final void testTheStop() throws ASDCControllerException, ASDCParametersException, IOException {
+
+ ASDCController asdcController = new ASDCController("asdc-controller1", new DistributionClientStubImpl(), vnfInstaller);
+
+ asdcController.closeASDC();
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.STOPPED);
+
+
+ asdcController = new ASDCController("asdc-controller1", new DistributionClientStubImpl(), vnfInstaller);
+ asdcController.initASDC();
+ asdcController.closeASDC();
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.STOPPED);
+ }
+
+ @Test
+ public final void testConfigRefresh() throws ASDCParametersException, ASDCControllerException, IOException, MsoPropertiesException {
+ IDistributionClient distributionClient;
+ distributionClient = Mockito.mock(IDistributionClient.class);
+ Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
+ Mockito.when(distributionClient.init(any(ASDCConfiguration.class), any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
+ Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
+
+
+ ASDCController asdcController = new ASDCController("asdc-controller1", distributionClient, vnfInstaller);
+
+ // it should not raise any exception even if controller is not yet initialized
+ asdcController.updateConfigIfNeeded();
+
+ asdcController.initASDC();
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.IDLE);
+ assertFalse(asdcController.updateConfigIfNeeded());
+
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP3);
+ msoPropertiesFactory.reloadMsoProperties();
+ // It should fail if it tries to refresh the config as the init will now fail
+ assertTrue(asdcController.updateConfigIfNeeded());
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.IDLE);
+
+
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ msoPropertiesFactory.reloadMsoProperties();
+ }
+
+ @Test
+ public final void testConfigRefreshWhenBusy() throws IOException, MsoPropertiesException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, ASDCParametersException, ASDCControllerException {
+ IDistributionClient distributionClient;
+ distributionClient = Mockito.mock(IDistributionClient.class);
+ Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
+ Mockito.when(distributionClient.init(any(ASDCConfiguration.class), any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
+ Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
+
+ ASDCController asdcController = new ASDCController("asdc-controller1", distributionClient, vnfInstaller);
+
+ // it should not raise any exception even if controller is not yet initialized
+ asdcController.updateConfigIfNeeded();
- private static String heatExample;
- private static String heatExampleMD5HashBase64;
+ asdcController.initASDC();
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.IDLE);
+ assertFalse(asdcController.updateConfigIfNeeded());
- private static INotificationData iNotif;
+ // Simulate a BUSY case by reflection
+ Field controllerStatus;
+ controllerStatus = ASDCController.class.getDeclaredField("controllerStatus");
+ controllerStatus.setAccessible(true);
+ controllerStatus.set(asdcController, ASDCControllerStatus.BUSY);
- private static IDistributionClientDownloadResult downloadResult;
- private static IDistributionClientDownloadResult downloadCorruptedResult;
- private static IDistributionClientResult successfulClientInitResult;
- private static IDistributionClientResult unsuccessfulClientInitResult;
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP3);
+ msoPropertiesFactory.reloadMsoProperties();
+ // It should fail if it tries to refresh the config as the init will now fail
+ try {
+ asdcController.updateConfigIfNeeded();
+ fail("ASDCControllerException should have been raised");
+ } catch (ASDCControllerException e) {
+ assertTrue("Cannot close the ASDC controller as it's currently in BUSY state".equals(e.getMessage()));
+ }
- private static IArtifactInfo artifactInfo1;
+ // Try it a second time to see if we still see the changes
+ try {
+ asdcController.updateConfigIfNeeded();
+ fail("ASDCControllerException should have been raised");
+ } catch (ASDCControllerException e) {
+ assertTrue("Cannot close the ASDC controller as it's currently in BUSY state".equals(e.getMessage()));
+ }
- private static IResourceInstance resource1;
+ // Revert to Idle by reflection
+ controllerStatus.set(asdcController, ASDCControllerStatus.IDLE);
+ controllerStatus.setAccessible(false);
- private static VfResourceInstaller vnfInstaller;
-
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString().substring(5);
- public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString().substring(5);
- public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString().substring(5);
- public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json").toString().substring(5);
- public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader().getResource("mso-with-NULL.json").toString().substring(5);
+ // This should work now, controller should be restarted
+ assertTrue(asdcController.updateConfigIfNeeded());
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.IDLE);
- @BeforeClass
- public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException, NoSuchAlgorithmException, ArtifactInstallerException {
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ msoPropertiesFactory.reloadMsoProperties();
+ }
- heatExample = new String(Files.readAllBytes(Paths.get(ASDCControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5Hash = md.digest(heatExample.getBytes());
- heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
- iNotif= Mockito.mock(INotificationData.class);
+ @Test
+ public final void testBadConfigRefresh() throws ASDCParametersException, ASDCControllerException, IOException, MsoPropertiesException {
+ IDistributionClient distributionClient;
+ distributionClient = Mockito.mock(IDistributionClient.class);
+ Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
+ Mockito.when(distributionClient.init(any(ASDCConfiguration.class), any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
+ Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
- // Create fake ArtifactInfo
- artifactInfo1 = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo1.getArtifactChecksum()).thenReturn(ASDCControllerTest.heatExampleMD5HashBase64);
- Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
- Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
- Mockito.when(artifactInfo1.getArtifactURL()).thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
- Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
- Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
+ ASDCController asdcController = new ASDCController("asdc-controller1", distributionClient, vnfInstaller);
- // Now provision the NotificationData mock
- List<IArtifactInfo> listArtifact = new ArrayList<>();
- listArtifact.add(artifactInfo1);
+ // it should not raise any exception even if controller is not yet initialized
+ asdcController.updateConfigIfNeeded();
- // Create fake resource Instance
- resource1 = Mockito.mock (IResourceInstance.class);
- Mockito.when (resource1.getResourceType ()).thenReturn ("VF");
- Mockito.when (resource1.getResourceName ()).thenReturn ("resourceName");
- Mockito.when (resource1.getArtifacts ()).thenReturn (listArtifact);
+ asdcController.initASDC();
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.IDLE);
+ assertFalse(asdcController.updateConfigIfNeeded());
- List<IResourceInstance> resources = new ArrayList<> ();
- resources.add (resource1);
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_BAD);
+ msoPropertiesFactory.reloadMsoProperties();
+ // It should fail if it tries to refresh the config as the init will now fail
+ try {
+ asdcController.updateConfigIfNeeded();
+ fail("ASDCParametersException should have been raised");
+ } catch (ASDCParametersException ep) {
+ assertTrue("consumerGroup parameter cannot be found in config mso.properties".equals(ep.getMessage()));
+ }
- Mockito.when(iNotif.getResources()).thenReturn(resources);
- Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
- Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
- Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
- Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
-
- downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
- Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
+ // This should stop the controller, as it can't work with a bad config file
+ assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.STOPPED);
- downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample+"badone").getBytes());
- Mockito.when(downloadCorruptedResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
- vnfInstaller = Mockito.mock(VfResourceInstaller.class);
-
- // Mock now the ASDC distribution client behavior
- successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(successfulClientInitResult.getDistributionActionResult ()).thenReturn(DistributionActionResultEnum.SUCCESS);
-
- unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult ()).thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
-
- }
-
- @Before
- public final void initBeforeEachTest() throws MsoPropertiesException {
- // load the config
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
+ msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ msoPropertiesFactory.reloadMsoProperties();
+ }
- @AfterClass
- public static final void kill () throws MsoPropertiesException {
+ @Test
+ public final void testConfigAccess() throws ASDCControllerException, ASDCParametersException, IOException {
+ IDistributionClient distributionClient;
+ distributionClient = Mockito.mock(IDistributionClient.class);
+ Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
+ Mockito.when(distributionClient.init(any(ASDCConfiguration.class), any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
+ Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
- msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
- }
+ ASDCController asdcController = new ASDCController("asdc-controller1", distributionClient, vnfInstaller);
- @Test
- public final void testTheInitWithASDCStub() throws ASDCControllerException, ASDCParametersException, IOException {
-
- ASDCController asdcController = new ASDCController("asdc-controller1",new DistributionClientStubImpl());
- asdcController.initASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
- }
-
- @Test
- public final void testTheNotificationWithASDCStub() throws ASDCControllerException, ASDCParametersException, IOException {
-
- ASDCController asdcController = new ASDCController("asdc-controller1",new DistributionClientStubImpl(),vnfInstaller);
- asdcController.initASDC();
- // try to send a notif, this should fail internally, we just want to ensure that in case of crash, controller status goes to IDLE
- asdcController.treatNotification(iNotif);
-
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
-
- }
-
- @Test
- public final void testASecondInit() throws ASDCControllerException, ASDCParametersException, IOException {
- ASDCController asdcController = new ASDCController("asdc-controller1",new DistributionClientStubImpl(),vnfInstaller);
- asdcController.initASDC();
- // try to send a notif, this should fail internally, we just want to ensure that in case of crash, controller status goes to IDLE
-
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
-
- try {
- asdcController.initASDC();
- fail("ASDCControllerException should have been raised for the init");
- } catch (ASDCControllerException e) {
- assertTrue("The controller is already initialized, call the closeASDC method first".equals(e.getMessage()));
- }
-
- // No changes expected on the controller state
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
- }
-
- @Test
- public final void testInitCrashWithMockitoClient() throws ASDCParametersException, IOException {
-
- IDistributionClient distributionClient;
- // First case for init method
- distributionClient = Mockito.mock(IDistributionClient.class);
- Mockito.when(distributionClient.download(artifactInfo1)).thenThrow(new RuntimeException("ASDC Client not initialized"));
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(unsuccessfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(unsuccessfulClientInitResult);
-
- ASDCController asdcController = new ASDCController("asdc-controller1",distributionClient,vnfInstaller);
-
- // This should return an exception
- try {
- asdcController.initASDC();
- fail("ASDCControllerException should have been raised for the init");
- } catch (ASDCControllerException e) {
- assertTrue("Initialization of the ASDC Controller failed with reason: null".equals(e.getMessage()));
- }
-
- assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.STOPPED);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
-
- // Second case for start method
-
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(unsuccessfulClientInitResult);
-
- // This should return an exception
- try {
- asdcController.initASDC();
- fail("ASDCControllerException should have been raised for the init");
- } catch (ASDCControllerException e) {
- assertTrue("Startup of the ASDC Controller failed with reason: null".equals(e.getMessage()));
- }
-
- assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.STOPPED);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
- }
-
- @Test
- public final void testTheStop() throws ASDCControllerException, ASDCParametersException, IOException {
-
- ASDCController asdcController = new ASDCController("asdc-controller1",new DistributionClientStubImpl(),vnfInstaller);
-
- asdcController.closeASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.STOPPED);
+ assertTrue("Unknown".equals(asdcController.getAddress()));
+ assertTrue("Unknown".equals(asdcController.getEnvironment()));
+ asdcController.initASDC();
- asdcController = new ASDCController("asdc-controller1",new DistributionClientStubImpl(),vnfInstaller);
- asdcController.initASDC();
- asdcController.closeASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.STOPPED);
- }
+ assertTrue("hostname".equals(asdcController.getAddress()));
+ assertTrue("environmentName".equals(asdcController.getEnvironment()));
- @Test
- public final void testConfigRefresh () throws ASDCParametersException, ASDCControllerException, IOException, MsoPropertiesException {
- IDistributionClient distributionClient;
- distributionClient = Mockito.mock(IDistributionClient.class);
- Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
-
-
- ASDCController asdcController = new ASDCController("asdc-controller1",distributionClient,vnfInstaller);
-
- // it should not raise any exception even if controller is not yet initialized
- asdcController.updateConfigIfNeeded();
-
- asdcController.initASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertFalse(asdcController.updateConfigIfNeeded());
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP3);
- msoPropertiesFactory.reloadMsoProperties();
- // It should fail if it tries to refresh the config as the init will now fail
- assertTrue(asdcController.updateConfigIfNeeded());
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
-
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
- }
-
- @Test
- public final void testConfigRefreshWhenBusy () throws IOException, MsoPropertiesException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, ASDCParametersException, ASDCControllerException {
- IDistributionClient distributionClient;
- distributionClient = Mockito.mock(IDistributionClient.class);
- Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
-
- ASDCController asdcController = new ASDCController("asdc-controller1",distributionClient,vnfInstaller);
-
- // it should not raise any exception even if controller is not yet initialized
- asdcController.updateConfigIfNeeded();
-
- asdcController.initASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertFalse(asdcController.updateConfigIfNeeded());
-
- // Simulate a BUSY case by reflection
- Field controllerStatus;
- controllerStatus = ASDCController.class.getDeclaredField("controllerStatus");
- controllerStatus.setAccessible(true);
- controllerStatus.set(asdcController,ASDCControllerStatus.BUSY);
-
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP3);
- msoPropertiesFactory.reloadMsoProperties();
- // It should fail if it tries to refresh the config as the init will now fail
- try {
- asdcController.updateConfigIfNeeded();
- fail ("ASDCControllerException should have been raised");
- } catch (ASDCControllerException e) {
- assertTrue("Cannot close the ASDC controller as it's currently in BUSY state".equals(e.getMessage()));
- }
-
- // Try it a second time to see if we still see the changes
- try {
- asdcController.updateConfigIfNeeded();
- fail ("ASDCControllerException should have been raised");
- } catch (ASDCControllerException e) {
- assertTrue("Cannot close the ASDC controller as it's currently in BUSY state".equals(e.getMessage()));
- }
-
- // Revert to Idle by reflection
- controllerStatus.set(asdcController,ASDCControllerStatus.IDLE);
- controllerStatus.setAccessible(false);
-
- // This should work now, controller should be restarted
- assertTrue(asdcController.updateConfigIfNeeded());
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
- }
-
-
- @Test
- public final void testBadConfigRefresh () throws ASDCParametersException, ASDCControllerException, IOException, MsoPropertiesException {
- IDistributionClient distributionClient;
- distributionClient = Mockito.mock(IDistributionClient.class);
- Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
-
-
- ASDCController asdcController = new ASDCController("asdc-controller1",distributionClient,vnfInstaller);
-
- // it should not raise any exception even if controller is not yet initialized
- asdcController.updateConfigIfNeeded();
-
- asdcController.initASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertFalse(asdcController.updateConfigIfNeeded());
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_BAD);
- msoPropertiesFactory.reloadMsoProperties();
- // It should fail if it tries to refresh the config as the init will now fail
- try {
- asdcController.updateConfigIfNeeded();
- fail ("ASDCParametersException should have been raised");
- } catch (ASDCParametersException ep) {
- assertTrue("consumerGroup parameter cannot be found in config mso.properties".equals(ep.getMessage()));
- }
-
- // This should stop the controller, as it can't work with a bad config file
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.STOPPED);
-
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
- }
-
- @Test
- public final void testConfigAccess () throws ASDCControllerException, ASDCParametersException, IOException {
- IDistributionClient distributionClient;
- distributionClient = Mockito.mock(IDistributionClient.class);
- Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
-
-
- ASDCController asdcController = new ASDCController("asdc-controller1",distributionClient,vnfInstaller);
-
- assertTrue("Unknown".equals(asdcController.getAddress()));
- assertTrue("Unknown".equals(asdcController.getEnvironment()));
-
- asdcController.initASDC();
-
- assertTrue("hostname".equals(asdcController.getAddress()));
- assertTrue("environmentName".equals(asdcController.getEnvironment()));
-
- }
+ }
}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java
index 6de04e2862..d322e7e0a8 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java
@@ -22,7 +22,6 @@
package org.openecomp.mso.asdc.client.tests;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -46,129 +45,129 @@ import org.openecomp.mso.asdc.installer.IVfModuleData;
public class ASDCElementInfoTest {
- @Test
- public void createASDCElementInfoWithNullParameterTest() {
- ASDCElementInfo elementInfoFromNullVfArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(null);
- ASDCElementInfo elementInfoFromNullVfModuleStructure = ASDCElementInfo.createElementFromVfModuleStructure(null);
- ASDCElementInfo elementInfoFromNullVfResourceStructure = ASDCElementInfo.createElementFromVfResourceStructure(null);
+ @Test
+ public void createASDCElementInfoWithNullParameterTest() {
+ ASDCElementInfo elementInfoFromNullVfArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(null);
+ ASDCElementInfo elementInfoFromNullVfModuleStructure = ASDCElementInfo.createElementFromVfModuleStructure(null);
+ ASDCElementInfo elementInfoFromNullVfResourceStructure = ASDCElementInfo.createElementFromVfResourceStructure(null);
- elementInfoFromNullVfArtifact.addElementInfo(null, null);
- elementInfoFromNullVfModuleStructure.addElementInfo(null, "someValue");
- elementInfoFromNullVfResourceStructure.addElementInfo("someKey", null);
+ elementInfoFromNullVfArtifact.addElementInfo(null, null);
+ elementInfoFromNullVfModuleStructure.addElementInfo(null, "someValue");
+ elementInfoFromNullVfResourceStructure.addElementInfo("someKey", null);
- assertEquals(elementInfoFromNullVfArtifact.toString(), "");
- assertEquals(elementInfoFromNullVfModuleStructure.toString(), "");
- assertEquals(elementInfoFromNullVfResourceStructure.toString(), "");
+ assertEquals(elementInfoFromNullVfArtifact.toString(), "");
+ assertEquals(elementInfoFromNullVfModuleStructure.toString(), "");
+ assertEquals(elementInfoFromNullVfResourceStructure.toString(), "");
- assertNotNull(elementInfoFromNullVfArtifact);
- assertNotNull(elementInfoFromNullVfModuleStructure);
- assertNotNull(elementInfoFromNullVfResourceStructure);
+ assertNotNull(elementInfoFromNullVfArtifact);
+ assertNotNull(elementInfoFromNullVfModuleStructure);
+ assertNotNull(elementInfoFromNullVfResourceStructure);
- assertNotNull(ASDCElementInfo.EMPTY_INSTANCE);
+ assertNotNull(ASDCElementInfo.EMPTY_INSTANCE);
- assertEquals(elementInfoFromNullVfArtifact, ASDCElementInfo.EMPTY_INSTANCE);
- assertEquals(elementInfoFromNullVfModuleStructure, ASDCElementInfo.EMPTY_INSTANCE);
- assertEquals(elementInfoFromNullVfResourceStructure, ASDCElementInfo.EMPTY_INSTANCE);
+ assertEquals(elementInfoFromNullVfArtifact, ASDCElementInfo.EMPTY_INSTANCE);
+ assertEquals(elementInfoFromNullVfModuleStructure, ASDCElementInfo.EMPTY_INSTANCE);
+ assertEquals(elementInfoFromNullVfResourceStructure, ASDCElementInfo.EMPTY_INSTANCE);
- assertEquals(ASDCElementInfo.EMPTY_INSTANCE.getType(), "");
- assertEquals(ASDCElementInfo.EMPTY_INSTANCE.toString(), "");
+ assertEquals(ASDCElementInfo.EMPTY_INSTANCE.getType(), "");
+ assertEquals(ASDCElementInfo.EMPTY_INSTANCE.toString(), "");
- assertEquals(elementInfoFromNullVfArtifact.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
- assertEquals(elementInfoFromNullVfModuleStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
- assertEquals(elementInfoFromNullVfResourceStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
- }
+ assertEquals(elementInfoFromNullVfArtifact.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
+ assertEquals(elementInfoFromNullVfModuleStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
+ assertEquals(elementInfoFromNullVfResourceStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
+ }
- @Test
- public void createASDCElementInfoFromVfResourceTest() {
+ @Test
+ public void createASDCElementInfoFromVfResourceTest() {
- String resourceInstanceName = "Resource 1";
+ String resourceInstanceName = "Resource 1";
- UUID generatedUUID = UUID.randomUUID();
+ UUID generatedUUID = UUID.randomUUID();
- INotificationData notificationData = Mockito.mock(INotificationData.class);
- IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
+ INotificationData notificationData = Mockito.mock(INotificationData.class);
+ IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
- Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
- Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
+ Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
+ Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
- VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
+ VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
- ASDCElementInfo elementInfoFromVfResource = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure);
+ ASDCElementInfo elementInfoFromVfResource = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure);
- assertTrue(elementInfoFromVfResource.toString().contains(resourceInstanceName));
- assertTrue(elementInfoFromVfResource.toString().contains(generatedUUID.toString()));
+ assertTrue(elementInfoFromVfResource.toString().contains(resourceInstanceName));
+ assertTrue(elementInfoFromVfResource.toString().contains(generatedUUID.toString()));
- assertFalse(ASDCConfiguration.VF_MODULES_METADATA.equals(elementInfoFromVfResource.getType()));
- assertEquals(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name(), elementInfoFromVfResource.getType());
+ assertFalse(ASDCConfiguration.VF_MODULES_METADATA.equals(elementInfoFromVfResource.getType()));
+ assertEquals(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name(), elementInfoFromVfResource.getType());
- assertFalse(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
- elementInfoFromVfResource.addElementInfo("MyInfo1", "someValue");
- assertTrue(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
- }
+ assertFalse(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
+ elementInfoFromVfResource.addElementInfo("MyInfo1", "someValue");
+ assertTrue(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
+ }
- @Test
- public void createASDCElementInfoFromVfModuleTest() throws ArtifactInstallerException {
+ @Test
+ public void createASDCElementInfoFromVfModuleTest() throws ArtifactInstallerException {
- String resourceInstanceName = "Resource 1";
+ String resourceInstanceName = "Resource 1";
- UUID generatedUUID = UUID.randomUUID();
+ UUID generatedUUID = UUID.randomUUID();
- INotificationData notificationData = Mockito.mock(INotificationData.class);
- IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
+ INotificationData notificationData = Mockito.mock(INotificationData.class);
+ IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
- Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
- Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
+ Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
+ Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
- VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
+ VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
- // Create module structure now
+ // Create module structure now
- String vfModuleModelName = "Module Model XYZ";
+ String vfModuleModelName = "Module Model XYZ";
- UUID generatedUUIDForModule = UUID.randomUUID();
+ UUID generatedUUIDForModule = UUID.randomUUID();
- IVfModuleData moduleMetadata = Mockito.mock(IVfModuleData.class);
- Mockito.when(moduleMetadata.getVfModuleModelName()).thenReturn(vfModuleModelName);
- Mockito.when(moduleMetadata.getVfModuleModelInvariantUUID()).thenReturn(generatedUUIDForModule.toString());
- Mockito.when(moduleMetadata.getArtifacts()).thenReturn(Collections.<String> emptyList());
+ IVfModuleData moduleMetadata = Mockito.mock(IVfModuleData.class);
+ Mockito.when(moduleMetadata.getVfModuleModelName()).thenReturn(vfModuleModelName);
+ Mockito.when(moduleMetadata.getVfModuleModelInvariantUUID()).thenReturn(generatedUUIDForModule.toString());
+ Mockito.when(moduleMetadata.getArtifacts()).thenReturn(Collections.<String>emptyList());
- VfModuleStructure vfModuleStructure = new VfModuleStructure(vfResourceStructure, moduleMetadata);
+ VfModuleStructure vfModuleStructure = new VfModuleStructure(vfResourceStructure, moduleMetadata);
- ASDCElementInfo elementInfoFromVfModule = ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure);
+ ASDCElementInfo elementInfoFromVfModule = ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure);
- assertTrue(elementInfoFromVfModule.toString().contains(vfModuleModelName));
- assertTrue(elementInfoFromVfModule.toString().contains(generatedUUIDForModule.toString()));
+ assertTrue(elementInfoFromVfModule.toString().contains(vfModuleModelName));
+ assertTrue(elementInfoFromVfModule.toString().contains(generatedUUIDForModule.toString()));
- assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromVfModule.getType()));
- assertEquals(ASDCConfiguration.VF_MODULES_METADATA, elementInfoFromVfModule.getType());
+ assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromVfModule.getType()));
+ assertEquals(ASDCConfiguration.VF_MODULES_METADATA, elementInfoFromVfModule.getType());
- assertFalse(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
- elementInfoFromVfModule.addElementInfo("MyInfo2", "someValue");
- assertTrue(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
- }
+ assertFalse(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
+ elementInfoFromVfModule.addElementInfo("MyInfo2", "someValue");
+ assertTrue(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
+ }
- @Test
- public void createASDCElementInfoFromArtifact() {
- for (String eVal : ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) {
- String generatedArtifactName = eVal + " 1";
- UUID generatedUUIDForArtifact = UUID.randomUUID();
+ @Test
+ public void createASDCElementInfoFromArtifact() {
+ for (String eVal : ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) {
+ String generatedArtifactName = eVal + " 1";
+ UUID generatedUUIDForArtifact = UUID.randomUUID();
- IArtifactInfo artifactInfo = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo.getArtifactType()).thenReturn(eVal);
- Mockito.when(artifactInfo.getArtifactName()).thenReturn(generatedArtifactName);
- Mockito.when(artifactInfo.getArtifactUUID()).thenReturn(generatedUUIDForArtifact.toString());
+ IArtifactInfo artifactInfo = Mockito.mock(IArtifactInfo.class);
+ Mockito.when(artifactInfo.getArtifactType()).thenReturn(eVal);
+ Mockito.when(artifactInfo.getArtifactName()).thenReturn(generatedArtifactName);
+ Mockito.when(artifactInfo.getArtifactUUID()).thenReturn(generatedUUIDForArtifact.toString());
- ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo);
+ ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo);
- assertTrue(elementInfoFromArtifact.toString().contains(generatedArtifactName));
- assertTrue(elementInfoFromArtifact.toString().contains(generatedUUIDForArtifact.toString()));
+ assertTrue(elementInfoFromArtifact.toString().contains(generatedArtifactName));
+ assertTrue(elementInfoFromArtifact.toString().contains(generatedUUIDForArtifact.toString()));
- assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromArtifact.getType()));
- assertEquals(eVal, elementInfoFromArtifact.getType());
+ assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromArtifact.getType()));
+ assertEquals(eVal, elementInfoFromArtifact.getType());
- assertFalse(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
- elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue");
- assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
- }
- }
+ assertFalse(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
+ elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue");
+ assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
+ }
+ }
}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCGlobalControllerTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCGlobalControllerTest.java
index 73c5456d29..93a23f8663 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCGlobalControllerTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCGlobalControllerTest.java
@@ -23,6 +23,7 @@ package org.openecomp.mso.asdc.client.tests;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
@@ -55,159 +56,156 @@ import org.openecomp.mso.properties.MsoPropertiesException;
import org.openecomp.mso.properties.MsoPropertiesFactory;
-
/**
* THis class tests the ASDC Controller by using the ASDC Mock CLient
- *
- *
*/
public class ASDCGlobalControllerTest {
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+
+ private static String heatExample;
+ private static String heatExampleMD5HashBase64;
+
+ private static INotificationData iNotif;
+
+ private static IDistributionClientDownloadResult downloadResult;
+ private static IDistributionClientDownloadResult downloadCorruptedResult;
+
+ private static IDistributionClientResult successfulClientInitResult;
+ private static IDistributionClientResult unsuccessfulClientInitResult;
+
+ private static IArtifactInfo artifactInfo1;
+
+ private static IResourceInstance resource1;
+
+ public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString().substring(5);
+ public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString().substring(5);
+ public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString().substring(5);
+ public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json").toString().substring(5);
+ public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader().getResource("mso-with-NULL.json").toString().substring(5);
+ public static final String ASDC_PROP_WITH_DOUBLE = MsoJavaProperties.class.getClassLoader().getResource("mso-two-configs.json").toString().substring(5);
+ public static final String ASDC_PROP_WITH_DOUBLE2 = MsoJavaProperties.class.getClassLoader().getResource("mso-two-configs2.json").toString().substring(5);
+
+ @BeforeClass
+ public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException, NoSuchAlgorithmException, ArtifactInstallerException {
+
+ heatExample = new String(Files.readAllBytes(Paths.get(ASDCGlobalControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ byte[] md5Hash = md.digest(heatExample.getBytes());
+ heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
+
+ iNotif = Mockito.mock(INotificationData.class);
+
+ // Create fake ArtifactInfo
+ artifactInfo1 = Mockito.mock(IArtifactInfo.class);
+ Mockito.when(artifactInfo1.getArtifactChecksum()).thenReturn(ASDCGlobalControllerTest.heatExampleMD5HashBase64);
+
+ Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
+ Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
+ Mockito.when(artifactInfo1.getArtifactURL()).thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
+ Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
+ Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
+
+ // Now provision the NotificationData mock
+ List<IArtifactInfo> listArtifact = new ArrayList<>();
+ listArtifact.add(artifactInfo1);
+
+ // Create fake resource Instance
+ resource1 = Mockito.mock(IResourceInstance.class);
+ Mockito.when(resource1.getResourceType()).thenReturn("VF");
+ Mockito.when(resource1.getResourceName()).thenReturn("resourceName");
+ Mockito.when(resource1.getArtifacts()).thenReturn(listArtifact);
+
+ List<IResourceInstance> resources = new ArrayList<>();
+ resources.add(resource1);
+
+ Mockito.when(iNotif.getResources()).thenReturn(resources);
+ Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
+ Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
+ Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
+ Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
+
+ downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
+ Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
+ Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
+ Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
+
+ downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
+ Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample + "badone").getBytes());
+ Mockito.when(downloadCorruptedResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
+ Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
+
+
+ // Mock now the ASDC distribution client behavior
+ successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
+ Mockito.when(successfulClientInitResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
+
+ unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
+ Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
+
+ }
+
+ @Before
+ public final void initBeforeEachTest() throws MsoPropertiesException {
+ // load the config
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ }
+
+ @AfterClass
+ public static final void kill() throws MsoPropertiesException {
+
+ msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
+ }
+
+ @Test
+ public final void testUpdateControllersConfigIfNeeded() throws ASDCControllerException, ASDCParametersException, IOException, MsoPropertiesException {
+
+ ASDCGlobalController asdcGlobalController = new ASDCGlobalController();
+ assertTrue(asdcGlobalController.getControllers().size() == 0);
+
+ // first init
+ assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
+ assertTrue(asdcGlobalController.getControllers().size() == 1);
+ assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
+
+ // Add a second one
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_WITH_DOUBLE);
+ assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
+ assertTrue(asdcGlobalController.getControllers().size() == 2);
+ assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
+ assertTrue(asdcGlobalController.getControllers().get("asdc-controller2") != null);
+ // Check that update does nothing
+ assertFalse(asdcGlobalController.updateControllersConfigIfNeeded());
+ assertTrue(asdcGlobalController.getControllers().size() == 2);
+
+ // Change the second one name
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_WITH_DOUBLE2);
+ assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
+ assertTrue(asdcGlobalController.getControllers().size() == 2);
+ assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
+ assertTrue(asdcGlobalController.getControllers().get("asdc-controller2B") != null);
+
+
+ }
+
+ @Test
+ public final void testCloseASDC() {
+
+ ASDCGlobalController asdcGlobalController = new ASDCGlobalController();
+ assertTrue(asdcGlobalController.getControllers().size() == 0);
- private static String heatExample;
- private static String heatExampleMD5HashBase64;
+ // first init
+ assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
+ assertTrue(asdcGlobalController.getControllers().size() == 1);
+ assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
- private static INotificationData iNotif;
+ asdcGlobalController.closeASDC();
+ assertTrue(asdcGlobalController.getControllers().size() == 0);
- private static IDistributionClientDownloadResult downloadResult;
- private static IDistributionClientDownloadResult downloadCorruptedResult;
- private static IDistributionClientResult successfulClientInitResult;
- private static IDistributionClientResult unsuccessfulClientInitResult;
-
- private static IArtifactInfo artifactInfo1;
-
- private static IResourceInstance resource1;
-
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString().substring(5);
- public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString().substring(5);
- public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString().substring(5);
- public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json").toString().substring(5);
- public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader().getResource("mso-with-NULL.json").toString().substring(5);
- public static final String ASDC_PROP_WITH_DOUBLE = MsoJavaProperties.class.getClassLoader().getResource("mso-two-configs.json").toString().substring(5);
- public static final String ASDC_PROP_WITH_DOUBLE2 = MsoJavaProperties.class.getClassLoader().getResource("mso-two-configs2.json").toString().substring(5);
-
- @BeforeClass
- public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException, NoSuchAlgorithmException, ArtifactInstallerException {
-
- heatExample = new String(Files.readAllBytes(Paths.get(ASDCGlobalControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5Hash = md.digest(heatExample.getBytes());
- heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
-
- iNotif= Mockito.mock(INotificationData.class);
-
- // Create fake ArtifactInfo
- artifactInfo1 = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo1.getArtifactChecksum()).thenReturn(ASDCGlobalControllerTest.heatExampleMD5HashBase64);
-
- Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
- Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
- Mockito.when(artifactInfo1.getArtifactURL()).thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
- Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
- Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
-
- // Now provision the NotificationData mock
- List<IArtifactInfo> listArtifact = new ArrayList<>();
- listArtifact.add(artifactInfo1);
-
- // Create fake resource Instance
- resource1 = Mockito.mock (IResourceInstance.class);
- Mockito.when (resource1.getResourceType ()).thenReturn ("VF");
- Mockito.when (resource1.getResourceName ()).thenReturn ("resourceName");
- Mockito.when (resource1.getArtifacts ()).thenReturn (listArtifact);
-
- List<IResourceInstance> resources = new ArrayList<> ();
- resources.add (resource1);
-
- Mockito.when(iNotif.getResources()).thenReturn(resources);
- Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
- Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
- Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
- Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
-
- downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
- Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
-
- downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample+"badone").getBytes());
- Mockito.when(downloadCorruptedResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
-
-
- // Mock now the ASDC distribution client behavior
- successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(successfulClientInitResult.getDistributionActionResult ()).thenReturn(DistributionActionResultEnum.SUCCESS);
-
- unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult ()).thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
-
- }
-
- @Before
- public final void initBeforeEachTest() throws MsoPropertiesException {
- // load the config
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
-
- @AfterClass
- public static final void kill () throws MsoPropertiesException {
-
- msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
- }
-
- @Test
- public final void testUpdateControllersConfigIfNeeded() throws ASDCControllerException, ASDCParametersException, IOException, MsoPropertiesException {
-
- ASDCGlobalController asdcGlobalController = new ASDCGlobalController();
- assertTrue(asdcGlobalController.getControllers().size()==0);
-
- // first init
- assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
- assertTrue(asdcGlobalController.getControllers().size()==1);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
-
- // Add a second one
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_WITH_DOUBLE);
- assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
- assertTrue(asdcGlobalController.getControllers().size()==2);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller2") != null);
- // Check that update does nothing
- assertFalse(asdcGlobalController.updateControllersConfigIfNeeded());
- assertTrue(asdcGlobalController.getControllers().size()==2);
-
- // Change the second one name
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_WITH_DOUBLE2);
- assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
- assertTrue(asdcGlobalController.getControllers().size()==2);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller2B") != null);
-
-
- }
-
- @Test
- public final void testCloseASDC() {
-
- ASDCGlobalController asdcGlobalController = new ASDCGlobalController();
- assertTrue(asdcGlobalController.getControllers().size()==0);
-
- // first init
- assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
- assertTrue(asdcGlobalController.getControllers().size()==1);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
-
- asdcGlobalController.closeASDC();
- assertTrue(asdcGlobalController.getControllers().size()==0);
-
-
- }
+ }
}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/BigDecimalVersionTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/BigDecimalVersionTest.java
index 3ecfdbbe40..0371b0cfcf 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/BigDecimalVersionTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/BigDecimalVersionTest.java
@@ -22,7 +22,9 @@ package org.openecomp.mso.asdc.client.tests;
import static org.junit.Assert.assertTrue;
+
import java.math.BigDecimal;
+
import org.junit.Test;
import org.openecomp.mso.asdc.installer.BigDecimalVersion;
@@ -31,23 +33,23 @@ import org.openecomp.mso.asdc.installer.BigDecimalVersion;
public class BigDecimalVersionTest {
@Test
- public final void versionCastTest () {
+ public final void versionCastTest() {
- BigDecimal versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("12.0");
- assertTrue(versionDecimal.equals(new BigDecimal("12.0")));
- assertTrue("12.0".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("12.0")));
+ BigDecimal versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("12.0");
+ assertTrue(versionDecimal.equals(new BigDecimal("12.0")));
+ assertTrue("12.0".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("12.0")));
- versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("12.0.2");
- assertTrue(versionDecimal.equals(new BigDecimal("12.02")));
- assertTrue("12.02".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("12.0.2")));
+ versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("12.0.2");
+ assertTrue(versionDecimal.equals(new BigDecimal("12.02")));
+ assertTrue("12.02".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("12.0.2")));
- versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("10");
- assertTrue(versionDecimal.equals(new BigDecimal("10")));
- assertTrue("10".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("10")));
+ versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("10");
+ assertTrue(versionDecimal.equals(new BigDecimal("10")));
+ assertTrue("10".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("10")));
- versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("10.1.2.6");
- assertTrue(versionDecimal.equals(new BigDecimal("10.126")));
- assertTrue("10.126".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("10.1.2.6")));
+ versionDecimal = BigDecimalVersion.castAndCheckNotificationVersion("10.1.2.6");
+ assertTrue(versionDecimal.equals(new BigDecimal("10.126")));
+ assertTrue("10.126".equals(BigDecimalVersion.castAndCheckNotificationVersionToString("10.1.2.6")));
}
}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/YamlTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/YamlTest.java
index 589968ece4..812b4459e5 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/YamlTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/YamlTest.java
@@ -29,6 +29,7 @@ import java.io.InputStream;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+
import org.apache.commons.io.IOUtils;
import org.junit.Test;
@@ -38,128 +39,128 @@ import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
public class YamlTest {
- @Test
- public void getYamlResourceTypeTestList() throws Exception {
-
- InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml"));
- YamlEditor decoder = new YamlEditor (IOUtils.toByteArray(input));
- List<String> typeList = decoder.getYamlNestedFileResourceTypeList();
-
- assertTrue(typeList.size() == 1 && typeList.get(0).equals("file:///my_test.yaml"));
- }
-
- @Test
- public void getParameterListTest() throws Exception {
-
- InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml"));
- YamlEditor decoder = new YamlEditor (IOUtils.toByteArray(input));
- Set <HeatTemplateParam> paramSet = decoder.getParameterList("123456");
-
- assertTrue(paramSet.size() == 5);
-
- for (HeatTemplateParam param : paramSet) {
- if ("ip_port_snmp_manager".equals(param.getParamName()) || "cor_direct_net_name".equals(param.getParamName()) || "cor_direct_net_RT".equals(param.getParamName())) {
-
- assertTrue(param.isRequired()==false);
- } else {
-
- assertTrue(param.isRequired()==true);
- }
-
- assertTrue("string".equals(param.getParamType()));
- }
- }
-
- @Test
- public void addParameterListWhenEmptyTest() throws Exception {
-
- InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTestWithoutParam.yaml"));
- YamlEditor decoder = new YamlEditor (IOUtils.toByteArray(input));
-
- Set <HeatTemplateParam> newParamSet = new HashSet<>();
-
- HeatTemplateParam heatParam1 = new HeatTemplateParam();
- heatParam1.setHeatTemplateArtifactUuid("1");
- heatParam1.setParamName("testos1");
- heatParam1.setParamType("string");
-
- HeatTemplateParam heatParam2 = new HeatTemplateParam();
- heatParam2.setHeatTemplateArtifactUuid("2");
- heatParam2.setParamName("testos2");
- heatParam2.setParamType("number");
-
- newParamSet.add(heatParam1);
- newParamSet.add(heatParam2);
-
- decoder.addParameterList(newParamSet);
-
- Set <HeatTemplateParam> paramSet = decoder.getParameterList("123456");
- assertTrue(paramSet.size() == 2);
-
- assertTrue(decoder.encode().contains("testos1"));
- assertTrue(decoder.encode().contains("string"));
- assertTrue(decoder.encode().contains("testos2"));
- assertTrue(decoder.encode().contains("number"));
- }
-
- @Test
- public void addParameterListTest() throws Exception {
-
- InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml"));
- YamlEditor decoder = new YamlEditor (IOUtils.toByteArray(input));
-
- Set <HeatTemplateParam> newParamSet = new HashSet<>();
-
- HeatTemplateParam heatParam1 = new HeatTemplateParam();
- heatParam1.setHeatTemplateArtifactUuid("1");
- heatParam1.setParamName("testos1");
- heatParam1.setParamType("string");
-
- HeatTemplateParam heatParam2 = new HeatTemplateParam();
- heatParam2.setHeatTemplateArtifactUuid("2");
- heatParam2.setParamName("testos2");
- heatParam2.setParamType("number");
-
- newParamSet.add(heatParam1);
- newParamSet.add(heatParam2);
-
- decoder.addParameterList(newParamSet);
-
- Set <HeatTemplateParam> paramSet = decoder.getParameterList("123456");
-
- assertTrue(paramSet.size() == 7);
-
- Boolean check1 = Boolean.FALSE;
- Boolean check2 = Boolean.FALSE;
-
- for (HeatTemplateParam param : paramSet) {
- if ("ip_port_snmp_manager".equals(param.getParamName()) || "cor_direct_net_name".equals(param.getParamName()) || "cor_direct_net_RT".equals(param.getParamName())) {
- assertFalse(param.isRequired());
- } else {
- assertTrue(param.isRequired());
- }
-
- if ("testos1".equals(param.getParamName()) && "string".equals(param.getParamType())) {
- check1=Boolean.TRUE;
- }
-
- if ("testos2".equals(param.getParamName()) && "number".equals(param.getParamType())) {
- check2=Boolean.TRUE;
- }
-
- }
-
- assertTrue(check1);
- assertTrue(check2);
- }
-
- @Test
- public void VfResourceInstallerTest() throws Exception {
-
- assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami toto, est dans le bois: toto ici","toto")));
- assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami file:///toto, est dans le bois: file:///toto ici","toto")));
- assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami file:///toto, est dans le bois: toto ici","toto")));
- assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami toto, est dans le bois: file:///toto ici","toto")));
-
- }
+ @Test
+ public void getYamlResourceTypeTestList() throws Exception {
+
+ InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml"));
+ YamlEditor decoder = new YamlEditor(IOUtils.toByteArray(input));
+ List<String> typeList = decoder.getYamlNestedFileResourceTypeList();
+
+ assertTrue(typeList.size() == 1 && typeList.get(0).equals("file:///my_test.yaml"));
+ }
+
+ @Test
+ public void getParameterListTest() throws Exception {
+
+ InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml"));
+ YamlEditor decoder = new YamlEditor(IOUtils.toByteArray(input));
+ Set<HeatTemplateParam> paramSet = decoder.getParameterList("123456");
+
+ assertTrue(paramSet.size() == 5);
+
+ for (HeatTemplateParam param : paramSet) {
+ if ("ip_port_snmp_manager".equals(param.getParamName()) || "cor_direct_net_name".equals(param.getParamName()) || "cor_direct_net_RT".equals(param.getParamName())) {
+
+ assertTrue(param.isRequired() == false);
+ } else {
+
+ assertTrue(param.isRequired() == true);
+ }
+
+ assertTrue("string".equals(param.getParamType()));
+ }
+ }
+
+ @Test
+ public void addParameterListWhenEmptyTest() throws Exception {
+
+ InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTestWithoutParam.yaml"));
+ YamlEditor decoder = new YamlEditor(IOUtils.toByteArray(input));
+
+ Set<HeatTemplateParam> newParamSet = new HashSet<>();
+
+ HeatTemplateParam heatParam1 = new HeatTemplateParam();
+ heatParam1.setHeatTemplateArtifactUuid("1");
+ heatParam1.setParamName("testos1");
+ heatParam1.setParamType("string");
+
+ HeatTemplateParam heatParam2 = new HeatTemplateParam();
+ heatParam2.setHeatTemplateArtifactUuid("2");
+ heatParam2.setParamName("testos2");
+ heatParam2.setParamType("number");
+
+ newParamSet.add(heatParam1);
+ newParamSet.add(heatParam2);
+
+ decoder.addParameterList(newParamSet);
+
+ Set<HeatTemplateParam> paramSet = decoder.getParameterList("123456");
+ assertTrue(paramSet.size() == 2);
+
+ assertTrue(decoder.encode().contains("testos1"));
+ assertTrue(decoder.encode().contains("string"));
+ assertTrue(decoder.encode().contains("testos2"));
+ assertTrue(decoder.encode().contains("number"));
+ }
+
+ @Test
+ public void addParameterListTest() throws Exception {
+
+ InputStream input = new FileInputStream(new File("src/test/resources/resource-examples/simpleTest.yaml"));
+ YamlEditor decoder = new YamlEditor(IOUtils.toByteArray(input));
+
+ Set<HeatTemplateParam> newParamSet = new HashSet<>();
+
+ HeatTemplateParam heatParam1 = new HeatTemplateParam();
+ heatParam1.setHeatTemplateArtifactUuid("1");
+ heatParam1.setParamName("testos1");
+ heatParam1.setParamType("string");
+
+ HeatTemplateParam heatParam2 = new HeatTemplateParam();
+ heatParam2.setHeatTemplateArtifactUuid("2");
+ heatParam2.setParamName("testos2");
+ heatParam2.setParamType("number");
+
+ newParamSet.add(heatParam1);
+ newParamSet.add(heatParam2);
+
+ decoder.addParameterList(newParamSet);
+
+ Set<HeatTemplateParam> paramSet = decoder.getParameterList("123456");
+
+ assertTrue(paramSet.size() == 7);
+
+ Boolean check1 = Boolean.FALSE;
+ Boolean check2 = Boolean.FALSE;
+
+ for (HeatTemplateParam param : paramSet) {
+ if ("ip_port_snmp_manager".equals(param.getParamName()) || "cor_direct_net_name".equals(param.getParamName()) || "cor_direct_net_RT".equals(param.getParamName())) {
+ assertFalse(param.isRequired());
+ } else {
+ assertTrue(param.isRequired());
+ }
+
+ if ("testos1".equals(param.getParamName()) && "string".equals(param.getParamType())) {
+ check1 = Boolean.TRUE;
+ }
+
+ if ("testos2".equals(param.getParamName()) && "number".equals(param.getParamType())) {
+ check2 = Boolean.TRUE;
+ }
+
+ }
+
+ assertTrue(check1);
+ assertTrue(check2);
+ }
+
+ @Test
+ public void VfResourceInstallerTest() throws Exception {
+
+ assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami toto, est dans le bois: toto ici", "toto")));
+ assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami file:///toto, est dans le bois: file:///toto ici", "toto")));
+ assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami file:///toto, est dans le bois: toto ici", "toto")));
+ assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami toto, est dans le bois: file:///toto ici", "toto")));
+
+ }
}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/ToscaResourceInstallerTest.java
index 9c20a084c3..48e12c26be 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/ToscaResourceInstallerTest.java
@@ -84,475 +84,475 @@ import mockit.MockUp;
public class ToscaResourceInstallerTest {
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private static String heatExample;
- private static String heatExampleMD5HashBase64;
-
- private static INotificationData iNotif;
-
- private static IDistributionClientDownloadResult downloadResult;
- private static IDistributionClientDownloadResult downloadCorruptedResult;
-
- private static IDistributionClientResult successfulClientInitResult;
- private static IDistributionClientResult unsuccessfulClientInitResult;
-
- private static IDistributionClient distributionClient;
-
- private static IArtifactInfo artifactInfo1;
-
- private static IResourceInstance resource1;
-
- private static VfResourceStructure vrs;
-
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString()
- .substring(5);
- public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString()
- .substring(5);
- public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString()
- .substring(5);
- public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json")
- .toString().substring(5);
- public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader()
- .getResource("mso-with-NULL.json").toString().substring(5);
-
- @BeforeClass
- public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException,
- NoSuchAlgorithmException, ArtifactInstallerException {
-
- heatExample = new String(Files.readAllBytes(Paths.get(
- ASDCControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5Hash = md.digest(heatExample.getBytes());
- heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
-
- iNotif = Mockito.mock(INotificationData.class);
-
- // Create fake ArtifactInfo
- artifactInfo1 = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo1.getArtifactChecksum())
- .thenReturn(ToscaResourceInstallerTest.heatExampleMD5HashBase64);
-
- Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
- Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
- Mockito.when(artifactInfo1.getArtifactURL())
- .thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
- Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
- Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
-
- distributionClient = Mockito.mock(IDistributionClient.class);
-
- // Now provision the NotificationData mock
- List<IArtifactInfo> listArtifact = new ArrayList<>();
- listArtifact.add(artifactInfo1);
-
- // Create fake resource Instance
- resource1 = Mockito.mock(IResourceInstance.class);
- // Mockito.when(resource1.getResourceType()).thenReturn("VF");
- Mockito.when(resource1.getResourceName()).thenReturn("resourceName");
- Mockito.when(resource1.getArtifacts()).thenReturn(listArtifact);
-
- List<IResourceInstance> resources = new ArrayList<>();
- resources.add(resource1);
-
- Mockito.when(iNotif.getResources()).thenReturn(resources);
- Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
- Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
- Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
- Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
-
- downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
- Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
-
- downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample + "badone").getBytes());
- Mockito.when(downloadCorruptedResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
-
- vrs = new VfResourceStructure(iNotif, resource1);
- try {
- vrs.addArtifactToStructure(distributionClient, artifactInfo1, downloadResult);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- try {
- vrs.createVfModuleStructures();
- } catch (ArtifactInstallerException e) {
- e.printStackTrace();
- }
- vrs.getNotification();
- vrs.getArtifactsMapByUUID();
- vrs.getCatalogNetworkResourceCustomization();
- vrs.getCatalogResourceCustomization();
- vrs.getCatalogService();
- vrs.getCatalogServiceToAllottedResources();
- vrs.getCatalogServiceToNetworks();
- vrs.getCatalogVnfResource();
- vrs.getResourceInstance();
- vrs.getVfModulesStructureList();
- vrs.getVfModuleStructure();
- vrs.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
- vrs.setCatalogResourceCustomization(new AllottedResourceCustomization());
- vrs.setCatalogService(new Service());
- vrs.setCatalogServiceToAllottedResources(new ServiceToAllottedResources());
- vrs.setCatalogServiceToNetworks(new ServiceToNetworks());
- vrs.setCatalogVnfResource(new VnfResource());
- vrs.setSuccessfulDeployment();
-
- AllottedResourceCustomization arc = new AllottedResourceCustomization();
- arc.setModelCustomizationUuid("modelCustomizationUuid");
- List<AllottedResourceCustomization> allottedResources = new ArrayList<>();
- allottedResources.add(arc);
-
- NetworkResourceCustomization nrc = new NetworkResourceCustomization();
- nrc.setModelCustomizationUuid("modelCustomizationUuid");
- List<NetworkResourceCustomization> networkResources = new ArrayList<>();
- networkResources.add(nrc);
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<AllottedResourceCustomization> getAllAllottedResourcesByServiceModelUuid(
- String serviceModelUuid) {
- return allottedResources;
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<NetworkResourceCustomization> getAllNetworksByServiceModelUuid(String serviceModelUuid) {
- return networkResources;
- }
- };
-
- // Mock now the ASDC distribution client behavior
- successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(successfulClientInitResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.SUCCESS);
-
- unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
-
- }
-
- @Before
- public final void initBeforeEachTest() throws MsoPropertiesException {
- // load the config
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
-
- @AfterClass
- public static final void kill() throws MsoPropertiesException {
-
- msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
-
- }
-
- @Test
- public void isResourceAlreadyDeployedAllotedResourceTest() {
- Mockito.when(resource1.getResourceType()).thenReturn("VF");
- Mockito.when(resource1.getCategory()).thenReturn("Allotted Resource");
- ToscaResourceInstaller tri = new ToscaResourceInstaller();
-
- try {
- tri.isResourceAlreadyDeployed(vrs);
- } catch (ArtifactInstallerException e) {
- }
- }
-
- @Test(expected=Exception.class)
- public void installTheResourceTest() {
-
- ToscaResourceStructure trs = new ToscaResourceStructure();
- trs.getAllottedResource();
- trs.getAllottedList();
- trs.getCatalogAllottedResourceCustomization();
- trs.getCatalogAllottedServiceToResourceCustomization();
- trs.getCatalogNetworkResource();
- trs.getCatalogNetworkResourceCustomization();
- trs.getCatalogResourceCustomization();
- trs.getCatalogService();
- trs.getCatalogTempNetworkHeatTemplateLookup();
- trs.getCatalogToscaCsar();
- trs.getCatalogVfModule();
- trs.getCatalogVfModuleCustomization();
- trs.getCatalogVfModuleToHeatFiles();
- trs.getCatalogVfServiceToResourceCustomization();
- trs.getCatalogVlServiceToResourceCustomization();
- trs.getCatalogVnfResCustomToVfModuleCustom();
- trs.getCatalogVnfResource();
- trs.getCatalogVnfResourceCustomization();
- trs.getEnvHeatTemplateUUID();
- trs.getHeatFilesUUID();
- trs.getHeatTemplateUUID();
- trs.getNetworkTypes();
- trs.getSdcCsarHelper();
- trs.getServiceMetadata();
- trs.getServiceToResourceCustomization();
- trs.getServiceVersion();
- trs.getToscaArtifact();
- trs.getVfTypes();
- trs.getVolHeatEnvTemplateUUID();
- trs.getVolHeatTemplateUUID();
-
- NodeTemplate nodeTemplate = Mockito.mock(NodeTemplate.class);
- List<NodeTemplate> alnt = new ArrayList<>();
- trs.setAllottedList(alnt);
- trs.setAllottedResource(new AllottedResource());
- trs.setCatalogAllottedResourceCustomization(new AllottedResourceCustomization());
- trs.setCatalogAllottedServiceToResourceCustomization(new ServiceToResourceCustomization());
- trs.setCatalogNetworkResource(new NetworkResource());
- trs.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
- trs.setCatalogResourceCustomization(new AllottedResourceCustomization());
- trs.setCatalogService(new Service());
- trs.setCatalogTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup());
- trs.setCatalogToscaCsar(new ToscaCsar());
- trs.setCatalogVfModule(new VfModule());
- trs.setCatalogVfModuleCustomization(new VfModuleCustomization());
- trs.setCatalogVfModuleToHeatFiles(new VfModuleToHeatFiles());
- trs.setCatalogVfServiceToResourceCustomization(new ServiceToResourceCustomization());
- trs.setCatalogVlServiceToResourceCustomization(new ServiceToResourceCustomization());
- trs.setCatalogVnfResCustomToVfModuleCustom(new VnfResCustomToVfModuleCustom());
- trs.setCatalogVnfResource(new VnfResource());
- trs.setCatalogVnfResourceCustomization(new VnfResourceCustomization());
- trs.setEnvHeatTemplateUUID("envHeatTemplateUUID");
- trs.setHeatFilesUUID("heatFilesUUID");
- trs.setHeatTemplateUUID("heatTemplateUUID");
- trs.setNetworkTypes(alnt);
- trs.setVolHeatTemplateUUID("volHeatTemplateUUID");
- trs.setSdcCsarHelper(new ISdcCsarHelper() {
-
- @Override
- public boolean hasTopology(NodeTemplate arg0) {
- return false;
- }
-
- @Override
- public NodeTemplate getVnfConfig(String arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getVfcListByVf(String arg0) {
- return null;
- }
-
- @Override
- public List<Group> getVfModulesByVf(String arg0) {
- return null;
- }
-
- @Override
- public String getTypeOfNodeTemplate(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getServiceVlList() {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getServiceVfList() {
- return null;
- }
-
- @Override
- public String getServiceSubstitutionMappingsTypeName() {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getServiceNodeTemplatesByType(String arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getServiceNodeTemplates() {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getServiceNodeTemplateBySdcType(SdcTypes arg0) {
- return null;
- }
-
- @Override
- public Map<String, Object> getServiceMetadataProperties() {
- return null;
- }
-
- @Override
- public Metadata getServiceMetadata() {
- return null;
- }
-
- @Override
- public List<Input> getServiceInputs() {
- return null;
- }
-
- @Override
- public Object getServiceInputLeafValueOfDefaultAsObject(String arg0) {
- return null;
- }
-
- @Override
- public String getServiceInputLeafValueOfDefault(String arg0) {
- return null;
- }
-
- @Override
- public String getNodeTemplatePropertyLeafValue(NodeTemplate arg0, String arg1) {
- return null;
- }
-
- @Override
- public Object getNodeTemplatePropertyAsObject(NodeTemplate arg0, String arg1) {
- return null;
- }
-
- @Override
- public List<Pair<NodeTemplate, NodeTemplate>> getNodeTemplatePairsByReqName(List<NodeTemplate> arg0,
- List<NodeTemplate> arg1, String arg2) {
- return null;
- }
-
- @Override
- public String getNodeTemplateCustomizationUuid(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getNodeTemplateChildren(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getNodeTemplateBySdcType(NodeTemplate arg0, SdcTypes arg1) {
- return null;
- }
-
- @Override
- public String getMetadataPropertyValue(Metadata arg0, String arg1) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getMembersOfVfModule(NodeTemplate arg0, Group arg1) {
- return null;
- }
-
- @Override
- public String getGroupPropertyLeafValue(Group arg0, String arg1) {
- return null;
- }
-
- @Override
- public Object getGroupPropertyAsObject(Group arg0, String arg1) {
- return null;
- }
-
- @Override
- public Map<String, Map<String, Object>> getCpPropertiesFromVfcAsObject(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public Map<String, Map<String, Object>> getCpPropertiesFromVfc(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getCpListByVf(String arg0) {
- return null;
- }
-
- @Override
- public String getConformanceLevel() {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getAllottedResources() {
- return null;
- }
-
- @Override
- public Map<String, String> filterNodeTemplatePropertiesByValue(NodeTemplate arg0, FilterType arg1,
- String arg2) {
- return null;
- }
- });
- // trs.setServiceMetadata(new Metadata(new HashMap<>()));
- trs.setServiceToResourceCustomization(new ServiceToResourceCustomization());
- trs.setServiceVersion("1.0");
- trs.setToscaArtifact(new IArtifactInfo() {
-
- @Override
- public List<IArtifactInfo> getRelatedArtifacts() {
- return null;
- }
-
- @Override
- public IArtifactInfo getGeneratedArtifact() {
- return null;
- }
-
- @Override
- public String getArtifactVersion() {
- return null;
- }
-
- @Override
- public String getArtifactUUID() {
- return null;
- }
-
- @Override
- public String getArtifactURL() {
- return null;
- }
-
- @Override
- public String getArtifactType() {
- return null;
- }
-
- @Override
- public Integer getArtifactTimeout() {
- return null;
- }
-
- @Override
- public String getArtifactName() {
- return null;
- }
-
- @Override
- public String getArtifactDescription() {
- return null;
- }
-
- @Override
- public String getArtifactChecksum() {
- return null;
- }
- });
- trs.setVfTypes(alnt);
- trs.setVnfAlreadyInstalled(true);
- trs.setVolHeatEnvTemplateUUID("volHeatEnvTemplateUUID");
- trs.isVnfAlreadyInstalled();
-
- trs.updateResourceStructure(artifactInfo1);
- ToscaResourceInstaller tri = new ToscaResourceInstaller();
-
- try {
- tri.installTheResource(trs, vrs);
- } catch (ArtifactInstallerException e) {
- }
- }
+ private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+
+ private static String heatExample;
+ private static String heatExampleMD5HashBase64;
+
+ private static INotificationData iNotif;
+
+ private static IDistributionClientDownloadResult downloadResult;
+ private static IDistributionClientDownloadResult downloadCorruptedResult;
+
+ private static IDistributionClientResult successfulClientInitResult;
+ private static IDistributionClientResult unsuccessfulClientInitResult;
+
+ private static IDistributionClient distributionClient;
+
+ private static IArtifactInfo artifactInfo1;
+
+ private static IResourceInstance resource1;
+
+ private static VfResourceStructure vrs;
+
+ public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString()
+ .substring(5);
+ public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString()
+ .substring(5);
+ public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString()
+ .substring(5);
+ public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json")
+ .toString().substring(5);
+ public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader()
+ .getResource("mso-with-NULL.json").toString().substring(5);
+
+ @BeforeClass
+ public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException,
+ NoSuchAlgorithmException, ArtifactInstallerException {
+
+ heatExample = new String(Files.readAllBytes(Paths.get(
+ ASDCControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ byte[] md5Hash = md.digest(heatExample.getBytes());
+ heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
+
+ iNotif = Mockito.mock(INotificationData.class);
+
+ // Create fake ArtifactInfo
+ artifactInfo1 = Mockito.mock(IArtifactInfo.class);
+ Mockito.when(artifactInfo1.getArtifactChecksum())
+ .thenReturn(ToscaResourceInstallerTest.heatExampleMD5HashBase64);
+
+ Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
+ Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
+ Mockito.when(artifactInfo1.getArtifactURL())
+ .thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
+ Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
+ Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
+
+ distributionClient = Mockito.mock(IDistributionClient.class);
+
+ // Now provision the NotificationData mock
+ List<IArtifactInfo> listArtifact = new ArrayList<>();
+ listArtifact.add(artifactInfo1);
+
+ // Create fake resource Instance
+ resource1 = Mockito.mock(IResourceInstance.class);
+ // Mockito.when(resource1.getResourceType()).thenReturn("VF");
+ Mockito.when(resource1.getResourceName()).thenReturn("resourceName");
+ Mockito.when(resource1.getArtifacts()).thenReturn(listArtifact);
+
+ List<IResourceInstance> resources = new ArrayList<>();
+ resources.add(resource1);
+
+ Mockito.when(iNotif.getResources()).thenReturn(resources);
+ Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
+ Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
+ Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
+ Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
+
+ downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
+ Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
+ Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
+ Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
+
+ downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
+ Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample + "badone").getBytes());
+ Mockito.when(downloadCorruptedResult.getDistributionActionResult())
+ .thenReturn(DistributionActionResultEnum.SUCCESS);
+ Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
+
+ vrs = new VfResourceStructure(iNotif, resource1);
+ try {
+ vrs.addArtifactToStructure(distributionClient, artifactInfo1, downloadResult);
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ try {
+ vrs.createVfModuleStructures();
+ } catch (ArtifactInstallerException e) {
+ e.printStackTrace();
+ }
+ vrs.getNotification();
+ vrs.getArtifactsMapByUUID();
+ vrs.getCatalogNetworkResourceCustomization();
+ vrs.getCatalogResourceCustomization();
+ vrs.getCatalogService();
+ vrs.getCatalogServiceToAllottedResources();
+ vrs.getCatalogServiceToNetworks();
+ vrs.getCatalogVnfResource();
+ vrs.getResourceInstance();
+ vrs.getVfModulesStructureList();
+ vrs.getVfModuleStructure();
+ vrs.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
+ vrs.setCatalogResourceCustomization(new AllottedResourceCustomization());
+ vrs.setCatalogService(new Service());
+ vrs.setCatalogServiceToAllottedResources(new ServiceToAllottedResources());
+ vrs.setCatalogServiceToNetworks(new ServiceToNetworks());
+ vrs.setCatalogVnfResource(new VnfResource());
+ vrs.setSuccessfulDeployment();
+
+ AllottedResourceCustomization arc = new AllottedResourceCustomization();
+ arc.setModelCustomizationUuid("modelCustomizationUuid");
+ List<AllottedResourceCustomization> allottedResources = new ArrayList<>();
+ allottedResources.add(arc);
+
+ NetworkResourceCustomization nrc = new NetworkResourceCustomization();
+ nrc.setModelCustomizationUuid("modelCustomizationUuid");
+ List<NetworkResourceCustomization> networkResources = new ArrayList<>();
+ networkResources.add(nrc);
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List<AllottedResourceCustomization> getAllAllottedResourcesByServiceModelUuid(
+ String serviceModelUuid) {
+ return allottedResources;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List<NetworkResourceCustomization> getAllNetworksByServiceModelUuid(String serviceModelUuid) {
+ return networkResources;
+ }
+ };
+
+ // Mock now the ASDC distribution client behavior
+ successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
+ Mockito.when(successfulClientInitResult.getDistributionActionResult())
+ .thenReturn(DistributionActionResultEnum.SUCCESS);
+
+ unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
+ Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult())
+ .thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
+
+ }
+
+ @Before
+ public final void initBeforeEachTest() throws MsoPropertiesException {
+ // load the config
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ }
+
+ @AfterClass
+ public static final void kill() throws MsoPropertiesException {
+
+ msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
+
+ }
+
+ @Test
+ public void isResourceAlreadyDeployedAllotedResourceTest() {
+ Mockito.when(resource1.getResourceType()).thenReturn("VF");
+ Mockito.when(resource1.getCategory()).thenReturn("Allotted Resource");
+ ToscaResourceInstaller tri = new ToscaResourceInstaller();
+
+ try {
+ tri.isResourceAlreadyDeployed(vrs);
+ } catch (ArtifactInstallerException e) {
+ }
+ }
+
+ @Test(expected = Exception.class)
+ public void installTheResourceTest() {
+
+ ToscaResourceStructure trs = new ToscaResourceStructure();
+ trs.getAllottedResource();
+ trs.getAllottedList();
+ trs.getCatalogAllottedResourceCustomization();
+ trs.getCatalogAllottedServiceToResourceCustomization();
+ trs.getCatalogNetworkResource();
+ trs.getCatalogNetworkResourceCustomization();
+ trs.getCatalogResourceCustomization();
+ trs.getCatalogService();
+ trs.getCatalogTempNetworkHeatTemplateLookup();
+ trs.getCatalogToscaCsar();
+ trs.getCatalogVfModule();
+ trs.getCatalogVfModuleCustomization();
+ trs.getCatalogVfModuleToHeatFiles();
+ trs.getCatalogVfServiceToResourceCustomization();
+ trs.getCatalogVlServiceToResourceCustomization();
+ trs.getCatalogVnfResCustomToVfModuleCustom();
+ trs.getCatalogVnfResource();
+ trs.getCatalogVnfResourceCustomization();
+ trs.getEnvHeatTemplateUUID();
+ trs.getHeatFilesUUID();
+ trs.getHeatTemplateUUID();
+ trs.getNetworkTypes();
+ trs.getSdcCsarHelper();
+ trs.getServiceMetadata();
+ trs.getServiceToResourceCustomization();
+ trs.getServiceVersion();
+ trs.getToscaArtifact();
+ trs.getVfTypes();
+ trs.getVolHeatEnvTemplateUUID();
+ trs.getVolHeatTemplateUUID();
+
+ NodeTemplate nodeTemplate = Mockito.mock(NodeTemplate.class);
+ List<NodeTemplate> alnt = new ArrayList<>();
+ trs.setAllottedList(alnt);
+ trs.setAllottedResource(new AllottedResource());
+ trs.setCatalogAllottedResourceCustomization(new AllottedResourceCustomization());
+ trs.setCatalogAllottedServiceToResourceCustomization(new ServiceToResourceCustomization());
+ trs.setCatalogNetworkResource(new NetworkResource());
+ trs.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
+ trs.setCatalogResourceCustomization(new AllottedResourceCustomization());
+ trs.setCatalogService(new Service());
+ trs.setCatalogTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup());
+ trs.setCatalogToscaCsar(new ToscaCsar());
+ trs.setCatalogVfModule(new VfModule());
+ trs.setCatalogVfModuleCustomization(new VfModuleCustomization());
+ trs.setCatalogVfModuleToHeatFiles(new VfModuleToHeatFiles());
+ trs.setCatalogVfServiceToResourceCustomization(new ServiceToResourceCustomization());
+ trs.setCatalogVlServiceToResourceCustomization(new ServiceToResourceCustomization());
+ trs.setCatalogVnfResCustomToVfModuleCustom(new VnfResCustomToVfModuleCustom());
+ trs.setCatalogVnfResource(new VnfResource());
+ trs.setCatalogVnfResourceCustomization(new VnfResourceCustomization());
+ trs.setEnvHeatTemplateUUID("envHeatTemplateUUID");
+ trs.setHeatFilesUUID("heatFilesUUID");
+ trs.setHeatTemplateUUID("heatTemplateUUID");
+ trs.setNetworkTypes(alnt);
+ trs.setVolHeatTemplateUUID("volHeatTemplateUUID");
+ trs.setSdcCsarHelper(new ISdcCsarHelper() {
+
+ @Override
+ public boolean hasTopology(NodeTemplate arg0) {
+ return false;
+ }
+
+ @Override
+ public NodeTemplate getVnfConfig(String arg0) {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getVfcListByVf(String arg0) {
+ return null;
+ }
+
+ @Override
+ public List<Group> getVfModulesByVf(String arg0) {
+ return null;
+ }
+
+ @Override
+ public String getTypeOfNodeTemplate(NodeTemplate arg0) {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getServiceVlList() {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getServiceVfList() {
+ return null;
+ }
+
+ @Override
+ public String getServiceSubstitutionMappingsTypeName() {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getServiceNodeTemplatesByType(String arg0) {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getServiceNodeTemplates() {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getServiceNodeTemplateBySdcType(SdcTypes arg0) {
+ return null;
+ }
+
+ @Override
+ public Map<String, Object> getServiceMetadataProperties() {
+ return null;
+ }
+
+ @Override
+ public Metadata getServiceMetadata() {
+ return null;
+ }
+
+ @Override
+ public List<Input> getServiceInputs() {
+ return null;
+ }
+
+ @Override
+ public Object getServiceInputLeafValueOfDefaultAsObject(String arg0) {
+ return null;
+ }
+
+ @Override
+ public String getServiceInputLeafValueOfDefault(String arg0) {
+ return null;
+ }
+
+ @Override
+ public String getNodeTemplatePropertyLeafValue(NodeTemplate arg0, String arg1) {
+ return null;
+ }
+
+ @Override
+ public Object getNodeTemplatePropertyAsObject(NodeTemplate arg0, String arg1) {
+ return null;
+ }
+
+ @Override
+ public List<Pair<NodeTemplate, NodeTemplate>> getNodeTemplatePairsByReqName(List<NodeTemplate> arg0,
+ List<NodeTemplate> arg1, String arg2) {
+ return null;
+ }
+
+ @Override
+ public String getNodeTemplateCustomizationUuid(NodeTemplate arg0) {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getNodeTemplateChildren(NodeTemplate arg0) {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getNodeTemplateBySdcType(NodeTemplate arg0, SdcTypes arg1) {
+ return null;
+ }
+
+ @Override
+ public String getMetadataPropertyValue(Metadata arg0, String arg1) {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getMembersOfVfModule(NodeTemplate arg0, Group arg1) {
+ return null;
+ }
+
+ @Override
+ public String getGroupPropertyLeafValue(Group arg0, String arg1) {
+ return null;
+ }
+
+ @Override
+ public Object getGroupPropertyAsObject(Group arg0, String arg1) {
+ return null;
+ }
+
+ @Override
+ public Map<String, Map<String, Object>> getCpPropertiesFromVfcAsObject(NodeTemplate arg0) {
+ return null;
+ }
+
+ @Override
+ public Map<String, Map<String, Object>> getCpPropertiesFromVfc(NodeTemplate arg0) {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getCpListByVf(String arg0) {
+ return null;
+ }
+
+ @Override
+ public String getConformanceLevel() {
+ return null;
+ }
+
+ @Override
+ public List<NodeTemplate> getAllottedResources() {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> filterNodeTemplatePropertiesByValue(NodeTemplate arg0, FilterType arg1,
+ String arg2) {
+ return null;
+ }
+ });
+ // trs.setServiceMetadata(new Metadata(new HashMap<>()));
+ trs.setServiceToResourceCustomization(new ServiceToResourceCustomization());
+ trs.setServiceVersion("1.0");
+ trs.setToscaArtifact(new IArtifactInfo() {
+
+ @Override
+ public List<IArtifactInfo> getRelatedArtifacts() {
+ return null;
+ }
+
+ @Override
+ public IArtifactInfo getGeneratedArtifact() {
+ return null;
+ }
+
+ @Override
+ public String getArtifactVersion() {
+ return null;
+ }
+
+ @Override
+ public String getArtifactUUID() {
+ return null;
+ }
+
+ @Override
+ public String getArtifactURL() {
+ return null;
+ }
+
+ @Override
+ public String getArtifactType() {
+ return null;
+ }
+
+ @Override
+ public Integer getArtifactTimeout() {
+ return null;
+ }
+
+ @Override
+ public String getArtifactName() {
+ return null;
+ }
+
+ @Override
+ public String getArtifactDescription() {
+ return null;
+ }
+
+ @Override
+ public String getArtifactChecksum() {
+ return null;
+ }
+ });
+ trs.setVfTypes(alnt);
+ trs.setVnfAlreadyInstalled(true);
+ trs.setVolHeatEnvTemplateUUID("volHeatEnvTemplateUUID");
+ trs.isVnfAlreadyInstalled();
+
+ trs.updateResourceStructure(artifactInfo1);
+ ToscaResourceInstaller tri = new ToscaResourceInstaller();
+
+ try {
+ tri.installTheResource(trs, vrs);
+ } catch (ArtifactInstallerException e) {
+ }
+ }
}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/VfResourceInstallerTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/VfResourceInstallerTest.java
index e2239dc952..04a9ea0a1e 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/VfResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/VfResourceInstallerTest.java
@@ -63,218 +63,219 @@ import mockit.Mock;
import mockit.MockUp;
public class VfResourceInstallerTest {
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- private static String heatExample;
- private static String heatExampleMD5HashBase64;
+ private static String heatExample;
+ private static String heatExampleMD5HashBase64;
- private static INotificationData iNotif;
+ private static INotificationData iNotif;
- private static IDistributionClientDownloadResult downloadResult;
- private static IDistributionClientDownloadResult downloadCorruptedResult;
+ private static IDistributionClientDownloadResult downloadResult;
+ private static IDistributionClientDownloadResult downloadCorruptedResult;
- private static IDistributionClientResult successfulClientInitResult;
- private static IDistributionClientResult unsuccessfulClientInitResult;
+ private static IDistributionClientResult successfulClientInitResult;
+ private static IDistributionClientResult unsuccessfulClientInitResult;
- private static IDistributionClient distributionClient;
+ private static IDistributionClient distributionClient;
- private static IArtifactInfo artifactInfo1;
+ private static IArtifactInfo artifactInfo1;
- private static IResourceInstance resource1;
+ private static IResourceInstance resource1;
- private static VfResourceStructure vrs;
+ private static VfResourceStructure vrs;
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString()
- .substring(5);
- public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString()
- .substring(5);
- public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString()
- .substring(5);
- public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json")
- .toString().substring(5);
- public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader()
- .getResource("mso-with-NULL.json").toString().substring(5);
+ public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString()
+ .substring(5);
+ public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString()
+ .substring(5);
+ public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString()
+ .substring(5);
+ public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json")
+ .toString().substring(5);
+ public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader()
+ .getResource("mso-with-NULL.json").toString().substring(5);
- @BeforeClass
- public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException,
- NoSuchAlgorithmException, ArtifactInstallerException {
+ @BeforeClass
+ public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException,
+ NoSuchAlgorithmException, ArtifactInstallerException {
- heatExample = new String(Files.readAllBytes(Paths.get(
- ASDCControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5Hash = md.digest(heatExample.getBytes());
- heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
+ heatExample = new String(Files.readAllBytes(Paths.get(
+ ASDCControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ byte[] md5Hash = md.digest(heatExample.getBytes());
+ heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
- iNotif = Mockito.mock(INotificationData.class);
+ iNotif = Mockito.mock(INotificationData.class);
- // Create fake ArtifactInfo
- artifactInfo1 = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo1.getArtifactChecksum()).thenReturn(VfResourceInstallerTest.heatExampleMD5HashBase64);
+ // Create fake ArtifactInfo
+ artifactInfo1 = Mockito.mock(IArtifactInfo.class);
+ Mockito.when(artifactInfo1.getArtifactChecksum()).thenReturn(VfResourceInstallerTest.heatExampleMD5HashBase64);
- Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
- Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
- Mockito.when(artifactInfo1.getArtifactURL())
- .thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
- Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
- Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
+ Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
+ Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
+ Mockito.when(artifactInfo1.getArtifactURL())
+ .thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
+ Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
+ Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
- distributionClient = Mockito.mock(IDistributionClient.class);
+ distributionClient = Mockito.mock(IDistributionClient.class);
- // Now provision the NotificationData mock
- List<IArtifactInfo> listArtifact = new ArrayList<>();
- listArtifact.add(artifactInfo1);
+ // Now provision the NotificationData mock
+ List<IArtifactInfo> listArtifact = new ArrayList<>();
+ listArtifact.add(artifactInfo1);
- // Create fake resource Instance
- resource1 = Mockito.mock(IResourceInstance.class);
+ // Create fake resource Instance
+ resource1 = Mockito.mock(IResourceInstance.class);
// Mockito.when(resource1.getResourceType()).thenReturn("VF");
- Mockito.when(resource1.getResourceName()).thenReturn("resourceName");
- Mockito.when(resource1.getArtifacts()).thenReturn(listArtifact);
-
- List<IResourceInstance> resources = new ArrayList<>();
- resources.add(resource1);
-
- Mockito.when(iNotif.getResources()).thenReturn(resources);
- Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
- Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
- Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
- Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
-
- downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
- Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
-
- downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample + "badone").getBytes());
- Mockito.when(downloadCorruptedResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
-
- vrs = new VfResourceStructure(iNotif, resource1);
- try {
- vrs.addArtifactToStructure(distributionClient, artifactInfo1, downloadResult);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- try {
- vrs.createVfModuleStructures();
- } catch (ArtifactInstallerException e) {
- e.printStackTrace();
- }
- vrs.getNotification();
- vrs.getArtifactsMapByUUID();
- vrs.getCatalogNetworkResourceCustomization();
- vrs.getCatalogResourceCustomization();
- vrs.getCatalogService();
- vrs.getCatalogServiceToAllottedResources();
- vrs.getCatalogServiceToNetworks();
- vrs.getCatalogVnfResource();
- vrs.getResourceInstance();
- vrs.getVfModulesStructureList();
- vrs.getVfModuleStructure();
- vrs.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
- vrs.setCatalogResourceCustomization(new AllottedResourceCustomization());
- vrs.setCatalogService(new Service());
- vrs.setCatalogServiceToAllottedResources(new ServiceToAllottedResources());
- vrs.setCatalogServiceToNetworks(new ServiceToNetworks());
- vrs.setCatalogVnfResource(new VnfResource());
- vrs.setSuccessfulDeployment();
-
- AllottedResourceCustomization arc= new AllottedResourceCustomization();
- arc.setModelCustomizationUuid("modelCustomizationUuid");
- List<AllottedResourceCustomization> allottedResources = new ArrayList<>();
- allottedResources.add(arc);
-
- NetworkResourceCustomization nrc = new NetworkResourceCustomization();
- nrc.setModelCustomizationUuid("modelCustomizationUuid");
- List<NetworkResourceCustomization> networkResources = new ArrayList<>();
- networkResources.add(nrc);
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<AllottedResourceCustomization> getAllAllottedResourcesByServiceModelUuid(String serviceModelUuid) {
- return allottedResources;
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<NetworkResourceCustomization> getAllNetworksByServiceModelUuid(String serviceModelUuid) {
- return networkResources;
- }
- };
-
- // Mock now the ASDC distribution client behavior
- successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(successfulClientInitResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.SUCCESS);
-
- unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
-
- }
-
- @Before
- public final void initBeforeEachTest() throws MsoPropertiesException {
- // load the config
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
-
- @AfterClass
- public static final void kill() throws MsoPropertiesException {
-
- msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
-
- }
-
- @Test
- public void isResourceAlreadyDeployedAllotedResourceTest() {
-
- Mockito.when(resource1.getResourceType()).thenReturn("VF");
- Mockito.when(resource1.getCategory()).thenReturn("Allotted Resource");
- VfResourceInstaller vfri = new VfResourceInstaller();
-
- try {
- vfri.isResourceAlreadyDeployed(vrs);
- } catch (ArtifactInstallerException e) {
- }
-
- }
-
- @Test
- public void isResourceAlreadyDeployedTest() {
-
- Mockito.when(resource1.getResourceType()).thenReturn("VF");
- Mockito.when(resource1.getCategory()).thenReturn("Not Allotted Resource");
- VfResourceInstaller vfri = new VfResourceInstaller();
-
- try {
- vfri.isResourceAlreadyDeployed(vrs);
- } catch (ArtifactInstallerException e) {
- }
-
- }
- @Test
- public void isResourceAlreadyDeployedDuplicateNtwrkTest() {
-
- Mockito.when(resource1.getResourceType()).thenReturn("VL");
- Mockito.when(resource1.getCategory()).thenReturn("Not Allotted Resource");
- VfResourceInstaller vfri = new VfResourceInstaller();
-
- try {
- vfri.isResourceAlreadyDeployed(vrs);
- } catch (ArtifactInstallerException e) {
- }
-
- }
-
- @Test(expected=Exception.class)
- public void installTheResourceTest() {
- VfResourceInstaller vfri = new VfResourceInstaller();
- try {
- vfri.installTheResource(vrs);
- } catch (ArtifactInstallerException e) {
- }
- }
+ Mockito.when(resource1.getResourceName()).thenReturn("resourceName");
+ Mockito.when(resource1.getArtifacts()).thenReturn(listArtifact);
+
+ List<IResourceInstance> resources = new ArrayList<>();
+ resources.add(resource1);
+
+ Mockito.when(iNotif.getResources()).thenReturn(resources);
+ Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
+ Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
+ Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
+ Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
+
+ downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
+ Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
+ Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
+ Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
+
+ downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
+ Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample + "badone").getBytes());
+ Mockito.when(downloadCorruptedResult.getDistributionActionResult())
+ .thenReturn(DistributionActionResultEnum.SUCCESS);
+ Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
+
+ vrs = new VfResourceStructure(iNotif, resource1);
+ try {
+ vrs.addArtifactToStructure(distributionClient, artifactInfo1, downloadResult);
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ try {
+ vrs.createVfModuleStructures();
+ } catch (ArtifactInstallerException e) {
+ e.printStackTrace();
+ }
+ vrs.getNotification();
+ vrs.getArtifactsMapByUUID();
+ vrs.getCatalogNetworkResourceCustomization();
+ vrs.getCatalogResourceCustomization();
+ vrs.getCatalogService();
+ vrs.getCatalogServiceToAllottedResources();
+ vrs.getCatalogServiceToNetworks();
+ vrs.getCatalogVnfResource();
+ vrs.getResourceInstance();
+ vrs.getVfModulesStructureList();
+ vrs.getVfModuleStructure();
+ vrs.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
+ vrs.setCatalogResourceCustomization(new AllottedResourceCustomization());
+ vrs.setCatalogService(new Service());
+ vrs.setCatalogServiceToAllottedResources(new ServiceToAllottedResources());
+ vrs.setCatalogServiceToNetworks(new ServiceToNetworks());
+ vrs.setCatalogVnfResource(new VnfResource());
+ vrs.setSuccessfulDeployment();
+
+ AllottedResourceCustomization arc = new AllottedResourceCustomization();
+ arc.setModelCustomizationUuid("modelCustomizationUuid");
+ List<AllottedResourceCustomization> allottedResources = new ArrayList<>();
+ allottedResources.add(arc);
+
+ NetworkResourceCustomization nrc = new NetworkResourceCustomization();
+ nrc.setModelCustomizationUuid("modelCustomizationUuid");
+ List<NetworkResourceCustomization> networkResources = new ArrayList<>();
+ networkResources.add(nrc);
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List<AllottedResourceCustomization> getAllAllottedResourcesByServiceModelUuid(String serviceModelUuid) {
+ return allottedResources;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List<NetworkResourceCustomization> getAllNetworksByServiceModelUuid(String serviceModelUuid) {
+ return networkResources;
+ }
+ };
+
+ // Mock now the ASDC distribution client behavior
+ successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
+ Mockito.when(successfulClientInitResult.getDistributionActionResult())
+ .thenReturn(DistributionActionResultEnum.SUCCESS);
+
+ unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
+ Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult())
+ .thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
+
+ }
+
+ @Before
+ public final void initBeforeEachTest() throws MsoPropertiesException {
+ // load the config
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
+ }
+
+ @AfterClass
+ public static final void kill() throws MsoPropertiesException {
+
+ msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
+
+ }
+
+ @Test
+ public void isResourceAlreadyDeployedAllotedResourceTest() {
+
+ Mockito.when(resource1.getResourceType()).thenReturn("VF");
+ Mockito.when(resource1.getCategory()).thenReturn("Allotted Resource");
+ VfResourceInstaller vfri = new VfResourceInstaller();
+
+ try {
+ vfri.isResourceAlreadyDeployed(vrs);
+ } catch (ArtifactInstallerException e) {
+ }
+
+ }
+
+ @Test
+ public void isResourceAlreadyDeployedTest() {
+
+ Mockito.when(resource1.getResourceType()).thenReturn("VF");
+ Mockito.when(resource1.getCategory()).thenReturn("Not Allotted Resource");
+ VfResourceInstaller vfri = new VfResourceInstaller();
+
+ try {
+ vfri.isResourceAlreadyDeployed(vrs);
+ } catch (ArtifactInstallerException e) {
+ }
+
+ }
+
+ @Test
+ public void isResourceAlreadyDeployedDuplicateNtwrkTest() {
+
+ Mockito.when(resource1.getResourceType()).thenReturn("VL");
+ Mockito.when(resource1.getCategory()).thenReturn("Not Allotted Resource");
+ VfResourceInstaller vfri = new VfResourceInstaller();
+
+ try {
+ vfri.isResourceAlreadyDeployed(vrs);
+ } catch (ArtifactInstallerException e) {
+ }
+
+ }
+
+ @Test(expected = Exception.class)
+ public void installTheResourceTest() {
+ VfResourceInstaller vfri = new VfResourceInstaller();
+ try {
+ vfri.installTheResource(vrs);
+ } catch (ArtifactInstallerException e) {
+ }
+ }
}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java
index 1d65501ce2..8278769ac9 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java
@@ -34,141 +34,141 @@ import org.openecomp.sdc.api.notification.INotificationData;
import org.openecomp.sdc.api.notification.IResourceInstance;
public class ASDCNotificationLoggingTest {
- @Test
- public void dumpASDCNotificationTestForNull() throws Exception {
- INotificationData asdcNotification = iNotificationDataObject();
-
- String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
-
- assertTrue(!result.equalsIgnoreCase("NULL"));
- }
-
- private INotificationData iNotificationDataObject() {
- INotificationData iNotification = new INotificationData() {
-
- @Override
- public String getServiceVersion() {
- return "DistributionID";
- }
-
- @Override
- public String getServiceUUID() {
- return "12343254";
- }
-
- @Override
- public String getServiceName() {
- return "servername";
- }
-
- @Override
- public String getServiceInvariantUUID() {
- return "ServiceInvariantUUID";
- }
-
- @Override
- public String getServiceDescription() {
- return "Description";
- }
-
- @Override
- public List<IArtifactInfo> getServiceArtifacts() {
- return new ArrayList();
- }
-
- @Override
- public List<IResourceInstance> getResources() {
- return new ArrayList();
- }
-
- @Override
- public String getDistributionID() {
- return "23434";
- }
-
- @Override
- public IArtifactInfo getArtifactMetadataByUUID(String arg0) {
- return null;
- }
- };
- return iNotification;
- }
-
- @Test
- public void dumpASDCNotificationTest() throws Exception {
- INotificationData asdcNotification = iNotificationDataObject();
- String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
-
- assertTrue(!result.equalsIgnoreCase("NULL"));
- }
-
- @Test
- public void dumpVfModuleMetaDataListTest() {
- INotificationData asdcNotification = iNotificationDataObject();
- List<IVfModuleData> list = new ArrayList<>();
- list.add(new VfModuleMetaData());
- String result = null;
- try {
- result = ASDCNotificationLogging.dumpVfModuleMetaDataList(list);
- } catch (Exception e) {
- }
-
- assertTrue(result == null);
-
- }
-
- public IArtifactInfo getIArtifactInfo() {
- return new IArtifactInfo() {
-
- @Override
- public List<IArtifactInfo> getRelatedArtifacts() {
- return null;
- }
-
- @Override
- public IArtifactInfo getGeneratedArtifact() {
- return null;
- }
-
- @Override
- public String getArtifactVersion() {
- return "version";
- }
-
- @Override
- public String getArtifactUUID() {
- return "123";
- }
-
- @Override
- public String getArtifactURL() {
- return "url";
- }
-
- @Override
- public String getArtifactType() {
- return "type";
- }
-
- @Override
- public Integer getArtifactTimeout() {
- return 12;
- }
-
- @Override
- public String getArtifactName() {
- return "name";
- }
-
- @Override
- public String getArtifactDescription() {
- return "desc";
- }
-
- @Override
- public String getArtifactChecksum() {
- return "true";
- }
- };
- }
+ @Test
+ public void dumpASDCNotificationTestForNull() throws Exception {
+ INotificationData asdcNotification = iNotificationDataObject();
+
+ String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
+
+ assertTrue(!result.equalsIgnoreCase("NULL"));
+ }
+
+ private INotificationData iNotificationDataObject() {
+ INotificationData iNotification = new INotificationData() {
+
+ @Override
+ public String getServiceVersion() {
+ return "DistributionID";
+ }
+
+ @Override
+ public String getServiceUUID() {
+ return "12343254";
+ }
+
+ @Override
+ public String getServiceName() {
+ return "servername";
+ }
+
+ @Override
+ public String getServiceInvariantUUID() {
+ return "ServiceInvariantUUID";
+ }
+
+ @Override
+ public String getServiceDescription() {
+ return "Description";
+ }
+
+ @Override
+ public List<IArtifactInfo> getServiceArtifacts() {
+ return new ArrayList();
+ }
+
+ @Override
+ public List<IResourceInstance> getResources() {
+ return new ArrayList();
+ }
+
+ @Override
+ public String getDistributionID() {
+ return "23434";
+ }
+
+ @Override
+ public IArtifactInfo getArtifactMetadataByUUID(String arg0) {
+ return null;
+ }
+ };
+ return iNotification;
+ }
+
+ @Test
+ public void dumpASDCNotificationTest() throws Exception {
+ INotificationData asdcNotification = iNotificationDataObject();
+ String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
+
+ assertTrue(!result.equalsIgnoreCase("NULL"));
+ }
+
+ @Test
+ public void dumpVfModuleMetaDataListTest() {
+ INotificationData asdcNotification = iNotificationDataObject();
+ List<IVfModuleData> list = new ArrayList<>();
+ list.add(new VfModuleMetaData());
+ String result = null;
+ try {
+ result = ASDCNotificationLogging.dumpVfModuleMetaDataList(list);
+ } catch (Exception e) {
+ }
+
+ assertTrue(result == null);
+
+ }
+
+ public IArtifactInfo getIArtifactInfo() {
+ return new IArtifactInfo() {
+
+ @Override
+ public List<IArtifactInfo> getRelatedArtifacts() {
+ return null;
+ }
+
+ @Override
+ public IArtifactInfo getGeneratedArtifact() {
+ return null;
+ }
+
+ @Override
+ public String getArtifactVersion() {
+ return "version";
+ }
+
+ @Override
+ public String getArtifactUUID() {
+ return "123";
+ }
+
+ @Override
+ public String getArtifactURL() {
+ return "url";
+ }
+
+ @Override
+ public String getArtifactType() {
+ return "type";
+ }
+
+ @Override
+ public Integer getArtifactTimeout() {
+ return 12;
+ }
+
+ @Override
+ public String getArtifactName() {
+ return "name";
+ }
+
+ @Override
+ public String getArtifactDescription() {
+ return "desc";
+ }
+
+ @Override
+ public String getArtifactChecksum() {
+ return "true";
+ }
+ };
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java
index 0bb5186a17..6621300210 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java
@@ -48,201 +48,201 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
/**
* Set of utility methods used for Unit testing
- *
*/
public class BPMNUtil {
- public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
- String pID = getProcessInstanceId(processEngineServices,
- processDefinitionID);
- assertProcessInstanceFinished(processEngineServices, pID);
- HistoricVariableInstance responseData = processEngineServices.getHistoryService()
- .createHistoricVariableInstanceQuery().processInstanceId(pID)
- .variableName(name)
- .singleResult();
-
- if (responseData != null) {
- return (responseData.getValue() != null ? responseData.getValue().toString(): null);
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
- String pID = getProcessInstanceId(processEngineServices,
- processDefinitionID);
- assertProcessInstanceFinished(processEngineServices, pID);
- Object responseData = processEngineServices.getHistoryService()
- .createHistoricVariableInstanceQuery().processInstanceId(pID)
- .variableName(name)
- .singleResult()
- .getValue();
- return (T) responseData;
- }
-
-
- public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {
- String pID = getProcessInstanceId(processEngineServices,
- processDefinitionID);
- assertNotNull(pID);
- assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count() > 0);
- }
-
- public static void assertNoProcessInstance(ProcessEngineServices processEngineServices, String processDefinitionID) {
- assertNull(getProcessInstanceId(processEngineServices, processDefinitionID));
- }
-
- public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
- assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
- }
-
- public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {
- String pID = getProcessInstanceId(processEngineServices,
- processDefinitionID);
- assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count());
- }
-
- private static String getProcessInstanceId(
- ProcessEngineServices processEngineServices, String processDefinitionID) {
- List<HistoricProcessInstance> historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
- String pID = null;
- for (HistoricProcessInstance hInstance: historyList) {
- if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
- pID = hInstance.getId();
- break;
- }
- }
- return pID;
- }
-
- public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
- return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count() == 1 ? true: false;
- }
-
-
- private static void buildVariable(String key, String value, Map<String,Object> variableValueType) {
- Map<String, Object> host = new HashMap<>();
- host.put("value", value);
- host.put("type", "String");
- variableValueType.put(key, host);
- }
-
- public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) {
- WorkflowResource workflowResource = new WorkflowResource();
- VariableMapImpl variableMap = new VariableMapImpl();
-
- Map<String, Object> variableValueType = new HashMap<>();
- for (String key : variables.keySet()) {
- buildVariable(key, variables.get(key), variableValueType);
- }
- buildVariable("mso-service-request-timeout","600", variableValueType);
- variableMap.put("variables", variableValueType);
-
- workflowResource.setProcessEngineServices4junit(processEngineServices);
- Response response = workflowResource.startProcessInstanceByKey(
- processKey, variableMap);
- WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
- return workflowResponse;
- }
-
- //Check the runtime service to see whether the process is completed
- public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid) throws InterruptedException {
- // Don't wait forever
- long waitTime = 120000;
- long endTime = System.currentTimeMillis() + waitTime;
-
- while (true) {
- if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) {
- break;
- }
-
- if (System.currentTimeMillis() >= endTime) {
- fail("Process " + pid + " did not finish in " + waitTime + "ms");
- }
-
- Thread.sleep(200);
- }
- }
-
- /**
- * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object
- * @param processEngineServices
- * @param processKey
- * @param variables
- * @return
- * @throws InterruptedException
- */
- public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) throws InterruptedException {
- ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables);
- pthread.start();
- BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey);
- String pid = getProcessInstanceId(processEngineServices, processKey);
- //Caution: If there is a problem with workflow, this may wait for ever
- while (true) {
- pid = getProcessInstanceId(processEngineServices, processKey);
- if (!isProcessInstanceFinished(processEngineServices,pid)) {
- Thread.sleep(200);
- } else{
- break;
- }
- }
- //need to retrieve for second time ?
- pid = getProcessInstanceId(processEngineServices, processKey);
- waitForWorkflowToFinish(processEngineServices, pid);
- return pthread.workflowResponse;
- }
-
- /**
- * Execute workflow using async resource
- * @param processEngineServices
- * @param processKey
- * @param asyncResponse
- * @param variables
- */
- private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey, AsynchronousResponse asyncResponse, Map<String,String> variables) {
- WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
- VariableMapImpl variableMap = new VariableMapImpl();
-
- Map<String, Object> variableValueType = new HashMap<>();
- for (String key : variables.keySet()) {
- buildVariable(key, variables.get(key), variableValueType);
- }
- buildVariable("mso-service-request-timeout","600", variableValueType);
- variableMap.put("variables", variableValueType);
-
- workflowResource.setProcessEngineServices4junit(processEngineServices);
- workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMap);
- }
-
- /**
- * Helper class which executes workflow in a thread
- *
- */
- static class ProcessThread extends Thread {
-
- public WorkflowResponse workflowResponse = null;
- public String processKey;
- public AsynchronousResponse asyncResponse = spy(AsynchronousResponse.class);
- public boolean started;
- public ProcessEngineServices processEngineServices;
- public Map<String,String> variables;
-
- public ProcessThread(String processKey, ProcessEngineServices processEngineServices, Map<String,String> variables) {
- this.processKey = processKey;
- this.processEngineServices = processEngineServices;
- this.variables = variables;
- }
-
- public void run() {
- started = true;
- doAnswer(new Answer<Void>() {
- public Void answer(InvocationOnMock invocation) {
- Response response = (Response) invocation.getArguments()[0];
- workflowResponse = (WorkflowResponse) response.getEntity();
- return null;
- }
- }).when(asyncResponse).setResponse(any(Response.class));
- executeAsyncFlow(processEngineServices, processKey, asyncResponse, variables);
- }
- }
+ public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
+ String pID = getProcessInstanceId(processEngineServices,
+ processDefinitionID);
+ assertProcessInstanceFinished(processEngineServices, pID);
+ HistoricVariableInstance responseData = processEngineServices.getHistoryService()
+ .createHistoricVariableInstanceQuery().processInstanceId(pID)
+ .variableName(name)
+ .singleResult();
+
+ if (responseData != null) {
+ return (responseData.getValue() != null ? responseData.getValue().toString() : null);
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
+ String pID = getProcessInstanceId(processEngineServices,
+ processDefinitionID);
+ assertProcessInstanceFinished(processEngineServices, pID);
+ Object responseData = processEngineServices.getHistoryService()
+ .createHistoricVariableInstanceQuery().processInstanceId(pID)
+ .variableName(name)
+ .singleResult()
+ .getValue();
+ return (T) responseData;
+ }
+
+
+ public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {
+ String pID = getProcessInstanceId(processEngineServices,
+ processDefinitionID);
+ assertNotNull(pID);
+ assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count() > 0);
+ }
+
+ public static void assertNoProcessInstance(ProcessEngineServices processEngineServices, String processDefinitionID) {
+ assertNull(getProcessInstanceId(processEngineServices, processDefinitionID));
+ }
+
+ public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
+ assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
+ }
+
+ public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {
+ String pID = getProcessInstanceId(processEngineServices,
+ processDefinitionID);
+ assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count());
+ }
+
+ private static String getProcessInstanceId(
+ ProcessEngineServices processEngineServices, String processDefinitionID) {
+ List<HistoricProcessInstance> historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
+ String pID = null;
+ for (HistoricProcessInstance hInstance : historyList) {
+ if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
+ pID = hInstance.getId();
+ break;
+ }
+ }
+ return pID;
+ }
+
+ public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
+ return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count() == 1 ? true : false;
+ }
+
+
+ private static void buildVariable(String key, String value, Map<String, Object> variableValueType) {
+ Map<String, Object> host = new HashMap<>();
+ host.put("value", value);
+ host.put("type", "String");
+ variableValueType.put(key, host);
+ }
+
+ public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey, Map<String, String> variables) {
+ WorkflowResource workflowResource = new WorkflowResource();
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+ for (String key : variables.keySet()) {
+ buildVariable(key, variables.get(key), variableValueType);
+ }
+ buildVariable("mso-service-request-timeout", "600", variableValueType);
+ variableMap.put("variables", variableValueType);
+
+ workflowResource.setProcessEngineServices4junit(processEngineServices);
+ Response response = workflowResource.startProcessInstanceByKey(
+ processKey, variableMap);
+ WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
+ return workflowResponse;
+ }
+
+ //Check the runtime service to see whether the process is completed
+ public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid) throws InterruptedException {
+ // Don't wait forever
+ long waitTime = 120000;
+ long endTime = System.currentTimeMillis() + waitTime;
+
+ while (true) {
+ if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) {
+ break;
+ }
+
+ if (System.currentTimeMillis() >= endTime) {
+ fail("Process " + pid + " did not finish in " + waitTime + "ms");
+ }
+
+ Thread.sleep(200);
+ }
+ }
+
+ /**
+ * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object
+ *
+ * @param processEngineServices
+ * @param processKey
+ * @param variables
+ * @return
+ * @throws InterruptedException
+ */
+ public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey, Map<String, String> variables) throws InterruptedException {
+ ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables);
+ pthread.start();
+ BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey);
+ String pid = getProcessInstanceId(processEngineServices, processKey);
+ //Caution: If there is a problem with workflow, this may wait for ever
+ while (true) {
+ pid = getProcessInstanceId(processEngineServices, processKey);
+ if (!isProcessInstanceFinished(processEngineServices, pid)) {
+ Thread.sleep(200);
+ } else {
+ break;
+ }
+ }
+ //need to retrieve for second time ?
+ pid = getProcessInstanceId(processEngineServices, processKey);
+ waitForWorkflowToFinish(processEngineServices, pid);
+ return pthread.workflowResponse;
+ }
+
+ /**
+ * Execute workflow using async resource
+ *
+ * @param processEngineServices
+ * @param processKey
+ * @param asyncResponse
+ * @param variables
+ */
+ private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey, AsynchronousResponse asyncResponse, Map<String, String> variables) {
+ WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+ for (String key : variables.keySet()) {
+ buildVariable(key, variables.get(key), variableValueType);
+ }
+ buildVariable("mso-service-request-timeout", "600", variableValueType);
+ variableMap.put("variables", variableValueType);
+
+ workflowResource.setProcessEngineServices4junit(processEngineServices);
+ workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMap);
+ }
+
+ /**
+ * Helper class which executes workflow in a thread
+ */
+ static class ProcessThread extends Thread {
+
+ public WorkflowResponse workflowResponse = null;
+ public String processKey;
+ public AsynchronousResponse asyncResponse = spy(AsynchronousResponse.class);
+ public boolean started;
+ public ProcessEngineServices processEngineServices;
+ public Map<String, String> variables;
+
+ public ProcessThread(String processKey, ProcessEngineServices processEngineServices, Map<String, String> variables) {
+ this.processKey = processKey;
+ this.processEngineServices = processEngineServices;
+ this.variables = variables;
+ }
+
+ public void run() {
+ started = true;
+ doAnswer(new Answer<Void>() {
+ public Void answer(InvocationOnMock invocation) {
+ Response response = (Response) invocation.getArguments()[0];
+ workflowResponse = (WorkflowResponse) response.getEntity();
+ return null;
+ }
+ }).when(asyncResponse).setResponse(any(Response.class));
+ executeAsyncFlow(processEngineServices, processKey, asyncResponse, variables);
+ }
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java
index 9d4dac2333..5438130a97 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -37,181 +37,180 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
* Unit test for CompleteMsoProcess.bpmn.
*/
public class CompleteMsoProcessTest extends WorkflowTest {
-
- private void executeFlow(String inputRequestFile) throws InterruptedException {
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile);
- Map<String, String> variables = new HashMap<>();
- variables.put("CompleteMsoProcessRequest",inputRequestFile);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CompleteMsoProcess", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- logEnd();
- }
-
- @Test
- @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void msoCompletionRequestWithNotificationurl_200() throws Exception {
- logStart();
-
- //Execute Flow
- executeFlow(gMsoCompletionRequestWithNotificationurl());
-
- //Verify Error
- String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
- Assert.assertEquals("200", CMSO_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
- logEnd();
- }
-
- @Test
- @Ignore // BROKEN TEST
- @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void msoCompletionRequestWithNotificationurl_500() throws Exception {
- logStart();
-
- //Execute Flow
- executeFlow(gMsoCompletionRequestWithNotificationurl());
-
- //Verify Error
- String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
- Assert.assertEquals("500", CMSO_ResponseCode);
- Assert.assertFalse((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
- logEnd();
- }
-
- @Test
- @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void msoCompletionRequestWithNoNotificationurl() throws Exception {
- logStart();
-
- //Execute Flow
- executeFlow(gMsoCompletionRequestWithNoNotificationurl());
-
- //Verify Error
- String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
- Assert.assertEquals("200", CMSO_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
- logEnd();
- }
-
- @Test
- @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception {
- logStart();
-
- //Execute Flow
- executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId());
-
- //Verify Error
- String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
- Assert.assertEquals("200", CMSO_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
- logEnd();
- }
-
- @Test
- @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception {
- logStart();
-
- //Execute Flow
- executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId());
-
- //Verify Error
- String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
- Assert.assertEquals("200", CMSO_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
- logEnd();
- }
-
- public String gMsoCompletionRequestWithNotificationurl() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id>uCPE1020_STUW105_5002</ns:request-id>"
- + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>OMX</ns:source>"
- + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
-
-
-
- public String gMsoCompletionRequestWithNoNotificationurl() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id>uCPE1020_STUW105_5002</ns:request-id>"
- + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>OMX</ns:source>"
- + " <ns:notification-url></ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
-
- public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id></ns:request-id>"
- + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>OMX</ns:source>"
- + " <ns:notification-url></ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
-
- public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id></ns:request-id>"
- + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>OMX</ns:source>"
- + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
+
+ private void executeFlow(String inputRequestFile) throws InterruptedException {
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile);
+ Map<String, String> variables = new HashMap<>();
+ variables.put("CompleteMsoProcessRequest", inputRequestFile);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CompleteMsoProcess", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void msoCompletionRequestWithNotificationurl_200() throws Exception {
+ logStart();
+
+ //Execute Flow
+ executeFlow(gMsoCompletionRequestWithNotificationurl());
+
+ //Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ @Test
+ @Ignore // BROKEN TEST
+ @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void msoCompletionRequestWithNotificationurl_500() throws Exception {
+ logStart();
+
+ //Execute Flow
+ executeFlow(gMsoCompletionRequestWithNotificationurl());
+
+ //Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("500", CMSO_ResponseCode);
+ Assert.assertFalse((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void msoCompletionRequestWithNoNotificationurl() throws Exception {
+ logStart();
+
+ //Execute Flow
+ executeFlow(gMsoCompletionRequestWithNoNotificationurl());
+
+ //Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception {
+ logStart();
+
+ //Execute Flow
+ executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId());
+
+ //Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception {
+ logStart();
+
+ //Execute Flow
+ executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId());
+
+ //Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ public String gMsoCompletionRequestWithNotificationurl() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
+ + " <ns:request-information>"
+ + " <ns:request-id>uCPE1020_STUW105_5002</ns:request-id>"
+ + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
+ + " <ns:source>OMX</ns:source>"
+ + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>"
+ + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+
+ public String gMsoCompletionRequestWithNoNotificationurl() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>"
+ + " <ns:request-id>uCPE1020_STUW105_5002</ns:request-id>"
+ + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
+ + " <ns:source>OMX</ns:source>"
+ + " <ns:notification-url></ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>"
+ + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+ public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>"
+ + " <ns:request-id></ns:request-id>"
+ + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
+ + " <ns:source>OMX</ns:source>"
+ + " <ns:notification-url></ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>"
+ + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+ public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>"
+ + " <ns:request-id></ns:request-id>"
+ + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
+ + " <ns:source>OMX</ns:source>"
+ + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>"
+ + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java
index 845f06045a..c900f291c3 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -34,100 +34,99 @@ import org.junit.Test;
* Unit test cases for ConfirmVolumeGroupName.bpmn
*/
public class ConfirmVolumeGroupNameTest extends WorkflowTest {
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "subprocess/ConfirmVolumeGroupName.bpmn"
- })
- public void sunnyDay() throws Exception {
-
- logStart();
- MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
-
- System.out.println("Before starting process");
-
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
- variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME");
- variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
- System.out.println("after setting variables");
- runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables);
- String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse");
- String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode");
-
- assertEquals("200", responseCode);
- System.out.println(response);
- logEnd();
- }
-
- /**
- * Rainy day scenario - nonexisting volume group id.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "subprocess/ConfirmVolumeGroupName.bpmn"
- })
- public void rainyDayNoVolumeGroupId() throws Exception {
-
- logStart();
- MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
-
- System.out.println("Before starting process");
-
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST");
- variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- System.out.println("after setting variables");
- runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables);
- String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse");
- String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode");
-
- assertEquals("404", responseCode);
- System.out.println(response);
-
- logEnd();
- }
-
- /**
- * Rainy day scenario - volume group name does not match the name in AAI
- *
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "subprocess/ConfirmVolumeGroupName.bpmn"
- })
- public void rainyDayNameDoesNotMatch() throws Exception {
-
- logStart();
- MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
-
- System.out.println("Before starting process");
-
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
- variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME");
- System.out.println("after setting variables");
- runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables);
- String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse");
- String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode");
-
- assertEquals("404", responseCode);
- System.out.println(response);
-
- logEnd();
- }
+ /**
+ * Sunny day scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/ConfirmVolumeGroupName.bpmn"
+ })
+ public void sunnyDay() throws Exception {
+
+ logStart();
+ MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
+
+ System.out.println("Before starting process");
+
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
+ variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME");
+ variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
+ System.out.println("after setting variables");
+ runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables);
+ String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse");
+ String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode");
+
+ assertEquals("200", responseCode);
+ System.out.println(response);
+ logEnd();
+ }
+
+ /**
+ * Rainy day scenario - nonexisting volume group id.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/ConfirmVolumeGroupName.bpmn"
+ })
+ public void rainyDayNoVolumeGroupId() throws Exception {
+
+ logStart();
+ MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
+
+ System.out.println("Before starting process");
+
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST");
+ variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ System.out.println("after setting variables");
+ runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables);
+ String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse");
+ String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode");
+
+ assertEquals("404", responseCode);
+ System.out.println(response);
+
+ logEnd();
+ }
+
+ /**
+ * Rainy day scenario - volume group name does not match the name in AAI
+ *
+ * @throws Exception
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/ConfirmVolumeGroupName.bpmn"
+ })
+ public void rainyDayNameDoesNotMatch() throws Exception {
+
+ logStart();
+ MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
+
+ System.out.println("Before starting process");
+
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
+ variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME");
+ System.out.println("after setting variables");
+ runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables);
+ String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse");
+ String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode");
+
+ assertEquals("404", responseCode);
+ System.out.println(response);
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java
index 457128f104..8b47304672 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java
@@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -37,55 +37,54 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
/**
* Please describe the ConfirmVolumeGroupTenantTest.java class
- *
*/
public class ConfirmVolumeGroupTenantTest extends WorkflowTest {
- @Test
- @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"})
- public void testRemoveLayer3Service_success() throws Exception{
- MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml");
+ @Test
+ @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"})
+ public void testRemoveLayer3Service_success() throws Exception {
+ MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables);
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables);
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch");
- String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch");
- String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "volumeHeatStackId");
+ String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch");
+ String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch");
+ String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "volumeHeatStackId");
- assertEquals("Response", "true", actualNameMatch);
- assertEquals("Response", "true", actualIdMatch);
- assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse);
- }
+ assertEquals("Response", "true", actualNameMatch);
+ assertEquals("Response", "true", actualIdMatch);
+ assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse);
+ }
- @Test
- @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"})
- public void testRemoveLayer3Service_idsNotMatch() throws Exception{
- MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
+ @Test
+ @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"})
+ public void testRemoveLayer3Service_idsNotMatch() throws Exception {
+ MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables);
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables);
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch");
- String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch");
- String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "WorkflowException");
+ String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch");
+ String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch");
+ String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "WorkflowException");
- assertEquals("Response", "true", actualNameMatch);
- assertEquals("Response", "false", actualIdMatch);
- assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant]", actualResponse);
+ assertEquals("Response", "true", actualNameMatch);
+ assertEquals("Response", "false", actualIdMatch);
+ assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant]", actualResponse);
- }
+ }
- private void setVariables(Map<String, String> variables) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("volumeGroupId","a8399879-31b3-4973-be26-0a0cbe776b58");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("aicCloudRegion", "MDTWNJ21");
- }
+ private void setVariables(Map<String, String> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("volumeGroupId", "a8399879-31b3-4973-be26-0a0cbe776b58");
+ variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
+ variables.put("aicCloudRegion", "MDTWNJ21");
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java
index b2b7760327..37a2a5ae2e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -40,238 +40,238 @@ import org.openecomp.mso.bpmn.core.WorkflowException;
* Unit test for CreateAAIVfModule.bpmn.
*/
public class CreateAAIVfModuleTest extends WorkflowTest {
-
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModule.bpmn"
- })
- public void TestCreateGenericVnfSuccess_200() {
- MockAAIGenericVnfSearch();
- MockAAICreateGenericVnf();
- MockAAIVfModulePUT(true);
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfName", "STMTN5MMSC22");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0");
- variables.put("vfModuleModelName", "MMSC::module-0");
-
- runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
- String response = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode");
- String responseCode = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode");
- Assert.assertEquals("201", responseCode);
- System.out.println(response);
- }
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModule.bpmn"
+ })
+ public void TestCreateGenericVnfSuccess_200() {
+
+ MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC22");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0");
+ variables.put("vfModuleModelName", "MMSC::module-0");
+
+ runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode");
+ String responseCode = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode");
+ Assert.assertEquals("201", responseCode);
+ System.out.println(response);
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModule.bpmn"
+ })
+ public void TestCreateVfModuleSuccess_200() {
+ // create Add-on VF Module for existing Generic VNF
+ MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0");
+ variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0");
+ runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode");
+ String responseCode = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode");
+ Assert.assertEquals("201", responseCode);
+ System.out.println(response);
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModule.bpmn"
+ })
+ public void TestQueryGenericVnfFailure_5000() {
+ MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC23");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0");
+ variables.put("vfModuleModelName", "MMSC::module-0");
+ runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
+ Assert.assertEquals(500, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Error occurred attempting to query AAI"));
+ System.out.println(exception.getErrorMessage());
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModule.bpmn"
+ })
+ public void TestCreateDupGenericVnfFailure_1002() {
+ MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC21");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
+ variables.put("vfModuleModelName", "MMSC::module-0");
+ runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists"));
+ System.out.println(exception.getErrorMessage());
+ }
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModule.bpmn"
- })
- public void TestCreateVfModuleSuccess_200() {
- // create Add-on VF Module for existing Generic VNF
- MockAAIGenericVnfSearch();
- MockAAICreateGenericVnf();
- MockAAIVfModulePUT(true);
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0");
- variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0");
- runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
- String response = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode");
- String responseCode = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode");
- Assert.assertEquals("201", responseCode);
- System.out.println(response);
- }
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModule.bpmn"
+ })
+ public void TestCreateDupVfModuleFailure_1002() {
+ MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0");
+ variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0");
+ runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF"));
+ System.out.println(exception.getErrorMessage());
+ }
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModule.bpmn"
- })
- public void TestQueryGenericVnfFailure_5000() {
- MockAAIGenericVnfSearch();
- MockAAICreateGenericVnf();
- MockAAIVfModulePUT(true);
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfName", "STMTN5MMSC23");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0");
- variables.put("vfModuleModelName", "MMSC::module-0");
- runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
- Assert.assertEquals(500, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("Error occurred attempting to query AAI"));
- System.out.println(exception.getErrorMessage());
- }
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModule.bpmn"
+ })
+ public void TestCreateGenericVnfFailure_5000() {
+ MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC22");
+ variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
+ variables.put("vfModuleModelName", "PCRF::module-0");
+ runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ System.out.println(exception.getErrorMessage());
+ }
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModule.bpmn"
- })
- public void TestCreateDupGenericVnfFailure_1002() {
- MockAAIGenericVnfSearch();
- MockAAICreateGenericVnf();
- MockAAIVfModulePUT(true);
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfName", "STMTN5MMSC21");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
- variables.put("vfModuleModelName", "MMSC::module-0");
- runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists"));
- System.out.println(exception.getErrorMessage());
- }
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModule.bpmn"
+ })
+ public void TestCreateGenericVnfFailure_1002() {
+ MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
+ variables.put("vfModuleModelName", "PCRF::module-0");
+ runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
+ System.out.println(exception.getErrorMessage());
+ }
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModule.bpmn"
- })
- public void TestCreateDupVfModuleFailure_1002() {
- MockAAIGenericVnfSearch();
- MockAAICreateGenericVnf();
- MockAAIVfModulePUT(true);
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0");
- variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0");
- runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF"));
- System.out.println(exception.getErrorMessage());
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModule.bpmn"
- })
- public void TestCreateGenericVnfFailure_5000() {
- MockAAIGenericVnfSearch();
- MockAAICreateGenericVnf();
- MockAAIVfModulePUT(true);
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfName", "STMTN5MMSC22");
- variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
- variables.put("vfModuleModelName", "PCRF::module-0");
- runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
- Assert.assertEquals(5000, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
- System.out.println(exception.getErrorMessage());
- }
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModule.bpmn"
+ })
+ public void TestCreateVfModuleFailure_5000() {
+ MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0");
+ variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0");
+ runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ System.out.println(exception.getErrorMessage());
+ }
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModule.bpmn"
- })
- public void TestCreateGenericVnfFailure_1002() {
- MockAAIGenericVnfSearch();
- MockAAICreateGenericVnf();
- MockAAIVfModulePUT(true);
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
- variables.put("vfModuleModelName", "PCRF::module-0");
- runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
- System.out.println(exception.getErrorMessage());
- }
+ public static void MockAAICreateGenericVnf() {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .withRequestBody(containing("<service-id>00000000-0000-0000-0000-000000000000</service-id>"))
+ .willReturn(aResponse()
+ .withStatus(201)));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .withRequestBody(containing("<service-id>99999999-9999-9999-9999-999999999999</service-id>"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ }
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModule.bpmn"
- })
- public void TestCreateVfModuleFailure_5000() {
- MockAAIGenericVnfSearch();
- MockAAICreateGenericVnf();
- MockAAIVfModulePUT(true);
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0");
- variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0");
- runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException");
- Assert.assertEquals(5000, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
- System.out.println(exception.getErrorMessage());
- }
+ // start of mocks used locally and by other VF Module unit tests
+ public static void MockAAIVfModulePUT(boolean isCreate) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("MMSC"))
+ .willReturn(aResponse()
+ .withStatus(isCreate ? 201 : 200)));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("PCRF"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
- public static void MockAAICreateGenericVnf(){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
- .withRequestBody(containing("<service-id>00000000-0000-0000-0000-000000000000</service-id>"))
- .willReturn(aResponse()
- .withStatus(201)));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
- .withRequestBody(containing("<service-id>99999999-9999-9999-9999-999999999999</service-id>"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockAAIVfModulePUT(boolean isCreate){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MMSC"))
- .willReturn(aResponse()
- .withStatus(isCreate ? 201 : 200)));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java
index 5cc26459e8..3d0fd50feb 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -38,99 +38,99 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit tests for CreateAAIVfModuleVolumeGroup.bpmn.
*/
public class CreateAAIVfModuleVolumeGroupTest extends WorkflowTest {
-
- /**
- * Test the happy path through the flow.
- */
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn"
- })
- public void happyPath() throws IOException {
-
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
- MockGetGenericVnfByIdWithPriority("skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2);
- MockPutVfModuleIdNoResponse("skask", "PCRF", "lukewarm");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
- invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(200, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI returns a 404.
- */
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn"
- })
- public void badGet() throws IOException {
-
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
- MockGetVfModuleId("skask", ".*", "VfModularity/VfModule-supercool.xml", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
- invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
- */
- @Test
- @Deployment(resources = {
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn"
- })
- public void badPatch() throws IOException {
-
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
- MockGetVfModuleId("skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
- invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn"
+ })
+ public void happyPath() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+ MockGetGenericVnfByIdWithPriority("skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2);
+ MockPutVfModuleIdNoResponse("skask", "PCRF", "lukewarm");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(200, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn"
+ })
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+ MockGetVfModuleId("skask", ".*", "VfModularity/VfModule-supercool.xml", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn"
+ })
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+ MockGetVfModuleId("skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DecomposeServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DecomposeServiceTest.java
index 7295cd8e10..13b9529d82 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DecomposeServiceTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DecomposeServiceTest.java
@@ -16,11 +16,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -33,63 +34,62 @@ import org.openecomp.mso.bpmn.common.WorkflowTest;
/**
* Unit Test for the DecomposeService Flow
- *
*/
public class DecomposeServiceTest extends WorkflowTest {
- public DecomposeServiceTest() throws IOException {
+ public DecomposeServiceTest() throws IOException {
+
+ }
- }
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/DecomposeService.bpmn"})
+ public void testDecomposeService_success() throws Exception {
+ MockGetServiceResourcesCatalogData("cmw-123-456-789", "/getCatalogServiceResourcesData.json", "1.0");
- @Test
- @Deployment(resources = {"subprocess/BuildingBlock/DecomposeService.bpmn"})
- public void testDecomposeService_success() throws Exception{
- MockGetServiceResourcesCatalogData("cmw-123-456-789", "/getCatalogServiceResourcesData.json", "1.0");
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", businessKey, variables);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
- invokeSubProcess("DecomposeService", businessKey, variables);
+ waitForProcessEnd(businessKey, 10000);
- waitForProcessEnd(businessKey, 10000);
+ Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue(isProcessEnded(businessKey));
+ }
- }
-
- //@Test
- @Deployment(resources = {"subprocess/BuildingBlock/DecomposeService.bpmn"})
- public void testDecomposeService_success_partial() throws Exception{
- MockGetServiceResourcesCatalogData("cmw-123-456-789", "/getCatalogServiceResourcesDataNoNetwork.json");
+ //@Test
+ @Deployment(resources = {"subprocess/BuildingBlock/DecomposeService.bpmn"})
+ public void testDecomposeService_success_partial() throws Exception {
+ MockGetServiceResourcesCatalogData("cmw-123-456-789", "/getCatalogServiceResourcesDataNoNetwork.json");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
- invokeSubProcess("DecomposeService", businessKey, variables);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
+ waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
+ Assert.assertTrue(isProcessEnded(businessKey));
- }
+ }
- private void setVariablesSuccess(Map<String, Object> variables, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId", siId);
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"cmw-123-456-789\"," +
- "\"modelVersionId\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
+ String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"cmw-123-456-789\"," +
+ "\"modelVersionId\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
- }
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java
index 564927a854..2b70a086c8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -39,605 +39,606 @@ import org.openecomp.mso.bpmn.core.WorkflowException;
* Unit test for DeleteAAIVfModule.bpmn.
*/
public class DeleteAAIVfModuleTest extends WorkflowTest {
- private static final String EOL = "\n";
-
- @Test
- @Deployment(resources = {
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestDeleteGenericVnfSuccess_200() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- MockAAIGenericVnfSearch();
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("DeleteAAIVfModuleRequest","<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id> <vnf-name>STMTN5MMSC21</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id> <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
- runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
- String response = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode");
- String responseCode = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode");
- Assert.assertEquals("200", responseCode);
- System.out.println(response);
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestDeleteVfModuleSuccess_200() {
- // delete Add-on Vf Module for existing Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- MockAAIGenericVnfSearch();
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("DeleteAAIVfModuleRequest",request);
- runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
- String response = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode");
- String responseCode = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode");
- Assert.assertEquals("200", responseCode);
- System.out.println(response);
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestQueryGenericVnfFailure_5000() {
- // query Generic Vnf failure (non-404) with A&AI
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c723</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC23</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a71</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- MockAAIGenericVnfSearch();
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("DeleteAAIVfModuleRequest",request);
- runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
- Assert.assertEquals(5000, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
- System.out.println(exception.getErrorMessage());
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestQueryGenericVnfFailure_1002() {
- // attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404)
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c722</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a72</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC22-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- MockAAIGenericVnfSearch();
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("DeleteAAIVfModuleRequest",request);
- runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
- System.out.println(exception.getErrorMessage());
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestDeleteGenericVnfFailure_5000() {
- // A&AI failure (non-200) when attempting to delete a Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- MockAAIGenericVnfSearch();
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("DeleteAAIVfModuleRequest",request);
- runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
- Assert.assertEquals(5000, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
- System.out.println(exception.getErrorMessage());
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestDeleteVfModuleFailure_5000() {
- // A&AI failure (non-200) when attempting to delete a Vf Module
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- MockAAIGenericVnfSearch();
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("DeleteAAIVfModuleRequest",request);
- runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
- Assert.assertEquals(5000, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
- System.out.println(exception.getErrorMessage());
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestDeleteVfModuleFailure_1002_1() {
- // failure attempting to delete Base Module when not the last Vf Module
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- MockAAIGenericVnfSearch();
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("DeleteAAIVfModuleRequest",request);
- runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module"));
- System.out.println(exception.getErrorMessage());
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestDeleteVfModuleFailure_1002_2() {
- // failure attempting to delete a Vf Module that does not exist (A&AI returns 404)
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76
- MockAAIGenericVnfSearch();
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("DeleteAAIVfModuleRequest","<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id> <vnf-name>STMTN5MMSC20</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id> <vf-module-name>STMTN5MMSC20-MMSC::module-2-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
- runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id"));
- System.out.println(exception.getErrorMessage());
- }
-
- // Start of VF Modularization A&AI mocks
-
- public static void MockAAIGenericVnfSearch(){
- String body;
-
- // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- // The following stubs are for DeleteAAIVfModule
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000020</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000074</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000075</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000019</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000076</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000077</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000018</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000078</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- }
- public static void MockAAIDeleteGenericVnf(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- }
-
- public static void MockAAIDeleteVfModule(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
-
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
+ private static final String EOL = "\n";
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DeleteAAIVfModule.bpmn"
+ })
+ public void TestDeleteGenericVnfSuccess_200() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ MockAAIGenericVnfSearch();
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("DeleteAAIVfModuleRequest", "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id> <vnf-name>STMTN5MMSC21</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id> <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
+ runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode");
+ String responseCode = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode");
+ Assert.assertEquals("200", responseCode);
+ System.out.println(response);
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DeleteAAIVfModule.bpmn"
+ })
+ public void TestDeleteVfModuleSuccess_200() {
+ // delete Add-on Vf Module for existing Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ MockAAIGenericVnfSearch();
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("DeleteAAIVfModuleRequest", request);
+ runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode");
+ String responseCode = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode");
+ Assert.assertEquals("200", responseCode);
+ System.out.println(response);
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DeleteAAIVfModule.bpmn"
+ })
+ public void TestQueryGenericVnfFailure_5000() {
+ // query Generic Vnf failure (non-404) with A&AI
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c723</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC23</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a71</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ MockAAIGenericVnfSearch();
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("DeleteAAIVfModuleRequest", request);
+ runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ System.out.println(exception.getErrorMessage());
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DeleteAAIVfModule.bpmn"
+ })
+ public void TestQueryGenericVnfFailure_1002() {
+ // attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404)
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c722</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a72</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC22-MMSC::module-1-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ MockAAIGenericVnfSearch();
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("DeleteAAIVfModuleRequest", request);
+ runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
+ System.out.println(exception.getErrorMessage());
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DeleteAAIVfModule.bpmn"
+ })
+ public void TestDeleteGenericVnfFailure_5000() {
+ // A&AI failure (non-200) when attempting to delete a Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ MockAAIGenericVnfSearch();
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("DeleteAAIVfModuleRequest", request);
+ runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ System.out.println(exception.getErrorMessage());
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DeleteAAIVfModule.bpmn"
+ })
+ public void TestDeleteVfModuleFailure_5000() {
+ // A&AI failure (non-200) when attempting to delete a Vf Module
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ MockAAIGenericVnfSearch();
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("DeleteAAIVfModuleRequest", request);
+ runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ System.out.println(exception.getErrorMessage());
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DeleteAAIVfModule.bpmn"
+ })
+ public void TestDeleteVfModuleFailure_1002_1() {
+ // failure attempting to delete Base Module when not the last Vf Module
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ MockAAIGenericVnfSearch();
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("DeleteAAIVfModuleRequest", request);
+ runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module"));
+ System.out.println(exception.getErrorMessage());
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DeleteAAIVfModule.bpmn"
+ })
+ public void TestDeleteVfModuleFailure_1002_2() {
+ // failure attempting to delete a Vf Module that does not exist (A&AI returns 404)
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76
+ MockAAIGenericVnfSearch();
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("DeleteAAIVfModuleRequest", "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id> <vnf-name>STMTN5MMSC20</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id> <vf-module-name>STMTN5MMSC20-MMSC::module-2-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
+ runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException");
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id"));
+ System.out.println(exception.getErrorMessage());
+ }
+
+ // Start of VF Modularization A&AI mocks
+
+ public static void MockAAIGenericVnfSearch() {
+ String body;
+
+ // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+
+ body =
+ "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>1508691</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>1508691</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ // The following stubs are for DeleteAAIVfModule
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000021</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000073</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000020</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000074</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000075</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000019</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000076</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000077</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000018</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000078</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000021</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000073</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+ }
+
+ public static void MockAAIDeleteGenericVnf() {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ }
+
+ public static void MockAAIDeleteVfModule() {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
+
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java
index 257cec9b11..d51bd66885 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -39,197 +39,195 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
* Unit test for FalloutHandler.bpmn.
*/
public class FalloutHandlerTest extends WorkflowTest {
- private void setupMocks() {
- stubFor(post(urlEqualTo("/dbadapters/MsoRequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody("<DbTag>Notified</DbTag>")));
- stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody("<DbTag>Notified</DbTag>")));
- }
-
- private void executeFlow(String inputRequestFile) throws InterruptedException {
- String method = getClass().getSimpleName() + "." + new Object() {
- }.getClass().getEnclosingMethod().getName();
- System.out.println("STARTED TEST: " + method);
-
- //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile);
- Map<String, String> variables = new HashMap<>();
- variables.put("FalloutHandlerRequest",inputRequestFile);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "FalloutHandler", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- System.out.println("ENDED TEST: " + method);
- }
-
- @Test
- @Deployment(resources = {"subprocess/FalloutHandler.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void msoFalloutHandlerWithNotificationurl_200() throws Exception{
- String method = getClass().getSimpleName() + "." + new Object() {
- }.getClass().getEnclosingMethod().getName();
- System.out.println("STARTED TEST: " + method);
-
- //Setup Mocks
- setupMocks();
- //Execute Flow
- executeFlow(gMsoFalloutHandlerWithNotificationurl());
- //Verify Error
- String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode");
- Assert.assertEquals("200", FH_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator"));
- }
-
- public String gMsoFalloutHandlerWithNotificationurl() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns7=\"http://org.openecomp/mso/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id>uCPE1020_STUW105_5002</ns7:request-id>"
- + " <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>OMX</ns7:source>"
- + " <ns7:notification-url>http://localhost:28090/CCD/StatusNotification</ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- return xml;
-
- }
-
-
-
-
- @Test
- @Deployment(resources = {"subprocess/FalloutHandler.bpmn"})
- public void msoFalloutHandlerWithNoNotificationurl() throws Exception{
- String method = getClass().getSimpleName() + "." + new Object() {
- }.getClass().getEnclosingMethod().getName();
- System.out.println("STARTED TEST: " + method);
- //Setup Mocks
- setupMocks();
- //Execute Flow
- executeFlow(gMsoFalloutHandlerWithNoNotificationurl());
- //Verify Error
- String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode");
- Assert.assertEquals("200", FH_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator"));
- }
-
- public String gMsoFalloutHandlerWithNoNotificationurl() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns7=\"http://org.openecomp/mso/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id>uCPE1020_STUW105_5002</ns7:request-id>"
- + " <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>OMX</ns7:source>"
- + " <ns7:notification-url></ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- return xml;
- }
-
- @Test
- @Deployment(resources = {"subprocess/FalloutHandler.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception{
- String method = getClass().getSimpleName() + "." + new Object() {
- }.getClass().getEnclosingMethod().getName();
- System.out.println("STARTED TEST: " + method);
- //Setup Mocks
- setupMocks();
- //Execute Flow
- executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId());
- //Verify Error
- String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode");
- Assert.assertEquals("200", FH_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator"));
- }
-
- public String gMsoFalloutHandlerWithNotificationurlNoRequestId() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns7=\"http://org.openecomp/mso/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id></ns7:request-id>"
- + " <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>OMX</ns7:source>"
- + " <ns7:notification-url>www.test.com</ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- return xml;
- }
-
- @Test
- @Deployment(resources = {"subprocess/FalloutHandler.bpmn"})
- public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception{
- String method = getClass().getSimpleName() + "." + new Object() {
- }.getClass().getEnclosingMethod().getName();
- System.out.println("STARTED TEST: " + method);
- //Setup Mocks
- setupMocks();
- //Execute Flow
- executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId());
- //Verify Error
- String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode");
- Assert.assertEquals("200", FH_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator"));
- }
-
- public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns7=\"http://org.openecomp/mso/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id></ns7:request-id>"
- + " <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>OMX</ns7:source>"
- + " <ns7:notification-url></ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- return xml;
- }
-
+ private void setupMocks() {
+ stubFor(post(urlEqualTo("/dbadapters/MsoRequestsDbAdapter"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("<DbTag>Notified</DbTag>")));
+ stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("<DbTag>Notified</DbTag>")));
+ }
+
+ private void executeFlow(String inputRequestFile) throws InterruptedException {
+ String method = getClass().getSimpleName() + "." + new Object() {
+ }.getClass().getEnclosingMethod().getName();
+ System.out.println("STARTED TEST: " + method);
+
+ //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile);
+ Map<String, String> variables = new HashMap<>();
+ variables.put("FalloutHandlerRequest", inputRequestFile);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "FalloutHandler", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ System.out.println("ENDED TEST: " + method);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/FalloutHandler.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void msoFalloutHandlerWithNotificationurl_200() throws Exception {
+ String method = getClass().getSimpleName() + "." + new Object() {
+ }.getClass().getEnclosingMethod().getName();
+ System.out.println("STARTED TEST: " + method);
+
+ //Setup Mocks
+ setupMocks();
+ //Execute Flow
+ executeFlow(gMsoFalloutHandlerWithNotificationurl());
+ //Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode");
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator"));
+ }
+
+ public String gMsoFalloutHandlerWithNotificationurl() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns7=\"http://org.openecomp/mso/request/types/v1\">"
+ + " <ns7:request-information>"
+ + " <ns7:request-id>uCPE1020_STUW105_5002</ns7:request-id>"
+ + " <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>OMX</ns7:source>"
+ + " <ns7:notification-url>http://localhost:28090/CCD/StatusNotification</ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>"
+ + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>"
+ + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+
+ }
+
+
+ @Test
+ @Deployment(resources = {"subprocess/FalloutHandler.bpmn"})
+ public void msoFalloutHandlerWithNoNotificationurl() throws Exception {
+ String method = getClass().getSimpleName() + "." + new Object() {
+ }.getClass().getEnclosingMethod().getName();
+ System.out.println("STARTED TEST: " + method);
+ //Setup Mocks
+ setupMocks();
+ //Execute Flow
+ executeFlow(gMsoFalloutHandlerWithNoNotificationurl());
+ //Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode");
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator"));
+ }
+
+ public String gMsoFalloutHandlerWithNoNotificationurl() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns7=\"http://org.openecomp/mso/request/types/v1\">"
+ + " <ns7:request-information>"
+ + " <ns7:request-id>uCPE1020_STUW105_5002</ns7:request-id>"
+ + " <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>OMX</ns7:source>"
+ + " <ns7:notification-url></ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>"
+ + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>"
+ + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/FalloutHandler.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception {
+ String method = getClass().getSimpleName() + "." + new Object() {
+ }.getClass().getEnclosingMethod().getName();
+ System.out.println("STARTED TEST: " + method);
+ //Setup Mocks
+ setupMocks();
+ //Execute Flow
+ executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId());
+ //Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode");
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator"));
+ }
+
+ public String gMsoFalloutHandlerWithNotificationurlNoRequestId() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns7=\"http://org.openecomp/mso/request/types/v1\">"
+ + " <ns7:request-information>"
+ + " <ns7:request-id></ns7:request-id>"
+ + " <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>OMX</ns7:source>"
+ + " <ns7:notification-url>www.test.com</ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>"
+ + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>"
+ + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/FalloutHandler.bpmn"})
+ public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception {
+ String method = getClass().getSimpleName() + "." + new Object() {
+ }.getClass().getEnclosingMethod().getName();
+ System.out.println("STARTED TEST: " + method);
+ //Setup Mocks
+ setupMocks();
+ //Execute Flow
+ executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId());
+ //Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode");
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator"));
+ }
+
+ public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns7=\"http://org.openecomp/mso/request/types/v1\">"
+ + " <ns7:request-information>"
+ + " <ns7:request-id></ns7:request-id>"
+ + " <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>OMX</ns7:source>"
+ + " <ns7:notification-url></ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>"
+ + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>"
+ + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java
index 125a9ad916..afa24c6a29 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java
@@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -41,239 +41,238 @@ import org.junit.Test;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-
/**
* Please describe the GenericDeleteServiceTest.java class
- *
*/
public class GenericDeleteServiceTest extends WorkflowTest {
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
- public void testGenericDeleteService_success_serviceInstance() throws Exception{
- MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234");
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
- String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
- String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
- assertEquals("true", foundIndicator);
- assertEquals("true", successIndicator);
- assertEquals("true", resourceVersionProvidedFlag);
- assertEquals(null, workflowException);
- }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
- public void testGenericDeleteService_success_serviceSubscription() throws Exception{
-
- MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 204);
-
- Map<String, String> variables = new HashMap<>();
- setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
- String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
- String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
-
- assertEquals("true", foundIndicator);
- assertEquals("true", successIndicator);
- assertEquals("true", resourceVersionProvidedFlag);
- assertEquals(null, workflowException);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
- public void testGenericDeleteService_success_instanceNoResourceVersion() throws Exception {
- MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceSubscription.xml");
- MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
- String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
- String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
-
- assertEquals("true", foundIndicator);
- assertEquals("true", successIndicator);
- assertEquals("false", resourceVersionProvidedFlag);
- assertEquals(null, workflowException);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
- public void testGenericDeleteService_success_subscriptionNoResourceVersion() throws Exception{
- MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml");
- MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 204);
-
- Map<String, String> variables = new HashMap<>();
- setVariablesSubscription(variables, null, "1604-MVM-26", "SDN-ETHERNET-INTERNET", null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
- String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
- String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
-
- assertEquals("true", foundIndicator);
- assertEquals("true", successIndicator);
- assertEquals("false", resourceVersionProvidedFlag);
- assertEquals(null, workflowException);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
- public void testGenericDeleteService_success_get404Response() throws Exception{
-
- MockGetServiceInstance_404("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET");
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
+ public void testGenericDeleteService_success_serviceInstance() throws Exception {
+ MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234");
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234");
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
+ String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
+ String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
+ assertEquals("true", foundIndicator);
+ assertEquals("true", successIndicator);
+ assertEquals("true", resourceVersionProvidedFlag);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
+ public void testGenericDeleteService_success_serviceSubscription() throws Exception {
+
+ MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 204);
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
+ String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
+ String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
+
+ assertEquals("true", foundIndicator);
+ assertEquals("true", successIndicator);
+ assertEquals("true", resourceVersionProvidedFlag);
+ assertEquals(null, workflowException);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
+ public void testGenericDeleteService_success_instanceNoResourceVersion() throws Exception {
+ MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceSubscription.xml");
+ MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
+ String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
+ String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
+
+ assertEquals("true", foundIndicator);
+ assertEquals("true", successIndicator);
+ assertEquals("false", resourceVersionProvidedFlag);
+ assertEquals(null, workflowException);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
+ public void testGenericDeleteService_success_subscriptionNoResourceVersion() throws Exception {
+ MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml");
+ MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 204);
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesSubscription(variables, null, "1604-MVM-26", "SDN-ETHERNET-INTERNET", null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
+ String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
+ String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
+
+ assertEquals("true", foundIndicator);
+ assertEquals("true", successIndicator);
+ assertEquals("false", resourceVersionProvidedFlag);
+ assertEquals(null, workflowException);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
+ public void testGenericDeleteService_success_get404Response() throws Exception {
+
+ MockGetServiceInstance_404("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
- String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
- String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
+ String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
+ String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
- assertEquals("false", foundIndicator);
- assertEquals("true", successIndicator);
- assertEquals("false", resourceVersionProvidedFlag);
- assertEquals(null, workflowException);
- }
+ assertEquals("false", foundIndicator);
+ assertEquals("true", successIndicator);
+ assertEquals("false", resourceVersionProvidedFlag);
+ assertEquals(null, workflowException);
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
- public void testGenericDeleteService_success_subscriptionGetEmpty200() throws Exception{
- MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 200);
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
+ public void testGenericDeleteService_success_subscriptionGetEmpty200() throws Exception {
+ MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 200);
- Map<String, String> variables = new HashMap<>();
- setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "");
+ Map<String, String> variables = new HashMap<>();
+ setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
- String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
- String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
+ String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
+ String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
- assertEquals("false", foundIndicator);
- assertEquals("true", successIndicator);
- assertEquals("false", resourceVersionProvidedFlag);
- assertEquals(null, workflowException);
+ assertEquals("false", foundIndicator);
+ assertEquals("true", successIndicator);
+ assertEquals("false", resourceVersionProvidedFlag);
+ assertEquals(null, workflowException);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
- public void testGenericDeleteService_success_delete404Response() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
+ public void testGenericDeleteService_success_delete404Response() throws Exception {
- MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GENDSI_getServiceInstanceResponse.xml");
- MockDeleteServiceInstance_404("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234");
+ MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GENDSI_getServiceInstanceResponse.xml");
+ MockDeleteServiceInstance_404("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234");
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234");
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
- String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
- String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
+ String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
+ String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
- assertEquals("false", foundIndicator);
- assertEquals("true", successIndicator);
- assertEquals("true", resourceVersionProvidedFlag);
- assertEquals(null, workflowException);
- }
+ assertEquals("false", foundIndicator);
+ assertEquals("true", successIndicator);
+ assertEquals("true", resourceVersionProvidedFlag);
+ assertEquals(null, workflowException);
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
- public void testGenericDeleteService_error_invalidVariables() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
+ public void testGenericDeleteService_error_invalidVariables() throws Exception {
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "1234");
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "1234");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
- String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
- String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
+ String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
+ String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
- String expectedResponse = "WorkflowException[processKey=GenericDeleteService,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]";
+ String expectedResponse = "WorkflowException[processKey=GenericDeleteService,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]";
- assertEquals("false", foundIndicator);
- assertEquals("false", successIndicator);
- assertEquals("true", resourceVersionProvidedFlag);
- assertEquals(expectedResponse, workflowException);
+ assertEquals("false", foundIndicator);
+ assertEquals("false", successIndicator);
+ assertEquals("true", resourceVersionProvidedFlag);
+ assertEquals(expectedResponse, workflowException);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
- public void testGenericDeleteService_error_getBadAAIResponse() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"})
+ public void testGenericDeleteService_error_getBadAAIResponse() throws Exception {
- MockGetServiceInstance_500("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "aaiFault.xml");
+ MockGetServiceInstance_500("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "aaiFault.xml");
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null);
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null);
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
- String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
- String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
-
- String expectedResponse = "WorkflowException[processKey=GenericDeleteService,errorCode=500,errorMessage=<requestError><serviceException><messageId>SVC3002</messageId><text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text><variables><variable>PUTcustomer</variable><variable>SubName01</variable><variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]</variable><variable>ERR.5.4.5105</variable></variables></serviceException></requestError>" + "\n" +
- "]";
-
- assertEquals("false", foundIndicator);
- assertEquals("false", successIndicator);
- assertEquals("false", resourceVersionProvidedFlag);
- assertEquals(expectedResponse, workflowException);
- }
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator");
+ String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator");
+ String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException");
+
+ String expectedResponse = "WorkflowException[processKey=GenericDeleteService,errorCode=500,errorMessage=<requestError><serviceException><messageId>SVC3002</messageId><text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text><variables><variable>PUTcustomer</variable><variable>SubName01</variable><variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]</variable><variable>ERR.5.4.5105</variable></variables></serviceException></requestError>" + "\n" +
+ "]";
+
+ assertEquals("false", foundIndicator);
+ assertEquals("false", successIndicator);
+ assertEquals("false", resourceVersionProvidedFlag);
+ assertEquals(expectedResponse, workflowException);
+ }
- private void setVariablesInstance(Map<String, String> variables, String siId, String globalCustId, String serviceType, String reVersion) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("GENDS_serviceInstanceId", siId);
- variables.put("GENDS_globalCustomerId",globalCustId);
- variables.put("GENDS_serviceType", serviceType);
- variables.put("GENDS_resourceVersion", reVersion);
- variables.put("GENDS_type", "service-instance");
- }
+ private void setVariablesInstance(Map<String, String> variables, String siId, String globalCustId, String serviceType, String reVersion) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("GENDS_serviceInstanceId", siId);
+ variables.put("GENDS_globalCustomerId", globalCustId);
+ variables.put("GENDS_serviceType", serviceType);
+ variables.put("GENDS_resourceVersion", reVersion);
+ variables.put("GENDS_type", "service-instance");
+ }
- private void setVariablesSubscription(Map<String, String> variables, String siId, String globalCustId, String serviceType, String reVersion) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("GENDS_serviceInstanceId", siId);
- variables.put("GENDS_globalCustomerId",globalCustId);
- variables.put("GENDS_serviceType", serviceType);
- variables.put("GENDS_resourceVersion", reVersion);
- variables.put("GENDS_type", "service-subscription");
- }
+ private void setVariablesSubscription(Map<String, String> variables, String siId, String globalCustId, String serviceType, String reVersion) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("GENDS_serviceInstanceId", siId);
+ variables.put("GENDS_globalCustomerId", globalCustId);
+ variables.put("GENDS_serviceType", serviceType);
+ variables.put("GENDS_resourceVersion", reVersion);
+ variables.put("GENDS_type", "service-subscription");
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java
index add9a32d61..8049b05781 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java
@@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -42,180 +42,179 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
/**
* Please describe the GenericDeleteVnfTest.java class
- *
*/
public class GenericDeleteVnfTest extends WorkflowTest {
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
- public void testGenericDeleteVnf_success_genericVnf() throws Exception{
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
+ public void testGenericDeleteVnf_success_genericVnf() throws Exception {
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- assertVariables("true", "true", "true", null);
+ assertVariables("true", "true", "true", null);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
- public void testGenericDeleteVnf_success_vce() throws Exception{
- MockDeleteVce("testVnfId123", "testReVer123", 204);
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
+ public void testGenericDeleteVnf_success_vce() throws Exception {
+ MockDeleteVce("testVnfId123", "testReVer123", 204);
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "vce", "testReVer123");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "vce", "testReVer123");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- assertVariables("true", "true", "true", null);
+ assertVariables("true", "true", "true", null);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
- public void testGenericDeleteVnf_success_genericVnfNoResourceVersion() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
+ public void testGenericDeleteVnf_success_genericVnfNoResourceVersion() throws Exception {
- MockGetGenericVnfById("/testVnfId123", "GenericFlows/getGenericVnfByNameResponse.xml", 200);
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ MockGetGenericVnfById("/testVnfId123", "GenericFlows/getGenericVnfByNameResponse.xml", 200);
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "generic-vnf", "");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "generic-vnf", "");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- assertVariables("true", "true", "false", null);
+ assertVariables("true", "true", "false", null);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
- public void testGenericDeleteVnf_success_vceNoResourceVersion() throws Exception{
- MockDeleteVce("testVnfId123", "testReVer123", 204);
- MockGetVceById("testVnfId123", "GenericFlows/getVceResponse.xml");
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
+ public void testGenericDeleteVnf_success_vceNoResourceVersion() throws Exception {
+ MockDeleteVce("testVnfId123", "testReVer123", 204);
+ MockGetVceById("testVnfId123", "GenericFlows/getVceResponse.xml");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "vce", null);
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "vce", null);
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- assertVariables("true", "true", "false", null);
+ assertVariables("true", "true", "false", null);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
- public void testGenericDeleteVnf_success_genericVnf404() throws Exception{
- MockDeleteGenericVnf("testVnfId123", "testReVer123", 404);
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
+ public void testGenericDeleteVnf_success_genericVnf404() throws Exception {
+ MockDeleteGenericVnf("testVnfId123", "testReVer123", 404);
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- assertVariables("true", "false", "true", null);
+ assertVariables("true", "false", "true", null);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
- public void testGenericDeleteVnf_success_vce404() throws Exception{
- MockDeleteVce("testVnfId123", "testReVer123", 404);
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
+ public void testGenericDeleteVnf_success_vce404() throws Exception {
+ MockDeleteVce("testVnfId123", "testReVer123", 404);
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "vce", "testReVer123");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "vce", "testReVer123");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- assertVariables("true", "false", "true", null);
+ assertVariables("true", "false", "true", null);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
- public void testGenericDeleteVnf_success_genericVnfNoResourceVersion404() throws Exception{
- MockGetGenericVnfById_404("testVnfId123");
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
+ public void testGenericDeleteVnf_success_genericVnfNoResourceVersion404() throws Exception {
+ MockGetGenericVnfById_404("testVnfId123");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "generic-vnf", "");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "generic-vnf", "");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- assertVariables("true", "false", "false", null);
+ assertVariables("true", "false", "false", null);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
- public void testGenericDeleteVnf_error_missingVariables() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
+ public void testGenericDeleteVnf_error_missingVariables() throws Exception {
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "", "testReVer123");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "", "testReVer123");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]");
+ assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]");
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
- public void testGenericDeleteVnf_error_genericVnf500() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
+ public void testGenericDeleteVnf_error_genericVnf500() throws Exception {
- MockDeleteGenericVnf_500("testVnfId123", "testReVer123");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123");
+ MockDeleteGenericVnf_500("testVnfId123", "testReVer123");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Received a bad response from AAI]");
+ assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Received a bad response from AAI]");
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
- public void testGenericDeleteVnf_error_genericVnf412() throws Exception{
- MockDeleteGenericVnf("testVnfId123", "testReVer123", 412);
+ @Test
+ @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"})
+ public void testGenericDeleteVnf_error_genericVnf412() throws Exception {
+ MockDeleteGenericVnf("testVnfId123", "testReVer123", 412);
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=412,errorMessage=Delete Vnf Received a resource-version Mismatch Error Response from AAI]");
+ assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=412,errorMessage=Delete Vnf Received a resource-version Mismatch Error Response from AAI]");
- }
+ }
- private void assertVariables(String exSuccessIndicator, String exFound, String exRVProvided, String exWorkflowException) {
+ private void assertVariables(String exSuccessIndicator, String exFound, String exRVProvided, String exWorkflowException) {
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_FoundIndicator");
- String rvProvided = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_resourceVersionProvided");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_FoundIndicator");
+ String rvProvided = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_resourceVersionProvided");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "WorkflowException");
- assertEquals(exSuccessIndicator, successIndicator);
- assertEquals(exFound, found);
- assertEquals(exRVProvided, rvProvided);
- assertEquals(exWorkflowException, workflowException);
- }
+ assertEquals(exSuccessIndicator, successIndicator);
+ assertEquals(exFound, found);
+ assertEquals(exRVProvided, rvProvided);
+ assertEquals(exWorkflowException, workflowException);
+ }
- private void setVariables(Map<String, String> variables, String vnfId, String type, String resourceVer) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("GENDV_vnfId", vnfId);
- variables.put("GENDV_type", type);
- variables.put("GENDV_resourceVersion", resourceVer);
- }
+ private void setVariables(Map<String, String> variables, String vnfId, String type, String resourceVer) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("GENDV_vnfId", vnfId);
+ variables.put("GENDV_type", type);
+ variables.put("GENDV_resourceVersion", resourceVer);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java
index 0198395750..c20028a636 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java
@@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -52,439 +52,439 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
public class GenericGetServiceTest extends WorkflowTest {
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstance() throws Exception{
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- assertEquals("true", successIndicator);
- assertEquals("true", found);
- assertEquals("false", obtainUrl);
- assertEquals("false", byName);
- assertNotNull(response);
- assertEquals(null, workflowException);
- }
-
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceSubscription() throws Exception{
-
- MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
-
- assertEquals("true", successIndicator);
- assertEquals("true", found);
- assertEquals("false", obtainUrl);
- assertEquals("false", byName);
- assertNotNull(response);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstance_byName() throws Exception{
-
- MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, null, "1604-MVM-26", null, null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
-
- assertEquals("true", successIndicator);
- assertEquals("true", found);
- assertEquals("true", obtainUrl);
- assertEquals("true", byName);
- assertNotNull(response);
- assertEquals("200", siUrlResponseCode);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstance_byId() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
-
- assertEquals("true", successIndicator);
- assertEquals("true", found);
- assertEquals("true", obtainUrl);
- assertEquals("false", byName);
- assertNotNull(response);
- assertEquals("200", siUrlResponseCode);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstance_404Response() throws Exception{
-
- MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
-
- assertEquals("true", successIndicator);
- assertEquals("false", found);
- assertEquals("false", obtainUrl);
- assertEquals("false", byName);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceSubscription404() throws Exception{
- MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", 404);
-
- Map<String, String> variables = new HashMap<>();
- setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
-
- assertEquals("true", successIndicator);
- assertEquals("false", found);
- assertEquals("false", obtainUrl);
- assertEquals("false", byName);
- assertNotNull(response);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstanceByName404() throws Exception{
-
- MockNodeQueryServiceInstanceByName_404("1604-MVM-26");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "", "1604-MVM-26", null, null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
-
- assertEquals("true", successIndicator);
- assertEquals("false", found);
- assertEquals("true", obtainUrl);
- assertEquals("true", byName);
- assertEquals("404", siUrlResponseCode);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstanceById404() throws Exception{
-
- MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
-
- assertEquals("true", successIndicator);
- assertEquals("false", found);
- assertEquals("true", obtainUrl);
- assertEquals("false", byName);
- assertEquals("404", siUrlResponseCode);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception{
-
- MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", " ");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
-
- assertEquals("true", successIndicator);
- assertEquals("false", found);
- assertEquals("false", obtainUrl);
- assertEquals("false", byName);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception{
- MockNodeQueryServiceInstanceByName("1604-MVM-26", "");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "", "1604-MVM-26", null, null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
-
- assertEquals("true", successIndicator);
- assertEquals("false", found);
- assertEquals("true", obtainUrl);
- assertEquals("true", byName);
- assertEquals("200", siUrlResponseCode);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", "");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
-
- assertEquals("true", successIndicator);
- assertEquals("false", found);
- assertEquals("true", obtainUrl);
- assertEquals("false", byName);
- assertEquals("200", siUrlResponseCode);
- assertEquals(null, workflowException);
- }
-
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception{
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
-
- String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.]";
-
- assertEquals("false", successIndicator);
- assertEquals("false", found);
- assertEquals("false", obtainUrl);
- assertEquals("false", byName);
- assertEquals(expectedWorkflowException, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception{
-
- Map<String, String> variables = new HashMap<>();
- setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
-
- String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.]";
-
-
- assertEquals("false", successIndicator);
- assertEquals("false", found);
- assertEquals("false", obtainUrl);
- assertEquals("false", byName);
- assertEquals(expectedWorkflowException, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception{
-
- MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceInstance() throws Exception {
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertEquals(null, workflowException);
+ }
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]";
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceSubscription() throws Exception {
- assertEquals("false", successIndicator);
- assertEquals("false", found);
- assertEquals("false", obtainUrl);
- assertEquals("false", byName);
- assertEquals(expectedWorkflowException, workflowException);
- }
+ MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml");
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception{
+ Map<String, String> variables = new HashMap<>();
+ setVariablesSubscription(variables, "", null, "1604-MVM-26", "SDN-ETHERNET-INTERNET");
- MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET");
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertEquals(null, workflowException);
+ }
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceInstance_byName() throws Exception {
- String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]";
+ MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- assertEquals("false", successIndicator);
- assertEquals("false", found);
- assertEquals("true", obtainUrl);
- assertEquals("false", byName);
- assertEquals("500", siUrlResponseCode);
- assertEquals(expectedWorkflowException, workflowException);
- }
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, null, "1604-MVM-26", null, null);
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception{
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- MockNodeQueryServiceInstanceByName_500("1604-MVM-26");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("true", byName);
+ assertNotNull(response);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, null, "1604-MVM-26", null, null);
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceInstance_byId() throws Exception {
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
- String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
- String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]";
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
- assertEquals("false", successIndicator);
- assertEquals("false", found);
- assertEquals("true", obtainUrl);
- assertEquals("true", byName);
- assertEquals("500", siUrlResponseCode);
- assertEquals(expectedWorkflowException, workflowException);
- }
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
@Test
@Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstance_byNameServicePresent() throws Exception{
+ public void testGenericGetService_success_serviceInstance_404Response() throws Exception {
+
+ MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%2F1604%2F0026%2FSW_INTERNET");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceSubscription404() throws Exception {
+ MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", 404);
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceInstanceByName404() throws Exception {
+
+ MockNodeQueryServiceInstanceByName_404("1604-MVM-26");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "", "1604-MVM-26", null, null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("true", byName);
+ assertEquals("404", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceInstanceById404() throws Exception {
+
+ MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals("404", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception {
+
+ MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", " ");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception {
+ MockNodeQueryServiceInstanceByName("1604-MVM-26", "");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "", "1604-MVM-26", null, null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("true", byName);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception {
+
+ MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", "");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception {
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.]";
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception {
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.]";
+
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception {
+
+ MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]";
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception {
+
+ MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]";
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals("500", siUrlResponseCode);
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception {
+
+ MockNodeQueryServiceInstanceByName_500("1604-MVM-26");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, null, "1604-MVM-26", null, null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]";
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("true", byName);
+ assertEquals("500", siUrlResponseCode);
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceInstance_byNameServicePresent() throws Exception {
MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml");
MockGetServiceInstance("XyCorporation", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
@@ -504,57 +504,57 @@ public class GenericGetServiceTest extends WorkflowTest {
assertEquals("true", successIndicator);
assertEquals("true", found);
- assertNotNull(resourceLink);
+ assertNotNull(resourceLink);
assertNotNull(response);
assertEquals("200", siUrlResponseCode);
assertEquals(null, workflowException);
}
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
- public void testGenericGetService_success_serviceInstance_byNameServiceNotPresent() throws Exception{
-
- MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml");
- MockGetServiceInstance("CorporationNotPresent", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, null, "1604-MVM-26", "CorporationNotPresent", null);
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
- String resourceLink = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_resourceLink");
- String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
- String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
-
- assertEquals("true", successIndicator);
- assertEquals("false", found);
- assertEquals(null, resourceLink);
- assertEquals(" ", response);
- assertEquals("200", siUrlResponseCode);
- assertEquals(null, workflowException);
- }
-
- private void setVariablesInstance(Map<String, String> variables, String siId, String siName, String globalCustId, String serviceType) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("GENGS_serviceInstanceId", siId);
- variables.put("GENGS_serviceInstanceName", siName);
- variables.put("GENGS_globalCustomerId",globalCustId);
- variables.put("GENGS_serviceType", serviceType);
- variables.put("GENGS_type", "service-instance");
- }
-
- private void setVariablesSubscription(Map<String, String> variables, String siId, String siName, String globalCustId, String serviceType) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("GENGS_serviceInstanceId", siId);
- variables.put("GENGS_serviceInstanceName", siName);
- variables.put("GENGS_globalCustomerId",globalCustId);
- variables.put("GENGS_serviceType", serviceType);
- variables.put("GENGS_type", "service-subscription");
- }
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
+ public void testGenericGetService_success_serviceInstance_byNameServiceNotPresent() throws Exception {
+
+ MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml");
+ MockGetServiceInstance("CorporationNotPresent", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariablesInstance(variables, null, "1604-MVM-26", "CorporationNotPresent", null);
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
+ String resourceLink = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_resourceLink");
+ String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals(null, resourceLink);
+ assertEquals(" ", response);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ private void setVariablesInstance(Map<String, String> variables, String siId, String siName, String globalCustId, String serviceType) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("GENGS_serviceInstanceId", siId);
+ variables.put("GENGS_serviceInstanceName", siName);
+ variables.put("GENGS_globalCustomerId", globalCustId);
+ variables.put("GENGS_serviceType", serviceType);
+ variables.put("GENGS_type", "service-instance");
+ }
+
+ private void setVariablesSubscription(Map<String, String> variables, String siId, String siName, String globalCustId, String serviceType) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("GENGS_serviceInstanceId", siId);
+ variables.put("GENGS_serviceInstanceName", siName);
+ variables.put("GENGS_globalCustomerId", globalCustId);
+ variables.put("GENGS_serviceType", serviceType);
+ variables.put("GENGS_type", "service-subscription");
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java
index 4922263744..6095209f40 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java
@@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -43,149 +43,148 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
/**
* Please describe the GenericGetVnfTest.java class
- *
*/
public class GenericGetVnfTest extends WorkflowTest {
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"})
- public void testGenericGetVnf_success_genericVnf() throws Exception{
- MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator");
- String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName");
- String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException");
-
- assertEquals("true", successIndicator);
- assertEquals("true", found);
- assertEquals("false", byName);
- assertNotNull(response);
- assertNotNull(vnf);
- assertEquals(null, workflowException);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"})
- public void testGenericGetVnf_success_vce() throws Exception{
- MockGetVceById("testVnfId123[?]depth=1", "GenericFlows/getVceResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "testVnfName123", "vce");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator");
- String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName");
- String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException");
-
- assertEquals("true", successIndicator);
- assertEquals("true", found);
- assertEquals("false", byName);
- assertNotNull(response);
- assertNotNull(vnf);
- assertEquals(null, workflowException);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"})
- public void testGenericGetVnf_success_genericVnfByName() throws Exception{
- MockGetGenericVnfByNameWithDepth("testVnfName123", 1, "GenericFlows/getGenericVnfResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "", "testVnfName123", "generic-vnf");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator");
- String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName");
- String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException");
-
- assertEquals("true", successIndicator);
- assertEquals("true", found);
- assertEquals("true", byName);
- assertNotNull(response);
- assertNotNull(vnf);
- assertEquals(null, workflowException);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"})
- public void testGenericGetVnf_success_vceByName() throws Exception{
- MockGetGenericVceByNameWithDepth("testVnfName123", 1, "GenericFlows/getVceByNameResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, null, "testVnfName123", "vce");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator");
- String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName");
- String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException");
-
- assertEquals("true", successIndicator);
- assertEquals("true", found);
- assertEquals("true", byName);
- assertNotNull(response);
- assertNotNull(vnf);
- assertEquals(null, workflowException);
-
- }
-
- @Test
- @Ignore // BROKEN TEST (previously ignored)
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"})
- public void testGenericGetVnf_error_genericVnf500() throws Exception{
-
- MockGetGenericVnfById_500("testVnfId123");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator");
- String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException");
- String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName");
-
- String expectedWorkflowException = "WorkflowException[processKey=GenericGetVnf,errorCode=500,errorMessage=Incoming VnfId and VnfName are null. VnfId or VnfName is required!]";
-
- assertEquals("false", successIndicator);
- assertEquals("false", found);
- assertEquals("false", byName);
-
- assertEquals(expectedWorkflowException, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String vnfId, String vnfName, String type) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("GENGV_vnfId", vnfId);
- variables.put("GENGV_vnfName",vnfName);
- variables.put("GENGV_type", type);
- }
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"})
+ public void testGenericGetVnf_success_genericVnf() throws Exception {
+ MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator");
+ String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName");
+ String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException");
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertNotNull(vnf);
+ assertEquals(null, workflowException);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"})
+ public void testGenericGetVnf_success_vce() throws Exception {
+ MockGetVceById("testVnfId123[?]depth=1", "GenericFlows/getVceResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "testVnfName123", "vce");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator");
+ String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName");
+ String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException");
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertNotNull(vnf);
+ assertEquals(null, workflowException);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"})
+ public void testGenericGetVnf_success_genericVnfByName() throws Exception {
+ MockGetGenericVnfByNameWithDepth("testVnfName123", 1, "GenericFlows/getGenericVnfResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "", "testVnfName123", "generic-vnf");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator");
+ String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName");
+ String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException");
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("true", byName);
+ assertNotNull(response);
+ assertNotNull(vnf);
+ assertEquals(null, workflowException);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"})
+ public void testGenericGetVnf_success_vceByName() throws Exception {
+ MockGetGenericVceByNameWithDepth("testVnfName123", 1, "GenericFlows/getVceByNameResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, null, "testVnfName123", "vce");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator");
+ String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName");
+ String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException");
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("true", byName);
+ assertNotNull(response);
+ assertNotNull(vnf);
+ assertEquals(null, workflowException);
+
+ }
+
+ @Test
+ @Ignore // BROKEN TEST (previously ignored)
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"})
+ public void testGenericGetVnf_error_genericVnf500() throws Exception {
+
+ MockGetGenericVnfById_500("testVnfId123");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator");
+ String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException");
+ String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName");
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetVnf,errorCode=500,errorMessage=Incoming VnfId and VnfName are null. VnfId or VnfName is required!]";
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", byName);
+
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ private void setVariables(Map<String, String> variables, String vnfId, String vnfName, String type) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("GENGV_vnfId", vnfId);
+ variables.put("GENGV_vnfName", vnfName);
+ variables.put("GENGV_type", type);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java
index 0e0a237090..7406becb11 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java
@@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -38,145 +38,144 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
/**
* Please describe the GenericPutVnf.java class
- *
*/
public class GenericPutVnfTest extends WorkflowTest {
- private String genericVnfPayload = "<generic-vnf><vnf-id>testId</vnf-id></generic-vnf>";
- private String vcePayload = "<vce><vnf-id>testId</vnf-id></vce>";
+ private String genericVnfPayload = "<generic-vnf><vnf-id>testId</vnf-id></generic-vnf>";
+ private String vcePayload = "<vce><vnf-id>testId</vnf-id></vce>";
- @Test
- @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
- public void testGenericPutVnf_success_genericVnf() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
+ public void testGenericPutVnf_success_genericVnf() throws Exception {
- MockPutGenericVnf("testVnfId123");
+ MockPutGenericVnf("testVnfId123");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
- assertEquals("true", successIndicator);
- assertEquals(null, workflowException);
+ assertEquals("true", successIndicator);
+ assertEquals(null, workflowException);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
- public void testGenericPutVnf_success_vce() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
+ public void testGenericPutVnf_success_vce() throws Exception {
- MockPutVce("testVnfId123");
+ MockPutVce("testVnfId123");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", vcePayload, "vce");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", vcePayload, "vce");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
- assertEquals("true", successIndicator);
- assertEquals(null, workflowException);
+ assertEquals("true", successIndicator);
+ assertEquals(null, workflowException);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
- public void testGenericPutVnf_error_missingType() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
+ public void testGenericPutVnf_error_missingType() throws Exception {
- MockPutGenericVnf("testVnfId123");
+ MockPutGenericVnf("testVnfId123");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", genericVnfPayload, "");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", genericVnfPayload, "");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
- String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=500,errorMessage=Incoming Vnf Payload and/or Type is null. These Variables are required!]";
+ String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=500,errorMessage=Incoming Vnf Payload and/or Type is null. These Variables are required!]";
- assertEquals("false", successIndicator);
- assertEquals(expectedWFEX, workflowException);
+ assertEquals("false", successIndicator);
+ assertEquals(expectedWFEX, workflowException);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
- public void testGenericPutVnf_error_missingPayload() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
+ public void testGenericPutVnf_error_missingPayload() throws Exception {
- MockPutGenericVnf("testVnfId123");
+ MockPutGenericVnf("testVnfId123");
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", genericVnfPayload, "");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", genericVnfPayload, "");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
- String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=500,errorMessage=Incoming Vnf Payload and/or Type is null. These Variables are required!]";
+ String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=500,errorMessage=Incoming Vnf Payload and/or Type is null. These Variables are required!]";
- assertEquals("false", successIndicator);
- assertEquals(expectedWFEX, workflowException);
+ assertEquals("false", successIndicator);
+ assertEquals(expectedWFEX, workflowException);
- }
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
- public void testGenericPutVnf_error_404() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
+ public void testGenericPutVnf_error_404() throws Exception {
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
- String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=404,errorMessage=Received a bad response from AAI]";
+ String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=404,errorMessage=Received a bad response from AAI]";
- assertEquals("false", successIndicator);
- assertEquals(expectedWFEX, workflowException);
- }
+ assertEquals("false", successIndicator);
+ assertEquals(expectedWFEX, workflowException);
+ }
- @Test
- @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
- public void testGenericPutVnf_error_400() throws Exception{
+ @Test
+ @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"})
+ public void testGenericPutVnf_error_400() throws Exception {
- MockPutGenericVnf("/testVnfId123", 400);
+ MockPutGenericVnf("/testVnfId123", 400);
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf");
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
+ String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException");
- String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=400,errorMessage=Received a bad response from AAI]";
+ String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=400,errorMessage=Received a bad response from AAI]";
- assertEquals("false", successIndicator);
- assertEquals(expectedWFEX, workflowException);
+ assertEquals("false", successIndicator);
+ assertEquals(expectedWFEX, workflowException);
- }
+ }
- private void setVariables(Map<String, String> variables, String vnfId, String payload, String type) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("GENPV_vnfId", vnfId);
- variables.put("GENPV_vnfPayload",payload);
- variables.put("GENPV_type", type);
- }
+ private void setVariables(Map<String, String> variables, String vnfId, String payload, String type) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("GENPV_vnfId", vnfId);
+ variables.put("GENPV_vnfPayload", payload);
+ variables.put("GENPV_type", type);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/HomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/HomingTest.java
index 3210fe8fc7..a6b85e1a82 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/HomingTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/HomingTest.java
@@ -51,428 +51,427 @@ import org.openecomp.mso.bpmn.common.WorkflowTest;
*/
public class HomingTest extends WorkflowTest {
- ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
- String subscriber = "";
- String subscriber2 = "";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public HomingTest() throws IOException {
- String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf");
- String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net");
- String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf");
- String sniroCallbackNoSolution = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound");
- String sniroCallbackPolicyException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException");
- String sniroCallbackServiceException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException");
- callbacks.put("sniro", JSON, "SNIROResponse", sniroCallback);
- callbacks.put("sniro2", JSON, "SNIROResponse", sniroCallback2);
- callbacks.put("sniro3", JSON, "SNIROResponse", sniroCallback3);
- callbacks.put("sniroNoSol", JSON, "SNIROResponse", sniroCallbackNoSolution);
- callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", sniroCallbackPolicyException);
- callbacks.put("sniroServiceEx", JSON, "SNIROResponse", sniroCallbackServiceException);
-
- // Service Model
- ModelInfo sModel = new ModelInfo();
- sModel.setModelCustomizationUuid("testModelCustomizationUuid");
- sModel.setModelInstanceName("testModelInstanceName");
- sModel.setModelInvariantUuid("testModelInvariantId");
- sModel.setModelName("testModelName");
- sModel.setModelUuid("testModelUuid");
- sModel.setModelVersion("testModelVersion");
- // Service Instance
- ServiceInstance si = new ServiceInstance();
- si.setInstanceId("testServiceInstanceId123");
- // Allotted Resources
- List<AllottedResource> arList = new ArrayList<AllottedResource>();
- AllottedResource ar = new AllottedResource();
- ar.setResourceId("testResourceIdAR");
- ar.setResourceInstanceName("testARInstanceName");
- ModelInfo arModel = new ModelInfo();
- arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
- arModel.setModelInvariantUuid("testModelInvariantIdAR");
- arModel.setModelName("testModelNameAR");
- arModel.setModelVersion("testModelVersionAR");
- arModel.setModelUuid("testARModelUuid");
- arModel.setModelType("testModelTypeAR");
- ar.setModelInfo(arModel);
- AllottedResource ar2 = new AllottedResource();
- ar2.setResourceId("testResourceIdAR2");
- ar2.setResourceInstanceName("testAR2InstanceName");
- ModelInfo arModel2 = new ModelInfo();
- arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
- arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
- arModel2.setModelName("testModelNameAR2");
- arModel2.setModelVersion("testModelVersionAR2");
- arModel2.setModelUuid("testAr2ModelUuid");
- arModel2.setModelType("testModelTypeAR2");
- ar2.setModelInfo(arModel2);
- arList.add(ar);
- arList.add(ar2);
- // Vnfs
- List<VnfResource> vnfList = new ArrayList<VnfResource>();
- VnfResource vnf = new VnfResource();
- vnf.setResourceId("testResourceIdVNF");
- vnf.setResourceInstanceName("testVnfInstanceName");
- ModelInfo vnfModel = new ModelInfo();
- vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
- vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
- vnfModel.setModelName("testModelNameVNF");
- vnfModel.setModelVersion("testModelVersionVNF");
- vnfModel.setModelUuid("testVnfModelUuid");
- vnfModel.setModelType("testModelTypeVNF");
- vnf.setModelInfo(vnfModel);
- vnfList.add(vnf);
- System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString());
- serviceDecomposition.setModelInfo(sModel);
- serviceDecomposition.setServiceAllottedResources(arList);
- serviceDecomposition.setServiceVnfs(vnfList);
- serviceDecomposition.setServiceInstance(si);
-
- // Subscriber
- subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
- subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
- }
-
- @Test
- @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
- public void testHoming_success_2AR1Vnf() throws Exception {
-
- mockSNIRO();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
-
- invokeSubProcess("Homing", businessKey, variables);
-
- injectWorkflowMessages(callbacks, "sniro");
-
- waitForProcessEnd(businessKey, 10000);
-
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
- String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
-
- Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
- HomingSolution resourceARHoming = resourceAR.getHomingSolution();
- Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
- HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
- Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
- HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
- String resourceARHomingString = resourceARHoming.toString();
- resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
- String resourceARHoming2String = resourceARHoming2.toString();
- resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
- String resourceVNFHomingString = resourceVNFHoming.toString();
- resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
- expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
-
- assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
- assertEquals(verifySniroRequest(), expectedSniroRequest);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
- public void testHoming_success_2AR1Vnf2Net() throws Exception {
-
- mockSNIRO();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables2(variables);
-
- invokeSubProcess("Homing", businessKey, variables);
-
- injectWorkflowMessages(callbacks, "sniro2");
-
- waitForProcessEnd(businessKey, 10000);
-
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
- String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
-
- Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
- HomingSolution resourceARHoming = resourceAR.getHomingSolution();
- Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
- HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
- Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
- HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
- Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
- HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
- Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
- HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
-
- String resourceARHomingString = resourceARHoming.toString();
- resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
- String resourceARHoming2String = resourceARHoming2.toString();
- resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
- String resourceVNFHomingString = resourceVNFHoming.toString();
- resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
- String resourceNetHomingString = resourceNetHoming.toString();
- resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
- String resourceNetHoming2String = resourceNetHoming2.toString();
- resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
- expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
-
- assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
- assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet", "aic", "testCloudRegionIdNet", "testAicClliNet", "3.0", null, null), resourceNetHomingString);
- assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionIdNet2", "testAicClliNet2", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), resourceNetHoming2String);
- assertEquals(verifySniroRequest(), expectedSniroRequest);
- }
-
- @Test
- @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/BuildingBlock/DecomposeService.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
- public void testHoming_success_vnfResourceList() throws Exception {
-
- // Create a Service Decomposition
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+ String subscriber = "";
+ String subscriber2 = "";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public HomingTest() throws IOException {
+ String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf");
+ String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net");
+ String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf");
+ String sniroCallbackNoSolution = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound");
+ String sniroCallbackPolicyException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException");
+ String sniroCallbackServiceException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException");
+ callbacks.put("sniro", JSON, "SNIROResponse", sniroCallback);
+ callbacks.put("sniro2", JSON, "SNIROResponse", sniroCallback2);
+ callbacks.put("sniro3", JSON, "SNIROResponse", sniroCallback3);
+ callbacks.put("sniroNoSol", JSON, "SNIROResponse", sniroCallbackNoSolution);
+ callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", sniroCallbackPolicyException);
+ callbacks.put("sniroServiceEx", JSON, "SNIROResponse", sniroCallbackServiceException);
+
+ // Service Model
+ ModelInfo sModel = new ModelInfo();
+ sModel.setModelCustomizationUuid("testModelCustomizationUuid");
+ sModel.setModelInstanceName("testModelInstanceName");
+ sModel.setModelInvariantUuid("testModelInvariantId");
+ sModel.setModelName("testModelName");
+ sModel.setModelUuid("testModelUuid");
+ sModel.setModelVersion("testModelVersion");
+ // Service Instance
+ ServiceInstance si = new ServiceInstance();
+ si.setInstanceId("testServiceInstanceId123");
+ // Allotted Resources
+ List<AllottedResource> arList = new ArrayList<AllottedResource>();
+ AllottedResource ar = new AllottedResource();
+ ar.setResourceId("testResourceIdAR");
+ ar.setResourceInstanceName("testARInstanceName");
+ ModelInfo arModel = new ModelInfo();
+ arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
+ arModel.setModelInvariantUuid("testModelInvariantIdAR");
+ arModel.setModelName("testModelNameAR");
+ arModel.setModelVersion("testModelVersionAR");
+ arModel.setModelUuid("testARModelUuid");
+ arModel.setModelType("testModelTypeAR");
+ ar.setModelInfo(arModel);
+ AllottedResource ar2 = new AllottedResource();
+ ar2.setResourceId("testResourceIdAR2");
+ ar2.setResourceInstanceName("testAR2InstanceName");
+ ModelInfo arModel2 = new ModelInfo();
+ arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
+ arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
+ arModel2.setModelName("testModelNameAR2");
+ arModel2.setModelVersion("testModelVersionAR2");
+ arModel2.setModelUuid("testAr2ModelUuid");
+ arModel2.setModelType("testModelTypeAR2");
+ ar2.setModelInfo(arModel2);
+ arList.add(ar);
+ arList.add(ar2);
+ // Vnfs
+ List<VnfResource> vnfList = new ArrayList<VnfResource>();
+ VnfResource vnf = new VnfResource();
+ vnf.setResourceId("testResourceIdVNF");
+ vnf.setResourceInstanceName("testVnfInstanceName");
+ ModelInfo vnfModel = new ModelInfo();
+ vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
+ vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
+ vnfModel.setModelName("testModelNameVNF");
+ vnfModel.setModelVersion("testModelVersionVNF");
+ vnfModel.setModelUuid("testVnfModelUuid");
+ vnfModel.setModelType("testModelTypeVNF");
+ vnf.setModelInfo(vnfModel);
+ vnfList.add(vnf);
+ System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString());
+ serviceDecomposition.setModelInfo(sModel);
+ serviceDecomposition.setServiceAllottedResources(arList);
+ serviceDecomposition.setServiceVnfs(vnfList);
+ serviceDecomposition.setServiceInstance(si);
+
+ // Subscriber
+ subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_success_2AR1Vnf() throws Exception {
+
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
+ assertEquals(verifySniroRequest(), expectedSniroRequest);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_success_2AR1Vnf2Net() throws Exception {
+
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables2(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro2");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
+ HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
+ Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
+ HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
+
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ String resourceNetHomingString = resourceNetHoming.toString();
+ resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
+ String resourceNetHoming2String = resourceNetHoming2.toString();
+ resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
+ expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
+ assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet", "aic", "testCloudRegionIdNet", "testAicClliNet", "3.0", null, null), resourceNetHomingString);
+ assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionIdNet2", "testAicClliNet2", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), resourceNetHoming2String);
+ assertEquals(verifySniroRequest(), expectedSniroRequest);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/BuildingBlock/DecomposeService.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_success_vnfResourceList() throws Exception {
+
+ // Create a Service Decomposition
//System.out.println("At start of testHoming_success_vnfResourceList");
- MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json");
- //MockGetServiceResourcesCatalogData("1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", "5.0", "/BuildingBlocks/catalogResp.json");
- String busKey = UUID.randomUUID().toString();
- Map<String, Object> vars = new HashMap<>();
- setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
- invokeSubProcess("DecomposeService", busKey, vars);
-
- ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
+ MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json");
+ //MockGetServiceResourcesCatalogData("1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", "5.0", "/BuildingBlocks/catalogResp.json");
+ String busKey = UUID.randomUUID().toString();
+ Map<String, Object> vars = new HashMap<>();
+ setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", busKey, vars);
+
+ ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
//System.out.println("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd);
- List<VnfResource> vnfResourceList = sd.getServiceVnfs();
+ List<VnfResource> vnfResourceList = sd.getServiceVnfs();
//System.out.println(" vnfResourceList = " + vnfResourceList);
- vnfResourceList.get(0).setResourceId("test-resource-id-000");
-
- // Invoke Homing
-
- mockSNIRO();
+ vnfResourceList.get(0).setResourceId("test-resource-id-000");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
- variables.put("serviceDecomposition", sd);
- variables.put("subscriberInfo", subscriber2);
-
- invokeSubProcess("Homing", businessKey, variables);
- injectWorkflowMessages(callbacks, "sniro3");
- waitForProcessEnd(businessKey, 10000);
+ // Invoke Homing
- //Get Variables
-
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ mockSNIRO();
- Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
- HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", sd);
+ variables.put("subscriberInfo", subscriber2);
- String resourceVnfHomingString = resourceVnfHoming.toString();
- resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
+ invokeSubProcess("Homing", businessKey, variables);
+ injectWorkflowMessages(callbacks, "sniro3");
+ waitForProcessEnd(businessKey, 10000);
- assertNull(workflowException);
+ //Get Variables
- //Verify request
- String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
- assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""), sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
-
- assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "att-aic", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
- }
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
- @Test
- @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
- public void testHoming_error_inputVariable() throws Exception {
+ Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
+ HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables3(variables);
+ String resourceVnfHomingString = resourceVnfHoming.toString();
+ resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
- invokeSubProcess("Homing", businessKey, variables);
+ assertNull(workflowException);
- waitForProcessEnd(businessKey, 10000);
+ //Verify request
+ String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+ assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""), sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "att-aic", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+ }
- assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]", workflowException.toString());
- }
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_error_inputVariable() throws Exception {
- @Test
- @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
- public void testHoming_error_badResponse() throws Exception {
- mockSNIRO_500();
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables3(variables);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
+ invokeSubProcess("Homing", businessKey, variables);
- invokeSubProcess("Homing", businessKey, variables);
+ waitForProcessEnd(businessKey, 10000);
- waitForProcessEnd(businessKey, 10000);
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]", workflowException.toString());
+ }
- assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro.]", workflowException.toString());
- }
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_error_badResponse() throws Exception {
+ mockSNIRO_500();
- @Test
- @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
- public void testHoming_error_sniroNoSolution() throws Exception {
- mockSNIRO();
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
-
- invokeSubProcess("Homing", businessKey, variables);
-
- injectWorkflowMessages(callbacks, "sniroNoSol");
-
- waitForProcessEnd(businessKey, 10000);
+ invokeSubProcess("Homing", businessKey, variables);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
- }
-
- @Test
- @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
- public void testHoming_error_sniroPolicyException() throws Exception {
- mockSNIRO();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
-
- invokeSubProcess("Homing", businessKey, variables);
-
- injectWorkflowMessages(callbacks, "sniroPolicyEx");
-
- waitForProcessEnd(businessKey, 10000);
-
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Policy Exception: Message content size exceeds the allowable limit]", workflowException.toString());
- }
-
- @Test
- @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
- public void testHoming_error_sniroServiceException() throws Exception {
- mockSNIRO();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
-
- invokeSubProcess("Homing", businessKey, variables);
-
- injectWorkflowMessages(callbacks, "sniroServiceEx");
-
- waitForProcessEnd(businessKey, 10000);
-
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Service Exception: SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", workflowException.toString());
- }
-
-
-
- private void setVariables(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
- variables.put("serviceDecomposition", serviceDecomposition);
- variables.put("subscriberInfo", subscriber2);
-
- }
-
- private void setVariables2(Map<String, Object> variables) {
- List<NetworkResource> netList = new ArrayList<NetworkResource>();
- NetworkResource net = new NetworkResource();
- net.setResourceId("testResourceIdNet");
- ModelInfo netModel = new ModelInfo();
- netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
- netModel.setModelInvariantUuid("testModelInvariantIdNet");
- netModel.setModelName("testModelNameNet");
- netModel.setModelVersion("testModelVersionNet");
- net.setModelInfo(netModel);
- netList.add(net);
- NetworkResource net2 = new NetworkResource();
- net2.setResourceId("testResourceIdNet2");
- ModelInfo netModel2 = new ModelInfo();
- netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
- netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
- netModel2.setModelName("testModelNameNet2");
- netModel2.setModelVersion("testModelVersionNet2");
- net2.setModelInfo(netModel2);
- netList.add(net2);
- serviceDecomposition.setServiceNetworks(netList);
-
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
- variables.put("serviceDecomposition", serviceDecomposition);
- variables.put("subscriberInfo", subscriber2);
- }
-
- private void setVariables3(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
- variables.put("serviceDecomposition", null);
- variables.put("subscriberInfo", subscriber2);
-
- }
-
- private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){
- String solution = "";
- if(enList == null){
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\" } }";
- }else{
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] } }";
- }
- return solution;
- }
-
- private String homingSolutionCloud(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){
- String solution = "";
- if(enList == null){
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\" } }";
- }else{
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] } }";
- }
- return solution;
- }
-
- private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\"," +
- "\"modelUuid\": \"2f7f309d-c842-4644-a2e4-34167be5eeb4\"," +
- "\"modelName\": \"ADIOD vRouter vCE 011017 Service\"," +
- "\"modelVersion\": \"5.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- }
-
- private String verifySniroRequest(){
- String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":600},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
- return request;
- }
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro.]", workflowException.toString());
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_error_sniroNoSolution() throws Exception {
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniroNoSol");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_error_sniroPolicyException() throws Exception {
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniroPolicyEx");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Policy Exception: Message content size exceeds the allowable limit]", workflowException.toString());
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_error_sniroServiceException() throws Exception {
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniroServiceEx");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Service Exception: SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", workflowException.toString());
+ }
+
+
+ private void setVariables(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ private void setVariables2(Map<String, Object> variables) {
+ List<NetworkResource> netList = new ArrayList<NetworkResource>();
+ NetworkResource net = new NetworkResource();
+ net.setResourceId("testResourceIdNet");
+ ModelInfo netModel = new ModelInfo();
+ netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
+ netModel.setModelInvariantUuid("testModelInvariantIdNet");
+ netModel.setModelName("testModelNameNet");
+ netModel.setModelVersion("testModelVersionNet");
+ net.setModelInfo(netModel);
+ netList.add(net);
+ NetworkResource net2 = new NetworkResource();
+ net2.setResourceId("testResourceIdNet2");
+ ModelInfo netModel2 = new ModelInfo();
+ netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
+ netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
+ netModel2.setModelName("testModelNameNet2");
+ netModel2.setModelVersion("testModelVersionNet2");
+ net2.setModelInfo(netModel2);
+ netList.add(net2);
+ serviceDecomposition.setServiceNetworks(netList);
+
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariables3(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", null);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList) {
+ String solution = "";
+ if (enList == null) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\" } }";
+ } else {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] } }";
+ }
+ return solution;
+ }
+
+ private String homingSolutionCloud(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList) {
+ String solution = "";
+ if (enList == null) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\" } }";
+ } else {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] } }";
+ }
+ return solution;
+ }
+
+ private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId", siId);
+
+ String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\"," +
+ "\"modelUuid\": \"2f7f309d-c842-4644-a2e4-34167be5eeb4\"," +
+ "\"modelName\": \"ADIOD vRouter vCE 011017 Service\"," +
+ "\"modelVersion\": \"5.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ }
+
+ private String verifySniroRequest() {
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":600},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+ return request;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ManualHandlingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ManualHandlingTest.java
index a7c2d19aa0..5d4d4b5f36 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ManualHandlingTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ManualHandlingTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -59,64 +59,63 @@ import org.openecomp.mso.bpmn.core.WorkflowException;
* Unit test for RainyDayHandler.bpmn.
*/
public class ManualHandlingTest extends WorkflowTest {
-
- @Test
- @Deployment(resources = {
- "subprocess/BuildingBlock/ManualHandling.bpmn"
- })
- public void TestManualHandlingSuccess() {
-
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceType", "X");
- variables.put("vnfType", "Y");
- variables.put("currentActivity", "BB1");
- variables.put("workStep", "1");
- variables.put("failedActivity", "");
- variables.put("errorCode", "123");
- variables.put("errorText", "update failed");
- variables.put("validResponses", "Rollback");
-
-
- String businessKey = UUID.randomUUID().toString();
- invokeSubProcess("ManualHandling", businessKey, variables);
-
- try {
- Thread.sleep(5);
- } catch (Exception e) {
-
- }
-
- TaskService taskService = processEngineRule.getTaskService();
-
- TaskQuery q = taskService.createTaskQuery();
-
- List<Task> tasks = q.orderByTaskCreateTime().asc().list();
- int i = 0;
-
- for (Task task : tasks) {
-
-
- System.out.println("TASK ID: " + task.getId());
- System.out.println("TASK NAME: " + task.getName());
- try {
- System.out.println("Completing the task");
- Map<String,Object> completeVariables = new HashMap<>();
- completeVariables.put("responseValue", "skip");
- taskService.complete(task.getId(), completeVariables);
- }
- catch(Exception e) {
- System.out.println("GOT EXCEPTION: " + e.getMessage());
- }
- }
-
- waitForProcessEnd(businessKey, 100000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- }
-
-
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/BuildingBlock/ManualHandling.bpmn"
+ })
+ public void TestManualHandlingSuccess() {
+
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceType", "X");
+ variables.put("vnfType", "Y");
+ variables.put("currentActivity", "BB1");
+ variables.put("workStep", "1");
+ variables.put("failedActivity", "");
+ variables.put("errorCode", "123");
+ variables.put("errorText", "update failed");
+ variables.put("validResponses", "Rollback");
+
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeSubProcess("ManualHandling", businessKey, variables);
+
+ try {
+ Thread.sleep(5);
+ } catch (Exception e) {
+
+ }
+
+ TaskService taskService = processEngineRule.getTaskService();
+
+ TaskQuery q = taskService.createTaskQuery();
+
+ List<Task> tasks = q.orderByTaskCreateTime().asc().list();
+ int i = 0;
+
+ for (Task task : tasks) {
+
+
+ System.out.println("TASK ID: " + task.getId());
+ System.out.println("TASK NAME: " + task.getName());
+ try {
+ System.out.println("Completing the task");
+ Map<String, Object> completeVariables = new HashMap<>();
+ completeVariables.put("responseValue", "skip");
+ taskService.complete(task.getId(), completeVariables);
+ } catch (Exception e) {
+ System.out.println("GOT EXCEPTION: " + e.getMessage());
+ }
+ }
+
+ waitForProcessEnd(businessKey, 100000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ }
+
+
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java
index be74770e98..7416a5e3f0 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -41,172 +41,172 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit tests for PrepareUpdateAAIVfModule.bpmn.
*/
public class PrepareUpdateAAIVfModuleTest extends WorkflowTest {
-
- /**
- * Test the happy path through the flow.
- */
- @Test
- @Deployment(resources = {
- "subprocess/PrepareUpdateAAIVfModule.bpmn"
- })
- public void happyPath() throws IOException {
-
- logStart();
-
- String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200);
- MockPatchVfModuleId("skask", "supercool");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
- invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(200, responseCode.intValue());
- String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId");
- System.out.println("Ouput heat-stack-id:" + heatStackId);
- Assert.assertEquals("slowburn", heatStackId);
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI returns a 404.
- */
- @Test
- @Deployment(resources = {
- "subprocess/PrepareUpdateAAIVfModule.bpmn"
- })
- public void badGet() throws IOException {
-
- logStart();
-
- String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
- MockGetGenericVnfById_404("skask[?]depth=1");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
- invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode");
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(404, responseCode.intValue());
- Assert.assertNotNull(workflowException);
- System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
-
- logEnd();
- }
-
- /**
- * Test the case where the validation of the VF Module fails.
- */
- @Test
- @Deployment(resources = {
- "subprocess/PrepareUpdateAAIVfModule.bpmn"
- })
- public void failValidation1() throws IOException {
-
- logStart();
-
- String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "lukewarm");
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
- invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- Assert.assertNotNull(workflowException);
- System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
- Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration"));
-
- logEnd();
- }
-
- /**
- * Test the case where the validation of the VF Module fails.
- */
- @Test
- @Deployment(resources = {
- "subprocess/PrepareUpdateAAIVfModule.bpmn"
- })
- public void failValidation2() throws IOException {
-
- logStart();
-
- String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "notsocool");
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
- invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- Assert.assertNotNull(workflowException);
- System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
- Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module"));
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404.
- */
- @Test
- @Deployment(resources = {
- "subprocess/PrepareUpdateAAIVfModule.bpmn"
- })
- public void badPatch() throws IOException {
-
- logStart();
-
- String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
- invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(404, responseCode.intValue());
- Assert.assertNotNull(workflowException);
- System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
-
- logEnd();
- }
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/PrepareUpdateAAIVfModule.bpmn"
+ })
+ public void happyPath() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+ MockPatchVfModuleId("skask", "supercool");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(200, responseCode.intValue());
+ String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId");
+ System.out.println("Ouput heat-stack-id:" + heatStackId);
+ Assert.assertEquals("slowburn", heatStackId);
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/PrepareUpdateAAIVfModule.bpmn"
+ })
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfById_404("skask[?]depth=1");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode");
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+ Assert.assertNotNull(workflowException);
+ System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the validation of the VF Module fails.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/PrepareUpdateAAIVfModule.bpmn"
+ })
+ public void failValidation1() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "lukewarm");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ Assert.assertNotNull(workflowException);
+ System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
+ Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the validation of the VF Module fails.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/PrepareUpdateAAIVfModule.bpmn"
+ })
+ public void failValidation2() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "notsocool");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ Assert.assertNotNull(workflowException);
+ System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
+ Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/PrepareUpdateAAIVfModule.bpmn"
+ })
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+ Assert.assertNotNull(workflowException);
+ System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/RainyDayHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/RainyDayHandlerTest.java
index 65575ba861..22be442841 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/RainyDayHandlerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/RainyDayHandlerTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -47,39 +47,38 @@ import org.openecomp.mso.bpmn.core.WorkflowException;
* Unit test for RainyDayHandler.bpmn.
*/
public class RainyDayHandlerTest extends WorkflowTest {
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Deployment(resources = {
- "subprocess/BuildingBlock/RainyDayHandler.bpmn",
- "subprocess/BuildingBlock/ManualHandling.bpmn"
- })
- public void TestRainyDayHandlingSuccess() {
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceType", "X");
- variables.put("vnfType", "Y");
- variables.put("currentActivity", "BB1");
- variables.put("workStep", "1");
- variables.put("failedActivity", "");
- variables.put("errorCode", "123");
- variables.put("errorText", "update failed");
-
- MockPolicyAbort();
-
-
- String businessKey = UUID.randomUUID().toString();
- invokeSubProcess("RainyDayHandler", businessKey, variables);
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ @Deployment(resources = {
+ "subprocess/BuildingBlock/RainyDayHandler.bpmn",
+ "subprocess/BuildingBlock/ManualHandling.bpmn"
+ })
+ public void TestRainyDayHandlingSuccess() {
+
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceType", "X");
+ variables.put("vnfType", "Y");
+ variables.put("currentActivity", "BB1");
+ variables.put("workStep", "1");
+ variables.put("failedActivity", "");
+ variables.put("errorCode", "123");
+ variables.put("errorText", "update failed");
+
+ MockPolicyAbort();
+
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeSubProcess("RainyDayHandler", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
- waitForProcessEnd(businessKey, 10000);
+ }
- Assert.assertTrue(isProcessEnded(businessKey));
-
- }
-
-
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ReceiveWorkflowMessageTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ReceiveWorkflowMessageTest.java
index a806515974..0a603b1210 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ReceiveWorkflowMessageTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ReceiveWorkflowMessageTest.java
@@ -42,101 +42,101 @@ import org.openecomp.mso.bpmn.core.WorkflowException;
*/
public class ReceiveWorkflowMessageTest extends WorkflowTest {
- private static final String EOL = "\n";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public ReceiveWorkflowMessageTest() throws IOException {
- callbacks.put("sdnc-event-success", JSON, "SDNCAEvent",
- "{" + EOL +
- " \"SDNCEvent\": {" + EOL +
- " \"eventType\": \"UCPE-ACTIVATION\"," + EOL +
- " \"eventCorrelatorType\": \"UCPE-HOST-NAME\"," + EOL +
- " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL +
- " \"params\": {\"entry\":[" + EOL +
- " {\"key\": \"success-indicator\", \"value\":\"Y\"}" + EOL +
- " ]}" +EOL +
- " }" + EOL +
- "}" + EOL);
-
- callbacks.put("sdnc-event-fail", JSON, "SDNCAEvent",
- "{" + EOL +
- " \"SDNCEvent\": {" + EOL +
- " \"eventType\": \"UCPE-ACTIVATION\"," + EOL +
- " \"eventCorrelatorType\": \"UCPE-HOST-NAME\"," + EOL +
- " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL +
- " \"params\": {\"entry\":[" + EOL +
- " {\"key\": \"success-indicator\", \"value\":\"N\"}" + EOL +
- " {\"key\": \"error-message\", \"value\":\"SOMETHING BAD HAPPENED\"}" + EOL +
- " ]}" +EOL +
- " }" + EOL +
- "}" + EOL);
- }
-
- /**
- * Test the happy path.
- */
- @Test
- @Deployment(resources = {
- "subprocess/ReceiveWorkflowMessage.bpmn"
- })
- public void happyPath() throws Exception {
-
- logStart();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
- variables.put("isDebugLogEnabled", "true");
- variables.put("RCVWFMSG_timeout", "PT1M");
- variables.put("RCVWFMSG_messageType", "SDNCAEvent");
- variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
-
- invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
- injectWorkflowMessages(callbacks, "sdnc-event-success");
- waitForProcessEnd(businessKey, 10000);
-
- String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
- System.out.println("Response:\n" + response);
- assertTrue(response.contains("\"SDNCEvent\""));
- assertTrue((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the timeout scenario.
- */
- @Test
- @Deployment(resources = {
- "subprocess/ReceiveWorkflowMessage.bpmn"
- })
- public void timeout() throws Exception {
- logStart();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
- variables.put("isDebugLogEnabled", "true");
- variables.put("RCVWFMSG_timeout", "PT0.1S");
- variables.put("RCVWFMSG_messageType", "SDNCAEvent");
- variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
-
- invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
-
- // No injection
-
- waitForProcessEnd(businessKey, 10000);
-
- // There is no response from SDNC, so the flow doesn't set WorkflowResponse.
- String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
- assertNull(response);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertNotNull(wfe);
- System.out.println(wfe.toString());
- assertEquals("Receive Workflow Message Timeout Error", wfe.getErrorMessage());
- assertFalse((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
-
- logEnd();
- }
+ private static final String EOL = "\n";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public ReceiveWorkflowMessageTest() throws IOException {
+ callbacks.put("sdnc-event-success", JSON, "SDNCAEvent",
+ "{" + EOL +
+ " \"SDNCEvent\": {" + EOL +
+ " \"eventType\": \"UCPE-ACTIVATION\"," + EOL +
+ " \"eventCorrelatorType\": \"UCPE-HOST-NAME\"," + EOL +
+ " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL +
+ " \"params\": {\"entry\":[" + EOL +
+ " {\"key\": \"success-indicator\", \"value\":\"Y\"}" + EOL +
+ " ]}" + EOL +
+ " }" + EOL +
+ "}" + EOL);
+
+ callbacks.put("sdnc-event-fail", JSON, "SDNCAEvent",
+ "{" + EOL +
+ " \"SDNCEvent\": {" + EOL +
+ " \"eventType\": \"UCPE-ACTIVATION\"," + EOL +
+ " \"eventCorrelatorType\": \"UCPE-HOST-NAME\"," + EOL +
+ " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL +
+ " \"params\": {\"entry\":[" + EOL +
+ " {\"key\": \"success-indicator\", \"value\":\"N\"}" + EOL +
+ " {\"key\": \"error-message\", \"value\":\"SOMETHING BAD HAPPENED\"}" + EOL +
+ " ]}" + EOL +
+ " }" + EOL +
+ "}" + EOL);
+ }
+
+ /**
+ * Test the happy path.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/ReceiveWorkflowMessage.bpmn"
+ })
+ public void happyPath() throws Exception {
+
+ logStart();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("RCVWFMSG_timeout", "PT1M");
+ variables.put("RCVWFMSG_messageType", "SDNCAEvent");
+ variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
+
+ invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
+ injectWorkflowMessages(callbacks, "sdnc-event-success");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+ System.out.println("Response:\n" + response);
+ assertTrue(response.contains("\"SDNCEvent\""));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the timeout scenario.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/ReceiveWorkflowMessage.bpmn"
+ })
+ public void timeout() throws Exception {
+ logStart();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("RCVWFMSG_timeout", "PT0.1S");
+ variables.put("RCVWFMSG_messageType", "SDNCAEvent");
+ variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
+
+ invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
+
+ // No injection
+
+ waitForProcessEnd(businessKey, 10000);
+
+ // There is no response from SDNC, so the flow doesn't set WorkflowResponse.
+ String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+ assertNull(response);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ assertNotNull(wfe);
+ System.out.println(wfe.toString());
+ assertEquals("Receive Workflow Message Timeout Error", wfe.getErrorMessage());
+ assertFalse((boolean) getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java
index ec1a22347b..966f74c9f5 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java
@@ -38,47 +38,47 @@ import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackService
* </pre>
*/
public class SDNCAdapterCallbackRule implements TestRule {
- public static final String DEFAULT_ENDPOINT_URL =
- "http://localhost:28080/mso/SDNCAdapterCallbackService";
+ public static final String DEFAULT_ENDPOINT_URL =
+ "http://localhost:28080/mso/SDNCAdapterCallbackService";
- private final ProcessEngineServices processEngineServices;
- private final String endpointUrl;
+ private final ProcessEngineServices processEngineServices;
+ private final String endpointUrl;
- public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) {
- this(processEngineServices, DEFAULT_ENDPOINT_URL);
- }
+ public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) {
+ this(processEngineServices, DEFAULT_ENDPOINT_URL);
+ }
- public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices,
- String endpointUrl) {
- this.processEngineServices = processEngineServices;
- this.endpointUrl = endpointUrl;
- }
+ public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices,
+ String endpointUrl) {
+ this.processEngineServices = processEngineServices;
+ this.endpointUrl = endpointUrl;
+ }
- @Override
- public Statement apply(final Statement baseStmt, Description description) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- Endpoint endpoint = null;
+ @Override
+ public Statement apply(final Statement baseStmt, Description description) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ Endpoint endpoint = null;
- try {
- SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl();
- sdncCallbackService.setProcessEngineServices4junit(processEngineServices);
+ try {
+ SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl();
+ sdncCallbackService.setProcessEngineServices4junit(processEngineServices);
- System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
- System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
+ System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
+ System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
- System.out.println("Publishing Endpoint - " + endpointUrl);
- endpoint = Endpoint.publish(endpointUrl, sdncCallbackService);
+ System.out.println("Publishing Endpoint - " + endpointUrl);
+ endpoint = Endpoint.publish(endpointUrl, sdncCallbackService);
- baseStmt.evaluate();
- } finally {
- if (endpoint != null) {
- System.out.println("Stopping Endpoint - " + endpointUrl);
- endpoint.stop();
- }
- }
- }
- };
- }
+ baseStmt.evaluate();
+ } finally {
+ if (endpoint != null) {
+ System.out.println("Stopping Endpoint - " + endpointUrl);
+ endpoint.stop();
+ }
+ }
+ }
+ };
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java
index 0349b178cb..e79d71b918 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -56,420 +56,420 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
*/
public class SDNCAdapterV1Test extends WorkflowTest {
- private String sdncAdapterWorkflowRequest;
- private String sdncAdapterWorkflowRequestAct;
- private String sdncAdapterCallbackRequestData;
- private String sdncAdapterCallbackRequestDataNonfinal;
-
- public SDNCAdapterV1Test() throws IOException {
- sdncAdapterWorkflowRequest = FileUtil.readResourceFile("sdncadapterworkflowrequest.xml");
- sdncAdapterWorkflowRequestAct = FileUtil.readResourceFile("sdncadapterworkflowrequest-act.xml");
- sdncAdapterCallbackRequestData = FileUtil.readResourceFile("sdncadaptercallbackrequestdata.text");
- sdncAdapterCallbackRequestDataNonfinal = FileUtil.readResourceFile("sdncadaptercallbackrequestdata-nonfinal.text");
- }
-
- /**
- * End-to-End flow - Unit test for SDNCAdapterV1.bpmn
- * - String input & String response
- */
-
- private WorkflowResponse invokeFlow(String workflowRequest) {
-
- Map<String, Object>valueMap = new HashMap<>();
- valueMap.put("value", workflowRequest);
- Map<String, Object> variables = new HashMap<>();
- variables.put("sdncAdapterWorkflowRequest", valueMap);
-
- Map<String, Object> valueMap2 = new HashMap<>();
- valueMap2.put("value", "true");
- variables.put("isDebugLogEnabled", valueMap2);
-
- VariableMapImpl varMap = new VariableMapImpl();
- varMap.put("variables", variables);
-
- //System.out.println("Invoking the flow");
-
- WorkflowResource workflowResource = new WorkflowResource();
- workflowResource.setProcessEngineServices4junit(processEngineRule);
+ private String sdncAdapterWorkflowRequest;
+ private String sdncAdapterWorkflowRequestAct;
+ private String sdncAdapterCallbackRequestData;
+ private String sdncAdapterCallbackRequestDataNonfinal;
+
+ public SDNCAdapterV1Test() throws IOException {
+ sdncAdapterWorkflowRequest = FileUtil.readResourceFile("sdncadapterworkflowrequest.xml");
+ sdncAdapterWorkflowRequestAct = FileUtil.readResourceFile("sdncadapterworkflowrequest-act.xml");
+ sdncAdapterCallbackRequestData = FileUtil.readResourceFile("sdncadaptercallbackrequestdata.text");
+ sdncAdapterCallbackRequestDataNonfinal = FileUtil.readResourceFile("sdncadaptercallbackrequestdata-nonfinal.text");
+ }
+
+ /**
+ * End-to-End flow - Unit test for SDNCAdapterV1.bpmn
+ * - String input & String response
+ */
+
+ private WorkflowResponse invokeFlow(String workflowRequest) {
+
+ Map<String, Object> valueMap = new HashMap<>();
+ valueMap.put("value", workflowRequest);
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("sdncAdapterWorkflowRequest", valueMap);
+
+ Map<String, Object> valueMap2 = new HashMap<>();
+ valueMap2.put("value", "true");
+ variables.put("isDebugLogEnabled", valueMap2);
+
+ VariableMapImpl varMap = new VariableMapImpl();
+ varMap.put("variables", variables);
+
+ //System.out.println("Invoking the flow");
+
+ WorkflowResource workflowResource = new WorkflowResource();
+ workflowResource.setProcessEngineServices4junit(processEngineRule);
- Response response = workflowResource.startProcessInstanceByKey("sdncAdapter", varMap);
- WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
-
- //String pid = workflowResponse.getProcessInstanceID();
- //System.out.println("Back from executing process instance with pid=" + pid);
- return workflowResponse;
- }
+ Response response = workflowResource.startProcessInstanceByKey("sdncAdapter", varMap);
+ WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
+
+ //String pid = workflowResponse.getProcessInstanceID();
+ //System.out.println("Back from executing process instance with pid=" + pid);
+ return workflowResponse;
+ }
- @Test
- @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void sunnyDay() throws InterruptedException {
-
- mockSDNCAdapter(200);
-
- //System.out.println("SDNCAdapter sunny day flow Started!");
-
- ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest);
- thread.start();
- waitForExecutionToStart("sdncAdapter", 3);
- String pid = getPid();
-
- assertProcessInstanceNotFinished(pid);
-
- System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
- String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId");
- CallbackHeader callbackHeader = new CallbackHeader();
- callbackHeader.setRequestId(generatedRequestId);
- callbackHeader.setResponseCode("200");
- callbackHeader.setResponseMessage("OK");
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
- sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
- sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData);
- SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
- callbackService.setProcessEngineServices4junit(processEngineRule);
- SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
- //System.out.println("Back from executing process again");
-
- assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
- assertProcessInstanceFinished(pid);
-
- //System.out.println("SDNCAdapter sunny day flow Completed!");
- }
-
- @Test
- @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void nonFinalWithTimeout() throws InterruptedException {
-
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBAdapter.xml");
-
- //System.out.println("SDNCAdapter interim status processing flow Started!");
-
- ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequestAct);
- thread.start();
- waitForExecutionToStart("sdncAdapter", 3);
- String pid = getPid();
-
- assertProcessInstanceNotFinished(pid);
-
- //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
- String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId");
- CallbackHeader callbackHeader = new CallbackHeader();
- callbackHeader.setRequestId(generatedRequestId);
- callbackHeader.setResponseCode("200");
- callbackHeader.setResponseMessage("OK");
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
- sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
- sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal);
- SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
- callbackService.setProcessEngineServices4junit(processEngineRule);
- SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
- //System.out.println("Back from executing process again");
-
- assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
- assertProcessInstanceNotFinished(pid);
-
- checkForTimeout(pid);
-
- assertEquals(true, (Boolean) (getVariable(pid, "continueListening")));
- assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify")));
-
-
- //System.out.println("SDNCAdapter interim status processing flow Completed!");
- }
-
- @Test
- @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void nonFinalThenFinal() throws InterruptedException {
-
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBAdapter.xml");
-
- //System.out.println("SDNCAdapter non-final then final processing flow Started!");
-
- // Start the flow
- ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequestAct);
- thread.start();
- waitForExecutionToStart("sdncAdapter", 3);
- String pid = getPid();
-
- assertProcessInstanceNotFinished(pid);
-
- // Inject a "non-final" SDNC Adapter asynchronous callback message
- //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
- String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId");
- CallbackHeader callbackHeader = new CallbackHeader();
- callbackHeader.setRequestId(generatedRequestId);
- callbackHeader.setResponseCode("200");
- callbackHeader.setResponseMessage("OK");
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
- sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
- sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal);
- SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
- callbackService.setProcessEngineServices4junit(processEngineRule);
- SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
- //System.out.println("Back from executing process again");
-
- assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
- assertProcessInstanceNotFinished(pid);
- assertEquals(true, (Boolean) (getVariable(pid, "continueListening")));
- assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify")));
-
- // Inject a "final" SDNC Adapter asynchronous callback message
- sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData);
- sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
- //System.out.println("Back from executing process again");
-
- assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
- assertProcessInstanceFinished(pid);
- assertEquals(false, (Boolean) (getVariable(pid, "continueListening")));
- assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify")));
-
- //System.out.println("SDNCAdapter non-final then final processing flow Completed!");
- }
-
-
- @Test
- @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void nonFinalThenFinalWithNotify() throws InterruptedException {
-
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBAdapter.xml");
-
- //System.out.println("SDNCAdapter non-final then final processing flow Started!");
-
- String modSdncAdapterWorkflowRequestAct = sdncAdapterWorkflowRequestAct;
- try {
- // only service-type "uCPE-VMS" is applicable to notification, so modify the test request
- modSdncAdapterWorkflowRequestAct = XmlTool.modifyElement(sdncAdapterWorkflowRequestAct, "tag0:service-type", "uCPE-VMS").get();
- System.out.println("modified request: " + modSdncAdapterWorkflowRequestAct);
- } catch (Exception e) {
- System.out.println("request modification failed");
- //e.printStackTrace();
- }
-
- // Start the flow
- ProcessExecutionThread thread = new ProcessExecutionThread(modSdncAdapterWorkflowRequestAct);
- thread.start();
- waitForExecutionToStart("sdncAdapter", 3);
- String pid = getPid();
-
- assertProcessInstanceNotFinished(pid);
-
- // Inject a "non-final" SDNC Adapter asynchronous callback message
- //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
- String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId");
- CallbackHeader callbackHeader = new CallbackHeader();
- callbackHeader.setRequestId(generatedRequestId);
- callbackHeader.setResponseCode("200");
- callbackHeader.setResponseMessage("OK");
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
- sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
- sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal);
- SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
- callbackService.setProcessEngineServices4junit(processEngineRule);
- SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
- //System.out.println("Back from executing process again");
-
- assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
- assertProcessInstanceNotFinished(pid);
- assertEquals(true, (Boolean) (getVariable(pid, "continueListening")));
- assertEquals(true, (Boolean) (getVariable(pid, "SDNCA_InterimNotify")));
-
- // Inject a "final" SDNC Adapter asynchronous callback message
- sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData);
- sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
- //System.out.println("Back from executing process again");
-
- assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
- assertProcessInstanceFinished(pid);
- assertEquals(false, (Boolean) (getVariable(pid, "continueListening")));
- assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify")));
-
- //System.out.println("SDNCAdapter non-final then final processing flow Completed!");
- }
-
-
- private void waitForExecutionToStart(String processDefintion, int count) throws InterruptedException {
- //System.out.println(processEngineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(processDefintion).count());
- while (processEngineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(processDefintion).count() != count) {
- Thread.sleep(200);
- }
- }
-
- @Test
- @Ignore // Ignored because PropertyConfigurationSetup is timing out
- @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void badCorrelationIdTest() throws InterruptedException, IOException {
-
- mockSDNCAdapter(200);
-
- Map<String, String> urnProperties = PropertyConfigurationSetup.createBpmnUrnProperties();
- urnProperties.put("mso.correlation.timeout", "5");
- PropertyConfigurationSetup.addProperties(urnProperties, 10000);
-
- //System.out.println("SDNCAdapter bad RequestId test Started!");
-
- ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest);
- thread.start();
- waitForExecutionToStart("sdncAdapter", 3);
- String pid = getPid();
- assertProcessInstanceNotFinished(pid);
-
- //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
- String badRequestId = "This is not the RequestId that was used";
- CallbackHeader callbackHeader = new CallbackHeader();
- callbackHeader.setRequestId(badRequestId);
- callbackHeader.setResponseCode("200");
- callbackHeader.setResponseMessage("OK");
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
- sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
- sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData);
- SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
- callbackService.setProcessEngineServices4junit(processEngineRule);
- SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
- //System.out.println("Back from executing process again");
-
- assertTrue(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
- assertTrue(((SDNCAdapterErrorResponse) sdncAdapterResponse).getError().contains("No process is waiting for sdncAdapterCallbackRequest"));
- assertProcessInstanceNotFinished(pid);
-
- //System.out.println("SDNCAdapter bad RequestId test Completed!");
- }
-
- @Test
- @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void badSynchronousResponse() throws IOException, InterruptedException {
-
- mockSDNCAdapter(404);
-
- //System.out.println("SDNCAdapter bad synchronous response flow Started!");
-
- ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest);
- thread.start();
- while (thread.isAlive()) {
- Thread.sleep(200);
- }
- WorkflowResponse response = thread.workflowResponse;
- Assert.assertNotNull(response);
- Assert.assertEquals("404 error", response.getMessageCode(),7000);
+ @Test
+ @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void sunnyDay() throws InterruptedException {
+
+ mockSDNCAdapter(200);
+
+ //System.out.println("SDNCAdapter sunny day flow Started!");
+
+ ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest);
+ thread.start();
+ waitForExecutionToStart("sdncAdapter", 3);
+ String pid = getPid();
+
+ assertProcessInstanceNotFinished(pid);
+
+ System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
+ String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId");
+ CallbackHeader callbackHeader = new CallbackHeader();
+ callbackHeader.setRequestId(generatedRequestId);
+ callbackHeader.setResponseCode("200");
+ callbackHeader.setResponseMessage("OK");
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
+ sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
+ sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData);
+ SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
+ callbackService.setProcessEngineServices4junit(processEngineRule);
+ SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ //System.out.println("Back from executing process again");
+
+ assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
+ assertProcessInstanceFinished(pid);
+
+ //System.out.println("SDNCAdapter sunny day flow Completed!");
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void nonFinalWithTimeout() throws InterruptedException {
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBAdapter.xml");
+
+ //System.out.println("SDNCAdapter interim status processing flow Started!");
+
+ ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequestAct);
+ thread.start();
+ waitForExecutionToStart("sdncAdapter", 3);
+ String pid = getPid();
+
+ assertProcessInstanceNotFinished(pid);
+
+ //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
+ String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId");
+ CallbackHeader callbackHeader = new CallbackHeader();
+ callbackHeader.setRequestId(generatedRequestId);
+ callbackHeader.setResponseCode("200");
+ callbackHeader.setResponseMessage("OK");
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
+ sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
+ sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal);
+ SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
+ callbackService.setProcessEngineServices4junit(processEngineRule);
+ SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ //System.out.println("Back from executing process again");
+
+ assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
+ assertProcessInstanceNotFinished(pid);
+
+ checkForTimeout(pid);
+
+ assertEquals(true, (Boolean) (getVariable(pid, "continueListening")));
+ assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify")));
+
+
+ //System.out.println("SDNCAdapter interim status processing flow Completed!");
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void nonFinalThenFinal() throws InterruptedException {
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBAdapter.xml");
+
+ //System.out.println("SDNCAdapter non-final then final processing flow Started!");
+
+ // Start the flow
+ ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequestAct);
+ thread.start();
+ waitForExecutionToStart("sdncAdapter", 3);
+ String pid = getPid();
+
+ assertProcessInstanceNotFinished(pid);
+
+ // Inject a "non-final" SDNC Adapter asynchronous callback message
+ //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
+ String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId");
+ CallbackHeader callbackHeader = new CallbackHeader();
+ callbackHeader.setRequestId(generatedRequestId);
+ callbackHeader.setResponseCode("200");
+ callbackHeader.setResponseMessage("OK");
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
+ sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
+ sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal);
+ SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
+ callbackService.setProcessEngineServices4junit(processEngineRule);
+ SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ //System.out.println("Back from executing process again");
+
+ assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
+ assertProcessInstanceNotFinished(pid);
+ assertEquals(true, (Boolean) (getVariable(pid, "continueListening")));
+ assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify")));
+
+ // Inject a "final" SDNC Adapter asynchronous callback message
+ sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData);
+ sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ //System.out.println("Back from executing process again");
+
+ assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
+ assertProcessInstanceFinished(pid);
+ assertEquals(false, (Boolean) (getVariable(pid, "continueListening")));
+ assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify")));
+
+ //System.out.println("SDNCAdapter non-final then final processing flow Completed!");
+ }
+
+
+ @Test
+ @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void nonFinalThenFinalWithNotify() throws InterruptedException {
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBAdapter.xml");
+
+ //System.out.println("SDNCAdapter non-final then final processing flow Started!");
+
+ String modSdncAdapterWorkflowRequestAct = sdncAdapterWorkflowRequestAct;
+ try {
+ // only service-type "uCPE-VMS" is applicable to notification, so modify the test request
+ modSdncAdapterWorkflowRequestAct = XmlTool.modifyElement(sdncAdapterWorkflowRequestAct, "tag0:service-type", "uCPE-VMS").get();
+ System.out.println("modified request: " + modSdncAdapterWorkflowRequestAct);
+ } catch (Exception e) {
+ System.out.println("request modification failed");
+ //e.printStackTrace();
+ }
+
+ // Start the flow
+ ProcessExecutionThread thread = new ProcessExecutionThread(modSdncAdapterWorkflowRequestAct);
+ thread.start();
+ waitForExecutionToStart("sdncAdapter", 3);
+ String pid = getPid();
+
+ assertProcessInstanceNotFinished(pid);
+
+ // Inject a "non-final" SDNC Adapter asynchronous callback message
+ //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
+ String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId");
+ CallbackHeader callbackHeader = new CallbackHeader();
+ callbackHeader.setRequestId(generatedRequestId);
+ callbackHeader.setResponseCode("200");
+ callbackHeader.setResponseMessage("OK");
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
+ sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
+ sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal);
+ SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
+ callbackService.setProcessEngineServices4junit(processEngineRule);
+ SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ //System.out.println("Back from executing process again");
+
+ assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
+ assertProcessInstanceNotFinished(pid);
+ assertEquals(true, (Boolean) (getVariable(pid, "continueListening")));
+ assertEquals(true, (Boolean) (getVariable(pid, "SDNCA_InterimNotify")));
+
+ // Inject a "final" SDNC Adapter asynchronous callback message
+ sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData);
+ sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ //System.out.println("Back from executing process again");
+
+ assertFalse(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
+ assertProcessInstanceFinished(pid);
+ assertEquals(false, (Boolean) (getVariable(pid, "continueListening")));
+ assertEquals(false, (Boolean) (getVariable(pid, "SDNCA_InterimNotify")));
+
+ //System.out.println("SDNCAdapter non-final then final processing flow Completed!");
+ }
+
+
+ private void waitForExecutionToStart(String processDefintion, int count) throws InterruptedException {
+ //System.out.println(processEngineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(processDefintion).count());
+ while (processEngineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(processDefintion).count() != count) {
+ Thread.sleep(200);
+ }
+ }
+
+ @Test
+ @Ignore // Ignored because PropertyConfigurationSetup is timing out
+ @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void badCorrelationIdTest() throws InterruptedException, IOException {
+
+ mockSDNCAdapter(200);
+
+ Map<String, String> urnProperties = PropertyConfigurationSetup.createBpmnUrnProperties();
+ urnProperties.put("mso.correlation.timeout", "5");
+ PropertyConfigurationSetup.addProperties(urnProperties, 10000);
+
+ //System.out.println("SDNCAdapter bad RequestId test Started!");
+
+ ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest);
+ thread.start();
+ waitForExecutionToStart("sdncAdapter", 3);
+ String pid = getPid();
+ assertProcessInstanceNotFinished(pid);
+
+ //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
+ String badRequestId = "This is not the RequestId that was used";
+ CallbackHeader callbackHeader = new CallbackHeader();
+ callbackHeader.setRequestId(badRequestId);
+ callbackHeader.setResponseCode("200");
+ callbackHeader.setResponseMessage("OK");
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
+ sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
+ sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData);
+ SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
+ callbackService.setProcessEngineServices4junit(processEngineRule);
+ SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ //System.out.println("Back from executing process again");
+
+ assertTrue(sdncAdapterResponse instanceof SDNCAdapterErrorResponse);
+ assertTrue(((SDNCAdapterErrorResponse) sdncAdapterResponse).getError().contains("No process is waiting for sdncAdapterCallbackRequest"));
+ assertProcessInstanceNotFinished(pid);
+
+ //System.out.println("SDNCAdapter bad RequestId test Completed!");
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void badSynchronousResponse() throws IOException, InterruptedException {
+
+ mockSDNCAdapter(404);
+
+ //System.out.println("SDNCAdapter bad synchronous response flow Started!");
+
+ ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest);
+ thread.start();
+ while (thread.isAlive()) {
+ Thread.sleep(200);
+ }
+ WorkflowResponse response = thread.workflowResponse;
+ Assert.assertNotNull(response);
+ Assert.assertEquals("404 error", response.getMessageCode(), 7000);
// assertProcessInstanceFinished(response.getProcessInstanceID());
- //System.out.println("SDNCAdapter bad synchronous response flow Completed!");
- }
-
- @Test
- @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void sdncNotFound() throws IOException, InterruptedException {
- mockSDNCAdapter(200);
- mockSDNCAdapter("/sdncAdapterMock/404", 400, "sdncCallbackErrorResponse.xml");
-
- ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest);
- thread.start();
- waitForExecutionToStart("sdncAdapter", 3);
- String pid = getPid();
-
- //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
- String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId");
- CallbackHeader callbackHeader = new CallbackHeader();
- callbackHeader.setRequestId(generatedRequestId);
- callbackHeader.setResponseCode("404");
- callbackHeader.setResponseMessage("Error processing request to SDNC. Not Found. https://sdncodl.it.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET. SDNC Returned-[error-type:application, error-tag:data-missing, error-message:Request could not be completed because the relevant data model content does not exist.]");
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
- sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
- SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
- callbackService.setProcessEngineServices4junit(processEngineRule);
- SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
- //System.out.println("Back from executing process again");
-
- assertProcessInstanceFinished(pid);
- assertNotNull(sdncAdapterResponse);
- //TODO query history to see SDNCA_ResponseCode, SDNCA_ErrorResponse
- //System.out.println("SDNCAdapter SDNC Notfound test Completed!");
- }
-
- @Test
- @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void asynchronousMessageTimeout() throws IOException, InterruptedException {
- mockSDNCAdapter(200);
- //System.out.println("SDNCAdapter asynchronous message timeout flow Started!");
- ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest);
- thread.start();
- waitForExecutionToStart("sdncAdapter", 3);
- checkForTimeout(getPid());
- }
-
- private void checkForTimeout(String pid) throws InterruptedException {
-
- assertProcessInstanceNotFinished(pid);
-
- ProcessEngineConfigurationImpl processEngineConfiguration =
- (ProcessEngineConfigurationImpl) processEngineRule.getProcessEngine().getProcessEngineConfiguration();
- assertTrue(processEngineConfiguration.getJobExecutor().isActive());
-
- Job timerJob = processEngineRule.getManagementService().createJobQuery().processInstanceId(pid).singleResult();
- assertNotNull(timerJob);
-
- processEngineRule.getManagementService().executeJob(timerJob.getId());
-
- assertProcessInstanceFinished(pid);
-
- //System.out.println("SDNCAdapter asynchronous message timeout flow Completed!");
- }
-
- class ProcessExecutionThread extends Thread {
-
- private String workflowRequest;
- private WorkflowResponse workflowResponse;
-
- public ProcessExecutionThread(String workflowRequest) {
- this.workflowRequest = workflowRequest;
- }
-
- public void run() {
- workflowResponse = invokeFlow(workflowRequest);
- workflowResponse.getProcessInstanceID();
- }
- }
-
- private String getPid() {
- return processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().list().get(0).getId();
- }
-
- private Object getVariable(String pid, String variableName) {
- try {
- return
- processEngineRule
- .getHistoryService()
- .createHistoricVariableInstanceQuery()
- .processInstanceId(pid).variableName(variableName)
- .singleResult()
- .getValue();
- } catch(Exception ex) {
- return null;
- }
- }
-
- private void assertProcessInstanceFinished(String pid) {
- assertEquals(1, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
- }
-
- private void assertProcessInstanceNotFinished(String pid) {
- assertEquals(0, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
- }
+ //System.out.println("SDNCAdapter bad synchronous response flow Completed!");
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void sdncNotFound() throws IOException, InterruptedException {
+ mockSDNCAdapter(200);
+ mockSDNCAdapter("/sdncAdapterMock/404", 400, "sdncCallbackErrorResponse.xml");
+
+ ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest);
+ thread.start();
+ waitForExecutionToStart("sdncAdapter", 3);
+ String pid = getPid();
+
+ //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing");
+ String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId");
+ CallbackHeader callbackHeader = new CallbackHeader();
+ callbackHeader.setRequestId(generatedRequestId);
+ callbackHeader.setResponseCode("404");
+ callbackHeader.setResponseMessage("Error processing request to SDNC. Not Found. https://sdncodl.it.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET. SDNC Returned-[error-type:application, error-tag:data-missing, error-message:Request could not be completed because the relevant data model content does not exist.]");
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
+ sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
+ SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
+ callbackService.setProcessEngineServices4junit(processEngineRule);
+ SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ //System.out.println("Back from executing process again");
+
+ assertProcessInstanceFinished(pid);
+ assertNotNull(sdncAdapterResponse);
+ //TODO query history to see SDNCA_ResponseCode, SDNCA_ErrorResponse
+ //System.out.println("SDNCAdapter SDNC Notfound test Completed!");
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericNotificationService.bpmn"
+ })
+ public void asynchronousMessageTimeout() throws IOException, InterruptedException {
+ mockSDNCAdapter(200);
+ //System.out.println("SDNCAdapter asynchronous message timeout flow Started!");
+ ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest);
+ thread.start();
+ waitForExecutionToStart("sdncAdapter", 3);
+ checkForTimeout(getPid());
+ }
+
+ private void checkForTimeout(String pid) throws InterruptedException {
+
+ assertProcessInstanceNotFinished(pid);
+
+ ProcessEngineConfigurationImpl processEngineConfiguration =
+ (ProcessEngineConfigurationImpl) processEngineRule.getProcessEngine().getProcessEngineConfiguration();
+ assertTrue(processEngineConfiguration.getJobExecutor().isActive());
+
+ Job timerJob = processEngineRule.getManagementService().createJobQuery().processInstanceId(pid).singleResult();
+ assertNotNull(timerJob);
+
+ processEngineRule.getManagementService().executeJob(timerJob.getId());
+
+ assertProcessInstanceFinished(pid);
+
+ //System.out.println("SDNCAdapter asynchronous message timeout flow Completed!");
+ }
+
+ class ProcessExecutionThread extends Thread {
+
+ private String workflowRequest;
+ private WorkflowResponse workflowResponse;
+
+ public ProcessExecutionThread(String workflowRequest) {
+ this.workflowRequest = workflowRequest;
+ }
+
+ public void run() {
+ workflowResponse = invokeFlow(workflowRequest);
+ workflowResponse.getProcessInstanceID();
+ }
+ }
+
+ private String getPid() {
+ return processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().list().get(0).getId();
+ }
+
+ private Object getVariable(String pid, String variableName) {
+ try {
+ return
+ processEngineRule
+ .getHistoryService()
+ .createHistoricVariableInstanceQuery()
+ .processInstanceId(pid).variableName(variableName)
+ .singleResult()
+ .getValue();
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+
+ private void assertProcessInstanceFinished(String pid) {
+ assertEquals(1, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
+ }
+
+ private void assertProcessInstanceNotFinished(String pid) {
+ assertEquals(0, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java
index 7c557ffe63..97d538840a 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -42,134 +42,134 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit tests for UpdateAAIGenericVnf bpmn.
*/
public class UpdateAAIGenericVnfTest extends WorkflowTest {
-
- /**
- * Test the happy path through the flow.
- */
- @Test
- @Deployment(resources = {
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void happyPath() throws IOException {
- logStart();
-
- String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf("/skask", 200);
- MockPatchGenericVnf("skask");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
- invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(200, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the happy path through the flow.
- */
- @Test
- @Deployment(resources = {
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void personaMismatch() throws IOException {
-
- logStart();
-
- String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
- updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert");
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
- invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("Workflow Exception: " + workflowException);
- Assert.assertNotNull(workflowException);
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI returns a 404.
- */
- @Test
- @Deployment(resources = {
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void badGet() throws IOException {
-
- logStart();
-
- String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
-
- MockGetGenericVnfById_404("skask[?]depth=1");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
- invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
- */
- @Test
- @Deployment(resources = {
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void badPatch() throws IOException {
-
- logStart();
-
- String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf_Bad("skask", 404);
- MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
- invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/UpdateAAIGenericVnf.bpmn"
+ })
+ public void happyPath() throws IOException {
+ logStart();
+
+ String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf("/skask", 200);
+ MockPatchGenericVnf("skask");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(200, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/UpdateAAIGenericVnf.bpmn"
+ })
+ public void personaMismatch() throws IOException {
+
+ logStart();
+
+ String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+ updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ System.out.println("Workflow Exception: " + workflowException);
+ Assert.assertNotNull(workflowException);
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/UpdateAAIGenericVnf.bpmn"
+ })
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+
+ MockGetGenericVnfById_404("skask[?]depth=1");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/UpdateAAIGenericVnf.bpmn"
+ })
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf_Bad("skask", 404);
+ MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java
index 30d7e6d8c6..0e59310eeb 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -41,101 +41,101 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit tests for UpdateAAIVfModuleTest.bpmn.
*/
public class UpdateAAIVfModuleTest extends WorkflowTest {
-
- /**
- * Test the happy path through the flow.
- */
- @Test
- @Deployment(resources = {
- "subprocess/UpdateAAIVfModule.bpmn"
- })
- public void happyPath() throws IOException {
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
- MockGetGenericVnfByIdWithPriority("/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml");
- MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200);
- MockPatchVfModuleId("skask", "supercool");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
- invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(200, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI returns a 404.
- */
- @Test
- @Deployment(resources = {
- "subprocess/UpdateAAIVfModule.bpmn"
- })
- public void badGet() throws IOException {
-
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
- MockGetGenericVnfById("/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
- invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
- */
- @Test
- @Deployment(resources = {
- "subprocess/UpdateAAIVfModule.bpmn"
- })
- public void badPatch() throws IOException {
-
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
- MockGetGenericVnfById_404("/skask/vf-modules/vf-module/supercool");
- MockGetGenericVnfById("/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200);
- MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
- invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
- System.out.println("Subflow response code: " + responseCode);
- System.out.println("Subflow response: " + response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/UpdateAAIVfModule.bpmn"
+ })
+ public void happyPath() throws IOException {
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfByIdWithPriority("/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml");
+ MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+ MockPatchVfModuleId("skask", "supercool");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(200, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/UpdateAAIVfModule.bpmn"
+ })
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfById("/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/UpdateAAIVfModule.bpmn"
+ })
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfById_404("/skask/vf-modules/vf-module/supercool");
+ MockGetGenericVnfById("/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200);
+ MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
+ System.out.println("Subflow response code: " + responseCode);
+ System.out.println("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java
index fb029fa740..e9a16a73b0 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -42,348 +42,348 @@ import org.openecomp.mso.bpmn.core.WorkflowException;
*/
public class VnfAdapterRestV1Test extends WorkflowTest {
- private static final String EOL = "\n";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- private final String CREATE_VF_MODULE_REQUEST =
- "<createVfModuleRequest>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleName>vfModuleName</vfModuleName>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vnfType>vnfType</vnfType>" + EOL +
- " <vnfVersion>vnfVersion</vnfVersion>" + EOL +
- " <vfModuleType>vfModuleType</vfModuleType>" + EOL +
- " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
- " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
- " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
- " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <backout>false</backout>" + EOL +
- " <failIfExists>true</failIfExists>" + EOL +
- " <vfModuleParams>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleParams>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- "</createVfModuleRequest>" + EOL;
-
- private final String UPDATE_VF_MODULE_REQUEST =
- "<updateVfModuleRequest>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleName>vfModuleName</vfModuleName>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vnfType>vnfType</vnfType>" + EOL +
- " <vnfVersion>vnfVersion</vnfVersion>" + EOL +
- " <vfModuleType>vfModuleType</vfModuleType>" + EOL +
- " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
- " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
- " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
- " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <backout>false</backout>" + EOL +
- " <failIfExists>true</failIfExists>" + EOL +
- " <vfModuleParams>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleParams>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- "</updateVfModuleRequest>" + EOL;
-
- private final String DELETE_VF_MODULE_REQUEST =
- "<deleteVfModuleRequest>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- "</deleteVfModuleRequest>" + EOL;
-
- private final String ROLLBACK_VF_MODULE_REQUEST =
- "<rollbackVfModuleRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <vfModuleRollback>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <vfModuleCreated>true</vfModuleCreated>" + EOL +
- " </vfModuleRollback>" + EOL +
- "</rollbackVfModuleRequest>" + EOL;
-
- public VnfAdapterRestV1Test() throws IOException {
- callbacks.put("createVfModule",
- "<createVfModuleResponse>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vfModuleCreated>true</vfModuleCreated>" + EOL +
- " <vfModuleOutputs>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleOutputs>" + EOL +
- " <rollback>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vfModuleCreated>true</vfModuleCreated>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>messageId</messageId>" + EOL +
- " </rollback>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</createVfModuleResponse>" + EOL);
-
- callbacks.put("updateVfModule",
- "<updateVfModuleResponse>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vfModuleOutputs>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleOutputs>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</updateVfModuleResponse>" + EOL);
-
- callbacks.put("deleteVfModule",
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL);
-
- callbacks.put("rollbackVfModule",
- "<rollbackVfModuleResponse>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <vfModuleRolledback>true</vfModuleRolledback>" + EOL +
- "</rollbackVfModuleResponse>" + EOL);
-
- callbacks.put("vfModuleException",
- "<vfModuleException>" + EOL +
- " <message>message</message>" + EOL +
- " <category>category</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL);
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void testCreateVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFPost("", 202, "vnfId");
-
- String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
- String messageId = requestId + "-" + System.currentTimeMillis();
- String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", requestId);
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfAdapterRestV1Request", request);
-
- invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
- injectVNFRestCallbacks(callbacks, "createVfModule");
- waitForProcessEnd(businessKey, 10000);
-
- String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
- System.out.println("Response:\n" + response);
- assertTrue(response.contains("<createVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void testUpdateVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFPut("/vfModuleId", 202);
-
- String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
- String messageId = requestId + "-" + System.currentTimeMillis();
- String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", requestId);
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfAdapterRestV1Request", request);
-
- invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
- injectVNFRestCallbacks(callbacks, "updateVfModule");
- waitForProcessEnd(businessKey, 10000);
-
- String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
- System.out.println("Response:\n" + response);
- assertTrue(response.contains("<updateVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void testDeleteVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFDelete("vnfId", "/vfModuleId", 202);
-
- String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
- String messageId = requestId + "-" + System.currentTimeMillis();
- String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", requestId);
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfAdapterRestV1Request", request);
-
- invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
- injectVNFRestCallbacks(callbacks, "deleteVfModule");
- waitForProcessEnd(businessKey, 10000);
-
- String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
- System.out.println("Response:\n" + response);
- assertTrue(response.contains("<deleteVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void testRollbackVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFRollbackDelete("/vfModuleId", 202);
-
- String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
- String messageId = requestId + "-" + System.currentTimeMillis();
- String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", requestId);
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfAdapterRestV1Request", request);
-
- invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
- injectVNFRestCallbacks(callbacks, "rollbackVfModule");
- waitForProcessEnd(businessKey, 10000);
-
- String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
- System.out.println("Response:\n" + response);
- assertTrue(response.contains("<rollbackVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void testCreateVfModuleException() throws Exception {
- logStart();
-
- mockVNFPost("", 202, "vnfId");
-
- String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
- String messageId = requestId + "-" + System.currentTimeMillis();
- String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", requestId);
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfAdapterRestV1Request", request);
-
- invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
- injectVNFRestCallbacks(callbacks, "vfModuleException");
- waitForProcessEnd(businessKey, 10000);
-
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertNotNull(wfe);
- System.out.println(wfe.toString());
-
- String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
- System.out.println("Response:\n" + response);
- assertTrue(response.contains("<vfModuleException>"));
- assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
+ private static final String EOL = "\n";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private final String CREATE_VF_MODULE_REQUEST =
+ "<createVfModuleRequest>" + EOL +
+ " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <tenantId>tenantId</tenantId>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleName>vfModuleName</vfModuleName>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vnfType>vnfType</vnfType>" + EOL +
+ " <vnfVersion>vnfVersion</vnfVersion>" + EOL +
+ " <vfModuleType>vfModuleType</vfModuleType>" + EOL +
+ " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
+ " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
+ " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
+ " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
+ " <skipAAI>true</skipAAI>" + EOL +
+ " <backout>false</backout>" + EOL +
+ " <failIfExists>true</failIfExists>" + EOL +
+ " <vfModuleParams>" + EOL +
+ " <entry>" + EOL +
+ " <key>key1</key>" + EOL +
+ " <value>value1</value>" + EOL +
+ " </entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>key2</key>" + EOL +
+ " <value>value2</value>" + EOL +
+ " </entry>" + EOL +
+ " </vfModuleParams>" + EOL +
+ " <msoRequest>" + EOL +
+ " <requestId>requestId</requestId>" + EOL +
+ " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
+ " </msoRequest>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
+ "</createVfModuleRequest>" + EOL;
+
+ private final String UPDATE_VF_MODULE_REQUEST =
+ "<updateVfModuleRequest>" + EOL +
+ " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <tenantId>tenantId</tenantId>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleName>vfModuleName</vfModuleName>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <vnfType>vnfType</vnfType>" + EOL +
+ " <vnfVersion>vnfVersion</vnfVersion>" + EOL +
+ " <vfModuleType>vfModuleType</vfModuleType>" + EOL +
+ " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
+ " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
+ " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
+ " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
+ " <skipAAI>true</skipAAI>" + EOL +
+ " <backout>false</backout>" + EOL +
+ " <failIfExists>true</failIfExists>" + EOL +
+ " <vfModuleParams>" + EOL +
+ " <entry>" + EOL +
+ " <key>key1</key>" + EOL +
+ " <value>value1</value>" + EOL +
+ " </entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>key2</key>" + EOL +
+ " <value>value2</value>" + EOL +
+ " </entry>" + EOL +
+ " </vfModuleParams>" + EOL +
+ " <msoRequest>" + EOL +
+ " <requestId>requestId</requestId>" + EOL +
+ " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
+ " </msoRequest>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
+ "</updateVfModuleRequest>" + EOL;
+
+ private final String DELETE_VF_MODULE_REQUEST =
+ "<deleteVfModuleRequest>" + EOL +
+ " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <tenantId>tenantId</tenantId>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <skipAAI>true</skipAAI>" + EOL +
+ " <msoRequest>" + EOL +
+ " <requestId>requestId</requestId>" + EOL +
+ " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
+ " </msoRequest>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
+ "</deleteVfModuleRequest>" + EOL;
+
+ private final String ROLLBACK_VF_MODULE_REQUEST =
+ "<rollbackVfModuleRequest>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
+ " <skipAAI>true</skipAAI>" + EOL +
+ " <vfModuleRollback>" + EOL +
+ " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <tenantId>tenantId</tenantId>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <msoRequest>" + EOL +
+ " <requestId>requestId</requestId>" + EOL +
+ " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
+ " </msoRequest>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <vfModuleCreated>true</vfModuleCreated>" + EOL +
+ " </vfModuleRollback>" + EOL +
+ "</rollbackVfModuleRequest>" + EOL;
+
+ public VnfAdapterRestV1Test() throws IOException {
+ callbacks.put("createVfModule",
+ "<createVfModuleResponse>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <vfModuleCreated>true</vfModuleCreated>" + EOL +
+ " <vfModuleOutputs>" + EOL +
+ " <entry>" + EOL +
+ " <key>key1</key>" + EOL +
+ " <value>value1</value>" + EOL +
+ " </entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>key2</key>" + EOL +
+ " <value>value2</value>" + EOL +
+ " </entry>" + EOL +
+ " </vfModuleOutputs>" + EOL +
+ " <rollback>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <vfModuleCreated>true</vfModuleCreated>" + EOL +
+ " <tenantId>tenantId</tenantId>" + EOL +
+ " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <msoRequest>" + EOL +
+ " <requestId>requestId</requestId>" + EOL +
+ " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
+ " </msoRequest>" + EOL +
+ " <messageId>messageId</messageId>" + EOL +
+ " </rollback>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</createVfModuleResponse>" + EOL);
+
+ callbacks.put("updateVfModule",
+ "<updateVfModuleResponse>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <vfModuleOutputs>" + EOL +
+ " <entry>" + EOL +
+ " <key>key1</key>" + EOL +
+ " <value>value1</value>" + EOL +
+ " </entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>key2</key>" + EOL +
+ " <value>value2</value>" + EOL +
+ " </entry>" + EOL +
+ " </vfModuleOutputs>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</updateVfModuleResponse>" + EOL);
+
+ callbacks.put("deleteVfModule",
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL);
+
+ callbacks.put("rollbackVfModule",
+ "<rollbackVfModuleResponse>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <vfModuleRolledback>true</vfModuleRolledback>" + EOL +
+ "</rollbackVfModuleResponse>" + EOL);
+
+ callbacks.put("vfModuleException",
+ "<vfModuleException>" + EOL +
+ " <message>message</message>" + EOL +
+ " <category>category</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL);
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void testCreateVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFPost("", 202, "vnfId");
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "createVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ System.out.println("Response:\n" + response);
+ assertTrue(response.contains("<createVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void testUpdateVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFPut("/vfModuleId", 202);
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "updateVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ System.out.println("Response:\n" + response);
+ assertTrue(response.contains("<updateVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void testDeleteVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFDelete("vnfId", "/vfModuleId", 202);
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "deleteVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ System.out.println("Response:\n" + response);
+ assertTrue(response.contains("<deleteVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void testRollbackVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFRollbackDelete("/vfModuleId", 202);
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "rollbackVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ System.out.println("Response:\n" + response);
+ assertTrue(response.contains("<rollbackVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void testCreateVfModuleException() throws Exception {
+ logStart();
+
+ mockVNFPost("", 202, "vnfId");
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "vfModuleException");
+ waitForProcessEnd(businessKey, 10000);
+
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ assertNotNull(wfe);
+ System.out.println(wfe.toString());
+
+ String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+ System.out.println("Response:\n" + response);
+ assertTrue(response.contains("<vfModuleException>"));
+ assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java
index 5f91298958..61dd627206 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -36,61 +36,62 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
public class WorkflowAsyncResourceTest extends WorkflowTest {
- @Test
- @Deployment(resources = { "testAsyncResource.bpmn" })
- public void asyncRequestSuccess() throws InterruptedException {
- //it can be any request which asynchronously processed by the workflow
- String request = "<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>";
-
- Map<String,String> variables = new HashMap<>();
- variables.put("testAsyncRequestMsg", request);
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("mso-service-request-timeout", "5");
-
- WorkflowResponse workflowResponse = BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables);
- assertEquals("Received the request, the process is getting executed, request message<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>", workflowResponse.getResponse());
- assertEquals(200, workflowResponse.getMessageCode());
- }
-
- private void executeWorkflow(String request, String requestId, AsynchronousResponse asyncResponse, String processKey) {
- WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
- VariableMapImpl variableMap = new VariableMapImpl();
-
- Map<String, Object> variableValueType = new HashMap<>();
-
- Map<String, Object> requestMsg = new HashMap<>();
- requestMsg.put("value", request);
- requestMsg.put("type", "String");
-
- Map<String, Object> msorequestId = new HashMap<>();
- msorequestId.put("type", "String");
- msorequestId.put("value",requestId);
-
- Map<String, Object> timeout = new HashMap<>();
- timeout.put("type", "String");
- timeout.put("value","5");
-
- variableValueType.put("testAsyncRequestMsg", requestMsg);
- variableValueType.put("mso-request-id", msorequestId);
- variableValueType.put("mso-service-request-timeout", timeout);
-
- variableMap.put("variables", variableValueType);
-
- workflowResource.setProcessEngineServices4junit(processEngineRule);
- workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMap);
- }
-
- class ProcessThread extends Thread {
-
- public WorkflowResponse workflowResponse;
- public String requestId;
- public String processKey;
- public AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class);
- public String request;
- public boolean started;
- public void run() {
- started = true;
- executeWorkflow(request, requestId, asyncResponse, processKey);
- }
- }
+ @Test
+ @Deployment(resources = {"testAsyncResource.bpmn"})
+ public void asyncRequestSuccess() throws InterruptedException {
+ //it can be any request which asynchronously processed by the workflow
+ String request = "<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>";
+
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testAsyncRequestMsg", request);
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("mso-service-request-timeout", "5");
+
+ WorkflowResponse workflowResponse = BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables);
+ assertEquals("Received the request, the process is getting executed, request message<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>", workflowResponse.getResponse());
+ assertEquals(200, workflowResponse.getMessageCode());
+ }
+
+ private void executeWorkflow(String request, String requestId, AsynchronousResponse asyncResponse, String processKey) {
+ WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+
+ Map<String, Object> requestMsg = new HashMap<>();
+ requestMsg.put("value", request);
+ requestMsg.put("type", "String");
+
+ Map<String, Object> msorequestId = new HashMap<>();
+ msorequestId.put("type", "String");
+ msorequestId.put("value", requestId);
+
+ Map<String, Object> timeout = new HashMap<>();
+ timeout.put("type", "String");
+ timeout.put("value", "5");
+
+ variableValueType.put("testAsyncRequestMsg", requestMsg);
+ variableValueType.put("mso-request-id", msorequestId);
+ variableValueType.put("mso-service-request-timeout", timeout);
+
+ variableMap.put("variables", variableValueType);
+
+ workflowResource.setProcessEngineServices4junit(processEngineRule);
+ workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMap);
+ }
+
+ class ProcessThread extends Thread {
+
+ public WorkflowResponse workflowResponse;
+ public String requestId;
+ public String processKey;
+ public AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class);
+ public String request;
+ public boolean started;
+
+ public void run() {
+ started = true;
+ executeWorkflow(request, requestId, asyncResponse, processKey);
+ }
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java
index 0da711a7b8..6ac5270c4c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.common;
@@ -39,59 +39,59 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
public class WorkflowContextHolderTest {
- private WorkflowContext createContext(AsynchronousResponse asyncResponse) {
- WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
- String requestId = UUID.randomUUID().toString();
- WorkflowContext workflowContext = new WorkflowContext("testAsyncProcess",
- requestId, asyncResponse, 1000L);
- contextHolder.put(workflowContext);
- return workflowContext;
- }
-
- @Test
- @Ignore // BROKEN TEST (previously ignored)
- public void testContextExpiry() throws InterruptedException {
-
- WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
- AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class);
- WorkflowContext workflowContext = createContext(asyncResponse);
- String requestId = workflowContext.getRequestId();
- WorkflowContext context1 = contextHolder.getWorkflowContext(requestId);
-
- Assert.assertNotNull(context1);
- Assert.assertEquals(requestId, context1.getRequestId());
- Assert.assertEquals(workflowContext.getProcessKey(), context1.getProcessKey());
- Assert.assertEquals(workflowContext.getStartTime(), context1.getStartTime());
-
- Thread.sleep(1000);
- //context should not be available after a second
- WorkflowContext context2 = contextHolder.getWorkflowContext(requestId);
- Assert.assertNull(context2);
- }
-
- @Test
- public void testProcessCallback() {
- WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
- AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class);
- WorkflowContext workflowContext = createContext(asyncResponse);
-
- WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
- callbackResponse.setMessage("Success");
- callbackResponse.setResponse("Successfully processed request");
- callbackResponse.setStatusCode(200);
-
- Response response = contextHolder.processCallback("testAsyncProcess",
- "process-instance-id", workflowContext.getRequestId(),
- callbackResponse);
- WorkflowResponse response1 = (WorkflowResponse) response.getEntity();
- Assert.assertNotNull(response1.getMessage());
- Assert.assertEquals(200,response1.getMessageCode());
- Assert.assertEquals("Success", response1.getMessage());
- Assert.assertEquals("Successfully processed request", response1.getResponse());
- verify(asyncResponse).setResponse(any(Response.class));
-
- WorkflowContext context1 = contextHolder.getWorkflowContext(workflowContext.getRequestId());
- Assert.assertNull(context1);
- }
+ private WorkflowContext createContext(AsynchronousResponse asyncResponse) {
+ WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
+ String requestId = UUID.randomUUID().toString();
+ WorkflowContext workflowContext = new WorkflowContext("testAsyncProcess",
+ requestId, asyncResponse, 1000L);
+ contextHolder.put(workflowContext);
+ return workflowContext;
+ }
+
+ @Test
+ @Ignore // BROKEN TEST (previously ignored)
+ public void testContextExpiry() throws InterruptedException {
+
+ WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
+ AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class);
+ WorkflowContext workflowContext = createContext(asyncResponse);
+ String requestId = workflowContext.getRequestId();
+ WorkflowContext context1 = contextHolder.getWorkflowContext(requestId);
+
+ Assert.assertNotNull(context1);
+ Assert.assertEquals(requestId, context1.getRequestId());
+ Assert.assertEquals(workflowContext.getProcessKey(), context1.getProcessKey());
+ Assert.assertEquals(workflowContext.getStartTime(), context1.getStartTime());
+
+ Thread.sleep(1000);
+ //context should not be available after a second
+ WorkflowContext context2 = contextHolder.getWorkflowContext(requestId);
+ Assert.assertNull(context2);
+ }
+
+ @Test
+ public void testProcessCallback() {
+ WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
+ AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class);
+ WorkflowContext workflowContext = createContext(asyncResponse);
+
+ WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
+ callbackResponse.setMessage("Success");
+ callbackResponse.setResponse("Successfully processed request");
+ callbackResponse.setStatusCode(200);
+
+ Response response = contextHolder.processCallback("testAsyncProcess",
+ "process-instance-id", workflowContext.getRequestId(),
+ callbackResponse);
+ WorkflowResponse response1 = (WorkflowResponse) response.getEntity();
+ Assert.assertNotNull(response1.getMessage());
+ Assert.assertEquals(200, response1.getMessageCode());
+ Assert.assertEquals("Success", response1.getMessage());
+ Assert.assertEquals("Successfully processed request", response1.getResponse());
+ verify(asyncResponse).setResponse(any(Response.class));
+
+ WorkflowContext context1 = contextHolder.getWorkflowContext(workflowContext.getRequestId());
+ Assert.assertNull(context1);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java
index 6f0095fb02..df2004d911 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java
@@ -83,6 +83,7 @@ import org.openecomp.mso.bpmn.core.domain.Resource;
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
import static org.openecomp.mso.bpmn.core.json.JsonUtils.*;
+
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -95,7 +96,6 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
/**
* A base class for Workflow tests.
* <p>
@@ -108,1934 +108,1970 @@ import com.github.tomakehurst.wiremock.junit.WireMockRule;
* </pre>
*/
public class WorkflowTest {
- @Rule
- public final ProcessEngineRule processEngineRule = new ProcessEngineRule();
-
- @Rule
- public final WireMockRule wireMockRule;
-
- /**
- * Content-Type for XML.
- */
- protected static final String XML = "application/xml";
-
- /**
- * Content-Type for JSON.
- */
- protected static final String JSON = "application/json; charset=UTF-8";
-
-
- /**
- * Constructor.
- */
- public WorkflowTest() throws RuntimeException {
- // Process WorkflowTestTransformer annotations
- List<ResponseTransformer> transformerList = new ArrayList<ResponseTransformer>();
-
- for (Field field : getClass().getFields()) {
- WorkflowTestTransformer annotation = (WorkflowTestTransformer)
- field.getAnnotation(WorkflowTestTransformer.class);
-
- if (annotation == null) {
- continue;
- }
-
- if (!Modifier.isStatic(field.getModifiers())) {
- throw new RuntimeException(field.getDeclaringClass().getName()
- + "#" + field.getName() + " has a @WorkflowTestTransformer "
- + " annotation but it is not declared static");
- }
-
- ResponseTransformer transformer;
-
- try {
- transformer = (ResponseTransformer) field.get(null);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(field.getDeclaringClass().getName()
- + "#" + field.getName() + " is not accessible", e);
- } catch (ClassCastException e) {
- throw new RuntimeException(field.getDeclaringClass().getName()
- + "#" + field.getName() + " is not a ResponseTransformer", e);
- }
-
- if (transformer == null) {
- continue;
- }
-
- transformerList.add(transformer);
- }
-
- ResponseTransformer[] transformerArray =
- transformerList.toArray(new ResponseTransformer[transformerList.size()]);
-
- wireMockRule = new WireMockRule(WireMockConfiguration.wireMockConfig()
- .port(28090).extensions(transformerArray));
- }
-
- @Before
- public void testSetup() throws Exception {
- CamundaDBSetup.configure();
- PropertyConfigurationSetup.init();
- }
-
- /**
- * The current request ID. Normally set when an "invoke" method is called.
- */
- protected volatile String msoRequestId = null;
-
- /**
- * The current service instance ID. Normally set when an "invoke" method
- * is called.
- */
- protected volatile String msoServiceInstanceId = null;
-
- /**
- * Logs a test start method.
- */
- protected void logStart() {
- StackTraceElement[] st = Thread.currentThread().getStackTrace();
- String method = st[2].getMethodName();
- System.out.println("STARTED TEST: " + method);
- }
-
- /**
- * Logs a test end method.
- */
- protected void logEnd() {
- StackTraceElement[] st = Thread.currentThread().getStackTrace();
- String method = st[2].getMethodName();
- System.out.println("ENDED TEST: " + method);
- }
-
- /**
- * Invokes a subprocess.
- * @param processKey the process key
- * @param businessKey a unique key that will identify the process instance
- * @param injectedVariables variables to inject into the process
- */
- protected void invokeSubProcess(String processKey, String businessKey, Map<String, Object> injectedVariables) {
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- System.out.println("JVM args = " + arguments);
-
- msoRequestId = (String) injectedVariables.get("mso-request-id");
- String requestId = (String) injectedVariables.get("msoRequestId");
-
- if (msoRequestId == null && requestId == null) {
- String msg = "mso-request-id variable was not provided";
- System.out.println(msg);
- fail(msg);
- }
-
- // Note: some scenarios don't have a service-instance-id, may be null
- msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
-
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables);
- }
-
- /**
- * Invokes an asynchronous process.
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param processKey the process key
- * @param schemaVersion the API schema version, e.g. "v1"
- * @param businessKey a unique key that will identify the process instance
- * @param request the request
- * @return a TestAsyncResponse object associated with the test
- */
- protected TestAsyncResponse invokeAsyncProcess(String processKey,
- String schemaVersion, String businessKey, String request) {
- return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null);
- }
-
- /**
- * Invokes an asynchronous process.
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param processKey the process key
- * @param schemaVersion the API schema version, e.g. "v1"
- * @param businessKey a unique key that will identify the process instance
- * @param request the request
- * @param injectedVariables optional variables to inject into the process
- * @return a TestAsyncResponse object associated with the test
- */
- protected TestAsyncResponse invokeAsyncProcess(String processKey,
- String schemaVersion, String businessKey, String request,
- Map<String, Object> injectedVariables) {
-
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- System.out.println("JVM args = " + arguments);
-
- Map<String, Object> variables = createVariables(schemaVersion, businessKey,
- request, injectedVariables, false);
- VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
-
- System.out.println("Sending " + request + " to " + processKey + " process");
- WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
- workflowResource.setProcessEngineServices4junit(processEngineRule);
-
- TestAsyncResponse asyncResponse = new TestAsyncResponse();
- workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMapImpl);
- return asyncResponse;
- }
-
- /**
- * Invokes an asynchronous process.
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param processKey the process key
- * @param schemaVersion the API schema version, e.g. "v1"
- * @param businessKey a unique key that will identify the process instance
- * @param request the request
- * @param injectedVariables optional variables to inject into the process
- * @param serviceInstantiationModel indicates whether this method is being
- * invoked for a flow that is designed using the service instantiation model
- * @return a TestAsyncResponse object associated with the test
- */
- protected TestAsyncResponse invokeAsyncProcess(String processKey,
- String schemaVersion, String businessKey, String request,
- Map<String, Object> injectedVariables, boolean serviceInstantiationModel) {
-
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- System.out.println("JVM args = " + arguments);
-
- Map<String, Object> variables = createVariables(schemaVersion, businessKey,
- request, injectedVariables, serviceInstantiationModel);
- VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
-
- System.out.println("Sending " + request + " to " + processKey + " process");
- WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
- workflowResource.setProcessEngineServices4junit(processEngineRule);
-
- TestAsyncResponse asyncResponse = new TestAsyncResponse();
- workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMapImpl);
- return asyncResponse;
- }
-
- /**
- * Private helper method that creates a variable map for a request.
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param schemaVersion the API schema version, e.g. "v1"
- * @param businessKey a unique key that will identify the process instance
- * @param request the request
- * @param injectedVariables optional variables to inject into the process
- * @param serviceInstantiationModel indicates whether this method is being
- * invoked for a flow that is designed using the service instantiation model
- * @return a variable map
- */
- private Map<String, Object> createVariables(String schemaVersion,
- String businessKey, String request, Map<String, Object> injectedVariables,
- boolean serviceInstantiationModel) {
-
- Map<String, Object> variables = new HashMap<>();
-
- // These variables may be overridded by injected variables.
- variables.put("mso-service-request-timeout", "180");
- variables.put("isDebugLogEnabled", "true");
-
- // These variables may not be overridded by injected variables.
- String[] notAllowed = new String[] {
- "mso-schema-version",
- "mso-business-key",
- "bpmnRequest",
- "mso-request-id",
- "mso-service-instance-id"
- };
-
- if (injectedVariables != null) {
- for (String key : injectedVariables.keySet()) {
- for (String var : notAllowed) {
- if (var.equals(key)) {
- String msg = "Cannot specify " + var + " in injected variables";
- System.out.println(msg);
- fail(msg);
- }
- }
-
- variables.put(key, injectedVariables.get(key));
- }
- }
-
- variables.put("mso-schema-version", schemaVersion);
- variables.put("mso-business-key", businessKey);
- variables.put("bpmnRequest", request);
-
- if (serviceInstantiationModel) {
+ @Rule
+ public final ProcessEngineRule processEngineRule = new ProcessEngineRule();
+
+ @Rule
+ public final WireMockRule wireMockRule;
+
+ /**
+ * Content-Type for XML.
+ */
+ protected static final String XML = "application/xml";
+
+ /**
+ * Content-Type for JSON.
+ */
+ protected static final String JSON = "application/json; charset=UTF-8";
+
+
+ /**
+ * Constructor.
+ */
+ public WorkflowTest() throws RuntimeException {
+ // Process WorkflowTestTransformer annotations
+ List<ResponseTransformer> transformerList = new ArrayList<ResponseTransformer>();
+
+ for (Field field : getClass().getFields()) {
+ WorkflowTestTransformer annotation = (WorkflowTestTransformer)
+ field.getAnnotation(WorkflowTestTransformer.class);
+
+ if (annotation == null) {
+ continue;
+ }
+
+ if (!Modifier.isStatic(field.getModifiers())) {
+ throw new RuntimeException(field.getDeclaringClass().getName()
+ + "#" + field.getName() + " has a @WorkflowTestTransformer "
+ + " annotation but it is not declared static");
+ }
+
+ ResponseTransformer transformer;
+
+ try {
+ transformer = (ResponseTransformer) field.get(null);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(field.getDeclaringClass().getName()
+ + "#" + field.getName() + " is not accessible", e);
+ } catch (ClassCastException e) {
+ throw new RuntimeException(field.getDeclaringClass().getName()
+ + "#" + field.getName() + " is not a ResponseTransformer", e);
+ }
+
+ if (transformer == null) {
+ continue;
+ }
+
+ transformerList.add(transformer);
+ }
+
+ ResponseTransformer[] transformerArray =
+ transformerList.toArray(new ResponseTransformer[transformerList.size()]);
+
+ wireMockRule = new WireMockRule(WireMockConfiguration.wireMockConfig()
+ .port(28090).extensions(transformerArray));
+ }
+
+ @Before
+ public void testSetup() throws Exception {
+ CamundaDBSetup.configure();
+ PropertyConfigurationSetup.init();
+ }
+
+ /**
+ * The current request ID. Normally set when an "invoke" method is called.
+ */
+ protected volatile String msoRequestId = null;
+
+ /**
+ * The current service instance ID. Normally set when an "invoke" method
+ * is called.
+ */
+ protected volatile String msoServiceInstanceId = null;
+
+ /**
+ * Logs a test start method.
+ */
+ protected void logStart() {
+ StackTraceElement[] st = Thread.currentThread().getStackTrace();
+ String method = st[2].getMethodName();
+ System.out.println("STARTED TEST: " + method);
+ }
+
+ /**
+ * Logs a test end method.
+ */
+ protected void logEnd() {
+ StackTraceElement[] st = Thread.currentThread().getStackTrace();
+ String method = st[2].getMethodName();
+ System.out.println("ENDED TEST: " + method);
+ }
+
+ /**
+ * Invokes a subprocess.
+ *
+ * @param processKey the process key
+ * @param businessKey a unique key that will identify the process instance
+ * @param injectedVariables variables to inject into the process
+ */
+ protected void invokeSubProcess(String processKey, String businessKey, Map<String, Object> injectedVariables) {
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ System.out.println("JVM args = " + arguments);
+
+ msoRequestId = (String) injectedVariables.get("mso-request-id");
+ String requestId = (String) injectedVariables.get("msoRequestId");
+
+ if (msoRequestId == null && requestId == null) {
+ String msg = "mso-request-id variable was not provided";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ // Note: some scenarios don't have a service-instance-id, may be null
+ msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
+
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables);
+ }
+
+ /**
+ * Invokes an asynchronous process.
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param processKey the process key
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @return a TestAsyncResponse object associated with the test
+ */
+ protected TestAsyncResponse invokeAsyncProcess(String processKey,
+ String schemaVersion, String businessKey, String request) {
+ return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null);
+ }
+
+ /**
+ * Invokes an asynchronous process.
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param processKey the process key
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @param injectedVariables optional variables to inject into the process
+ * @return a TestAsyncResponse object associated with the test
+ */
+ protected TestAsyncResponse invokeAsyncProcess(String processKey,
+ String schemaVersion, String businessKey, String request,
+ Map<String, Object> injectedVariables) {
+
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ System.out.println("JVM args = " + arguments);
+
+ Map<String, Object> variables = createVariables(schemaVersion, businessKey,
+ request, injectedVariables, false);
+ VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
+
+ System.out.println("Sending " + request + " to " + processKey + " process");
+ WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
+ workflowResource.setProcessEngineServices4junit(processEngineRule);
+
+ TestAsyncResponse asyncResponse = new TestAsyncResponse();
+ workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMapImpl);
+ return asyncResponse;
+ }
+
+ /**
+ * Invokes an asynchronous process.
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param processKey the process key
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @param injectedVariables optional variables to inject into the process
+ * @param serviceInstantiationModel indicates whether this method is being
+ * invoked for a flow that is designed using the service instantiation model
+ * @return a TestAsyncResponse object associated with the test
+ */
+ protected TestAsyncResponse invokeAsyncProcess(String processKey,
+ String schemaVersion, String businessKey, String request,
+ Map<String, Object> injectedVariables, boolean serviceInstantiationModel) {
+
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ System.out.println("JVM args = " + arguments);
+
+ Map<String, Object> variables = createVariables(schemaVersion, businessKey,
+ request, injectedVariables, serviceInstantiationModel);
+ VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
+
+ System.out.println("Sending " + request + " to " + processKey + " process");
+ WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
+ workflowResource.setProcessEngineServices4junit(processEngineRule);
+
+ TestAsyncResponse asyncResponse = new TestAsyncResponse();
+ workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMapImpl);
+ return asyncResponse;
+ }
+
+ /**
+ * Private helper method that creates a variable map for a request.
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @param injectedVariables optional variables to inject into the process
+ * @param serviceInstantiationModel indicates whether this method is being
+ * invoked for a flow that is designed using the service instantiation model
+ * @return a variable map
+ */
+ private Map<String, Object> createVariables(String schemaVersion,
+ String businessKey, String request, Map<String, Object> injectedVariables,
+ boolean serviceInstantiationModel) {
+
+ Map<String, Object> variables = new HashMap<>();
+
+ // These variables may be overridded by injected variables.
+ variables.put("mso-service-request-timeout", "180");
+ variables.put("isDebugLogEnabled", "true");
+
+ // These variables may not be overridded by injected variables.
+ String[] notAllowed = new String[]{
+ "mso-schema-version",
+ "mso-business-key",
+ "bpmnRequest",
+ "mso-request-id",
+ "mso-service-instance-id"
+ };
+
+ if (injectedVariables != null) {
+ for (String key : injectedVariables.keySet()) {
+ for (String var : notAllowed) {
+ if (var.equals(key)) {
+ String msg = "Cannot specify " + var + " in injected variables";
+ System.out.println(msg);
+ fail(msg);
+ }
+ }
+
+ variables.put(key, injectedVariables.get(key));
+ }
+ }
+
+ variables.put("mso-schema-version", schemaVersion);
+ variables.put("mso-business-key", businessKey);
+ variables.put("bpmnRequest", request);
+
+ if (serviceInstantiationModel) {
/*
- * The request ID and the service instance ID are generated for flows
+ * The request ID and the service instance ID are generated for flows
* that follow the service instantiation model unless "requestId" and
* "serviceInstanceId" are injected variables.
*/
- try {
- msoRequestId = (String) injectedVariables.get("requestId");
- variables.put("mso-request-id", msoRequestId);
- msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
- variables.put("mso-service-instance-id", msoServiceInstanceId);
- }
- catch(Exception e) {
- }
- if (msoRequestId == null || msoRequestId.trim().equals("")) {
- System.out.println("No requestId element in injectedVariables");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- }
- if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) {
- System.out.println("No seviceInstanceId element in injectedVariables");
- variables.put("mso-service-instance-id", UUID.randomUUID().toString());
- }
-
- } else {
- msoRequestId = getXMLTextElement(request, "request-id");
-
- if (msoRequestId == null) {
- //check in injected variables
- try {
- msoRequestId = (String) injectedVariables.get("requestId");
- }
- catch(Exception e) {
- }
- if (msoRequestId == null || msoRequestId.trim().equals("")) {
- String msg = "No request-id element in " + request;
- System.out.println(msg);
- fail(msg);
- }
- }
-
- variables.put("mso-request-id", msoRequestId);
-
- // Note: some request types don't have a service-instance-id
- msoServiceInstanceId = getXMLTextElement(request, "service-instance-id");
-
- if (msoServiceInstanceId != null) {
- variables.put("mso-service-instance-id", msoServiceInstanceId);
- }
- }
-
- return variables;
- }
-
- /**
- * Private helper method that creates a camunda VariableMapImpl from a simple
- * variable map.
- * @param variables the simple variable map
- * @return a VariableMap
- */
- private VariableMapImpl createVariableMapImpl(Map<String, Object> variables) {
- Map<String, Object> wrappedVariables = new HashMap<>();
-
- for (String key : variables.keySet()) {
- Object value = variables.get(key);
- wrappedVariables.put(key, wrapVariableValue(value));
- }
-
- VariableMapImpl variableMapImpl = new VariableMapImpl();
- variableMapImpl.put("variables", wrappedVariables);
- return variableMapImpl;
- }
-
- /**
- * Private helper method that wraps a variable value for inclusion in a
- * camunda VariableMapImpl.
- * @param value the variable value
- * @return the wrapped variable
- */
- private Map<String, Object> wrapVariableValue(Object value) {
- HashMap<String, Object> valueMap = new HashMap<>();
- valueMap.put("value", value);
- return valueMap;
- }
-
- /**
- * Receives a response from an asynchronous process.
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param businessKey the process business key
- * @param asyncResponse the TestAsyncResponse object associated with the test
- * @param timeout the timeout in milliseconds
- * @return the WorkflowResponse
- */
- protected WorkflowResponse receiveResponse(String businessKey,
- TestAsyncResponse asyncResponse, long timeout) {
- System.out.println("Waiting " + timeout + "ms for process with business key " + businessKey
- + " to send a response");
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
-
- while (now <= endTime) {
- Response response = asyncResponse.getResponse();
-
- if (response != null) {
- System.out.println("Received a response from process with business key " + businessKey);
-
- Object entity = response.getEntity();
-
- if (!(entity instanceof WorkflowResponse)) {
- String msg = "Response entity is " +
- (entity == null ? "null" : entity.getClass().getName()) +
- ", expected WorkflowResponse";
- System.out.println(msg);
- fail(msg);
- return null; // unreachable
- }
-
- return (WorkflowResponse) entity;
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- String msg = "Interrupted waiting for a response from process with business key " +
- businessKey;
- System.out.println(msg);
- fail(msg);
- return null; // unreachable
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "No response received from process with business key " + businessKey +
- " within " + timeout + "ms";
- System.out.println(msg);
- fail("Process with business key " + businessKey + " did not end within 10000ms");
- return null; // unreachable
- }
-
- /**
- * Runs a program to inject SDNC callback data into the test environment.
- * A program is essentially just a list of keys that identify callback data
- * to be injected, in sequence. An example program:
- * <pre>
- * reserve, assign, delete:ERR
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param callbacks an object containing callback data for the program
- * @param program the program to execute
- */
- protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String content = null;
- String contentType = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No callback defined for '" + action + "' SDNC request";
- System.out.println(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else if ("ERR".equals(modifier)) {
- content = "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}";
- contentType = JSON;
- } else {
- String msg = "Invalid SDNC program modifier: '" + modifier + "'";
- System.out.println(msg);
- fail(msg);
- }
-
- if (contentType == null) {
- // Default for backward compatibility with existing tests.
- contentType = JSON;
- }
-
- if (!injectSDNCRestCallback(contentType, content, 10000)) {
- fail("Failed to inject SDNC '" + action + "' callback");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of SDNC '" + action + "' callback");
- }
- }
- }
-
- /**
- * Runs a program to inject SDNC events into the test environment.
- * A program is essentially just a list of keys that identify event data
- * to be injected, in sequence. An example program:
- * <pre>
- * event1, event2
- * </pre>
- * NOTE: Each callback must have a message type associated with it, e.g.
- * "SDNCAEvent".
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param callbacks an object containing event data for the program
- * @param program the program to execute
- */
- protected void injectSDNCEvents(CallbackSet callbacks, String program) {
- injectWorkflowMessages(callbacks, program);
- }
-
- /**
- * Runs a program to inject SDNC callback data into the test environment.
- * A program is essentially just a list of keys that identify callback data
- * to be injected, in sequence. An example program:
- * <pre>
- * reserve, assign, delete:ERR
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param callbacks an object containing callback data for the program
- * @param program the program to execute
- */
- protected void injectSDNCCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String content = null;
- int respCode = 200;
- String respMsg = "OK";
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No callback defined for '" + action + "' SDNC request";
- System.out.println(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- respCode = 200;
- respMsg = "OK";
- } else if ("CREATED".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No callback defined for '" + action + "' SDNC request";
- System.out.println(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- respCode = 201;
- respMsg = "Created";
- } else if ("ERR".equals(modifier)) {
- content = "<svc-request-id>((REQUEST-ID))</svc-request-id><response-code>500</response-code><response-message>SIMULATED ERROR FROM SDNC ADAPTER</response-message>";
- respCode = 500;
- respMsg = "SERVER ERROR";
- } else {
- String msg = "Invalid SDNC program modifier: '" + modifier + "'";
- System.out.println(msg);
- fail(msg);
- }
-
- if (!injectSDNCCallback(respCode, respMsg, content, 10000)) {
- fail("Failed to inject SDNC '" + action + "' callback");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of SDNC '" + action + "' callback");
- }
- }
- }
-
- /**
- * Runs a program to inject VNF adapter REST callback data into the test environment.
- * A program is essentially just a list of keys that identify callback data
- * to be injected, in sequence. An example program:
- * <pre>
- * create, rollback
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param callbacks an object containing callback data for the program
- * @param program the program to execute
- */
- protected void injectVNFRestCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String content = null;
- String contentType = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No callback defined for '" + action + "' VNF REST request";
- System.out.println(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else if ("ERR".equals(modifier)) {
- content = "SIMULATED ERROR FROM VNF ADAPTER";
- contentType = "text/plain";
- } else {
- String msg = "Invalid VNF REST program modifier: '" + modifier + "'";
- System.out.println(msg);
- fail(msg);
- }
-
- if (contentType == null) {
- // Default for backward compatibility with existing tests.
- contentType = XML;
- }
-
- if (!injectVnfAdapterRestCallback(contentType, content, 10000)) {
- fail("Failed to inject VNF REST '" + action + "' callback");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of VNF REST '" + action + "' callback");
- }
- }
- }
-
- /**
- * Runs a program to inject VNF callback data into the test environment.
- * A program is essentially just a list of keys that identify callback data
- * to be injected, in sequence. An example program:
- * <pre>
- * createVnf, deleteVnf
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param callbacks an object containing callback data for the program
- * @param program the program to execute
- */
- protected void injectVNFCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String content = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No callback defined for '" + action + "' VNF request";
- System.out.println(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- } else if ("ERR".equals(modifier)) {
- String msg = "Currently unsupported VNF program modifier: '" + modifier + "'";
- System.out.println(msg);
- fail(msg);
- } else {
- String msg = "Invalid VNF program modifier: '" + modifier + "'";
- System.out.println(msg);
- fail(msg);
- }
-
- boolean injected = false;
-
- if (content.contains("createVnfNotification")) {
- injected = injectCreateVNFCallback(content, 10000);
- } else if (content.contains("deleteVnfNotification")) {
- injected = injectDeleteVNFCallback(content, 10000);
- } else if (content.contains("updateVnfNotification")) {
- injected = injectUpdateVNFCallback(content, 10000);
- }
-
- if (!injected) {
- String msg = "Failed to inject VNF '" + action + "' callback";
- System.out.println(msg);
- fail(msg);
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of VNF '" + action + "' callback");
- }
- }
- }
-
- /**
- * Waits for the number of running processes with the specified process
- * definition key to equal a particular count.
- * @param processKey the process definition key
- * @param count the desired count
- * @param timeout the timeout in milliseconds
- */
- protected void waitForRunningProcessCount(String processKey, int count, long timeout) {
- System.out.println("Waiting " + timeout + "ms for there to be " + count + " "
- + processKey + " instances");
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
- int last = -1;
-
- while (now <= endTime) {
- int actual = processEngineRule.getRuntimeService()
- .createProcessInstanceQuery()
- .processDefinitionKey(processKey)
- .list().size();
-
- if (actual != last) {
- System.out.println("There are now " + actual + " "
- + processKey + " instances");
- last = actual;
- }
-
- if (actual == count) {
- return;
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- String msg = "Interrupted waiting for there to be " + count + " "
- + processKey + " instances";
- System.out.println(msg);
- fail(msg);
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "Timed out waiting for there to be " + count + " "
- + processKey + " instances";
- System.out.println(msg);
- fail(msg);
- }
-
- /**
- * Waits for the specified process variable to be set.
- * @param processKey the process definition key
- * @param variable the variable name
- * @param timeout the timeout in milliseconds
- * @return the variable value, or null if it cannot be obtained
- * in the specified time
- */
- protected Object getProcessVariable(String processKey, String variable,
- long timeout) {
-
- System.out.println("Waiting " + timeout + "ms for "
- + processKey + "." + variable + " to be set");
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
-
- ProcessInstance processInstance = null;
- Object value = null;
-
- while (value == null) {
- if (now > endTime) {
- if (processInstance == null) {
- System.out.println("Timed out waiting for "
- + processKey + " to start");
- } else {
- System.out.println("Timed out waiting for "
- + processKey + "[" + processInstance.getId()
- + "]." + variable + " to be set");
- }
-
- return null;
- }
-
- if (processInstance == null) {
- processInstance = processEngineRule.getRuntimeService()
- .createProcessInstanceQuery()
- .processDefinitionKey(processKey)
- .singleResult();
- }
-
- if (processInstance != null) {
- value = processEngineRule.getRuntimeService()
- .getVariable(processInstance.getId(), variable);
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- System.out.println("Interrupted waiting for "
- + processKey + "." + variable + " to be set");
- return null;
- }
-
- now = System.currentTimeMillis();
- }
-
- System.out.println(processKey + "["
- + processInstance.getId() + "]." + variable + "="
- + value);
-
- return value;
- }
-
- /**
- * Injects a single SDNC adapter callback request. The specified callback data
- * may contain the placeholder string ((REQUEST-ID)) which is replaced with
- * the actual SDNC request ID. Note: this is not the requestId in the original
- * MSO request.
- * @param contentType the HTTP content type for the callback
- * @param content the content of the callback
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- */
- protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) {
- String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1",
- "SDNCAResponse_CORRELATOR", timeout);
-
- if (sdncRequestId == null) {
- return false;
- }
-
- content = content.replace("((REQUEST-ID))", sdncRequestId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{REQUEST-ID}}", sdncRequestId);
-
- System.out.println("Injecting SDNC adapter callback");
- WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource();
- workflowMessageResource.setProcessEngineServices4junit(processEngineRule);
- Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content);
- System.out.println("Workflow response to SDNC adapter callback: " + response);
- return true;
- }
-
- /**
- * Injects a single SDNC adapter callback request. The specified callback data
- * may contain the placeholder string ((REQUEST-ID)) which is replaced with
- * the actual SDNC request ID. Note: this is not the requestId in the original
- * MSO request.
- * @param content the content of the callback
- * @param respCode the response code (normally 200)
- * @param respMsg the response message (normally "OK")
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- */
- protected boolean injectSDNCCallback(int respCode, String respMsg,
- String content, long timeout) {
-
- String sdncRequestId = (String) getProcessVariable("sdncAdapter",
- "SDNCA_requestId", timeout);
-
- if (sdncRequestId == null) {
- return false;
- }
-
- content = content.replace("((REQUEST-ID))", sdncRequestId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{REQUEST-ID}}", sdncRequestId);
-
- System.out.println("Injecting SDNC adapter callback");
- CallbackHeader callbackHeader = new CallbackHeader();
- callbackHeader.setRequestId(sdncRequestId);
- callbackHeader.setResponseCode(String.valueOf(respCode));
- callbackHeader.setResponseMessage(respMsg);
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
- sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
- sdncAdapterCallbackRequest.setRequestData(content);
- SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
- callbackService.setProcessEngineServices4junit(processEngineRule);
- SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
- System.out.println("Workflow response to SDNC adapter callback: " + sdncAdapterResponse);
-
- return true;
- }
-
- /**
- * Injects a single VNF adapter callback request. The specified callback data
- * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
- * the actual message ID. Note: this is not the requestId in the original
- * MSO request.
- * @param contentType the HTTP content type for the callback
- * @param content the content of the callback
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- */
- protected boolean injectVnfAdapterRestCallback(String contentType, String content, long timeout) {
- String messageId = (String) getProcessVariable("vnfAdapterRestV1",
- "VNFAResponse_CORRELATOR", timeout);
-
- if (messageId == null) {
- return false;
- }
-
- content = content.replace("((MESSAGE-ID))", messageId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{MESSAGE-ID}}", messageId);
-
- System.out.println("Injecting VNF adapter callback");
- WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource();
- workflowMessageResource.setProcessEngineServices4junit(processEngineRule);
- Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content);
- System.out.println("Workflow response to VNF adapter callback: " + response);
- return true;
- }
-
- /**
- * Injects a Create VNF adapter callback request. The specified callback data
- * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
- * the actual message ID. It may also contain the placeholder string
- * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
- * @param content the content of the callback
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- * @throws JAXBException if the content does not adhere to the schema
- */
- protected boolean injectCreateVNFCallback(String content, long timeout) {
-
- String messageId = (String) getProcessVariable("vnfAdapterCreateV1",
- "VNFC_messageId", timeout);
-
- if (messageId == null) {
- return false;
- }
-
- content = content.replace("((MESSAGE-ID))", messageId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{MESSAGE-ID}}", messageId);
-
- if(content.contains("((REQUEST-ID))")){
- content = content.replace("((REQUEST-ID))", msoRequestId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{REQUEST-ID}}", msoRequestId);
- }
-
- System.out.println("Injecting VNF adapter callback");
-
- // Is it possible to unmarshal this with JAXB? I couldn't.
-
- CreateVnfNotification createVnfNotification = new CreateVnfNotification();
- XPathTool xpathTool = new VnfNotifyXPathTool();
- xpathTool.setXML(content);
-
- try {
- String completed = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:completed/text()");
- createVnfNotification.setCompleted("true".equals(completed));
-
- String vnfId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:vnfId/text()");
- createVnfNotification.setVnfId(vnfId);
-
- NodeList entries = (NodeList) xpathTool.evaluate(
- "/tns:createVnfNotification/tns:outputs/tns:entry",
- XPathConstants.NODESET);
-
- CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs();
-
- for (int i = 0; i < entries.getLength(); i++) {
- Node node = entries.item(i);
-
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
- String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
- outputs.add(key, value);
- }
- }
-
- createVnfNotification.setOutputs(outputs);
-
- VnfRollback rollback = new VnfRollback();
-
- String cloudSiteId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()");
- rollback.setCloudSiteId(cloudSiteId);
-
- String requestId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
- String serviceInstanceId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
-
- if (requestId != null || serviceInstanceId != null) {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId(requestId);
- msoRequest.setServiceInstanceId(serviceInstanceId);
- rollback.setMsoRequest(msoRequest);
- }
-
- String tenantCreated = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()");
- rollback.setTenantCreated("true".equals(tenantCreated));
-
- String tenantId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:tenantId/text()");
- rollback.setTenantId(tenantId);
-
- String vnfCreated = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()");
- rollback.setVnfCreated("true".equals(vnfCreated));
-
- String rollbackVnfId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:vnfId/text()");
- rollback.setVnfId(rollbackVnfId);
-
- createVnfNotification.setRollback(rollback);
-
- } catch (Exception e) {
- System.out.println("Failed to unmarshal VNF callback content:");
- System.out.println(content);
- return false;
- }
-
- VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
- notifyService.setProcessEngineServices4junit(processEngineRule);
-
- notifyService.createVnfNotification(
- messageId,
- createVnfNotification.isCompleted(),
- createVnfNotification.getException(),
- createVnfNotification.getErrorMessage(),
- createVnfNotification.getVnfId(),
- createVnfNotification.getOutputs(),
- createVnfNotification.getRollback());
-
- return true;
- }
-
- /**
- * Injects a Delete VNF adapter callback request. The specified callback data
- * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
- * the actual message ID. It may also contain the placeholder string
- * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
- * @param content the content of the callback
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- * @throws JAXBException if the content does not adhere to the schema
- */
- protected boolean injectDeleteVNFCallback(String content, long timeout) {
-
- String messageId = (String) getProcessVariable("vnfAdapterDeleteV1",
- "VNFDEL_uuid", timeout);
-
- if (messageId == null) {
- return false;
- }
-
- content = content.replace("((MESSAGE-ID))", messageId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{MESSAGE-ID}}", messageId);
-
- System.out.println("Injecting VNF adapter delete callback");
-
- // Is it possible to unmarshal this with JAXB? I couldn't.
-
- DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification();
- XPathTool xpathTool = new VnfNotifyXPathTool();
- xpathTool.setXML(content);
-
- try {
- String completed = xpathTool.evaluate(
- "/tns:deleteVnfNotification/tns:completed/text()");
- deleteVnfNotification.setCompleted("true".equals(completed));
- // if notification failure, set the exception and error message
- if (deleteVnfNotification.isCompleted() == false) {
- deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL);
- deleteVnfNotification.setErrorMessage(xpathTool.evaluate(
- "/tns:deleteVnfNotification/tns:errorMessage/text()")) ;
- }
-
- } catch (Exception e) {
- System.out.println("Failed to unmarshal VNF Delete callback content:");
- System.out.println(content);
- return false;
- }
-
- VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
- notifyService.setProcessEngineServices4junit(processEngineRule);
-
- notifyService.deleteVnfNotification(
- messageId,
- deleteVnfNotification.isCompleted(),
- deleteVnfNotification.getException(),
- deleteVnfNotification.getErrorMessage());
-
- return true;
- }
-
- /**
- * Injects a Update VNF adapter callback request. The specified callback data
- * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
- * the actual message ID. It may also contain the placeholder string
- * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
- * @param content the content of the callback
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- * @throws JAXBException if the content does not adhere to the schema
- */
- protected boolean injectUpdateVNFCallback(String content, long timeout) {
-
- String messageId = (String) getProcessVariable("vnfAdapterUpdate",
- "VNFU_messageId", timeout);
-
- if (messageId == null) {
- return false;
- }
-
- content = content.replace("((MESSAGE-ID))", messageId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{MESSAGE-ID}}", messageId);
-
- content = content.replace("((REQUEST-ID))", msoRequestId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{REQUEST-ID}}", msoRequestId);
-
- System.out.println("Injecting VNF adapter callback");
-
- // Is it possible to unmarshal this with JAXB? I couldn't.
-
- UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification();
- XPathTool xpathTool = new VnfNotifyXPathTool();
- xpathTool.setXML(content);
-
- try {
- String completed = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:completed/text()");
- updateVnfNotification.setCompleted("true".equals(completed));
-
- NodeList entries = (NodeList) xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:outputs/tns:entry",
- XPathConstants.NODESET);
-
- UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs();
-
- for (int i = 0; i < entries.getLength(); i++) {
- Node node = entries.item(i);
-
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
- String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
- outputs.add(key, value);
- }
- }
-
- updateVnfNotification.setOutputs(outputs);
-
- VnfRollback rollback = new VnfRollback();
-
- String cloudSiteId = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()");
- rollback.setCloudSiteId(cloudSiteId);
-
- String requestId = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
- String serviceInstanceId = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
-
- if (requestId != null || serviceInstanceId != null) {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId(requestId);
- msoRequest.setServiceInstanceId(serviceInstanceId);
- rollback.setMsoRequest(msoRequest);
- }
-
- String tenantCreated = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()");
- rollback.setTenantCreated("true".equals(tenantCreated));
-
- String tenantId = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()");
- rollback.setTenantId(tenantId);
-
- String vnfCreated = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()");
- rollback.setVnfCreated("true".equals(vnfCreated));
-
- String rollbackVnfId = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()");
- rollback.setVnfId(rollbackVnfId);
-
- updateVnfNotification.setRollback(rollback);
-
- } catch (Exception e) {
- System.out.println("Failed to unmarshal VNF callback content:");
- System.out.println(content);
- return false;
- }
-
- VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
- notifyService.setProcessEngineServices4junit(processEngineRule);
-
- notifyService.updateVnfNotification(
- messageId,
- updateVnfNotification.isCompleted(),
- updateVnfNotification.getException(),
- updateVnfNotification.getErrorMessage(),
- updateVnfNotification.getOutputs(),
- updateVnfNotification.getRollback());
-
- return true;
- }
-
- /**
- * Runs a program to inject workflow messages into the test environment.
- * A program is essentially just a list of keys that identify event data
- * to be injected, in sequence. An example program:
- * <pre>
- * event1, event2
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * NOTE: Each callback must have a workflow message type associated with it.
- * @param callbacks an object containing event data for the program
- * @param program the program to execute
- */
- protected void injectWorkflowMessages(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String messageType = null;
- String content = null;
- String contentType = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No '" + action + "' workflow message callback is defined";
- System.out.println(msg);
- fail(msg);
- }
-
- messageType = callbackData.getMessageType();
-
- if (messageType == null || messageType.trim().equals("")) {
- String msg = "No workflow message type is defined in the '" + action + "' callback";
- System.out.println(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else {
- String msg = "Invalid workflow message program modifier: '" + modifier + "'";
- System.out.println(msg);
- fail(msg);
- }
-
- if (!injectWorkflowMessage(contentType, messageType, content, 10000)) {
- fail("Failed to inject '" + action + "' workflow message");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of '" + action + "' workflow message");
- }
- }
- }
-
- /**
- * Injects a workflow message. The specified callback data may contain the
- * placeholder string ((CORRELATOR)) which is replaced with the actual
- * correlator value.
- * @param contentType the HTTP contentType for the message (possibly null)
- * @param messageType the message type
- * @param content the message content (possibly null)
- * @param timeout the timeout in milliseconds
- * @return true if the message could be injected, false otherwise
- */
- protected boolean injectWorkflowMessage(String contentType, String messageType, String content, long timeout) {
- String correlator = (String) getProcessVariable("ReceiveWorkflowMessage",
- messageType + "_CORRELATOR", timeout);
-
- if (correlator == null) {
- return false;
- }
-
- if (content != null) {
- content = content.replace("((CORRELATOR))", correlator);
- }
-
- System.out.println("Injecting " + messageType + " message");
- WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource();
- workflowMessageResource.setProcessEngineServices4junit(processEngineRule);
- Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
- System.out.println("Workflow response to " + messageType + " message: " + response);
- return true;
- }
-
- /**
- * Runs a program to inject sniro workflow messages into the test environment.
- * A program is essentially just a list of keys that identify event data
- * to be injected, in sequence. For more details, see
- * injectSNIROCallbacks(String contentType, String messageType, String content, long timeout)
- *
- * Errors are handled with junit assertions and will cause the test to fail.
- * NOTE: Each callback must have a workflow message type associated with it.
- *
- * @param callbacks an object containing event data for the program
- * @param program the program to execute
- */
- protected void injectSNIROCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String messageType = null;
- String content = null;
- String contentType = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No '" + action + "' workflow message callback is defined";
- System.out.println(msg);
- fail(msg);
- }
-
- messageType = callbackData.getMessageType();
-
- if (messageType == null || messageType.trim().equals("")) {
- String msg = "No workflow message type is defined in the '" + action + "' callback";
- System.out.println(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else {
- String msg = "Invalid workflow message program modifier: '" + modifier + "'";
- System.out.println(msg);
- fail(msg);
- }
-
- if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) {
- fail("Failed to inject '" + action + "' workflow message");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of '" + action + "' workflow message");
- }
- }
- }
-
- /**
- * Injects a sniro workflow message. The specified callback response may
- * contain the placeholder strings ((CORRELATOR)) and ((SERVICE_RESOURCE_ID))
- * The ((CORRELATOR)) is replaced with the actual correlator value from the
- * request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId
- * value from the sniro request. Currently this only works with sniro request
- * that contain only 1 resource.
- *
- * @param contentType the HTTP contentType for the message (possibly null)
- * @param messageType the message type
- * @param content the message content (possibly null)
- * @param timeout the timeout in milliseconds
- * @return true if the message could be injected, false otherwise
- */
- protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) {
- String correlator = (String) getProcessVariable("ReceiveWorkflowMessage",
- messageType + "_CORRELATOR", timeout);
-
- if (correlator == null) {
- return false;
- }
- if (content != null) {
- content = content.replace("((CORRELATOR))", correlator);
- if(messageType.equalsIgnoreCase("SNIROResponse")){
- //TODO figure out a solution for when there is more than 1 resource being homed (i.e. more than 1 reason in the placement list)
- ServiceDecomposition decomp = (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout);
- List<Resource> resourceList = decomp.getServiceResources();
- if(resourceList.size() == 1){
- String resourceId = "";
- for(Resource resource:resourceList){
- resourceId = resource.getResourceId();
- }
- String homingList = getJsonValue(content, "solutionInfo.placement");
- JSONArray placementArr = new JSONArray(homingList);
- if(placementArr.length() == 1){
- content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
- }
- String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
- JSONArray licenseArr = new JSONArray(licenseInfoList);
- if(licenseArr.length() == 1){
- content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
- }
- }
- }
- }
- System.out.println("Injecting " + messageType + " message");
- WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource();
- workflowMessageResource.setProcessEngineServices4junit(processEngineRule);
- Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
- System.out.println("Workflow response to " + messageType + " message: " + response);
- return true;
- }
-
-
- /**
- * Wait for the process to end.
- * @param businessKey the process business key
- * @param timeout the amount of time to wait, in milliseconds
- */
- protected void waitForProcessEnd(String businessKey, long timeout) {
- System.out.println("Waiting " + timeout + "ms for process with business key " +
- businessKey + " to end");
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
-
- while (now <= endTime) {
- if (isProcessEnded(businessKey)) {
- System.out.println("Process with business key " + businessKey + " has ended");
- return;
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- String msg = "Interrupted waiting for process with business key " +
- businessKey + " to end";
- System.out.println(msg);
- fail(msg);
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "Process with business key " + businessKey +
- " did not end within " + timeout + "ms";
- System.out.println(msg);
- fail(msg);
- }
-
- /**
- * Verifies that the specified historic process variable has the specified value.
- * If the variable does not have the specified value, the test is failed.
- * @param businessKey the process business key
- * @param variable the variable name
- * @param value the expected variable value
- */
- protected void checkVariable(String businessKey, String variable, Object value) {
- if (!isProcessEnded(businessKey)) {
- fail("Cannot get historic variable " + variable + " because process with business key " +
- businessKey + " has not ended");
- }
-
- Object variableValue = getVariableFromHistory(businessKey, variable);
- assertEquals(value, variableValue);
- }
-
- /**
- * Checks to see if the specified process is ended.
- * @param businessKey the process business Key
- * @return true if the process is ended
- */
- protected boolean isProcessEnded(String businessKey) {
- HistoricProcessInstance processInstance = processEngineRule.getHistoryService()
- .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
- return processInstance != null && processInstance.getEndTime() != null;
- }
-
- /**
- * Gets a variable value from a historical process instance.
- * @param businessKey the process business key
- * @param variableName the variable name
- * @return the variable value, or null if the variable could not be
- * obtained
- */
- protected Object getVariableFromHistory(String businessKey, String variableName) {
- try {
- HistoricProcessInstance processInstance = processEngineRule.getHistoryService()
- .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
-
- if (processInstance == null) {
- return null;
- }
-
- HistoricVariableInstance v = processEngineRule.getHistoryService()
- .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
- .variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- System.out.println("Error retrieving variable " + variableName +
- " from historical process with business key " + businessKey + ": " + e);
- return null;
- }
- }
-
- /**
- * Gets the value of a subflow variable from the specified subflow's
- * historical process instance.
- *
- * @param subflowName - the name of the subflow that contains the variable
- * @param variableName the variable name
- *
- * @return the variable value, or null if the variable could not be obtained
- *
- */
- protected Object getVariableFromSubflowHistory(String subflowName, String variableName) {
- try {
- List<HistoricProcessInstance> processInstanceList = processEngineRule.getHistoryService()
- .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
-
- if (processInstanceList == null) {
- return null;
- }
-
- processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
-
- HistoricProcessInstance processInstance = processInstanceList.get(0);
-
- HistoricVariableInstance v = processEngineRule.getHistoryService()
- .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
- .variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- System.out.println("Error retrieving variable " + variableName +
- " from sub flow: " + subflowName + ", Exception is: " + e);
- return null;
- }
- }
-
- /**
- * Gets the value of a subflow variable from the subflow's
- * historical process x instance.
- *
- * @param subflowName - the name of the subflow that contains the variable
- * @param variableName the variable name
- * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from mainflow)
- *
- * @return the variable value, or null if the variable could not be obtained
- */
- protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) {
- try {
- List<HistoricProcessInstance> processInstanceList = processEngineRule.getHistoryService()
- .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
-
- if (processInstanceList == null) {
- return null;
- }
-
- processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
-
- HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
-
- HistoricVariableInstance v = processEngineRule.getHistoryService()
- .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
- .variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- System.out.println("Error retrieving variable " + variableName +
- " from " + subflowInstanceIndex + " instance index of sub flow: " + subflowName + ", Exception is: " + e);
- return null;
- }
- }
-
-
- /**
- * Extracts text from an XML element. This method is not namespace aware
- * (namespaces are ignored). The first matching element is selected.
- * @param xml the XML document or fragment
- * @param tag the desired element, e.g. "<name>"
- * @return the element text, or null if the element was not found
- */
- protected String getXMLTextElement(String xml, String tag) {
- xml = removeXMLNamespaces(xml);
-
- if (!tag.startsWith("<")) {
- tag = "<" + tag + ">";
- }
-
- int start = xml.indexOf(tag);
-
- if (start == -1) {
- return null;
- }
-
- int end = xml.indexOf('<', start + tag.length());
-
- if (end == -1) {
- return null;
- }
-
- return xml.substring(start + tag.length(), end);
- }
-
- /**
- * Removes namespace definitions and prefixes from XML, if any.
- */
- private String removeXMLNamespaces(String xml) {
- // remove xmlns declaration
- xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "");
-
- // remove opening tag prefix
- xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3");
-
- // remove closing tags prefix
- xml = xml.replaceAll("(</)(\\w+:)(.*?>)", "$1$3");
-
- // remove extra spaces left when xmlns declarations are removed
- xml = xml.replaceAll("\\s+>", ">");
-
- return xml;
- }
-
- /**
- * Asserts that two XML documents are semantically equivalent. Differences
- * in whitespace or in namespace usage do not affect the comparison.
- * @param expected the expected XML
- * @param actual the XML to test
- * @throws SAXException
- * @throws IOException
- */
+ try {
+ msoRequestId = (String) injectedVariables.get("requestId");
+ variables.put("mso-request-id", msoRequestId);
+ msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
+ variables.put("mso-service-instance-id", msoServiceInstanceId);
+ } catch (Exception e) {
+ }
+ if (msoRequestId == null || msoRequestId.trim().equals("")) {
+ System.out.println("No requestId element in injectedVariables");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ }
+ if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) {
+ System.out.println("No seviceInstanceId element in injectedVariables");
+ variables.put("mso-service-instance-id", UUID.randomUUID().toString());
+ }
+
+ } else {
+ msoRequestId = getXMLTextElement(request, "request-id");
+
+ if (msoRequestId == null) {
+ //check in injected variables
+ try {
+ msoRequestId = (String) injectedVariables.get("requestId");
+ } catch (Exception e) {
+ }
+ if (msoRequestId == null || msoRequestId.trim().equals("")) {
+ String msg = "No request-id element in " + request;
+ System.out.println(msg);
+ fail(msg);
+ }
+ }
+
+ variables.put("mso-request-id", msoRequestId);
+
+ // Note: some request types don't have a service-instance-id
+ msoServiceInstanceId = getXMLTextElement(request, "service-instance-id");
+
+ if (msoServiceInstanceId != null) {
+ variables.put("mso-service-instance-id", msoServiceInstanceId);
+ }
+ }
+
+ return variables;
+ }
+
+ /**
+ * Private helper method that creates a camunda VariableMapImpl from a simple
+ * variable map.
+ *
+ * @param variables the simple variable map
+ * @return a VariableMap
+ */
+ private VariableMapImpl createVariableMapImpl(Map<String, Object> variables) {
+ Map<String, Object> wrappedVariables = new HashMap<>();
+
+ for (String key : variables.keySet()) {
+ Object value = variables.get(key);
+ wrappedVariables.put(key, wrapVariableValue(value));
+ }
+
+ VariableMapImpl variableMapImpl = new VariableMapImpl();
+ variableMapImpl.put("variables", wrappedVariables);
+ return variableMapImpl;
+ }
+
+ /**
+ * Private helper method that wraps a variable value for inclusion in a
+ * camunda VariableMapImpl.
+ *
+ * @param value the variable value
+ * @return the wrapped variable
+ */
+ private Map<String, Object> wrapVariableValue(Object value) {
+ HashMap<String, Object> valueMap = new HashMap<>();
+ valueMap.put("value", value);
+ return valueMap;
+ }
+
+ /**
+ * Receives a response from an asynchronous process.
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param businessKey the process business key
+ * @param asyncResponse the TestAsyncResponse object associated with the test
+ * @param timeout the timeout in milliseconds
+ * @return the WorkflowResponse
+ */
+ protected WorkflowResponse receiveResponse(String businessKey,
+ TestAsyncResponse asyncResponse, long timeout) {
+ System.out.println("Waiting " + timeout + "ms for process with business key " + businessKey
+ + " to send a response");
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ Response response = asyncResponse.getResponse();
+
+ if (response != null) {
+ System.out.println("Received a response from process with business key " + businessKey);
+
+ Object entity = response.getEntity();
+
+ if (!(entity instanceof WorkflowResponse)) {
+ String msg = "Response entity is " +
+ (entity == null ? "null" : entity.getClass().getName()) +
+ ", expected WorkflowResponse";
+ System.out.println(msg);
+ fail(msg);
+ return null; // unreachable
+ }
+
+ return (WorkflowResponse) entity;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for a response from process with business key " +
+ businessKey;
+ System.out.println(msg);
+ fail(msg);
+ return null; // unreachable
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "No response received from process with business key " + businessKey +
+ " within " + timeout + "ms";
+ System.out.println(msg);
+ fail("Process with business key " + businessKey + " did not end within 10000ms");
+ return null; // unreachable
+ }
+
+ /**
+ * Runs a program to inject SDNC callback data into the test environment.
+ * A program is essentially just a list of keys that identify callback data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' SDNC request";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else if ("ERR".equals(modifier)) {
+ content = "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}";
+ contentType = JSON;
+ } else {
+ String msg = "Invalid SDNC program modifier: '" + modifier + "'";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ if (contentType == null) {
+ // Default for backward compatibility with existing tests.
+ contentType = JSON;
+ }
+
+ if (!injectSDNCRestCallback(contentType, content, 10000)) {
+ fail("Failed to inject SDNC '" + action + "' callback");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of SDNC '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Runs a program to inject SDNC events into the test environment.
+ * A program is essentially just a list of keys that identify event data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * event1, event2
+ * </pre>
+ * NOTE: Each callback must have a message type associated with it, e.g.
+ * "SDNCAEvent".
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param callbacks an object containing event data for the program
+ * @param program the program to execute
+ */
+ protected void injectSDNCEvents(CallbackSet callbacks, String program) {
+ injectWorkflowMessages(callbacks, program);
+ }
+
+ /**
+ * Runs a program to inject SDNC callback data into the test environment.
+ * A program is essentially just a list of keys that identify callback data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectSDNCCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+ int respCode = 200;
+ String respMsg = "OK";
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' SDNC request";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ respCode = 200;
+ respMsg = "OK";
+ } else if ("CREATED".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' SDNC request";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ respCode = 201;
+ respMsg = "Created";
+ } else if ("ERR".equals(modifier)) {
+ content = "<svc-request-id>((REQUEST-ID))</svc-request-id><response-code>500</response-code><response-message>SIMULATED ERROR FROM SDNC ADAPTER</response-message>";
+ respCode = 500;
+ respMsg = "SERVER ERROR";
+ } else {
+ String msg = "Invalid SDNC program modifier: '" + modifier + "'";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ if (!injectSDNCCallback(respCode, respMsg, content, 10000)) {
+ fail("Failed to inject SDNC '" + action + "' callback");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of SDNC '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Runs a program to inject VNF adapter REST callback data into the test environment.
+ * A program is essentially just a list of keys that identify callback data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * create, rollback
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectVNFRestCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' VNF REST request";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else if ("ERR".equals(modifier)) {
+ content = "SIMULATED ERROR FROM VNF ADAPTER";
+ contentType = "text/plain";
+ } else {
+ String msg = "Invalid VNF REST program modifier: '" + modifier + "'";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ if (contentType == null) {
+ // Default for backward compatibility with existing tests.
+ contentType = XML;
+ }
+
+ if (!injectVnfAdapterRestCallback(contentType, content, 10000)) {
+ fail("Failed to inject VNF REST '" + action + "' callback");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of VNF REST '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Runs a program to inject VNF callback data into the test environment.
+ * A program is essentially just a list of keys that identify callback data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * createVnf, deleteVnf
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectVNFCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' VNF request";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ } else if ("ERR".equals(modifier)) {
+ String msg = "Currently unsupported VNF program modifier: '" + modifier + "'";
+ System.out.println(msg);
+ fail(msg);
+ } else {
+ String msg = "Invalid VNF program modifier: '" + modifier + "'";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ boolean injected = false;
+
+ if (content.contains("createVnfNotification")) {
+ injected = injectCreateVNFCallback(content, 10000);
+ } else if (content.contains("deleteVnfNotification")) {
+ injected = injectDeleteVNFCallback(content, 10000);
+ } else if (content.contains("updateVnfNotification")) {
+ injected = injectUpdateVNFCallback(content, 10000);
+ }
+
+ if (!injected) {
+ String msg = "Failed to inject VNF '" + action + "' callback";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of VNF '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Waits for the number of running processes with the specified process
+ * definition key to equal a particular count.
+ *
+ * @param processKey the process definition key
+ * @param count the desired count
+ * @param timeout the timeout in milliseconds
+ */
+ protected void waitForRunningProcessCount(String processKey, int count, long timeout) {
+ System.out.println("Waiting " + timeout + "ms for there to be " + count + " "
+ + processKey + " instances");
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+ int last = -1;
+
+ while (now <= endTime) {
+ int actual = processEngineRule.getRuntimeService()
+ .createProcessInstanceQuery()
+ .processDefinitionKey(processKey)
+ .list().size();
+
+ if (actual != last) {
+ System.out.println("There are now " + actual + " "
+ + processKey + " instances");
+ last = actual;
+ }
+
+ if (actual == count) {
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for there to be " + count + " "
+ + processKey + " instances";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Timed out waiting for there to be " + count + " "
+ + processKey + " instances";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ /**
+ * Waits for the specified process variable to be set.
+ *
+ * @param processKey the process definition key
+ * @param variable the variable name
+ * @param timeout the timeout in milliseconds
+ * @return the variable value, or null if it cannot be obtained
+ * in the specified time
+ */
+ protected Object getProcessVariable(String processKey, String variable,
+ long timeout) {
+
+ System.out.println("Waiting " + timeout + "ms for "
+ + processKey + "." + variable + " to be set");
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ ProcessInstance processInstance = null;
+ Object value = null;
+
+ while (value == null) {
+ if (now > endTime) {
+ if (processInstance == null) {
+ System.out.println("Timed out waiting for "
+ + processKey + " to start");
+ } else {
+ System.out.println("Timed out waiting for "
+ + processKey + "[" + processInstance.getId()
+ + "]." + variable + " to be set");
+ }
+
+ return null;
+ }
+
+ if (processInstance == null) {
+ processInstance = processEngineRule.getRuntimeService()
+ .createProcessInstanceQuery()
+ .processDefinitionKey(processKey)
+ .singleResult();
+ }
+
+ if (processInstance != null) {
+ value = processEngineRule.getRuntimeService()
+ .getVariable(processInstance.getId(), variable);
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ System.out.println("Interrupted waiting for "
+ + processKey + "." + variable + " to be set");
+ return null;
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ System.out.println(processKey + "["
+ + processInstance.getId() + "]." + variable + "="
+ + value);
+
+ return value;
+ }
+
+ /**
+ * Injects a single SDNC adapter callback request. The specified callback data
+ * may contain the placeholder string ((REQUEST-ID)) which is replaced with
+ * the actual SDNC request ID. Note: this is not the requestId in the original
+ * MSO request.
+ *
+ * @param contentType the HTTP content type for the callback
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ */
+ protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) {
+ String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1",
+ "SDNCAResponse_CORRELATOR", timeout);
+
+ if (sdncRequestId == null) {
+ return false;
+ }
+
+ content = content.replace("((REQUEST-ID))", sdncRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", sdncRequestId);
+
+ System.out.println("Injecting SDNC adapter callback");
+ WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource();
+ workflowMessageResource.setProcessEngineServices4junit(processEngineRule);
+ Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content);
+ System.out.println("Workflow response to SDNC adapter callback: " + response);
+ return true;
+ }
+
+ /**
+ * Injects a single SDNC adapter callback request. The specified callback data
+ * may contain the placeholder string ((REQUEST-ID)) which is replaced with
+ * the actual SDNC request ID. Note: this is not the requestId in the original
+ * MSO request.
+ *
+ * @param content the content of the callback
+ * @param respCode the response code (normally 200)
+ * @param respMsg the response message (normally "OK")
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ */
+ protected boolean injectSDNCCallback(int respCode, String respMsg,
+ String content, long timeout) {
+
+ String sdncRequestId = (String) getProcessVariable("sdncAdapter",
+ "SDNCA_requestId", timeout);
+
+ if (sdncRequestId == null) {
+ return false;
+ }
+
+ content = content.replace("((REQUEST-ID))", sdncRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", sdncRequestId);
+
+ System.out.println("Injecting SDNC adapter callback");
+ CallbackHeader callbackHeader = new CallbackHeader();
+ callbackHeader.setRequestId(sdncRequestId);
+ callbackHeader.setResponseCode(String.valueOf(respCode));
+ callbackHeader.setResponseMessage(respMsg);
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
+ sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
+ sdncAdapterCallbackRequest.setRequestData(content);
+ SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl();
+ callbackService.setProcessEngineServices4junit(processEngineRule);
+ SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ System.out.println("Workflow response to SDNC adapter callback: " + sdncAdapterResponse);
+
+ return true;
+ }
+
+ /**
+ * Injects a single VNF adapter callback request. The specified callback data
+ * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
+ * the actual message ID. Note: this is not the requestId in the original
+ * MSO request.
+ *
+ * @param contentType the HTTP content type for the callback
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ */
+ protected boolean injectVnfAdapterRestCallback(String contentType, String content, long timeout) {
+ String messageId = (String) getProcessVariable("vnfAdapterRestV1",
+ "VNFAResponse_CORRELATOR", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ System.out.println("Injecting VNF adapter callback");
+ WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource();
+ workflowMessageResource.setProcessEngineServices4junit(processEngineRule);
+ Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content);
+ System.out.println("Workflow response to VNF adapter callback: " + response);
+ return true;
+ }
+
+ /**
+ * Injects a Create VNF adapter callback request. The specified callback data
+ * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
+ * the actual message ID. It may also contain the placeholder string
+ * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+ *
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ * @throws JAXBException if the content does not adhere to the schema
+ */
+ protected boolean injectCreateVNFCallback(String content, long timeout) {
+
+ String messageId = (String) getProcessVariable("vnfAdapterCreateV1",
+ "VNFC_messageId", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ if (content.contains("((REQUEST-ID))")) {
+ content = content.replace("((REQUEST-ID))", msoRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", msoRequestId);
+ }
+
+ System.out.println("Injecting VNF adapter callback");
+
+ // Is it possible to unmarshal this with JAXB? I couldn't.
+
+ CreateVnfNotification createVnfNotification = new CreateVnfNotification();
+ XPathTool xpathTool = new VnfNotifyXPathTool();
+ xpathTool.setXML(content);
+
+ try {
+ String completed = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:completed/text()");
+ createVnfNotification.setCompleted("true".equals(completed));
+
+ String vnfId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:vnfId/text()");
+ createVnfNotification.setVnfId(vnfId);
+
+ NodeList entries = (NodeList) xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:outputs/tns:entry",
+ XPathConstants.NODESET);
+
+ CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs();
+
+ for (int i = 0; i < entries.getLength(); i++) {
+ Node node = entries.item(i);
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element entry = (Element) node;
+ String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
+ String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
+ outputs.add(key, value);
+ }
+ }
+
+ createVnfNotification.setOutputs(outputs);
+
+ VnfRollback rollback = new VnfRollback();
+
+ String cloudSiteId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()");
+ rollback.setCloudSiteId(cloudSiteId);
+
+ String requestId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
+ String serviceInstanceId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
+
+ if (requestId != null || serviceInstanceId != null) {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestId);
+ msoRequest.setServiceInstanceId(serviceInstanceId);
+ rollback.setMsoRequest(msoRequest);
+ }
+
+ String tenantCreated = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()");
+ rollback.setTenantCreated("true".equals(tenantCreated));
+
+ String tenantId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:tenantId/text()");
+ rollback.setTenantId(tenantId);
+
+ String vnfCreated = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()");
+ rollback.setVnfCreated("true".equals(vnfCreated));
+
+ String rollbackVnfId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:vnfId/text()");
+ rollback.setVnfId(rollbackVnfId);
+
+ createVnfNotification.setRollback(rollback);
+
+ } catch (Exception e) {
+ System.out.println("Failed to unmarshal VNF callback content:");
+ System.out.println(content);
+ return false;
+ }
+
+ VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+ notifyService.setProcessEngineServices4junit(processEngineRule);
+
+ notifyService.createVnfNotification(
+ messageId,
+ createVnfNotification.isCompleted(),
+ createVnfNotification.getException(),
+ createVnfNotification.getErrorMessage(),
+ createVnfNotification.getVnfId(),
+ createVnfNotification.getOutputs(),
+ createVnfNotification.getRollback());
+
+ return true;
+ }
+
+ /**
+ * Injects a Delete VNF adapter callback request. The specified callback data
+ * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
+ * the actual message ID. It may also contain the placeholder string
+ * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+ *
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ * @throws JAXBException if the content does not adhere to the schema
+ */
+ protected boolean injectDeleteVNFCallback(String content, long timeout) {
+
+ String messageId = (String) getProcessVariable("vnfAdapterDeleteV1",
+ "VNFDEL_uuid", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ System.out.println("Injecting VNF adapter delete callback");
+
+ // Is it possible to unmarshal this with JAXB? I couldn't.
+
+ DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification();
+ XPathTool xpathTool = new VnfNotifyXPathTool();
+ xpathTool.setXML(content);
+
+ try {
+ String completed = xpathTool.evaluate(
+ "/tns:deleteVnfNotification/tns:completed/text()");
+ deleteVnfNotification.setCompleted("true".equals(completed));
+ // if notification failure, set the exception and error message
+ if (deleteVnfNotification.isCompleted() == false) {
+ deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL);
+ deleteVnfNotification.setErrorMessage(xpathTool.evaluate(
+ "/tns:deleteVnfNotification/tns:errorMessage/text()"));
+ }
+
+ } catch (Exception e) {
+ System.out.println("Failed to unmarshal VNF Delete callback content:");
+ System.out.println(content);
+ return false;
+ }
+
+ VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+ notifyService.setProcessEngineServices4junit(processEngineRule);
+
+ notifyService.deleteVnfNotification(
+ messageId,
+ deleteVnfNotification.isCompleted(),
+ deleteVnfNotification.getException(),
+ deleteVnfNotification.getErrorMessage());
+
+ return true;
+ }
+
+ /**
+ * Injects a Update VNF adapter callback request. The specified callback data
+ * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
+ * the actual message ID. It may also contain the placeholder string
+ * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+ *
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ * @throws JAXBException if the content does not adhere to the schema
+ */
+ protected boolean injectUpdateVNFCallback(String content, long timeout) {
+
+ String messageId = (String) getProcessVariable("vnfAdapterUpdate",
+ "VNFU_messageId", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ content = content.replace("((REQUEST-ID))", msoRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", msoRequestId);
+
+ System.out.println("Injecting VNF adapter callback");
+
+ // Is it possible to unmarshal this with JAXB? I couldn't.
+
+ UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification();
+ XPathTool xpathTool = new VnfNotifyXPathTool();
+ xpathTool.setXML(content);
+
+ try {
+ String completed = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:completed/text()");
+ updateVnfNotification.setCompleted("true".equals(completed));
+
+ NodeList entries = (NodeList) xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:outputs/tns:entry",
+ XPathConstants.NODESET);
+
+ UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs();
+
+ for (int i = 0; i < entries.getLength(); i++) {
+ Node node = entries.item(i);
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element entry = (Element) node;
+ String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
+ String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
+ outputs.add(key, value);
+ }
+ }
+
+ updateVnfNotification.setOutputs(outputs);
+
+ VnfRollback rollback = new VnfRollback();
+
+ String cloudSiteId = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()");
+ rollback.setCloudSiteId(cloudSiteId);
+
+ String requestId = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
+ String serviceInstanceId = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
+
+ if (requestId != null || serviceInstanceId != null) {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestId);
+ msoRequest.setServiceInstanceId(serviceInstanceId);
+ rollback.setMsoRequest(msoRequest);
+ }
+
+ String tenantCreated = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()");
+ rollback.setTenantCreated("true".equals(tenantCreated));
+
+ String tenantId = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()");
+ rollback.setTenantId(tenantId);
+
+ String vnfCreated = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()");
+ rollback.setVnfCreated("true".equals(vnfCreated));
+
+ String rollbackVnfId = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()");
+ rollback.setVnfId(rollbackVnfId);
+
+ updateVnfNotification.setRollback(rollback);
+
+ } catch (Exception e) {
+ System.out.println("Failed to unmarshal VNF callback content:");
+ System.out.println(content);
+ return false;
+ }
+
+ VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+ notifyService.setProcessEngineServices4junit(processEngineRule);
+
+ notifyService.updateVnfNotification(
+ messageId,
+ updateVnfNotification.isCompleted(),
+ updateVnfNotification.getException(),
+ updateVnfNotification.getErrorMessage(),
+ updateVnfNotification.getOutputs(),
+ updateVnfNotification.getRollback());
+
+ return true;
+ }
+
+ /**
+ * Runs a program to inject workflow messages into the test environment.
+ * A program is essentially just a list of keys that identify event data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * event1, event2
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * NOTE: Each callback must have a workflow message type associated with it.
+ *
+ * @param callbacks an object containing event data for the program
+ * @param program the program to execute
+ */
+ protected void injectWorkflowMessages(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String messageType = null;
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No '" + action + "' workflow message callback is defined";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ messageType = callbackData.getMessageType();
+
+ if (messageType == null || messageType.trim().equals("")) {
+ String msg = "No workflow message type is defined in the '" + action + "' callback";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else {
+ String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ if (!injectWorkflowMessage(contentType, messageType, content, 10000)) {
+ fail("Failed to inject '" + action + "' workflow message");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of '" + action + "' workflow message");
+ }
+ }
+ }
+
+ /**
+ * Injects a workflow message. The specified callback data may contain the
+ * placeholder string ((CORRELATOR)) which is replaced with the actual
+ * correlator value.
+ *
+ * @param contentType the HTTP contentType for the message (possibly null)
+ * @param messageType the message type
+ * @param content the message content (possibly null)
+ * @param timeout the timeout in milliseconds
+ * @return true if the message could be injected, false otherwise
+ */
+ protected boolean injectWorkflowMessage(String contentType, String messageType, String content, long timeout) {
+ String correlator = (String) getProcessVariable("ReceiveWorkflowMessage",
+ messageType + "_CORRELATOR", timeout);
+
+ if (correlator == null) {
+ return false;
+ }
+
+ if (content != null) {
+ content = content.replace("((CORRELATOR))", correlator);
+ }
+
+ System.out.println("Injecting " + messageType + " message");
+ WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource();
+ workflowMessageResource.setProcessEngineServices4junit(processEngineRule);
+ Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+ System.out.println("Workflow response to " + messageType + " message: " + response);
+ return true;
+ }
+
+ /**
+ * Runs a program to inject sniro workflow messages into the test environment.
+ * A program is essentially just a list of keys that identify event data
+ * to be injected, in sequence. For more details, see
+ * injectSNIROCallbacks(String contentType, String messageType, String content, long timeout)
+ * <p>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * NOTE: Each callback must have a workflow message type associated with it.
+ *
+ * @param callbacks an object containing event data for the program
+ * @param program the program to execute
+ */
+ protected void injectSNIROCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String messageType = null;
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No '" + action + "' workflow message callback is defined";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ messageType = callbackData.getMessageType();
+
+ if (messageType == null || messageType.trim().equals("")) {
+ String msg = "No workflow message type is defined in the '" + action + "' callback";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else {
+ String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) {
+ fail("Failed to inject '" + action + "' workflow message");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of '" + action + "' workflow message");
+ }
+ }
+ }
+
+ /**
+ * Injects a sniro workflow message. The specified callback response may
+ * contain the placeholder strings ((CORRELATOR)) and ((SERVICE_RESOURCE_ID))
+ * The ((CORRELATOR)) is replaced with the actual correlator value from the
+ * request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId
+ * value from the sniro request. Currently this only works with sniro request
+ * that contain only 1 resource.
+ *
+ * @param contentType the HTTP contentType for the message (possibly null)
+ * @param messageType the message type
+ * @param content the message content (possibly null)
+ * @param timeout the timeout in milliseconds
+ * @return true if the message could be injected, false otherwise
+ */
+ protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) {
+ String correlator = (String) getProcessVariable("ReceiveWorkflowMessage",
+ messageType + "_CORRELATOR", timeout);
+
+ if (correlator == null) {
+ return false;
+ }
+ if (content != null) {
+ content = content.replace("((CORRELATOR))", correlator);
+ if (messageType.equalsIgnoreCase("SNIROResponse")) {
+ //TODO figure out a solution for when there is more than 1 resource being homed (i.e. more than 1 reason in the placement list)
+ ServiceDecomposition decomp = (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout);
+ List<Resource> resourceList = decomp.getServiceResources();
+ if (resourceList.size() == 1) {
+ String resourceId = "";
+ for (Resource resource : resourceList) {
+ resourceId = resource.getResourceId();
+ }
+ String homingList = getJsonValue(content, "solutionInfo.placement");
+ JSONArray placementArr = new JSONArray(homingList);
+ if (placementArr.length() == 1) {
+ content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ }
+ String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
+ JSONArray licenseArr = new JSONArray(licenseInfoList);
+ if (licenseArr.length() == 1) {
+ content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ }
+ }
+ }
+ }
+ System.out.println("Injecting " + messageType + " message");
+ WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource();
+ workflowMessageResource.setProcessEngineServices4junit(processEngineRule);
+ Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+ System.out.println("Workflow response to " + messageType + " message: " + response);
+ return true;
+ }
+
+
+ /**
+ * Wait for the process to end.
+ *
+ * @param businessKey the process business key
+ * @param timeout the amount of time to wait, in milliseconds
+ */
+ protected void waitForProcessEnd(String businessKey, long timeout) {
+ System.out.println("Waiting " + timeout + "ms for process with business key " +
+ businessKey + " to end");
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ if (isProcessEnded(businessKey)) {
+ System.out.println("Process with business key " + businessKey + " has ended");
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for process with business key " +
+ businessKey + " to end";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Process with business key " + businessKey +
+ " did not end within " + timeout + "ms";
+ System.out.println(msg);
+ fail(msg);
+ }
+
+ /**
+ * Verifies that the specified historic process variable has the specified value.
+ * If the variable does not have the specified value, the test is failed.
+ *
+ * @param businessKey the process business key
+ * @param variable the variable name
+ * @param value the expected variable value
+ */
+ protected void checkVariable(String businessKey, String variable, Object value) {
+ if (!isProcessEnded(businessKey)) {
+ fail("Cannot get historic variable " + variable + " because process with business key " +
+ businessKey + " has not ended");
+ }
+
+ Object variableValue = getVariableFromHistory(businessKey, variable);
+ assertEquals(value, variableValue);
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ *
+ * @param businessKey the process business Key
+ * @return true if the process is ended
+ */
+ protected boolean isProcessEnded(String businessKey) {
+ HistoricProcessInstance processInstance = processEngineRule.getHistoryService()
+ .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
+ return processInstance != null && processInstance.getEndTime() != null;
+ }
+
+ /**
+ * Gets a variable value from a historical process instance.
+ *
+ * @param businessKey the process business key
+ * @param variableName the variable name
+ * @return the variable value, or null if the variable could not be
+ * obtained
+ */
+ protected Object getVariableFromHistory(String businessKey, String variableName) {
+ try {
+ HistoricProcessInstance processInstance = processEngineRule.getHistoryService()
+ .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
+
+ if (processInstance == null) {
+ return null;
+ }
+
+ HistoricVariableInstance v = processEngineRule.getHistoryService()
+ .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
+ .variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ System.out.println("Error retrieving variable " + variableName +
+ " from historical process with business key " + businessKey + ": " + e);
+ return null;
+ }
+ }
+
+ /**
+ * Gets the value of a subflow variable from the specified subflow's
+ * historical process instance.
+ *
+ * @param subflowName - the name of the subflow that contains the variable
+ * @param variableName the variable name
+ * @return the variable value, or null if the variable could not be obtained
+ */
+ protected Object getVariableFromSubflowHistory(String subflowName, String variableName) {
+ try {
+ List<HistoricProcessInstance> processInstanceList = processEngineRule.getHistoryService()
+ .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
+
+ if (processInstanceList == null) {
+ return null;
+ }
+
+ processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+ HistoricProcessInstance processInstance = processInstanceList.get(0);
+
+ HistoricVariableInstance v = processEngineRule.getHistoryService()
+ .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
+ .variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ System.out.println("Error retrieving variable " + variableName +
+ " from sub flow: " + subflowName + ", Exception is: " + e);
+ return null;
+ }
+ }
+
+ /**
+ * Gets the value of a subflow variable from the subflow's
+ * historical process x instance.
+ *
+ * @param subflowName - the name of the subflow that contains the variable
+ * @param variableName the variable name
+ * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from mainflow)
+ * @return the variable value, or null if the variable could not be obtained
+ */
+ protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) {
+ try {
+ List<HistoricProcessInstance> processInstanceList = processEngineRule.getHistoryService()
+ .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
+
+ if (processInstanceList == null) {
+ return null;
+ }
+
+ processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+ HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
+
+ HistoricVariableInstance v = processEngineRule.getHistoryService()
+ .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
+ .variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ System.out.println("Error retrieving variable " + variableName +
+ " from " + subflowInstanceIndex + " instance index of sub flow: " + subflowName + ", Exception is: " + e);
+ return null;
+ }
+ }
+
+
+ /**
+ * Extracts text from an XML element. This method is not namespace aware
+ * (namespaces are ignored). The first matching element is selected.
+ *
+ * @param xml the XML document or fragment
+ * @param tag the desired element, e.g. "<name>"
+ * @return the element text, or null if the element was not found
+ */
+ protected String getXMLTextElement(String xml, String tag) {
+ xml = removeXMLNamespaces(xml);
+
+ if (!tag.startsWith("<")) {
+ tag = "<" + tag + ">";
+ }
+
+ int start = xml.indexOf(tag);
+
+ if (start == -1) {
+ return null;
+ }
+
+ int end = xml.indexOf('<', start + tag.length());
+
+ if (end == -1) {
+ return null;
+ }
+
+ return xml.substring(start + tag.length(), end);
+ }
+
+ /**
+ * Removes namespace definitions and prefixes from XML, if any.
+ */
+ private String removeXMLNamespaces(String xml) {
+ // remove xmlns declaration
+ xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "");
+
+ // remove opening tag prefix
+ xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3");
+
+ // remove closing tags prefix
+ xml = xml.replaceAll("(</)(\\w+:)(.*?>)", "$1$3");
+
+ // remove extra spaces left when xmlns declarations are removed
+ xml = xml.replaceAll("\\s+>", ">");
+
+ return xml;
+ }
+
+ /**
+ * Asserts that two XML documents are semantically equivalent. Differences
+ * in whitespace or in namespace usage do not affect the comparison.
+ *
+ * @param expected the expected XML
+ * @param actual the XML to test
+ * @throws SAXException
+ * @throws IOException
+ */
public static void assertXMLEquals(String expected, String actual)
- throws SAXException, IOException {
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setIgnoreAttributeOrder(true);
- DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual));
- List<?> allDifferences = diff.getAllDifferences();
- assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size());
+ throws SAXException, IOException {
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreAttributeOrder(true);
+ DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual));
+ List<?> allDifferences = diff.getAllDifferences();
+ assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size());
+ }
+
+ /**
+ * A test implementation of AsynchronousResponse.
+ */
+ public class TestAsyncResponse implements AsynchronousResponse {
+ Response response = null;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public synchronized void setResponse(Response response) {
+ this.response = response;
+ }
+
+ /**
+ * Gets the response.
+ *
+ * @return the response, or null if none has been produced yet
+ */
+ public synchronized Response getResponse() {
+ return response;
+ }
}
- /**
- * A test implementation of AsynchronousResponse.
- */
- public class TestAsyncResponse implements AsynchronousResponse {
- Response response = null;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public synchronized void setResponse(Response response) {
- this.response = response;
- }
-
- /**
- * Gets the response.
- * @return the response, or null if none has been produced yet
- */
- public synchronized Response getResponse() {
- return response;
- }
- }
-
- /**
- * An object that contains callback data for a "program".
- */
- public class CallbackSet {
- private final Map<String, CallbackData> map = new HashMap<>();
-
- /**
- * Add untyped callback data to the set.
- * @param action the action with which the data is associated
- * @param content the callback data
- */
- public void put(String action, String content) {
- map.put(action, new CallbackData(null, null, content));
- }
-
- /**
- * Add callback data to the set.
- * @param action the action with which the data is associated
- * @param messageType the callback message type
- * @param content the callback data
- */
- public void put(String action, String messageType, String content) {
- map.put(action, new CallbackData(null, messageType, content));
- }
-
- /**
- * Add callback data to the set.
- * @param action the action with which the data is associated
- * @param contentType the callback HTTP content type
- * @param messageType the callback message type
- * @param content the callback data
- */
- public void put(String action, String contentType, String messageType, String content) {
- map.put(action, new CallbackData(contentType, messageType, content));
- }
-
- /**
- * Retrieve callback data from the set.
- * @param action the action with which the data is associated
- * @return the callback data, or null if there is none for the specified operation
- */
- public CallbackData get(String action) {
- return map.get(action);
- }
- }
-
- /**
- * Represents a callback data item.
- */
- public class CallbackData {
- private final String contentType;
- private final String messageType;
- private final String content;
-
- /**
- * Constructor
- * @param contentType the HTTP content type (optional)
- * @param messageType the callback message type (optional)
- * @param content the content
- */
- public CallbackData(String contentType, String messageType, String content) {
- this.contentType = contentType;
- this.messageType = messageType;
- this.content = content;
- }
-
- /**
- * Gets the callback HTTP content type, possibly null.
- */
- public String getContentType() {
- return contentType;
- }
-
- /**
- * Gets the callback message type, possibly null.
- */
- public String getMessageType() {
- return messageType;
- }
-
- /**
- * Gets the callback content.
- */
- public String getContent() {
- return content;
- }
- }
-
- /**
- * A tool for evaluating XPath expressions.
- */
- protected class XPathTool {
- private final DocumentBuilderFactory factory;
- private final SimpleNamespaceContext context = new SimpleNamespaceContext();
- private final XPath xpath = XPathFactory.newInstance().newXPath();
- private String xml = null;
- private Document doc = null;
-
- /**
- * Constructor.
- */
- public XPathTool() {
- factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- xpath.setNamespaceContext(context);
- }
-
- /**
- * Adds a namespace.
- * @param prefix the namespace prefix
- * @param uri the namespace uri
- */
- public synchronized void addNamespace(String prefix, String uri) {
- context.add(prefix, uri);
- }
-
- /**
- * Sets the XML content to be operated on.
- * @param xml the XML content
- */
- public synchronized void setXML(String xml) {
- this.xml = xml;
- this.doc = null;
- }
-
- /**
- * Returns the document object.
- * @return the document object, or null if XML has not been set
- * @throws SAXException
- * @throws IOException
- * @throws ParserConfigurationException
- */
- public synchronized Document getDocument()
- throws ParserConfigurationException, IOException, SAXException {
- if (xml == null) {
- return null;
- }
-
- buildDocument();
- return doc;
- }
-
- /**
- * Evaluates the specified XPath expression and returns a string result.
- * This method throws exceptions on error.
- * @param expression the expression
- * @return the result object
- * @throws ParserConfigurationException
- * @throws IOException
- * @throws SAXException
- * @throws XPathExpressionException on error
- */
- public synchronized String evaluate(String expression)
- throws ParserConfigurationException, SAXException,
- IOException, XPathExpressionException {
- return (String) evaluate(expression, XPathConstants.STRING);
- }
-
- /**
- * Evaluates the specified XPath expression.
- * This method throws exceptions on error.
- * @param expression the expression
- * @param returnType the return type
- * @return the result object
- * @throws ParserConfigurationException
- * @throws IOException
- * @throws SAXException
- * @throws XPathExpressionException on error
- */
- public synchronized Object evaluate(String expression, QName returnType)
- throws ParserConfigurationException, SAXException,
- IOException, XPathExpressionException {
-
- buildDocument();
- XPathExpression expr = xpath.compile(expression);
- return expr.evaluate(doc, returnType);
- }
-
- /**
- * Private helper method that builds the document object.
- * Assumes the calling method is synchronized.
- * @throws ParserConfigurationException
- * @throws IOException
- * @throws SAXException
- */
- private void buildDocument() throws ParserConfigurationException,
- IOException, SAXException {
- if (doc == null) {
- if (xml == null) {
- throw new IOException("XML input is null");
- }
-
- DocumentBuilder builder = factory.newDocumentBuilder();
- InputSource source = new InputSource(new StringReader(xml));
- doc = builder.parse(source);
- }
- }
- }
-
- /**
- * A NamespaceContext class based on a Map.
- */
- private class SimpleNamespaceContext implements NamespaceContext {
- private Map<String, String> prefixMap = new HashMap<>();
- private Map<String, String> uriMap = new HashMap<>();
-
- public synchronized void add(String prefix, String uri) {
- prefixMap.put(prefix, uri);
- uriMap.put(uri, prefix);
- }
-
- @Override
- public synchronized String getNamespaceURI(String prefix) {
- return prefixMap.get(prefix);
- }
-
- @Override
- public Iterator<String> getPrefixes(String uri) {
- List<String> list = new ArrayList<>();
- String prefix = uriMap.get(uri);
- if (prefix != null) {
- list.add(prefix);
- }
- return list.iterator();
- }
-
- @Override
- public String getPrefix(String uri) {
- return uriMap.get(uri);
- }
- }
-
- /**
- * A VnfNotify XPathTool.
- */
- protected class VnfNotifyXPathTool extends XPathTool {
- public VnfNotifyXPathTool() {
- addNamespace("tns", "http://org.openecomp.mso/vnfNotify");
- }
- }
-
- /**
- * Helper class to make it easier to create this type.
- */
- private static class CreateVnfNotificationOutputs
- extends CreateVnfNotification.Outputs {
- public void add(String key, String value) {
- Entry entry = new Entry();
- entry.setKey(key);
- entry.setValue(value);
- getEntry().add(entry);
- }
- }
-
- /**
- * Helper class to make it easier to create this type.
- */
- private static class UpdateVnfNotificationOutputs
- extends UpdateVnfNotification.Outputs {
- public void add(String key, String value) {
- Entry entry = new Entry();
- entry.setKey(key);
- entry.setValue(value);
- getEntry().add(entry);
- }
- }
+ /**
+ * An object that contains callback data for a "program".
+ */
+ public class CallbackSet {
+ private final Map<String, CallbackData> map = new HashMap<>();
+
+ /**
+ * Add untyped callback data to the set.
+ *
+ * @param action the action with which the data is associated
+ * @param content the callback data
+ */
+ public void put(String action, String content) {
+ map.put(action, new CallbackData(null, null, content));
+ }
+
+ /**
+ * Add callback data to the set.
+ *
+ * @param action the action with which the data is associated
+ * @param messageType the callback message type
+ * @param content the callback data
+ */
+ public void put(String action, String messageType, String content) {
+ map.put(action, new CallbackData(null, messageType, content));
+ }
+
+ /**
+ * Add callback data to the set.
+ *
+ * @param action the action with which the data is associated
+ * @param contentType the callback HTTP content type
+ * @param messageType the callback message type
+ * @param content the callback data
+ */
+ public void put(String action, String contentType, String messageType, String content) {
+ map.put(action, new CallbackData(contentType, messageType, content));
+ }
+
+ /**
+ * Retrieve callback data from the set.
+ *
+ * @param action the action with which the data is associated
+ * @return the callback data, or null if there is none for the specified operation
+ */
+ public CallbackData get(String action) {
+ return map.get(action);
+ }
+ }
+
+ /**
+ * Represents a callback data item.
+ */
+ public class CallbackData {
+ private final String contentType;
+ private final String messageType;
+ private final String content;
+
+ /**
+ * Constructor
+ *
+ * @param contentType the HTTP content type (optional)
+ * @param messageType the callback message type (optional)
+ * @param content the content
+ */
+ public CallbackData(String contentType, String messageType, String content) {
+ this.contentType = contentType;
+ this.messageType = messageType;
+ this.content = content;
+ }
+
+ /**
+ * Gets the callback HTTP content type, possibly null.
+ */
+ public String getContentType() {
+ return contentType;
+ }
+
+ /**
+ * Gets the callback message type, possibly null.
+ */
+ public String getMessageType() {
+ return messageType;
+ }
+
+ /**
+ * Gets the callback content.
+ */
+ public String getContent() {
+ return content;
+ }
+ }
+
+ /**
+ * A tool for evaluating XPath expressions.
+ */
+ protected class XPathTool {
+ private final DocumentBuilderFactory factory;
+ private final SimpleNamespaceContext context = new SimpleNamespaceContext();
+ private final XPath xpath = XPathFactory.newInstance().newXPath();
+ private String xml = null;
+ private Document doc = null;
+
+ /**
+ * Constructor.
+ */
+ public XPathTool() {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ xpath.setNamespaceContext(context);
+ }
+
+ /**
+ * Adds a namespace.
+ *
+ * @param prefix the namespace prefix
+ * @param uri the namespace uri
+ */
+ public synchronized void addNamespace(String prefix, String uri) {
+ context.add(prefix, uri);
+ }
+
+ /**
+ * Sets the XML content to be operated on.
+ *
+ * @param xml the XML content
+ */
+ public synchronized void setXML(String xml) {
+ this.xml = xml;
+ this.doc = null;
+ }
+
+ /**
+ * Returns the document object.
+ *
+ * @return the document object, or null if XML has not been set
+ * @throws SAXException
+ * @throws IOException
+ * @throws ParserConfigurationException
+ */
+ public synchronized Document getDocument()
+ throws ParserConfigurationException, IOException, SAXException {
+ if (xml == null) {
+ return null;
+ }
+
+ buildDocument();
+ return doc;
+ }
+
+ /**
+ * Evaluates the specified XPath expression and returns a string result.
+ * This method throws exceptions on error.
+ *
+ * @param expression the expression
+ * @return the result object
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ * @throws XPathExpressionException on error
+ */
+ public synchronized String evaluate(String expression)
+ throws ParserConfigurationException, SAXException,
+ IOException, XPathExpressionException {
+ return (String) evaluate(expression, XPathConstants.STRING);
+ }
+
+ /**
+ * Evaluates the specified XPath expression.
+ * This method throws exceptions on error.
+ *
+ * @param expression the expression
+ * @param returnType the return type
+ * @return the result object
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ * @throws XPathExpressionException on error
+ */
+ public synchronized Object evaluate(String expression, QName returnType)
+ throws ParserConfigurationException, SAXException,
+ IOException, XPathExpressionException {
+
+ buildDocument();
+ XPathExpression expr = xpath.compile(expression);
+ return expr.evaluate(doc, returnType);
+ }
+
+ /**
+ * Private helper method that builds the document object.
+ * Assumes the calling method is synchronized.
+ *
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ */
+ private void buildDocument() throws ParserConfigurationException,
+ IOException, SAXException {
+ if (doc == null) {
+ if (xml == null) {
+ throw new IOException("XML input is null");
+ }
+
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ InputSource source = new InputSource(new StringReader(xml));
+ doc = builder.parse(source);
+ }
+ }
+ }
+
+ /**
+ * A NamespaceContext class based on a Map.
+ */
+ private class SimpleNamespaceContext implements NamespaceContext {
+ private Map<String, String> prefixMap = new HashMap<>();
+ private Map<String, String> uriMap = new HashMap<>();
+
+ public synchronized void add(String prefix, String uri) {
+ prefixMap.put(prefix, uri);
+ uriMap.put(uri, prefix);
+ }
+
+ @Override
+ public synchronized String getNamespaceURI(String prefix) {
+ return prefixMap.get(prefix);
+ }
+
+ @Override
+ public Iterator<String> getPrefixes(String uri) {
+ List<String> list = new ArrayList<>();
+ String prefix = uriMap.get(uri);
+ if (prefix != null) {
+ list.add(prefix);
+ }
+ return list.iterator();
+ }
+
+ @Override
+ public String getPrefix(String uri) {
+ return uriMap.get(uri);
+ }
+ }
+
+ /**
+ * A VnfNotify XPathTool.
+ */
+ protected class VnfNotifyXPathTool extends XPathTool {
+ public VnfNotifyXPathTool() {
+ addNamespace("tns", "http://org.openecomp.mso/vnfNotify");
+ }
+ }
+
+ /**
+ * Helper class to make it easier to create this type.
+ */
+ private static class CreateVnfNotificationOutputs
+ extends CreateVnfNotification.Outputs {
+ public void add(String key, String value) {
+ Entry entry = new Entry();
+ entry.setKey(key);
+ entry.setValue(value);
+ getEntry().add(entry);
+ }
+ }
+
+ /**
+ * Helper class to make it easier to create this type.
+ */
+ private static class UpdateVnfNotificationOutputs
+ extends UpdateVnfNotification.Outputs {
+ public void add(String key, String value) {
+ Entry entry = new Entry();
+ entry.setKey(key);
+ entry.setValue(value);
+ getEntry().add(entry);
+ }
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java
index 38d0584d0d..4aee9c619d 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java
@@ -14,62 +14,62 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
import java.io.IOException;
import java.io.InputStream;
+
import org.openecomp.mso.logger.MsoLogger;
/**
- *
* File utility class.<br/>
* <p>
* </p>
- *
+ *
* @author
- * @version ONAP Sep 15, 2017
+ * @version ONAP Sep 15, 2017
*/
public class FileUtil {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
-
- /**
- * Read the specified resource file and return the contents as a String.
- *
- * @param fileName Name of the resource file
- * @return the contents of the resource file as a String
- * @throws IOException if there is a problem reading the file
- */
- public static String readResourceFile(String fileName) {
- InputStream stream;
- try {
- stream = getResourceAsStream(fileName);
- byte[] bytes;
- bytes = new byte[stream.available()];
- stream.read(bytes);
- stream.close();
- return new String(bytes);
- } catch (IOException e) {
- LOGGER.debug("Exception:", e);
- return "";
- }
- }
-
- /**
- * Get an InputStream for the resource specified.
- *
- * @param resourceName Name of resource for which to get InputStream.
- * @return an InputStream for the resource specified.
- * @throws IOException If we can't get the InputStream for whatever reason.
- */
- private static InputStream getResourceAsStream(String resourceName) throws IOException {
- InputStream stream =
- FileUtil.class.getClassLoader().getResourceAsStream(resourceName);
- if (stream == null) {
- throw new IOException("Can't access resource '" + resourceName + "'");
- }
- return stream;
- }
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+
+ /**
+ * Read the specified resource file and return the contents as a String.
+ *
+ * @param fileName Name of the resource file
+ * @return the contents of the resource file as a String
+ * @throws IOException if there is a problem reading the file
+ */
+ public static String readResourceFile(String fileName) {
+ InputStream stream;
+ try {
+ stream = getResourceAsStream(fileName);
+ byte[] bytes;
+ bytes = new byte[stream.available()];
+ stream.read(bytes);
+ stream.close();
+ return new String(bytes);
+ } catch (IOException e) {
+ LOGGER.debug("Exception:", e);
+ return "";
+ }
+ }
+
+ /**
+ * Get an InputStream for the resource specified.
+ *
+ * @param resourceName Name of resource for which to get InputStream.
+ * @return an InputStream for the resource specified.
+ * @throws IOException If we can't get the InputStream for whatever reason.
+ */
+ private static InputStream getResourceAsStream(String resourceName) throws IOException {
+ InputStream stream =
+ FileUtil.class.getClassLoader().getResourceAsStream(resourceName);
+ if (stream == null) {
+ throw new IOException("Can't access resource '" + resourceName + "'");
+ }
+ return stream;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java
index 74f50ba438..db782dc2f9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -34,7 +34,6 @@ import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
/**
- *
* Mock Resource which is used to start, stop the WireMock Server
* Also up to 50 mock properties can be added at run-time to change the properties used in transformers such as sdnc_delay in SDNCAdapterMockTransformer
* You can also selectively setup a stub (use reset before setting up), reset all stubs
@@ -42,139 +41,146 @@ import com.github.tomakehurst.wiremock.client.WireMock;
@Path("/server")
public class MockResource {
- private boolean started = false;
- private final Integer defaultPort = 28090;
- private WireMockServer wireMockServer = null;
- private static Map<String,String> mockProperties = new HashMap<>();
-
- public static String getMockProperties(String key) {
- return mockProperties.get(key);
- }
-
- private synchronized void initMockServer(int portNumber) {
- String path = FileUtil.class.getClassLoader().getResource("__files/sdncSimResponse.xml").getFile();
- path = path.substring(0,path.indexOf("__files/"));
-
- wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.openecomp.mso.bpmn.mock.SDNCAdapterMockTransformer")
- .extensions("org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer")
- .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterCreateMockTransformer")
- .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterDeleteMockTransformer")
- .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterUpdateMockTransformer")
- .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterRollbackMockTransformer")
- .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterQueryMockTransformer"));
- //.withRootDirectory(path));
- //Mocks were failing - commenting out for now, both mock and transformers seem to work fine
- WireMock.configureFor("localhost", portNumber);
- wireMockServer.start();
+ private boolean started = false;
+ private final Integer defaultPort = 28090;
+ private WireMockServer wireMockServer = null;
+ private static Map<String, String> mockProperties = new HashMap<>();
+
+ public static String getMockProperties(String key) {
+ return mockProperties.get(key);
+ }
+
+ private synchronized void initMockServer(int portNumber) {
+ String path = FileUtil.class.getClassLoader().getResource("__files/sdncSimResponse.xml").getFile();
+ path = path.substring(0, path.indexOf("__files/"));
+
+ wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.openecomp.mso.bpmn.mock.SDNCAdapterMockTransformer")
+ .extensions("org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer")
+ .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterCreateMockTransformer")
+ .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterDeleteMockTransformer")
+ .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterUpdateMockTransformer")
+ .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterRollbackMockTransformer")
+ .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterQueryMockTransformer"));
+ //.withRootDirectory(path));
+ //Mocks were failing - commenting out for now, both mock and transformers seem to work fine
+ WireMock.configureFor("localhost", portNumber);
+ wireMockServer.start();
// StubResponse.setupAllMocks();
- started= true;
- }
+ started = true;
+ }
- public static void main(String [] args) {
- MockResource mockresource = new MockResource();
- mockresource.start(28090);
- mockresource.reset();
+ public static void main(String[] args) {
+ MockResource mockresource = new MockResource();
+ mockresource.start(28090);
+ mockresource.reset();
// mockresource.setupStub("MockCreateTenant");
- }
-
- /**
- * Starts the wiremock server in default port
- * @return
- */
- @GET
- @Path("/start")
- @Produces("application/json")
- public Response start() {
- return startMockServer(defaultPort);
- }
-
- private Response startMockServer(int port) {
- if (!started) {
- initMockServer(defaultPort);
- System.out.println("Started Mock Server in port " + port);
- return Response.status(200).entity("Started Mock Server in port " + port).build();
- } else {
- return Response.status(200).entity("Mock Server is already running").build();
- }
- }
-
- /**
- * Starts the wiremock server in a different port
- * @param portNumber
- * @return
- */
- @GET
- @Path("/start/{portNumber}")
- @Produces("application/json")
- public Response start(@PathParam("portNumber") Integer portNumber) {
- if (portNumber == null) portNumber = defaultPort;
- return startMockServer(portNumber.intValue());
- }
-
-
- /**
- * Stop the wiremock server
- * @return
- */
- @GET
- @Path("/stop")
- @Produces("application/json")
- public synchronized Response stop() {
- if (wireMockServer.isRunning()) {
- wireMockServer.stop();
- started = false;
- return Response.status(200).entity("Stopped Mock Server in port ").build();
- }
- return Response.status(200).entity("Mock Server is not running").build();
- }
-
-
- /**
- * Return list of mock properties
- * @return
- */
- @GET
- @Path("/properties")
- @Produces("application/json")
- public Response getProperties() {
- return Response.status(200).entity(mockProperties).build();
- }
-
- /**
- * Update a particular mock property at run-time
- * @param name
- * @param value
- * @return
- */
- @POST
- @Path("/properties/{name}/{value}")
- public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) {
- if (mockProperties.size() > 50) return Response.serverError().build();
- mockProperties.put(name, value);
- return Response.status(200).build();
- }
-
- /**
- * Reset all stubs
- * @return
- */
- @GET
- @Path("/reset")
- @Produces("application/json")
- public Response reset() {
- WireMock.reset();
- return Response.status(200).entity("Wiremock stubs are reset").build();
- }
-
-
- /**
- * Setup a stub selectively
- * Prior to use, make sure that stub method is available in StubResponse class
- * @param methodName
- * @return
- */
-
- // commenting for now until we figure out a way to use new StubResponse classes to setupStubs
+ }
+
+ /**
+ * Starts the wiremock server in default port
+ *
+ * @return
+ */
+ @GET
+ @Path("/start")
+ @Produces("application/json")
+ public Response start() {
+ return startMockServer(defaultPort);
+ }
+
+ private Response startMockServer(int port) {
+ if (!started) {
+ initMockServer(defaultPort);
+ System.out.println("Started Mock Server in port " + port);
+ return Response.status(200).entity("Started Mock Server in port " + port).build();
+ } else {
+ return Response.status(200).entity("Mock Server is already running").build();
+ }
+ }
+
+ /**
+ * Starts the wiremock server in a different port
+ *
+ * @param portNumber
+ * @return
+ */
+ @GET
+ @Path("/start/{portNumber}")
+ @Produces("application/json")
+ public Response start(@PathParam("portNumber") Integer portNumber) {
+ if (portNumber == null) portNumber = defaultPort;
+ return startMockServer(portNumber.intValue());
+ }
+
+
+ /**
+ * Stop the wiremock server
+ *
+ * @return
+ */
+ @GET
+ @Path("/stop")
+ @Produces("application/json")
+ public synchronized Response stop() {
+ if (wireMockServer.isRunning()) {
+ wireMockServer.stop();
+ started = false;
+ return Response.status(200).entity("Stopped Mock Server in port ").build();
+ }
+ return Response.status(200).entity("Mock Server is not running").build();
+ }
+
+
+ /**
+ * Return list of mock properties
+ *
+ * @return
+ */
+ @GET
+ @Path("/properties")
+ @Produces("application/json")
+ public Response getProperties() {
+ return Response.status(200).entity(mockProperties).build();
+ }
+
+ /**
+ * Update a particular mock property at run-time
+ *
+ * @param name
+ * @param value
+ * @return
+ */
+ @POST
+ @Path("/properties/{name}/{value}")
+ public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) {
+ if (mockProperties.size() > 50) return Response.serverError().build();
+ mockProperties.put(name, value);
+ return Response.status(200).build();
+ }
+
+ /**
+ * Reset all stubs
+ *
+ * @return
+ */
+ @GET
+ @Path("/reset")
+ @Produces("application/json")
+ public Response reset() {
+ WireMock.reset();
+ return Response.status(200).entity("Wiremock stubs are reset").build();
+ }
+
+
+ /**
+ * Setup a stub selectively
+ * Prior to use, make sure that stub method is available in StubResponse class
+ *
+ * @param methodName
+ * @return
+ */
+
+ // commenting for now until we figure out a way to use new StubResponse classes to setupStubs
// @GET
// @Path("/stub/{methodName}")
// @Produces("application/json")
@@ -197,9 +203,7 @@ public class MockResource {
// }
// return Response.status(200).entity("Successfully invoked " + methodName).build();
// }
-
-
- public static Map<String,String> getMockProperties(){
- return mockProperties;
- }
+ public static Map<String, String> getMockProperties() {
+ return mockProperties;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java
index ba48bffca0..961e2989b9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -25,26 +25,25 @@ import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
- *
* JAX RS Application wiring for Mock Resource
*/
@ApplicationPath("/console")
public class MockResourceApplication extends Application {
- private Set<Object> singletons = new HashSet<>();
- private Set<Class<?>> classes = new HashSet<>();
+ private Set<Object> singletons = new HashSet<>();
+ private Set<Class<?>> classes = new HashSet<>();
- public MockResourceApplication() {
- singletons.add(new MockResource());
- }
+ public MockResourceApplication() {
+ singletons.add(new MockResource());
+ }
- @Override
- public Set<Class<?>> getClasses() {
- return classes;
- }
+ @Override
+ public Set<Class<?>> getClasses() {
+ return classes;
+ }
- @Override
- public Set<Object> getSingletons() {
- return singletons;
- }
+ @Override
+ public Set<Object> getSingletons() {
+ return singletons;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java
index 9c4e7936b1..180bc52d22 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -29,112 +29,109 @@ import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
import org.openecomp.mso.logger.MsoLogger;
+
/**
- *
* Simulates SDNC Adapter Callback response
- *
*/
public class SDNCAdapterMockTransformer extends ResponseTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private String callbackResponse;
- private String requestId;
-
- public SDNCAdapterMockTransformer() {
- callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml");
- }
-
- public SDNCAdapterMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- public String name() {
- return "sdnc-adapter-transformer";
- }
-
- /**
- * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
- * so that callback response can be correlated
- *
- * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
- * the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource) {
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
-
- callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- System.out.println("callbackResponse:" + callbackResponse);
-
- if (this.requestId != null) {
- callbackResponse = callbackResponse.replace(this.requestId, requestId);
- } else {
- callbackResponse = callbackResponse.replace("testRequestId", requestId);
- }
-
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 300;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ private String callbackResponse;
+ private String requestId;
+
+ public SDNCAdapterMockTransformer() {
+ callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml");
+ }
+
+ public SDNCAdapterMockTransformer(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String name() {
+ return "sdnc-adapter-transformer";
+ }
+
+ /**
+ * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
+ * so that callback response can be correlated
+ * <p>
+ * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
+ * the callback response is sent
+ */
+ @Override
+ public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+ FileSource fileSource) {
+ String requestBody = request.getBodyAsString();
+
+ String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>") + 25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
+ String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>") + 23, requestBody.indexOf("</sdncadapter:RequestId>"));
+
+ callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+ System.out.println("callbackResponse:" + callbackResponse);
+
+ if (this.requestId != null) {
+ callbackResponse = callbackResponse.replace(this.requestId, requestId);
+ } else {
+ callbackResponse = callbackResponse.replace("testRequestId", requestId);
+ }
+
+
+ Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
+ int delay = 300;
+ if (sdncDelay != null) {
+ delay = Integer.parseInt(sdncDelay.toString());
+ }
+
+ //Kick off callback thread
+ System.out.println("callback Url:" + callbackUrl + ":delay:" + delay);
+ CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl, callbackResponse, delay);
+ calbackResponseThread.start();
+
+ //return 200 OK with empty body
+ return ResponseDefinitionBuilder
.like(responseDefinition).but()
.withStatus(200).withBody("").withHeader("Content-Type", "text/xml")
.build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- LOGGER.debug("Exception :",e1);
- }
- LOGGER.debug("Sending callback response:" + callbackUrl);
- ClientRequest request = new ClientRequest(callbackUrl);
- request.body("text/xml", payLoad);
- System.err.println(payLoad);
- try {
- ClientResponse result = request.post();
- //System.err.println("Successfully posted callback:" + result.getStatus());
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- }
- }
-
- }
+ }
+
+ @Override
+ public boolean applyGlobally() {
+ return false;
+ }
+
+ /**
+ * Callback response thread which sends the callback response asynchronously
+ */
+ private class CallbackResponseThread extends Thread {
+
+ private String callbackUrl;
+ private String payLoad;
+ private int delay;
+
+ public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+ this.callbackUrl = callbackUrl;
+ this.payLoad = payLoad;
+ this.delay = delay;
+ }
+
+ public void run() {
+ try {
+ //Delay sending callback response
+ sleep(delay);
+ } catch (InterruptedException e1) {
+ LOGGER.debug("Exception :", e1);
+ }
+ LOGGER.debug("Sending callback response:" + callbackUrl);
+ ClientRequest request = new ClientRequest(callbackUrl);
+ request.body("text/xml", payLoad);
+ System.err.println(payLoad);
+ try {
+ ClientResponse result = request.post();
+ //System.err.println("Successfully posted callback:" + result.getStatus());
+ } catch (Exception e) {
+ LOGGER.debug("Exception :", e);
+ }
+ }
+
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
index e59e3b67d2..96f0511798 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -31,102 +31,102 @@ import org.openecomp.mso.logger.MsoLogger;
public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private String callbackResponse;
- private String requestId;
-
- public SDNCAdapterNetworkTopologyMockTransformer() {
- callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml");
- }
-
- public SDNCAdapterNetworkTopologyMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- public String name() {
- return "network-topology-operation-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource) {
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
- System.out.println("request callbackUrl : " + callbackUrl);
- System.out.println("request requestId : " + requestId);
-
- System.out.println("file path/name : " + responseDefinition.getBodyFileName());
- callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- // extract Response responseRequestId
- String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>")+11, callbackResponse.indexOf("</RequestId>"));
- System.out.println("response requestId: " + responseRequestId);
- System.out.println("callbackResponse (before): " + callbackResponse);
- callbackResponse = callbackResponse.replace(responseRequestId, requestId);
- if (this.requestId != null) {
- callbackResponse = callbackResponse.replace(this.requestId, requestId);
- } else {
- callbackResponse = callbackResponse.replace(responseRequestId, requestId);
- }
- System.out.println("callbackResponse (after):" + callbackResponse);
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 300;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with body
- return ResponseDefinitionBuilder
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private String callbackResponse;
+ private String requestId;
+
+ public SDNCAdapterNetworkTopologyMockTransformer() {
+ callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml");
+ }
+
+ public SDNCAdapterNetworkTopologyMockTransformer(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String name() {
+ return "network-topology-operation-transformer";
+ }
+
+ @Override
+ public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource) {
+ String requestBody = request.getBodyAsString();
+
+ String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>") + 25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
+ String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>") + 23, requestBody.indexOf("</sdncadapter:RequestId>"));
+ System.out.println("request callbackUrl : " + callbackUrl);
+ System.out.println("request requestId : " + requestId);
+
+ System.out.println("file path/name : " + responseDefinition.getBodyFileName());
+ callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+ // extract Response responseRequestId
+ String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>") + 11, callbackResponse.indexOf("</RequestId>"));
+ System.out.println("response requestId: " + responseRequestId);
+ System.out.println("callbackResponse (before): " + callbackResponse);
+ callbackResponse = callbackResponse.replace(responseRequestId, requestId);
+ if (this.requestId != null) {
+ callbackResponse = callbackResponse.replace(this.requestId, requestId);
+ } else {
+ callbackResponse = callbackResponse.replace(responseRequestId, requestId);
+ }
+ System.out.println("callbackResponse (after):" + callbackResponse);
+
+ Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
+ int delay = 300;
+ if (sdncDelay != null) {
+ delay = Integer.parseInt(sdncDelay.toString());
+ }
+
+ //Kick off callback thread
+ System.out.println("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay);
+ CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl, callbackResponse, delay);
+ calbackResponseThread.start();
+
+ //return 200 OK with body
+ return ResponseDefinitionBuilder
.like(responseDefinition).but()
.withStatus(200).withBody(callbackResponse).withHeader("Content-Type", "text/xml")
.build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- LOGGER.debug("Exception :",e1);
- }
- LOGGER.debug("Sending callback response to url: " + callbackUrl);
- ClientRequest request = new ClientRequest(callbackUrl);
- request.body("text/xml", payLoad);
- //System.err.println(payLoad);
- try {
- ClientResponse result = request.post();
- LOGGER.debug("Successfully posted callback? Status: " + result.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- LOGGER.debug("catch error in - request.post() ");
- LOGGER.debug("Exception :",e);
- }
- }
-
- }
+ }
+
+ @Override
+ public boolean applyGlobally() {
+ return false;
+ }
+
+ private class CallbackResponseThread extends Thread {
+
+ private String callbackUrl;
+ private String payLoad;
+ private int delay;
+
+ public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+ this.callbackUrl = callbackUrl;
+ this.payLoad = payLoad;
+ this.delay = delay;
+ }
+
+ public void run() {
+ try {
+ //Delay sending callback response
+ sleep(delay);
+ } catch (InterruptedException e1) {
+ // TODO Auto-generated catch block
+ LOGGER.debug("Exception :", e1);
+ }
+ LOGGER.debug("Sending callback response to url: " + callbackUrl);
+ ClientRequest request = new ClientRequest(callbackUrl);
+ request.body("text/xml", payLoad);
+ //System.err.println(payLoad);
+ try {
+ ClientResponse result = request.post();
+ LOGGER.debug("Successfully posted callback? Status: " + result.getStatus());
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ LOGGER.debug("catch error in - request.post() ");
+ LOGGER.debug("Exception :", e);
+ }
+ }
+
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java
index f9a6543387..472321f5cc 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -32,1038 +32,1059 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
/**
* Reusable Mock StubResponses for AAI Endpoints
- *
*/
public class StubResponseAAI {
- public static void setupAllMocks() {
-
- }
-
-
- /**
- * Tunnel-XConnect Mock Stub Response
- */
- public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
-
- /**
- * Allotted Resource Mock StubResponses below
- */
- public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(204)));
- }
-
- public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockQueryAllottedResourceById(String allottedResourceId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
-
- /**
- * Service Instance Mock StubResponses below
- */
- public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(204)));
- }
-
- public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockGetServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")));
- }
-
- public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- /**
- * Service-Subscription Mock StubResponses below
- */
- public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- /**
- * Customer Mock StubResponses below
- */
- public static void MockGetCustomer(String globalCustId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteCustomer(String globalCustId) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutCustomer(String globalCustId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutCustomer_500(String globalCustId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
-
- /**
- * Generic-Vnf Mock StubResponses below
- */
-
- public static void MockGetGenericVnfById(String vnfId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .atPriority(1)
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .atPriority(priority)
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfById_404(String vnfId){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockGetGenericVnfById_500(String vnfId){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockGetGenericVnfByName(String vnfName, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByName_404(String vnfName){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(204)));
- }
-
- public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockPutGenericVnf(String vnfId){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .withRequestBody(containing(requestBodyContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutGenericVnf(String vnfId, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPatchGenericVnf(String vnfId){
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- /**
- * Vce Mock StubResponses below
- */
- public static void MockGetVceById(String vnfId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVceByName(String vnfName, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutVce(String vnfId){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- /**
- * Tenant Mock StubResponses below
- */
- public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetTenant(String tenantId, String responseFile) {
- stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- /**
- * Network Mock StubResponses below
- */
- public static void MockGetNetwork(String networkId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkByName(String networkName, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkByName_404(String responseFile, String networkName) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkCloudRegion_404(String cloudRegion) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockPutNetwork(String networkId, int statusCode, String responseFile) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkVpnBinding(String responseFile, String vpnBinding) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkPolicy(String responseFile, String policy) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkTableReference(String responseFile, String tableReference) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth ))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPatchVfModuleId(String vnfId, String vfModuleId) {
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- /////////////
-
- public static void MockVNFAdapterRestVfModule() {
- stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void MockDBUpdateVfModule(){
- stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/DBUpdateResponse.xml")));
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockSDNCAdapterVfModule() {
- // simplified the implementation to return "success" for all requests
- stubFor(post(urlEqualTo("/SDNCAdapter"))
+ public static void setupAllMocks() {
+
+ }
+
+
+ /**
+ * Tunnel-XConnect Mock Stub Response
+ */
+ public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+
+ /**
+ * Allotted Resource Mock StubResponses below
+ */
+ public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(204)));
+ }
+
+ public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
+ stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockQueryAllottedResourceById(String allottedResourceId, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:" + allottedResourceId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+
+ /**
+ * Service Instance Mock StubResponses below
+ */
+ public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(204)));
+ }
+
+ public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void MockGetServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")));
+ }
+
+ public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + 1234))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ /**
+ * Service-Subscription Mock StubResponses below
+ */
+ public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ /**
+ * Customer Mock StubResponses below
+ */
+ public static void MockGetCustomer(String globalCustId, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockDeleteCustomer(String globalCustId) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockPutCustomer(String globalCustId) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockPutCustomer_500(String globalCustId) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+
+ /**
+ * Generic-Vnf Mock StubResponses below
+ */
+
+ public static void MockGetGenericVnfById(String vnfId, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
+ .atPriority(1)
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
+ .atPriority(priority)
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetGenericVnfById_404(String vnfId) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ public static void MockGetGenericVnfById_500(String vnfId) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockGetGenericVnfByName(String vnfName, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetGenericVnfByName_404(String vnfName) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ public static void MockDeleteGenericVnf(String vnfId, String resourceVersion) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(204)));
+ }
+
+ public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockPutGenericVnf(String vnfId) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
+ .withRequestBody(containing(requestBodyContaining))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void MockPutGenericVnf(String vnfId, int statusCode) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void MockPutGenericVnf_Bad(String vnfId, int statusCode) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void MockPatchGenericVnf(String vnfId) {
+ stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ /**
+ * Vce Mock StubResponses below
+ */
+ public static void MockGetVceById(String vnfId, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetVceByName(String vnfName, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void MockPutVce(String vnfId) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ /**
+ * Tenant Mock StubResponses below
+ */
+ public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetTenant(String tenantId, String responseFile) {
+ stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ /**
+ * Network Mock StubResponses below
+ */
+ public static void MockGetNetwork(String networkId, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegion))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkByName(String networkName, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkName))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkByName_404(String responseFile, String networkName) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkName))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkCloudRegion_404(String cloudRegion) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegion))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ public static void MockPutNetwork(String networkId, int statusCode, String responseFile) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkVpnBinding(String responseFile, String vpnBinding) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + vpnBinding + "[?]depth=all"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkPolicy(String responseFile, String policy) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + policy + "[?]depth=all"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkTableReference(String responseFile, String tableReference) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + tableReference + "[?]depth=all"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockPatchVfModuleId(String vnfId, String vfModuleId) {
+ stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ /////////////
+
+ public static void MockVNFAdapterRestVfModule() {
+ stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void MockDBUpdateVfModule() {
+ stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/DBUpdateResponse.xml")));
+ }
+
+ // start of mocks used locally and by other VF Module unit tests
+ public static void MockSDNCAdapterVfModule() {
+ // simplified the implementation to return "success" for all requests
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
// .withRequestBody(containing("SvcInstanceId><"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
-
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockAAIVfModule() {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
- .atPriority(1)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VfModule-supercool.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm"))
- .atPriority(2)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VfModule-lukewarm.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
- .atPriority(5)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VfModule-new.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/GenericVnf.xml")));
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
+
+ }
+
+ // start of mocks used locally and by other VF Module unit tests
+ public static void MockAAIVfModule() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
+ .atPriority(1)
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/VfModule-supercool.xml")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm"))
+ .atPriority(2)
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/VfModule-lukewarm.xml")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
+ .atPriority(5)
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/VfModule-new.xml")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/GenericVnf.xml")));
+ stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
// .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
// .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(200)));
- // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(200)));
- // HTTP PUT stub still used by DoCreateVfModuleTest
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MODULELABEL"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21/volume-groups/volume-group/78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VolumeGroup.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VolumeGroup.xml")));
- stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml")));
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId"))
- .withRequestBody(containing("NEWvBNGModuleId"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
-
-
- //////////////
-
- /**
- * Cloud infrastructure below
- */
-
- public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- /**
- * Volume Group StubResponse below
- */
- public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) {
- stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- /**
- * VF-Module StubResponse below
- * @param statusCode TODO
- */
- public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")));
- }
-
- public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutVfModuleId(String vnfId, String vfModuleId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(returnCode)));
- }
-
- public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(returnCode)));
- }
-
- public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) {
- stubFor(patch(urlMatching(endpoint))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- /* AAI Pserver Queries */
- public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) {
- stubFor(put(urlMatching("/v10/query.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/v10/network/generic-vnfs/.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/json; charset=utf-8")
- .withBodyFile(responseFile)));
- }
-
- public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) {
- stubFor(patch(urlMatching("/v10/network/generic-vnfs/.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- ));
- }
-
- //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above ////
- @Deprecated
- public static void MockGetVceById(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getVceResponse.xml")));
- }
- @Deprecated
- public static void MockGetVceByName(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getVceByNameResponse.xml")));
- }
- @Deprecated
- public static void MockPutVce(){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- @Deprecated
- public static void MockDeleteVce(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(204)));
- }
- @Deprecated
- public static void MockDeleteVce_404(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- @Deprecated
- public static void MockDeleteServiceSubscription(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
- .willReturn(aResponse()
- .withStatus(204)));
- }
- @Deprecated
- public static void MockGetServiceSubscription(){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getServiceSubscription.xml")));
- }
- @Deprecated
- public static void MockGetServiceSubscription_200Empty(){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(" ")));
- }
- @Deprecated
- public static void MockGetServiceSubscription_404() {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockGENPSIPutServiceInstance(){
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
- }
-
- @Deprecated
- public static void MockGENPSIPutServiceSubscription(){
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
- }
- @Deprecated
- public static void MockGENPSIPutServiceInstance_get500(){
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericPutServiceInstance/aaiFault.xml")));
- }
-
- @Deprecated
- public static void MockGetGenericVnfById(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfById_404(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockGetGenericVnfByName(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfByName_hasRelationships(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfById_hasRelationships(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfById_500(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
- @Deprecated
- public static void MockGetGenericVnfByName_404(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockPutGenericVnf(){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- @Deprecated
- public static void MockPutGenericVnf_400(){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(400)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(204)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf_404(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf_500(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf_412(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(412)));
- }
+ .willReturn(aResponse()
+ .withStatus(200)));
+ // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("PCRF"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ // HTTP PUT stub still used by DoCreateVfModuleTest
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("MODULELABEL"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21/volume-groups/volume-group/78987"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/VolumeGroup.xml")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/78987"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/VolumeGroup.xml")));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml")));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml")));
+ stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId"))
+ .withRequestBody(containing("NEWvBNGModuleId"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+
+ //////////////
+
+ /**
+ * Cloud infrastructure below
+ */
+
+ public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ /**
+ * Volume Group StubResponse below
+ */
+ public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) {
+ stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ /**
+ * VF-Module StubResponse below
+ *
+ * @param statusCode TODO
+ */
+ public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")));
+ }
+
+ public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockPutVfModuleId(String vnfId, String vfModuleId) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(returnCode)));
+ }
+
+ public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion))
+ .willReturn(aResponse()
+ .withStatus(returnCode)));
+ }
+
+ public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) {
+ stubFor(patch(urlMatching(endpoint))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ /* AAI Pserver Queries */
+ public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) {
+ stubFor(put(urlMatching("/v10/query.*"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) {
+ stubFor(get(urlMatching("/v10/network/generic-vnfs/.*"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/json; charset=utf-8")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) {
+ stubFor(patch(urlMatching("/v10/network/generic-vnfs/.*"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ ));
+ }
+
+ //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above ////
+ @Deprecated
+ public static void MockGetVceById() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getVceResponse.xml")));
+ }
+
+ @Deprecated
+ public static void MockGetVceByName() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getVceByNameResponse.xml")));
+ }
+
+ @Deprecated
+ public static void MockPutVce() {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ @Deprecated
+ public static void MockDeleteVce() {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
+ .willReturn(aResponse()
+ .withStatus(204)));
+ }
+
+ @Deprecated
+ public static void MockDeleteVce_404() {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ @Deprecated
+ public static void MockDeleteServiceSubscription() {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
+ .willReturn(aResponse()
+ .withStatus(204)));
+ }
+
+ @Deprecated
+ public static void MockGetServiceSubscription() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getServiceSubscription.xml")));
+ }
+
+ @Deprecated
+ public static void MockGetServiceSubscription_200Empty() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(" ")));
+ }
+
+ @Deprecated
+ public static void MockGetServiceSubscription_404() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ @Deprecated
+ public static void MockGENPSIPutServiceInstance() {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
+ }
+
+ @Deprecated
+ public static void MockGENPSIPutServiceSubscription() {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
+ }
+
+ @Deprecated
+ public static void MockGENPSIPutServiceInstance_get500() {
+ stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericPutServiceInstance/aaiFault.xml")));
+ }
+
+ @Deprecated
+ public static void MockGetGenericVnfById() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
+ }
+
+ @Deprecated
+ public static void MockGetGenericVnfById_404() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ @Deprecated
+ public static void MockGetGenericVnfByName() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
+ }
+
+ @Deprecated
+ public static void MockGetGenericVnfByName_hasRelationships() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
+ }
+
+ @Deprecated
+ public static void MockGetGenericVnfById_hasRelationships() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
+ }
+
+ @Deprecated
+ public static void MockGetGenericVnfById_500() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ @Deprecated
+ public static void MockGetGenericVnfByName_404() {
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ @Deprecated
+ public static void MockPutGenericVnf() {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ @Deprecated
+ public static void MockPutGenericVnf_400() {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
+ .willReturn(aResponse()
+ .withStatus(400)));
+ }
+
+ @Deprecated
+ public static void MockDeleteGenericVnf() {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
+ .willReturn(aResponse()
+ .withStatus(204)));
+ }
+
+ @Deprecated
+ public static void MockDeleteGenericVnf_404() {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
+ .willReturn(aResponse()
+ .withStatus(404)));
+ }
+
+ @Deprecated
+ public static void MockDeleteGenericVnf_500() {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ @Deprecated
+ public static void MockDeleteGenericVnf_412() {
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123"))
+ .willReturn(aResponse()
+ .withStatus(412)));
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java
index ffa6701a89..c872567504 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -31,80 +31,80 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
*/
public class StubResponseDatabase {
- public static void setupAllMocks() {
-
- }
-
- public static void MockUpdateRequestDB(String fileName){
- stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(fileName)));
- }
-
- public static void mockUpdateRequestDB(int statusCode, String reponseFile) {
- stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(reponseFile)));
- }
-
- public static void MockGetAllottedResourcesByModelInvariantId(String modelInvariantId, String responseFile){
- stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetAllottedResourcesByModelInvariantId_500(String modelInvariantId, String responseFile){
- stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockGetVnfCatalogDataCustomizationUuid(String vnfModelCustomizationUuid, String responseFile){
- stubFor(get(urlEqualTo("/v2/serviceVnfs?vnfModelCustomizationUuid=" + vnfModelCustomizationUuid))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVfModuleByModelNameCatalogData(String vfModuleModelName, String responseFile){
- stubFor(get(urlEqualTo("/v2/vfModules?vfModuleModelName=" + vfModuleModelName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String serviceModelVersion, String responseFile){
- stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid +
- "&serviceModelVersion=" + serviceModelVersion))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String responseFile){
- stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetServiceResourcesCatalogDataByModelUuid(String serviceModelUuid, String responseFile){
+ public static void setupAllMocks() {
+
+ }
+
+ public static void MockUpdateRequestDB(String fileName) {
+ stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(fileName)));
+ }
+
+ public static void mockUpdateRequestDB(int statusCode, String reponseFile) {
+ stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(reponseFile)));
+ }
+
+ public static void MockGetAllottedResourcesByModelInvariantId(String modelInvariantId, String responseFile) {
+ stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetAllottedResourcesByModelInvariantId_500(String modelInvariantId, String responseFile) {
+ stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockGetVnfCatalogDataCustomizationUuid(String vnfModelCustomizationUuid, String responseFile) {
+ stubFor(get(urlEqualTo("/v2/serviceVnfs?vnfModelCustomizationUuid=" + vnfModelCustomizationUuid))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetVfModuleByModelNameCatalogData(String vfModuleModelName, String responseFile) {
+ stubFor(get(urlEqualTo("/v2/vfModules?vfModuleModelName=" + vfModuleModelName))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String serviceModelVersion, String responseFile) {
+ stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid +
+ "&serviceModelVersion=" + serviceModelVersion))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String responseFile) {
+ stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockGetServiceResourcesCatalogDataByModelUuid(String serviceModelUuid, String responseFile) {
stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=" + serviceModelUuid))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java
index 8baeb1b137..f64d80c066 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -28,86 +28,85 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
/**
* Please describe the StubResponseNetwork.java class
- *
*/
public class StubResponseNetworkAdapter {
- private static final String EOL = "\n";
-
- public static void setupAllMocks() {
-
- }
-
-
- public static void MockNetworkAdapter() {
- stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockNetworkAdapter(String response) {
- stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(response)));
- }
-
- public static void MockNetworkAdapter_500() {
- stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockNetworkAdapterPost(String responseFile, String requestContaining) {
- stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapter(String networkId, int statusCode, String responseFile) {
- stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapterContainingRequest(String requestContaining, int statusCode, String responseFile) {
- stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutNetworkAdapter(String networkId, String requestContaining, int statusCode, String responseFile) {
- stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapterRestRollbackDelete(String responseFile, String networkId) {
- stubFor(delete(urlEqualTo("/networks/NetworkAdapter/"+networkId+"/rollback"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNetworkAdapterRestPut(String responseFile, String networkId) {
- stubFor(put(urlEqualTo("/networks/NetworkAdapter/"+networkId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
+ private static final String EOL = "\n";
+
+ public static void setupAllMocks() {
+
+ }
+
+
+ public static void MockNetworkAdapter() {
+ stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockNetworkAdapter(String response) {
+ stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(response)));
+ }
+
+ public static void MockNetworkAdapter_500() {
+ stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockNetworkAdapterPost(String responseFile, String requestContaining) {
+ stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockNetworkAdapter(String networkId, int statusCode, String responseFile) {
+ stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockNetworkAdapterContainingRequest(String requestContaining, int statusCode, String responseFile) {
+ stubFor(post(urlEqualTo("/networks/NetworkAdapter"))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockPutNetworkAdapter(String networkId, String requestContaining, int statusCode, String responseFile) {
+ stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockNetworkAdapterRestRollbackDelete(String responseFile, String networkId) {
+ stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId + "/rollback"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void MockNetworkAdapterRestPut(String responseFile, String networkId) {
+ stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java
index fdaede1b39..d84af85258 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -31,64 +31,63 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
/**
* Reusable Mock StubResponses for Policy
- *
*/
public class StubResponsePolicy {
- public static void setupAllMocks() {
-
- }
-
- // start of Policy mocks
- public static void MockPolicyAbort() {
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("BB1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("UPDVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("RPLVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
-
- }
-
- public static void MockPolicySkip() {
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("BB1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("UPDVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("RPLVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
-
- }
-
-
+ public static void setupAllMocks() {
+
+ }
+
+ // start of Policy mocks
+ public static void MockPolicyAbort() {
+ stubFor(post(urlEqualTo("/pdp/api/getDecision"))
+ .withRequestBody(containing("BB1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("policyAbortResponse.json")));
+
+ stubFor(post(urlEqualTo("/pdp/api/getDecision"))
+ .withRequestBody(containing("UPDVnfI"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("policyAbortResponse.json")));
+
+ stubFor(post(urlEqualTo("/pdp/api/getDecision"))
+ .withRequestBody(containing("RPLVnfI"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("policyAbortResponse.json")));
+
+
+ }
+
+ public static void MockPolicySkip() {
+ stubFor(post(urlEqualTo("/pdp/api/getDecision"))
+ .withRequestBody(containing("BB1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("Policy/policySkipResponse.json")));
+
+ stubFor(post(urlEqualTo("/pdp/api/getDecision"))
+ .withRequestBody(containing("UPDVnfI"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("Policy/policySkipResponse.json")));
+
+ stubFor(post(urlEqualTo("/pdp/api/getDecision"))
+ .withRequestBody(containing("RPLVnfI"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("Policy/policySkipResponse.json")));
+
+
+ }
+
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java
index f41d6d7dba..60adca2c67 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -29,118 +29,118 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
*/
public class StubResponseSDNCAdapter {
- public static void setupAllMocks() {
-
- }
-
- public static void mockSDNCAdapter_500() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockSDNCAdapter_500(String requestContaining) {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockSDNCAdapter(int statusCode) {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void mockSDNCAdapter(String endpoint, int statusCode, String responseFile) {
- stubFor(post(urlEqualTo(endpoint))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapter(String responseFile) {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapter(String endpoint, String requestContaining, int statusCode, String responseFile) {
- stubFor(post(urlEqualTo(endpoint))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapterSimulator(String responseFile) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers("sdnc-adapter-transformer")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers("sdnc-adapter-transformer")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapterRest() {
- stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterRest_500() {
- stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterRest(String requestContaining) {
- stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterRest_500(String requestContaining) {
- stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withTransformers("network-topology-operation-transformer")
- .withBodyFile(responseFile)));
- }
-
-
+ public static void setupAllMocks() {
+
+ }
+
+ public static void mockSDNCAdapter_500() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void mockSDNCAdapter_500(String requestContaining) {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void mockSDNCAdapter(int statusCode) {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)));
+ }
+
+ public static void mockSDNCAdapter(String endpoint, int statusCode, String responseFile) {
+ stubFor(post(urlEqualTo(endpoint))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void mockSDNCAdapter(String responseFile) {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void mockSDNCAdapter(String endpoint, String requestContaining, int statusCode, String responseFile) {
+ stubFor(post(urlEqualTo(endpoint))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void mockSDNCAdapterSimulator(String responseFile) {
+ MockResource mockResource = new MockResource();
+ mockResource.updateProperties("sdnc_delay", "300");
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/soap+xml")
+ .withTransformers("sdnc-adapter-transformer")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) {
+ MockResource mockResource = new MockResource();
+ mockResource.updateProperties("sdnc_delay", "300");
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/soap+xml")
+ .withTransformers("sdnc-adapter-transformer")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void mockSDNCAdapterRest() {
+ stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/json")));
+ }
+
+ public static void mockSDNCAdapterRest_500() {
+ stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "application/json")));
+ }
+
+ public static void mockSDNCAdapterRest(String requestContaining) {
+ stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/json")));
+ }
+
+ public static void mockSDNCAdapterRest_500(String requestContaining) {
+ stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "application/json")));
+ }
+
+ public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) {
+ MockResource mockResource = new MockResource();
+ mockResource.updateProperties("sdnc_delay", "300");
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withTransformers("network-topology-operation-transformer")
+ .withBodyFile(responseFile)));
+ }
+
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java
index c16ac43d41..14720080de 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java
@@ -33,37 +33,37 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
*/
public class StubResponseSNIRO {
- public static void setupAllMocks() {
+ public static void setupAllMocks() {
- }
+ }
- public static void mockSNIRO() {
- stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
+ public static void mockSNIRO() {
+ stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/json")));
+ }
- public static void mockSNIRO(String responseFile) {
- stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
+ public static void mockSNIRO(String responseFile) {
+ stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
- public static void mockSNIRO_400() {
- stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(400)
- .withHeader("Content-Type", "application/json")));
- }
+ public static void mockSNIRO_400() {
+ stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
+ .willReturn(aResponse()
+ .withStatus(400)
+ .withHeader("Content-Type", "application/json")));
+ }
- public static void mockSNIRO_500() {
- stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
- }
+ public static void mockSNIRO_500() {
+ stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "application/json")));
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java
index b4aca5081e..27be8d008f 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -32,127 +32,128 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
*/
public class StubResponseVNFAdapter {
- public static void mockVNFAdapter() {
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void mockVNFAdapter(String responseFile) {
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void mockVNFAdapter_500() {
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockVNFAdapterTransformer(String transformer, String responseFile) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("vnf_delay", "300");
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers(transformer)
- .withBodyFile(responseFile)));
- }
-
- public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("vnf_delay", "300");
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers(transformer)
- .withBodyFile(responseFile)));
- }
-
- public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) {
- stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFPut(String vfModuleId, int statusCode) {
- stubFor(put(urlEqualTo("/vnfs/v1/vnfs/vnfId/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFPut(String vnfId, String vfModuleId, int statusCode) {
- stubFor(put(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFDelete(String vnfId, String vfModuleId, int statusCode) {
- stubFor(delete(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFRollbackDelete(String vfModuleId, int statusCode) {
- stubFor(delete(urlEqualTo("/vnfs/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockPutVNFVolumeGroup(String volumeGroupId, int statusCode) {
- stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockPutVNFVolumeGroupRollback(String volumeGroupId, int statusCode) {
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId + "/rollback"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
- public static void mockPostVNFVolumeGroup(int statusCode) {
- stubFor(post(urlEqualTo("/vnfs/v1/volume-groups"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVNFAdapterRest(String vnfId) {
- stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void mockVNFAdapterRest_500(String vnfId) {
- stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void mockVfModuleDelete(String volumeGroupId) {
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/"+ volumeGroupId))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void mockVfModuleDelete(String volumeGroupId, int statusCode) {
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/xml")));
- }
+ public static void mockVNFAdapter() {
+ stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void mockVNFAdapter(String responseFile) {
+ stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void mockVNFAdapter_500() {
+ stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void mockVNFAdapterTransformer(String transformer, String responseFile) {
+ MockResource mockResource = new MockResource();
+ mockResource.updateProperties("vnf_delay", "300");
+ stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/soap+xml")
+ .withTransformers(transformer)
+ .withBodyFile(responseFile)));
+ }
+
+ public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) {
+ MockResource mockResource = new MockResource();
+ mockResource.updateProperties("vnf_delay", "300");
+ stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
+ .withRequestBody(containing(requestContaining))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/soap+xml")
+ .withTransformers(transformer)
+ .withBodyFile(responseFile)));
+ }
+
+ public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) {
+ stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVNFPut(String vfModuleId, int statusCode) {
+ stubFor(put(urlEqualTo("/vnfs/v1/vnfs/vnfId/vf-modules" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVNFPut(String vnfId, String vfModuleId, int statusCode) {
+ stubFor(put(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVNFDelete(String vnfId, String vfModuleId, int statusCode) {
+ stubFor(delete(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVNFRollbackDelete(String vfModuleId, int statusCode) {
+ stubFor(delete(urlEqualTo("/vnfs/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockPutVNFVolumeGroup(String volumeGroupId, int statusCode) {
+ stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockPutVNFVolumeGroupRollback(String volumeGroupId, int statusCode) {
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId + "/rollback"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockPostVNFVolumeGroup(int statusCode) {
+ stubFor(post(urlEqualTo("/vnfs/v1/volume-groups"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVNFAdapterRest(String vnfId) {
+ stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void mockVNFAdapterRest_500(String vnfId) {
+ stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules"))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void mockVfModuleDelete(String volumeGroupId) {
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void mockVfModuleDelete(String volumeGroupId, int statusCode) {
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java
index 23921da8d8..845f9fa28c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -31,118 +31,118 @@ import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
import org.openecomp.mso.logger.MsoLogger;
+
/**
* Please describe the VnfAdapterCreateMockTransformer.java class
- *
*/
public class VnfAdapterCreateMockTransformer extends ResponseTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private String notifyCallbackResponse;
- private String ackResponse;
-
- public VnfAdapterCreateMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response
- }
-
- @Override
- public String name() {
- return "vnf-adapter-create-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- LOGGER.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- System.out.println("response (mock) messageId : " + responseMessageId);
- System.out.println("request (replacement) messageId: " + messageId);
-
- System.out.println("vnf Response (before):" + notifyCallbackResponse);
- System.out.println("vnf Response (after):" + updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("VnfAdapterCreateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- @SuppressWarnings("deprecation")
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- LOGGER.debug("Exception :",e1);
- }
- LOGGER.debug("Sending callback response to url: " + callbackUrl);
- ClientRequest request = new ClientRequest(callbackUrl);
- request.body("text/xml", payLoad);
- //System.out.println("payLoad: " + payLoad);
-
- try {
- ClientResponse result = request.post();
- LOGGER.debug("Successfully posted callback? Status: " + result.getStatus());
- //System.err.println("Successfully posted callback:" + result.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- LOGGER.debug("catch error in - request.post() ");
- LOGGER.debug("Exception :",e);
- }
- }
-
- }
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private String notifyCallbackResponse;
+ private String ackResponse;
+
+ public VnfAdapterCreateMockTransformer() {
+ notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response
+ }
+
+ @Override
+ public String name() {
+ return "vnf-adapter-create-transformer";
+ }
+
+ @Override
+ public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+ FileSource fileSource) {
+
+ String requestBody = request.getBodyAsString();
+
+ String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>") + 17, requestBody.indexOf("</notificationUrl>"));
+ String messageId = requestBody.substring(requestBody.indexOf("<messageId>") + 11, requestBody.indexOf("</messageId>"));
+ String responseMessageId = "";
+ String updatedResponse = "";
+
+ try {
+ // try supplied response file (if any)
+ System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+ ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+ notifyCallbackResponse = ackResponse;
+ responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>") + 11, ackResponse.indexOf("</messageId>"));
+ updatedResponse = ackResponse.replace(responseMessageId, messageId);
+ } catch (Exception ex) {
+ LOGGER.debug("Exception :", ex);
+ System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'");
+ responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>") + 11, notifyCallbackResponse.indexOf("</messageId>"));
+ updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
+ }
+
+ System.out.println("response (mock) messageId : " + responseMessageId);
+ System.out.println("request (replacement) messageId: " + messageId);
+
+ System.out.println("vnf Response (before):" + notifyCallbackResponse);
+ System.out.println("vnf Response (after):" + updatedResponse);
+
+ Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
+ int delay = 300;
+ if (vnfDelay != null) {
+ delay = Integer.parseInt(vnfDelay.toString());
+ }
+
+ //Kick off callback thread
+ System.out.println("VnfAdapterCreateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+ CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl, updatedResponse, delay);
+ callbackResponseThread.start();
+
+ return ResponseDefinitionBuilder
+ .like(responseDefinition).but()
+ .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
+ .build();
+
+ }
+
+ @Override
+ public boolean applyGlobally() {
+ return false;
+ }
+
+ private class CallbackResponseThread extends Thread {
+
+ private String callbackUrl;
+ private String payLoad;
+ private int delay;
+
+ public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+ this.callbackUrl = callbackUrl;
+ this.payLoad = payLoad;
+ this.delay = delay;
+ }
+
+ @SuppressWarnings("deprecation")
+ public void run() {
+ try {
+ //Delay sending callback response
+ sleep(delay);
+ } catch (InterruptedException e1) {
+ // TODO Auto-generated catch block
+ LOGGER.debug("Exception :", e1);
+ }
+ LOGGER.debug("Sending callback response to url: " + callbackUrl);
+ ClientRequest request = new ClientRequest(callbackUrl);
+ request.body("text/xml", payLoad);
+ //System.out.println("payLoad: " + payLoad);
+
+ try {
+ ClientResponse result = request.post();
+ LOGGER.debug("Successfully posted callback? Status: " + result.getStatus());
+ //System.err.println("Successfully posted callback:" + result.getStatus());
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ LOGGER.debug("catch error in - request.post() ");
+ LOGGER.debug("Exception :", e);
+ }
+ }
+
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java
index ee6972e46e..70729047b3 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -27,117 +27,117 @@ import com.github.tomakehurst.wiremock.common.FileSource;
import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+
/**
* Please describe the VnfAdapterCreateMockTransformer.java class
- *
*/
public class VnfAdapterDeleteMockTransformer extends ResponseTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private String notifyCallbackResponse;
- private String ackResponse;
-
- public VnfAdapterDeleteMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml");
- }
-
- @Override
- public String name() {
- return "vnf-adapter-delete-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource) {
-
- // System.err.println("notifyCallbackResponse:" + notifyCallbackResponse);
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- LOGGER.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- System.out.println("response (mock) messageId : " + responseMessageId);
- System.out.println("request (replacement) messageId: " + messageId);
-
- System.out.println("vnf Response (before):" + notifyCallbackResponse);
- System.out.println("vnf Response (after):" + updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("VnfAdapterDeleteMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- @SuppressWarnings("deprecation")
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- LOGGER.debug("Exception :",e1);
- }
- System.out.println("Sending callback response to url: " + callbackUrl);
- ClientRequest request = new ClientRequest(callbackUrl);
- request.body("text/xml", payLoad);
- //System.err.println(payLoad);
- try {
- ClientResponse result = request.post();
- System.out.println("Successfully posted callback? Status: " + result.getStatus());
- //System.err.println("Successfully posted callback:" + result.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- System.out.println("catch error in - request.post() ");
- LOGGER.debug("Exception :",e);
- }
- }
-
- }
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private String notifyCallbackResponse;
+ private String ackResponse;
+
+ public VnfAdapterDeleteMockTransformer() {
+ notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml");
+ }
+
+ @Override
+ public String name() {
+ return "vnf-adapter-delete-transformer";
+ }
+
+ @Override
+ public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+ FileSource fileSource) {
+
+ // System.err.println("notifyCallbackResponse:" + notifyCallbackResponse);
+
+ String requestBody = request.getBodyAsString();
+
+ String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>") + 17, requestBody.indexOf("</notificationUrl>"));
+ String messageId = requestBody.substring(requestBody.indexOf("<messageId>") + 11, requestBody.indexOf("</messageId>"));
+ String responseMessageId = "";
+ String updatedResponse = "";
+
+ try {
+ // try supplied response file (if any)
+ System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+ ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+ notifyCallbackResponse = ackResponse;
+ responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>") + 11, ackResponse.indexOf("</messageId>"));
+ updatedResponse = ackResponse.replace(responseMessageId, messageId);
+ } catch (Exception ex) {
+ LOGGER.debug("Exception :", ex);
+ System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'");
+ responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>") + 11, notifyCallbackResponse.indexOf("</messageId>"));
+ updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
+ }
+
+ System.out.println("response (mock) messageId : " + responseMessageId);
+ System.out.println("request (replacement) messageId: " + messageId);
+
+ System.out.println("vnf Response (before):" + notifyCallbackResponse);
+ System.out.println("vnf Response (after):" + updatedResponse);
+
+ Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
+ int delay = 300;
+ if (vnfDelay != null) {
+ delay = Integer.parseInt(vnfDelay.toString());
+ }
+
+ //Kick off callback thread
+ System.out.println("VnfAdapterDeleteMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+ CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl, updatedResponse, delay);
+ callbackResponseThread.start();
+
+ return ResponseDefinitionBuilder
+ .like(responseDefinition).but()
+ .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
+ .build();
+
+ }
+
+ @Override
+ public boolean applyGlobally() {
+ return false;
+ }
+
+ private class CallbackResponseThread extends Thread {
+
+ private String callbackUrl;
+ private String payLoad;
+ private int delay;
+
+ public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+ this.callbackUrl = callbackUrl;
+ this.payLoad = payLoad;
+ this.delay = delay;
+ }
+
+ @SuppressWarnings("deprecation")
+ public void run() {
+ try {
+ //Delay sending callback response
+ sleep(delay);
+ } catch (InterruptedException e1) {
+ // TODO Auto-generated catch block
+ LOGGER.debug("Exception :", e1);
+ }
+ System.out.println("Sending callback response to url: " + callbackUrl);
+ ClientRequest request = new ClientRequest(callbackUrl);
+ request.body("text/xml", payLoad);
+ //System.err.println(payLoad);
+ try {
+ ClientResponse result = request.post();
+ System.out.println("Successfully posted callback? Status: " + result.getStatus());
+ //System.err.println("Successfully posted callback:" + result.getStatus());
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ System.out.println("catch error in - request.post() ");
+ LOGGER.debug("Exception :", e);
+ }
+ }
+
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java
index 1582071d3a..687c2372c5 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -32,130 +32,130 @@ import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
import org.openecomp.mso.logger.MsoLogger;
+
/**
* Please describe the VnfAdapterQueryMockTransformer.java class
- *
*/
-public class VnfAdapterQueryMockTransformer extends ResponseTransformer{
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private String notifyCallbackResponse;
- private String ackResponse;
- private String messageId;
-
- public VnfAdapterQueryMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml");
- }
-
- public VnfAdapterQueryMockTransformer(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public String name() {
- return "vnf-adapter-query-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- // String updatedResponse = notifyCallbackResponse.replace("b1a82ce6-7f5c-45fd-9273-acaf88fc2137", messageId);
-
- String responseMessageId = "";
- String updatedResponse = "";
-
- // if (ackResponse == null) {
- //System.err.println("file:" + responseDefinition.getBodyFileName());
- // ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- //}
-
-
- try {
- // try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- LOGGER.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- System.out.println("response (mock) messageId : " + responseMessageId);
- System.out.println("request (replacement) messageId: " + messageId);
-
- System.out.println("vnf Response (before):" + notifyCallbackResponse);
- System.out.println("vnf Response (after):" + updatedResponse);
-
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
-
- //System.out.println("notficationUrl" + notficationUrl);
- //System.out.println("updatedResponse" + updatedResponse);
- System.out.println("VnfAdapterQueryMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- System.out.println("Inside Callback" );
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- LOGGER.debug("Exception :",e1);
- }
- ClientRequest request = new ClientRequest(callbackUrl);
- request.body("text/xml", payLoad);
- //System.err.println(payLoad);
- try {
- ClientResponse result = request.post();
- //System.err.println("Successfully posted callback:" + result.getStatus());
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- }
- }
-
- }
+public class VnfAdapterQueryMockTransformer extends ResponseTransformer {
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private String notifyCallbackResponse;
+ private String ackResponse;
+ private String messageId;
+
+ public VnfAdapterQueryMockTransformer() {
+ notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml");
+ }
+
+ public VnfAdapterQueryMockTransformer(String messageId) {
+ this.messageId = messageId;
+ }
+
+ @Override
+ public String name() {
+ return "vnf-adapter-query-transformer";
+ }
+
+ @Override
+ public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+ FileSource fileSource) {
+
+ String requestBody = request.getBodyAsString();
+
+ String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>") + 17, requestBody.indexOf("</notificationUrl>"));
+ String messageId = requestBody.substring(requestBody.indexOf("<messageId>") + 11, requestBody.indexOf("</messageId>"));
+ // String updatedResponse = notifyCallbackResponse.replace("b1a82ce6-7f5c-45fd-9273-acaf88fc2137", messageId);
+
+ String responseMessageId = "";
+ String updatedResponse = "";
+
+ // if (ackResponse == null) {
+ //System.err.println("file:" + responseDefinition.getBodyFileName());
+ // ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+ //}
+
+
+ try {
+ // try supplied response file (if any)
+ System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+ ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+ notifyCallbackResponse = ackResponse;
+ responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>") + 11, ackResponse.indexOf("</messageId>"));
+ updatedResponse = ackResponse.replace(responseMessageId, messageId);
+ } catch (Exception ex) {
+ LOGGER.debug("Exception :", ex);
+ System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'");
+ responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>") + 11, notifyCallbackResponse.indexOf("</messageId>"));
+ updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
+ }
+
+ System.out.println("response (mock) messageId : " + responseMessageId);
+ System.out.println("request (replacement) messageId: " + messageId);
+
+ System.out.println("vnf Response (before):" + notifyCallbackResponse);
+ System.out.println("vnf Response (after):" + updatedResponse);
+
+
+ Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
+ int delay = 300;
+ if (vnfDelay != null) {
+ delay = Integer.parseInt(vnfDelay.toString());
+ }
+
+ //Kick off callback thread
+
+ //System.out.println("notficationUrl" + notficationUrl);
+ //System.out.println("updatedResponse" + updatedResponse);
+ System.out.println("VnfAdapterQueryMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+ CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl, updatedResponse, delay);
+ System.out.println("Inside Callback");
+ callbackResponseThread.start();
+
+ return ResponseDefinitionBuilder
+ .like(responseDefinition).but()
+ .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
+ .build();
+ }
+
+ @Override
+ public boolean applyGlobally() {
+ return false;
+ }
+
+ private class CallbackResponseThread extends Thread {
+
+ private String callbackUrl;
+ private String payLoad;
+ private int delay;
+
+ public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+ this.callbackUrl = callbackUrl;
+ this.payLoad = payLoad;
+ this.delay = delay;
+ }
+
+ public void run() {
+ try {
+ //Delay sending callback response
+ sleep(delay);
+ } catch (InterruptedException e1) {
+ LOGGER.debug("Exception :", e1);
+ }
+ ClientRequest request = new ClientRequest(callbackUrl);
+ request.body("text/xml", payLoad);
+ //System.err.println(payLoad);
+ try {
+ ClientResponse result = request.post();
+ //System.err.println("Successfully posted callback:" + result.getStatus());
+ } catch (Exception e) {
+ LOGGER.debug("Exception :", e);
+ }
+ }
+
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java
index 186fd35b6f..6d5d02a7b4 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -28,117 +28,117 @@ import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
import org.openecomp.mso.logger.MsoLogger;
+
/**
* Please describe the VnfAdapterCreateMockTransformer.java class
- *
*/
public class VnfAdapterRollbackMockTransformer extends ResponseTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private String notifyCallbackResponse;
- private String ackResponse;
- private String messageId;
-
- public VnfAdapterRollbackMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml");
- }
-
- public VnfAdapterRollbackMockTransformer(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public String name() {
- return "vnf-adapter-rollback-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- LOGGER.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- System.out.println("response (mock) messageId : " + responseMessageId);
- System.out.println("request (replacement) messageId: " + messageId);
-
- System.out.println("vnf Response (before):" + notifyCallbackResponse);
- System.out.println("vnf Response (after):" + updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("VnfAdapterRollbackMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- LOGGER.debug("Exception :",e1);
- }
- System.out.println("Sending callback response to url: " + callbackUrl);
- ClientRequest request = new ClientRequest(callbackUrl);
- request.body("text/xml", payLoad);
- //System.err.println(payLoad);
- try {
- ClientResponse result = request.post();
- System.out.println("Successfully posted callback? Status: " + result.getStatus());
- //System.err.println("Successfully posted callback:" + result.getStatus());
- } catch (Exception e) {
- System.out.println("catch error in - request.post() ");
- LOGGER.debug("Exception :",e);
- }
- }
-
- }
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private String notifyCallbackResponse;
+ private String ackResponse;
+ private String messageId;
+
+ public VnfAdapterRollbackMockTransformer() {
+ notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml");
+ }
+
+ public VnfAdapterRollbackMockTransformer(String messageId) {
+ this.messageId = messageId;
+ }
+
+ @Override
+ public String name() {
+ return "vnf-adapter-rollback-transformer";
+ }
+
+ @Override
+ public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+ FileSource fileSource) {
+
+ String requestBody = request.getBodyAsString();
+
+ String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>") + 17, requestBody.indexOf("</notificationUrl>"));
+ String messageId = requestBody.substring(requestBody.indexOf("<messageId>") + 11, requestBody.indexOf("</messageId>"));
+ String responseMessageId = "";
+ String updatedResponse = "";
+
+ try {
+ // try supplied response file (if any)
+ System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+ ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+ notifyCallbackResponse = ackResponse;
+ responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>") + 11, ackResponse.indexOf("</messageId>"));
+ updatedResponse = ackResponse.replace(responseMessageId, messageId);
+ } catch (Exception ex) {
+ LOGGER.debug("Exception :", ex);
+ System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'");
+ responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>") + 11, notifyCallbackResponse.indexOf("</messageId>"));
+ updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
+ }
+
+ System.out.println("response (mock) messageId : " + responseMessageId);
+ System.out.println("request (replacement) messageId: " + messageId);
+
+ System.out.println("vnf Response (before):" + notifyCallbackResponse);
+ System.out.println("vnf Response (after):" + updatedResponse);
+
+ Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
+ int delay = 300;
+ if (vnfDelay != null) {
+ delay = Integer.parseInt(vnfDelay.toString());
+ }
+
+ //Kick off callback thread
+ System.out.println("VnfAdapterRollbackMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+ CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl, updatedResponse, delay);
+ callbackResponseThread.start();
+
+ return ResponseDefinitionBuilder
+ .like(responseDefinition).but()
+ .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
+ .build();
+
+ }
+
+ @Override
+ public boolean applyGlobally() {
+ return false;
+ }
+
+ private class CallbackResponseThread extends Thread {
+
+ private String callbackUrl;
+ private String payLoad;
+ private int delay;
+
+ public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+ this.callbackUrl = callbackUrl;
+ this.payLoad = payLoad;
+ this.delay = delay;
+ }
+
+ public void run() {
+ try {
+ //Delay sending callback response
+ sleep(delay);
+ } catch (InterruptedException e1) {
+ LOGGER.debug("Exception :", e1);
+ }
+ System.out.println("Sending callback response to url: " + callbackUrl);
+ ClientRequest request = new ClientRequest(callbackUrl);
+ request.body("text/xml", payLoad);
+ //System.err.println(payLoad);
+ try {
+ ClientResponse result = request.post();
+ System.out.println("Successfully posted callback? Status: " + result.getStatus());
+ //System.err.println("Successfully posted callback:" + result.getStatus());
+ } catch (Exception e) {
+ System.out.println("catch error in - request.post() ");
+ LOGGER.debug("Exception :", e);
+ }
+ }
+
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java
index 7808b47d24..a2c4358ea0 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.mock;
@@ -32,118 +32,118 @@ import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
import org.openecomp.mso.logger.MsoLogger;
+
/**
* Please describe the VnfAdapterUpdateMockTransformer.java class
- *
*/
public class VnfAdapterUpdateMockTransformer extends ResponseTransformer {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private String notifyCallbackResponse;
- private String requestId;
- private String ackResponse;
-
- public VnfAdapterUpdateMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml");
- }
-
- public VnfAdapterUpdateMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
-
- public String name() {
- return "vnf-adapter-update-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- LOGGER.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- System.out.println("response (mock) messageId : " + responseMessageId);
- System.out.println("request (replacement) messageId: " + messageId);
-
- System.out.println("vnf Response (before):" + notifyCallbackResponse);
- System.out.println("vnf Response (after):" + updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("VnfAdapterUpdateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- LOGGER.debug("Exception :", e1);
- }
- System.out.println("Sending callback response to url: " + callbackUrl);
- ClientRequest request = new ClientRequest(callbackUrl);
- request.body("text/xml", payLoad);
- //System.err.println(payLoad);
- try {
- ClientResponse result = request.post();
- System.out.println("Successfully posted callback? Status: " + result.getStatus());
- //System.err.println("Successfully posted callback:" + result.getStatus());
- } catch (Exception e) {
- System.out.println("catch error in - request.post() ");
- LOGGER.debug("Exception :",e);
- }
- }
-
- }
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private String notifyCallbackResponse;
+ private String requestId;
+ private String ackResponse;
+
+ public VnfAdapterUpdateMockTransformer() {
+ notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml");
+ }
+
+ public VnfAdapterUpdateMockTransformer(String requestId) {
+ this.requestId = requestId;
+ }
+
+
+ public String name() {
+ return "vnf-adapter-update-transformer";
+ }
+
+ @Override
+ public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
+ FileSource fileSource) {
+
+ String requestBody = request.getBodyAsString();
+
+ String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>") + 17, requestBody.indexOf("</notificationUrl>"));
+ String messageId = requestBody.substring(requestBody.indexOf("<messageId>") + 11, requestBody.indexOf("</messageId>"));
+ String responseMessageId = "";
+ String updatedResponse = "";
+
+ try {
+ // try supplied response file (if any)
+ System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
+ ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
+ notifyCallbackResponse = ackResponse;
+ responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>") + 11, ackResponse.indexOf("</messageId>"));
+ updatedResponse = ackResponse.replace(responseMessageId, messageId);
+ } catch (Exception ex) {
+ LOGGER.debug("Exception :", ex);
+ System.out.println(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'");
+ responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>") + 11, notifyCallbackResponse.indexOf("</messageId>"));
+ updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
+ }
+
+ System.out.println("response (mock) messageId : " + responseMessageId);
+ System.out.println("request (replacement) messageId: " + messageId);
+
+ System.out.println("vnf Response (before):" + notifyCallbackResponse);
+ System.out.println("vnf Response (after):" + updatedResponse);
+
+ Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
+ int delay = 300;
+ if (vnfDelay != null) {
+ delay = Integer.parseInt(vnfDelay.toString());
+ }
+
+ //Kick off callback thread
+ System.out.println("VnfAdapterUpdateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay);
+ CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl, updatedResponse, delay);
+ callbackResponseThread.start();
+
+ return ResponseDefinitionBuilder
+ .like(responseDefinition).but()
+ .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
+ .build();
+
+ }
+
+ @Override
+ public boolean applyGlobally() {
+ return false;
+ }
+
+ private class CallbackResponseThread extends Thread {
+
+ private String callbackUrl;
+ private String payLoad;
+ private int delay;
+
+ public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
+ this.callbackUrl = callbackUrl;
+ this.payLoad = payLoad;
+ this.delay = delay;
+ }
+
+ public void run() {
+ try {
+ //Delay sending callback response
+ sleep(delay);
+ } catch (InterruptedException e1) {
+ LOGGER.debug("Exception :", e1);
+ }
+ System.out.println("Sending callback response to url: " + callbackUrl);
+ ClientRequest request = new ClientRequest(callbackUrl);
+ request.body("text/xml", payLoad);
+ //System.err.println(payLoad);
+ try {
+ ClientResponse result = request.post();
+ System.out.println("Successfully posted callback? Status: " + result.getStatus());
+ //System.err.println("Successfully posted callback:" + result.getStatus());
+ } catch (Exception e) {
+ System.out.println("catch error in - request.post() ");
+ LOGGER.debug("Exception :", e);
+ }
+ }
+
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java
index 8943014ad0..05e418b494 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java
@@ -26,6 +26,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.google.common.base.Charsets;
+
import javax.ws.rs.BadRequestException;
import javax.ws.rs.ForbiddenException;
import javax.ws.rs.InternalServerErrorException;
@@ -37,6 +38,7 @@ import javax.ws.rs.NotSupportedException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.ClientResponseContext;
import javax.ws.rs.core.Response.Status;
+
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.apache.commons.io.IOUtils;
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java
index bee0a828ea..680beb5d5b 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java
@@ -30,36 +30,39 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.onap.aai.domain.yang.Pserver;
+
import static org.junit.Assert.assertEquals;
+
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
+
public class AAIPServerTest {
- @BeforeClass
- public static void setUp() {
- System.setProperty("mso.config.path", "src/test/resources");
- System.setProperty("javax.net.ssl.keyStore", "C:/etc/ecomp/mso/config/msoClientKeyStore.jks");
- System.setProperty("javax.net.ssl.keyStorePassword", "mso4you");
- System.setProperty("javax.net.ssl.trustStore", "C:/etc/ecomp/mso/config/msoTrustStore.jks");
- System.setProperty("javax.net.ssl.trustStorePassword", "mso_Domain2.0_4you");
- }
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void pserverTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
- AAIRestClientImpl client = new AAIRestClientImpl();
- File file = new File("src/test/resources/__files/AAI/pserver.json");
- List<Pserver> list = client.getListOfPservers(file);
-
- assertEquals("", list.get(0).getHostname(), "test");
- }
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void pserverActualTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
- AAIRestClientImpl client = new AAIRestClientImpl();
- List<Pserver> list = client.getPhysicalServerByVnfId("d946afed-8ebe-4c5d-9665-54fcc043b8e7", UUID.randomUUID().toString());
- assertEquals("", list.size(), 0);
- }
+ @BeforeClass
+ public static void setUp() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ System.setProperty("javax.net.ssl.keyStore", "C:/etc/ecomp/mso/config/msoClientKeyStore.jks");
+ System.setProperty("javax.net.ssl.keyStorePassword", "mso4you");
+ System.setProperty("javax.net.ssl.trustStore", "C:/etc/ecomp/mso/config/msoTrustStore.jks");
+ System.setProperty("javax.net.ssl.trustStorePassword", "mso_Domain2.0_4you");
+ }
+
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ public void pserverTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
+ AAIRestClientImpl client = new AAIRestClientImpl();
+ File file = new File("src/test/resources/__files/AAI/pserver.json");
+ List<Pserver> list = client.getListOfPservers(file);
+
+ assertEquals("", list.get(0).getHostname(), "test");
+ }
+
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ public void pserverActualTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
+ AAIRestClientImpl client = new AAIRestClientImpl();
+ List<Pserver> list = client.getPhysicalServerByVnfId("d946afed-8ebe-4c5d-9665-54fcc043b8e7", UUID.randomUUID().toString());
+ assertEquals("", list.size(), 0);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java
index 2272f31685..cfa61c2799 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java
@@ -39,61 +39,61 @@ import org.onap.aai.domain.yang.Pserver;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.class)
public class AAIValidatorTest {
-
- @Mock
- protected AAIRestClient client;
- String vnfName = "testVnf";
- String uuid = "UUID";
- AAIValidatorImpl validator;
-
- @Before
- public void init(){
- validator = new AAIValidatorImpl();
- validator.setClient(client);
- }
-
- public List<Pserver> getPservers(boolean locked){
- Pserver pserver = new Pserver();
- pserver.setInMaint(locked);
- List<Pserver> pservers = new ArrayList<Pserver>();
- pservers.add(pserver);
- return pservers;
- }
-
- public GenericVnf createGenericVnfs(boolean locked){
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setInMaint(locked);
-
- return genericVnf;
- }
- @Test
- public void test_IsPhysicalServerLocked_True() throws IOException{
- when(client.getPhysicalServerByVnfId(vnfName,uuid)).thenReturn(getPservers(true));
- boolean locked = validator.isPhysicalServerLocked(vnfName, uuid);
- assertEquals(true, locked);
- }
-
- @Test
- public void test_IsPhysicalServerLocked_False() throws JsonParseException, JsonMappingException, UnsupportedEncodingException, IOException {
- when(client.getPhysicalServerByVnfId(vnfName,uuid)).thenReturn(getPservers(false));
- boolean locked = validator.isPhysicalServerLocked(vnfName, uuid);
- assertEquals(false, locked);
- }
-
- @Test
- public void test_IsVNFLocked_False() throws Exception{
- when(client.getVnfByName(vnfName,uuid)).thenReturn(createGenericVnfs(false));
- boolean locked = validator.isVNFLocked(vnfName, uuid);
- assertEquals(false, locked);
- }
+ @Mock
+ protected AAIRestClient client;
+ String vnfName = "testVnf";
+ String uuid = "UUID";
+ AAIValidatorImpl validator;
- @Test
- public void test_IsVNFLocked_True() throws Exception{
- when(client.getVnfByName(vnfName,uuid)).thenReturn(createGenericVnfs(true));
- boolean locked = validator.isVNFLocked(vnfName, uuid);
- assertEquals(true,locked );
- }
+ @Before
+ public void init() {
+ validator = new AAIValidatorImpl();
+ validator.setClient(client);
+ }
+
+ public List<Pserver> getPservers(boolean locked) {
+ Pserver pserver = new Pserver();
+ pserver.setInMaint(locked);
+ List<Pserver> pservers = new ArrayList<Pserver>();
+ pservers.add(pserver);
+ return pservers;
+ }
+
+ public GenericVnf createGenericVnfs(boolean locked) {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setInMaint(locked);
+
+ return genericVnf;
+ }
+
+ @Test
+ public void test_IsPhysicalServerLocked_True() throws IOException {
+ when(client.getPhysicalServerByVnfId(vnfName, uuid)).thenReturn(getPservers(true));
+ boolean locked = validator.isPhysicalServerLocked(vnfName, uuid);
+ assertEquals(true, locked);
+ }
+
+ @Test
+ public void test_IsPhysicalServerLocked_False() throws JsonParseException, JsonMappingException, UnsupportedEncodingException, IOException {
+ when(client.getPhysicalServerByVnfId(vnfName, uuid)).thenReturn(getPservers(false));
+ boolean locked = validator.isPhysicalServerLocked(vnfName, uuid);
+ assertEquals(false, locked);
+ }
+
+ @Test
+ public void test_IsVNFLocked_False() throws Exception {
+ when(client.getVnfByName(vnfName, uuid)).thenReturn(createGenericVnfs(false));
+ boolean locked = validator.isVNFLocked(vnfName, uuid);
+ assertEquals(false, locked);
+ }
+
+ @Test
+ public void test_IsVNFLocked_True() throws Exception {
+ when(client.getVnfByName(vnfName, uuid)).thenReturn(createGenericVnfs(true));
+ boolean locked = validator.isVNFLocked(vnfName, uuid);
+ assertEquals(true, locked);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java
index 09c2ab5c30..c20e54c9a5 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java
@@ -30,12 +30,12 @@ import com.openpojo.validation.test.impl.SetterTester;
public class EntitiesTest {
- private String packageName = "org.openecomp.mso.client.aai.entities";
+ private String packageName = "org.openecomp.mso.client.aai.entities";
- @Test
- public void validate() {
- Validator validator = ValidatorBuilder.create().with(new SetterMustExistRule(), new GetterMustExistRule())
- .with(new SetterTester(), new GetterTester()).build();
- validator.validate(packageName);
- }
+ @Test
+ public void validate() {
+ Validator validator = ValidatorBuilder.create().with(new SetterMustExistRule(), new GetterMustExistRule())
+ .with(new SetterTester(), new GetterTester()).build();
+ validator.validate(packageName);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java
index 2b082f1b8d..071b5845c8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java
@@ -38,61 +38,61 @@ import org.openecomp.appc.client.lcm.model.Status;
public class ApplicationControllerClientTest {
- private static ApplicationControllerClient client;
- private static ApplicationControllerSupport support;
+ private static ApplicationControllerClient client;
+ private static ApplicationControllerSupport support;
- @BeforeClass
- public static void beforeClass() {
- client = new ApplicationControllerClient();
- support = new ApplicationControllerSupport();
- client.appCSupport = support;
- System.setProperty("mso.config.path", "src/test/resources");
+ @BeforeClass
+ public static void beforeClass() {
+ client = new ApplicationControllerClient();
+ support = new ApplicationControllerSupport();
+ client.appCSupport = support;
+ System.setProperty("mso.config.path", "src/test/resources");
- }
+ }
- @AfterClass
- public static void afterClass() throws Exception {
- client.shutdownclient();
- }
+ @AfterClass
+ public static void afterClass() throws Exception {
+ client.shutdownclient();
+ }
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void createRequest_CheckLock_RequestBuilt() throws Exception {
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ public void createRequest_CheckLock_RequestBuilt() throws Exception {
- org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
- "org.openecomp.appc.client.lcm.model");
- Flags flags = new Flags();
- ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
- actionIdentifiers.setVnfId("vnfId");
- CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers,
- flags, null, "requestId");
- assertEquals(checkLockInput.getAction().name(), "CheckLock");
- }
+ org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
+ "org.openecomp.appc.client.lcm.model");
+ Flags flags = new Flags();
+ ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
+ actionIdentifiers.setVnfId("vnfId");
+ CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers,
+ flags, null, "requestId");
+ assertEquals(checkLockInput.getAction().name(), "CheckLock");
+ }
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void runCommand_liveAppc() throws Exception {
- org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
- "org.openecomp.appc.client.lcm.model");
- Flags flags = new Flags();
- ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
- actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f");
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ public void runCommand_liveAppc() throws Exception {
+ org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
+ "org.openecomp.appc.client.lcm.model");
+ Flags flags = new Flags();
+ ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
+ actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f");
- // CheckLockInput checkLockInput = (CheckLockInput)
- // client.createRequest(Action.CheckLock,actionIdentifiers,flags,null,"requestId");
- Status status = client.runCommand(Action.Lock, actionIdentifiers, flags, null, UUID.randomUUID().toString());
- assertEquals("Status of run command is correct", status.getCode(), 306);
- }
+ // CheckLockInput checkLockInput = (CheckLockInput)
+ // client.createRequest(Action.CheckLock,actionIdentifiers,flags,null,"requestId");
+ Status status = client.runCommand(Action.Lock, actionIdentifiers, flags, null, UUID.randomUUID().toString());
+ assertEquals("Status of run command is correct", status.getCode(), 306);
+ }
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void runCommand_CheckLock_RequestBuilt() throws Exception {
- org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
- "org.openecomp.appc.client.lcm.model");
- Flags flags = new Flags();
- ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
- actionIdentifiers.setVnfId("fusion-vpp-vnf-001");
- Status status = client.runCommand(Action.CheckLock, actionIdentifiers, flags, null, "requestId");
- assertEquals("Status of run command is correct", status.getCode(), 400);
- }
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ public void runCommand_CheckLock_RequestBuilt() throws Exception {
+ org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
+ "org.openecomp.appc.client.lcm.model");
+ Flags flags = new Flags();
+ ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
+ actionIdentifiers.setVnfId("fusion-vpp-vnf-001");
+ Status status = client.runCommand(Action.CheckLock, actionIdentifiers, flags, null, "requestId");
+ assertEquals("Status of run command is correct", status.getCode(), 400);
+ }
}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java
index 58f1ae264d..861ea0a749 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java
@@ -46,6 +46,7 @@ import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
+
import org.junit.BeforeClass;
import org.junit.Test;
import org.openecomp.mso.bpmn.core.json.JsonUtils;
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java
index 506dba2552..80871db00d 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java
@@ -36,7 +36,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.core;
@@ -49,56 +49,56 @@ import org.junit.Test;
public class PropertyConfigurationTest {
- @Before
- public void beforeTest() throws IOException {
- Map<String, String> defaultProperties = PropertyConfigurationSetup.createBpmnProperties();
- defaultProperties.put("testValue", "testKey");
- PropertyConfigurationSetup.init(defaultProperties);
- }
-
- @Test
- public void testPropertyFileWatcher() throws InterruptedException, IOException {
- Assert.assertEquals(true, PropertyConfiguration.getInstance().isFileWatcherRunning());
- }
-
- @Test
- public void testPropertyLoading() throws IOException, InterruptedException {
- PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
- Map<String,String> props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
- Assert.assertNotNull(props);
- Assert.assertEquals("testValue", props.get("testKey"));
- }
-
- @Test
- public void testPropertyReload() throws IOException, InterruptedException {
- PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
- Map<String,String> properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
- Assert.assertNotNull(properties);
- Assert.assertEquals("testValue", properties.get("testKey"));
+ @Before
+ public void beforeTest() throws IOException {
+ Map<String, String> defaultProperties = PropertyConfigurationSetup.createBpmnProperties();
+ defaultProperties.put("testValue", "testKey");
+ PropertyConfigurationSetup.init(defaultProperties);
+ }
+
+ @Test
+ public void testPropertyFileWatcher() throws InterruptedException, IOException {
+ Assert.assertEquals(true, PropertyConfiguration.getInstance().isFileWatcherRunning());
+ }
+
+ @Test
+ public void testPropertyLoading() throws IOException, InterruptedException {
+ PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
+ Map<String, String> props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
+ Assert.assertNotNull(props);
+ Assert.assertEquals("testValue", props.get("testKey"));
+ }
+
+ @Test
+ public void testPropertyReload() throws IOException, InterruptedException {
+ PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
+ Map<String, String> properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
+ Assert.assertNotNull(properties);
+ Assert.assertEquals("testValue", properties.get("testKey"));
+
+ Map<String, String> newProperties = PropertyConfigurationSetup.createBpmnProperties();
+ newProperties.put("newKey", "newValue");
+ PropertyConfigurationSetup.addProperties(newProperties, 10000);
+
+ // Reload and check for the new value
+ properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
+ Assert.assertNotNull(properties);
+ Assert.assertEquals("newValue", properties.get("newKey"));
+ }
- Map<String, String> newProperties = PropertyConfigurationSetup.createBpmnProperties();
- newProperties.put("newKey", "newValue");
- PropertyConfigurationSetup.addProperties(newProperties, 10000);
+ @Test(expected = IllegalArgumentException.class)
+ public void testPropertyFileDoesNotExists_NotIntheList() throws IOException {
+ PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
+ propertyConfiguration.getProperties("badfile.properties");
+ Assert.fail("Expected IllegalArgumentException");
+ }
- // Reload and check for the new value
- properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
- Assert.assertNotNull(properties);
- Assert.assertEquals("newValue", properties.get("newKey"));
- }
-
- @Test(expected=IllegalArgumentException.class)
- public void testPropertyFileDoesNotExists_NotIntheList() throws IOException {
- PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
- propertyConfiguration.getProperties("badfile.properties");
- Assert.fail("Expected IllegalArgumentException");
- }
-
- @Test(expected=java.lang.UnsupportedOperationException.class)
- public void testPropertyModificationException() throws IOException {
- PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
- Map<String,String> props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
- Assert.assertNotNull(props);
- Assert.assertEquals("testValue", props.get("testKey"));
- props.put("newKey", "newvalue");
- }
+ @Test(expected = java.lang.UnsupportedOperationException.class)
+ public void testPropertyModificationException() throws IOException {
+ PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
+ Map<String, String> props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
+ Assert.assertNotNull(props);
+ Assert.assertEquals("testValue", props.get("testKey"));
+ props.put("newKey", "newvalue");
+ }
}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java
index 2d204c338a..17580c03a5 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java
@@ -43,222 +43,222 @@ import org.openecomp.mso.logger.MsoLogger;
*/
public class TestBaseTask {
- @Rule
- public ProcessEngineRule processEngineRule = new ProcessEngineRule();
-
- @Before
- public void beforeTest() throws Exception {
- CamundaDBSetup.configure();
- PropertyConfigurationSetup.init();
- }
-
- @Test
- @Deployment(resources={"BaseTaskTest.bpmn"})
- public void shouldInvokeService() {
- Map<String, Object> variables = new HashMap<>();
- variables.put("firstName", "Jane");
- variables.put("lastName", "Doe");
- variables.put("age", (Integer)25);
- variables.put("lastVisit", (Long)1438270117000L);
-
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- assertNotNull(runtimeService);
- processEngineRule.getTaskService();
- runtimeService.startProcessInstanceByKey("BaseTaskTest", variables);
- }
-
- /**
- * Unit test code for BaseTask.
- */
- public static class TestTask extends BaseTask {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private Expression existingString;
- private Expression nonExistingString;
- private Expression existingStringFromVar;
- private Expression nonExistingStringFromVar;
-
- private Expression existingInteger;
- private Expression nonExistingInteger;
- private Expression existingIntegerFromVar;
- private Expression nonExistingIntegerFromVar;
-
- private Expression existingLong;
- private Expression nonExistingLong;
- private Expression existingLongFromVar;
- private Expression nonExistingLongFromVar;
-
- private Expression existingOutputVar;
- private Expression nonExistingOutputVar;
- private Expression existingBadOutputVar;
-
- public void execute(DelegateExecution execution) throws Exception {
- msoLogger.debug("Started executing " + getClass().getSimpleName());
-
- /*********************************************************************/
- msoLogger.debug("Running String Field Tests");
- /*********************************************************************/
-
- String s = getStringField(existingString, execution, "existingString");
- Assert.assertEquals("Hello World", s);
-
- try {
- s = getStringField(nonExistingString, execution, "nonExistingString");
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- }
- }
-
- s = getOptionalStringField(existingString, execution, "existingString");
- Assert.assertEquals("Hello World", s);
-
- s = getOptionalStringField(nonExistingString, execution, "nonExistingString");
- Assert.assertEquals(null, s);
-
- /*********************************************************************/
- msoLogger.debug("Running String Expression Tests");
- /*********************************************************************/
-
- s = getStringField(existingStringFromVar, execution, "existingStringFromVar");
- Assert.assertEquals("Jane", s);
-
- try {
- s = getStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar");
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingStringFromVar");
- }
- }
-
- s = getOptionalStringField(existingStringFromVar, execution, "existingStringFromVar");
- Assert.assertEquals("Jane", s);
-
- s = getOptionalStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar");
- Assert.assertEquals(null, s);
-
- /*********************************************************************/
- msoLogger.debug("Running Integer Field Tests");
- /*********************************************************************/
-
- Integer i = getIntegerField(existingInteger, execution, "existingInteger");
- Assert.assertEquals((Integer)42, i);
-
- try {
- i = getIntegerField(nonExistingInteger, execution, "nonExistingInteger");
- Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
- }
- }
-
- i = getOptionalIntegerField(existingInteger, execution, "existingInteger");
- Assert.assertEquals((Integer)42, i);
-
- i = getOptionalIntegerField(nonExistingInteger, execution, "nonExistingInteger");
- Assert.assertEquals(null, i);
-
- /*********************************************************************/
- msoLogger.debug("Running Integer Expression Tests");
- /*********************************************************************/
-
- i = getIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar");
- Assert.assertEquals((Integer)25, i);
-
- try {
- i = getIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar");
- Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingIntegerFromVar");
- }
- }
-
- i = getOptionalIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar");
- Assert.assertEquals((Integer)25, i);
-
- i = getOptionalIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar");
- Assert.assertEquals(null, i);
-
- /*********************************************************************/
- msoLogger.debug("Running Long Field Tests");
- /*********************************************************************/
-
- Long l = getLongField(existingLong, execution, "existingLong");
- Assert.assertEquals((Long)123456789L, l);
-
- try {
- l = getLongField(nonExistingLong, execution, "nonExistingLong");
- Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
- }
- }
-
- l = getOptionalLongField(existingLong, execution, "existingLong");
- Assert.assertEquals((Long)123456789L, l);
-
- l = getOptionalLongField(nonExistingLong, execution, "nonExistingLong");
- Assert.assertEquals(null, l);
-
- /*********************************************************************/
- msoLogger.debug("Running Long Expression Tests");
- /*********************************************************************/
-
- l = getLongField(existingLongFromVar, execution, "existingLongFromVar");
- Assert.assertEquals((Long)1438270117000L, l);
-
- try {
- l = getLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar");
- Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingLongFromVar");
- }
- }
-
- l = getOptionalLongField(existingLongFromVar, execution, "existingLongFromVar");
- Assert.assertEquals((Long)1438270117000L, l);
-
- l = getOptionalLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar");
- Assert.assertEquals(null, i);
-
- /*********************************************************************/
- msoLogger.debug("Running Output Variable Field Tests");
- /*********************************************************************/
-
- String var = getOutputField(existingOutputVar, execution, "existingOutputVar");
- Assert.assertEquals("goodVariable", var);
-
- try {
- var = getOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar");
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- }
- }
-
- var = getOptionalOutputField(existingOutputVar, execution, "existingOutputVar");
- Assert.assertEquals("goodVariable", var);
-
- var = getOptionalOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar");
- Assert.assertEquals(null, var);
-
- try {
- var = getOutputField(existingBadOutputVar, execution, "existingBadOutputVar");
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- }
- }
-
- msoLogger.debug("Finished executing " + getClass().getSimpleName());
- }
- }
+ @Rule
+ public ProcessEngineRule processEngineRule = new ProcessEngineRule();
+
+ @Before
+ public void beforeTest() throws Exception {
+ CamundaDBSetup.configure();
+ PropertyConfigurationSetup.init();
+ }
+
+ @Test
+ @Deployment(resources = {"BaseTaskTest.bpmn"})
+ public void shouldInvokeService() {
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("firstName", "Jane");
+ variables.put("lastName", "Doe");
+ variables.put("age", (Integer) 25);
+ variables.put("lastVisit", (Long) 1438270117000L);
+
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ assertNotNull(runtimeService);
+ processEngineRule.getTaskService();
+ runtimeService.startProcessInstanceByKey("BaseTaskTest", variables);
+ }
+
+ /**
+ * Unit test code for BaseTask.
+ */
+ public static class TestTask extends BaseTask {
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private Expression existingString;
+ private Expression nonExistingString;
+ private Expression existingStringFromVar;
+ private Expression nonExistingStringFromVar;
+
+ private Expression existingInteger;
+ private Expression nonExistingInteger;
+ private Expression existingIntegerFromVar;
+ private Expression nonExistingIntegerFromVar;
+
+ private Expression existingLong;
+ private Expression nonExistingLong;
+ private Expression existingLongFromVar;
+ private Expression nonExistingLongFromVar;
+
+ private Expression existingOutputVar;
+ private Expression nonExistingOutputVar;
+ private Expression existingBadOutputVar;
+
+ public void execute(DelegateExecution execution) throws Exception {
+ msoLogger.debug("Started executing " + getClass().getSimpleName());
+
+ /*********************************************************************/
+ msoLogger.debug("Running String Field Tests");
+ /*********************************************************************/
+
+ String s = getStringField(existingString, execution, "existingString");
+ Assert.assertEquals("Hello World", s);
+
+ try {
+ s = getStringField(nonExistingString, execution, "nonExistingString");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ }
+ }
+
+ s = getOptionalStringField(existingString, execution, "existingString");
+ Assert.assertEquals("Hello World", s);
+
+ s = getOptionalStringField(nonExistingString, execution, "nonExistingString");
+ Assert.assertEquals(null, s);
+
+ /*********************************************************************/
+ msoLogger.debug("Running String Expression Tests");
+ /*********************************************************************/
+
+ s = getStringField(existingStringFromVar, execution, "existingStringFromVar");
+ Assert.assertEquals("Jane", s);
+
+ try {
+ s = getStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingStringFromVar");
+ }
+ }
+
+ s = getOptionalStringField(existingStringFromVar, execution, "existingStringFromVar");
+ Assert.assertEquals("Jane", s);
+
+ s = getOptionalStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar");
+ Assert.assertEquals(null, s);
+
+ /*********************************************************************/
+ msoLogger.debug("Running Integer Field Tests");
+ /*********************************************************************/
+
+ Integer i = getIntegerField(existingInteger, execution, "existingInteger");
+ Assert.assertEquals((Integer) 42, i);
+
+ try {
+ i = getIntegerField(nonExistingInteger, execution, "nonExistingInteger");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
+ }
+ }
+
+ i = getOptionalIntegerField(existingInteger, execution, "existingInteger");
+ Assert.assertEquals((Integer) 42, i);
+
+ i = getOptionalIntegerField(nonExistingInteger, execution, "nonExistingInteger");
+ Assert.assertEquals(null, i);
+
+ /*********************************************************************/
+ msoLogger.debug("Running Integer Expression Tests");
+ /*********************************************************************/
+
+ i = getIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar");
+ Assert.assertEquals((Integer) 25, i);
+
+ try {
+ i = getIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingIntegerFromVar");
+ }
+ }
+
+ i = getOptionalIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar");
+ Assert.assertEquals((Integer) 25, i);
+
+ i = getOptionalIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar");
+ Assert.assertEquals(null, i);
+
+ /*********************************************************************/
+ msoLogger.debug("Running Long Field Tests");
+ /*********************************************************************/
+
+ Long l = getLongField(existingLong, execution, "existingLong");
+ Assert.assertEquals((Long) 123456789L, l);
+
+ try {
+ l = getLongField(nonExistingLong, execution, "nonExistingLong");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
+ }
+ }
+
+ l = getOptionalLongField(existingLong, execution, "existingLong");
+ Assert.assertEquals((Long) 123456789L, l);
+
+ l = getOptionalLongField(nonExistingLong, execution, "nonExistingLong");
+ Assert.assertEquals(null, l);
+
+ /*********************************************************************/
+ msoLogger.debug("Running Long Expression Tests");
+ /*********************************************************************/
+
+ l = getLongField(existingLongFromVar, execution, "existingLongFromVar");
+ Assert.assertEquals((Long) 1438270117000L, l);
+
+ try {
+ l = getLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingLongFromVar");
+ }
+ }
+
+ l = getOptionalLongField(existingLongFromVar, execution, "existingLongFromVar");
+ Assert.assertEquals((Long) 1438270117000L, l);
+
+ l = getOptionalLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar");
+ Assert.assertEquals(null, i);
+
+ /*********************************************************************/
+ msoLogger.debug("Running Output Variable Field Tests");
+ /*********************************************************************/
+
+ String var = getOutputField(existingOutputVar, execution, "existingOutputVar");
+ Assert.assertEquals("goodVariable", var);
+
+ try {
+ var = getOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ }
+ }
+
+ var = getOptionalOutputField(existingOutputVar, execution, "existingOutputVar");
+ Assert.assertEquals("goodVariable", var);
+
+ var = getOptionalOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar");
+ Assert.assertEquals(null, var);
+
+ try {
+ var = getOutputField(existingBadOutputVar, execution, "existingBadOutputVar");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ }
+ }
+
+ msoLogger.debug("Finished executing " + getClass().getSimpleName());
+ }
+ }
}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java
index 57f479f7cb..edaf45848f 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java
@@ -23,6 +23,7 @@ package org.openecomp.mso.bpmn.core.internal;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Optional;
+
import org.junit.Test;
public class VariableNameExtractorTest {
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java
index f29ccc75e0..0fb15f93b9 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java
@@ -31,84 +31,84 @@ import org.openecomp.mso.logger.MsoLogger;
* Sets up the unit test (H2) database for Camunda.
*/
public class CamundaDBSetup {
- private static boolean isDBConfigured = false;
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private CamundaDBSetup() {
- }
-
- public static synchronized void configure() throws SQLException {
- if (isDBConfigured) {
- return;
- }
-
- LOGGER.debug ("Configuring the Camunda H2 database for MSO");
-
- Connection connection = null;
- PreparedStatement stmt = null;
-
- try {
- connection = DriverManager.getConnection(
- "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", "");
-
- stmt = connection.prepareStatement("delete from ACT_HI_VARINST");
- stmt.executeUpdate();
- stmt.close();
- stmt = null;
-
- stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob");
- stmt.executeUpdate();
- stmt.close();
- stmt = null;
-
+ private static boolean isDBConfigured = false;
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private CamundaDBSetup() {
+ }
+
+ public static synchronized void configure() throws SQLException {
+ if (isDBConfigured) {
+ return;
+ }
+
+ LOGGER.debug("Configuring the Camunda H2 database for MSO");
+
+ Connection connection = null;
+ PreparedStatement stmt = null;
+
+ try {
+ connection = DriverManager.getConnection(
+ "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", "");
+
+ stmt = connection.prepareStatement("delete from ACT_HI_VARINST");
+ stmt.executeUpdate();
+ stmt.close();
+ stmt = null;
+
+ stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob");
+ stmt.executeUpdate();
+ stmt.close();
+ stmt = null;
+
// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob");
// stmt.executeUpdate();
// stmt.close();
// stmt = null;
- stmt = connection.prepareStatement("delete from ACT_HI_DETAIL");
- stmt.executeUpdate();
- stmt.close();
- stmt = null;
+ stmt = connection.prepareStatement("delete from ACT_HI_DETAIL");
+ stmt.executeUpdate();
+ stmt.close();
+ stmt = null;
- stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob");
- stmt.executeUpdate();
- stmt.close();
- stmt = null;
+ stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob");
+ stmt.executeUpdate();
+ stmt.close();
+ stmt = null;
// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob");
// stmt.executeUpdate();
// stmt.close();
// stmt = null;
- stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob");
- stmt.executeUpdate();
- stmt.close();
- stmt = null;
-
- connection.close();
- connection = null;
-
- isDBConfigured = true;
- } catch (SQLException e) {
- LOGGER.debug ("CamundaDBSetup caught " + e.getClass().getSimpleName());
- LOGGER.debug("SQLException :",e);
- } finally {
- if (stmt != null) {
- try {
- stmt.close();
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- }
- }
-
- if (connection != null) {
- try {
- connection.close();
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- }
- }
- }
- }
+ stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob");
+ stmt.executeUpdate();
+ stmt.close();
+ stmt = null;
+
+ connection.close();
+ connection = null;
+
+ isDBConfigured = true;
+ } catch (SQLException e) {
+ LOGGER.debug("CamundaDBSetup caught " + e.getClass().getSimpleName());
+ LOGGER.debug("SQLException :", e);
+ } finally {
+ if (stmt != null) {
+ try {
+ stmt.close();
+ } catch (Exception e) {
+ LOGGER.debug("Exception :", e);
+ }
+ }
+
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ LOGGER.debug("Exception :", e);
+ }
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java
index 549664588e..314f8e9075 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java
@@ -49,81 +49,81 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
*/
public class CreateGenericALaCarteServiceInstanceTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- public CreateGenericALaCarteServiceInstanceTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCSITopologyAssignCallback.xml"));
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
- @Test
- @Deployment(resources = {
- "process/CreateGenericALaCarteServiceInstance.bpmn",
- "subprocess/DoCreateServiceInstance.bpmn",
- "subprocess/DoCreateServiceInstanceRollback.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericPutService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn" })
- public void sunnyDayAlaCarte() throws Exception {
-
- logStart();
-
- //AAI
- MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml");
- MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", "");
- MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", "GenericFlows/getServiceInstance.xml");
- MockNodeQueryServiceInstanceByName("RAATest-1", null);
- MockNodeQueryServiceInstanceById("RaaTest-1-id", null);
- //SDNC
- mockSDNCAdapter(200);
- //DB
- mockUpdateRequestDB(200, "DBUpdateResponse.xml");
-
-
- String businessKey = UUID.randomUUID().toString();
-
- //String createVfModuleRequest = FileUtil.readResourceFile("__files/SIRequest.json");
-
- Map<String, String> variables = setupVariables();
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateGenericALaCarteServiceInstance", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowResponse");
- //assertNotNull(workflowResp);
- System.out.println("Workflow (Synch) Response:\n" + workflowResp);
- String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowException");
- String completionReq = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "completionRequest");
- System.out.println("completionReq:\n" + completionReq);
- System.out.println("workflowException:\n" + workflowException);
- assertNotNull(completionReq);
- assertEquals(null, workflowException);
-
-
- //injectSDNCCallbacks(callbacks, "assign");
-
- logEnd();
- }
-
- // Success Scenario
- private Map<String, String> setupVariables() {
- Map<String, String> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", getRequest());
- variables.put("mso-request-id", "RaaCSIRequestId-1");
- variables.put("serviceInstanceId","RaaTest-1-id");
- return variables;
- }
-
- public String getRequest() {
- String request = "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"MCBH-1610\",\"subscriberName\":\"Kaneohe\"},\"requestInfo\":{\"instanceName\":\"RAATest-1\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"viprsvc\",\"aLaCarte\":\"false\",\"userParams\":[]}}}";
- return request;
- }
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public CreateGenericALaCarteServiceInstanceTest() throws IOException {
+ callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCSITopologyAssignCallback.xml"));
+ }
+
+ /**
+ * Sunny day VID scenario.
+ *
+ * @throws Exception
+ */
+ //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
+ @Test
+ @Deployment(resources = {
+ "process/CreateGenericALaCarteServiceInstance.bpmn",
+ "subprocess/DoCreateServiceInstance.bpmn",
+ "subprocess/DoCreateServiceInstanceRollback.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericPutService.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"})
+ public void sunnyDayAlaCarte() throws Exception {
+
+ logStart();
+
+ //AAI
+ MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml");
+ MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", "");
+ MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", "GenericFlows/getServiceInstance.xml");
+ MockNodeQueryServiceInstanceByName("RAATest-1", null);
+ MockNodeQueryServiceInstanceById("RaaTest-1-id", null);
+ //SDNC
+ mockSDNCAdapter(200);
+ //DB
+ mockUpdateRequestDB(200, "DBUpdateResponse.xml");
+
+
+ String businessKey = UUID.randomUUID().toString();
+
+ //String createVfModuleRequest = FileUtil.readResourceFile("__files/SIRequest.json");
+
+ Map<String, String> variables = setupVariables();
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateGenericALaCarteServiceInstance", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowResponse");
+ //assertNotNull(workflowResp);
+ System.out.println("Workflow (Synch) Response:\n" + workflowResp);
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowException");
+ String completionReq = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "completionRequest");
+ System.out.println("completionReq:\n" + completionReq);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNotNull(completionReq);
+ assertEquals(null, workflowException);
+
+
+ //injectSDNCCallbacks(callbacks, "assign");
+
+ logEnd();
+ }
+
+ // Success Scenario
+ private Map<String, String> setupVariables() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("bpmnRequest", getRequest());
+ variables.put("mso-request-id", "RaaCSIRequestId-1");
+ variables.put("serviceInstanceId", "RaaTest-1-id");
+ return variables;
+ }
+
+ public String getRequest() {
+ String request = "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"MCBH-1610\",\"subscriberName\":\"Kaneohe\"},\"requestInfo\":{\"instanceName\":\"RAATest-1\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"viprsvc\",\"aLaCarte\":\"false\",\"userParams\":[]}}}";
+ return request;
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java
index b95ebb5fc7..32ed557b9b 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java
@@ -27,6 +27,7 @@ import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetwork
// new mock methods
import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapterTopology;
import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter_500;
+
import org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer;
import static org.openecomp.mso.bpmn.common.BPMNUtil.executeAsyncWorkflow;
@@ -49,617 +50,616 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
/**
* Unit test cases for CreateNetworkInstance.bpmn
- *
*/
public class CreateNetworkInstanceTest extends WorkflowTest {
- @WorkflowTestTransformer
- public static final ResponseTransformer sdncAdapterMockTransformer =
- new SDNCAdapterNetworkTopologyMockTransformer();
-
- @Rule
- public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- new SDNCAdapterCallbackRule(processEngineRule);
-
- /**
- * End-to-End flow - Unit test for CreateNetworkInstance.bpmn
- * - String input & String response
- */
-
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success1() throws Exception {
-
- System.out.println("-----------------------------------------------------------------");
- System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Started! ");
- System.out.println("-----------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
- MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
- MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariables1();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- System.out.println("----------------------------------------------------------");
- System.out.println("- got workflow response -");
- System.out.println("----------------------------------------------------------");
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success2() throws Exception {
-
- System.out.println("----------------------------------------------------------------");
- System.out.println(" Success viPER 2 - CreateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
- MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
- MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariables2();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
-
- String completeMsoProcessRequest =
- "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
- + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
- + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
- + " <request-info>" + '\n'
- + " <request-id>testRequestId</request-id>" + '\n'
- + " <action>CREATE</action>" + '\n'
- + " <source>VID</source>" + '\n'
- + " </request-info>" + '\n'
- + " <aetgt:status-message>Network has been created successfully.</aetgt:status-message>" + '\n'
- + " <aetgt:mso-bpel-name>BPMN Network action: CREATE</aetgt:mso-bpel-name>" + '\n'
- + "</aetgt:MsoCompletionRequest>";
-
- Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
-
- System.out.println("---------------------------------------------------------");
- System.out.println(" Success viPER 2 - CreateNetworkInstance flow Completed ");
- System.out.println("---------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_VID_1610_Network_SDNC_Rollback() throws Exception {
-
- System.out.println("--------------------------------------------------------------------------");
- System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! ");
- System.out.println("--------------------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>rollback");
- MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
- MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
- MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml","49c86598-f766-46f8-84f8-8d1c1b10f9b4");
-
- Map<String, String> variables = setupVariablesVID1();
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
-
- System.out.println("--------------------------------------------------------------------");
- System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed ");
- System.out.println("--------------------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_vIPER_1702_Network_SDNC_Rollback() throws Exception {
-
- System.out.println("--------------------------------------------------------------------------");
- System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! ");
- System.out.println("--------------------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>unassign");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>deactivate");
- MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
- MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
- MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml","49c86598-f766-46f8-84f8-8d1c1b10f9b4");
-
- Map<String, String> variables = setupVariables1();
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
-
- System.out.println("--------------------------------------------------------------------");
- System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed ");
- System.out.println("--------------------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_sdncFailure() throws Exception {
-
- System.out.println("----------------------------------------------------------------");
- System.out.println(" SNDC Failure - CreateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapter_500("SvcAction>query");
- MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariables2();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
-
- System.out.println("---------------------------------------------------------");
- System.out.println(" SNDC Failure - CreateNetworkInstance flow Completed ");
- System.out.println("---------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_queryServiceInstance404() throws Exception {
-
- System.out.println("----------------------------------------------------------------------------------");
- System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------------------------------");
-
- //setup simulators
- mockSDNCAdapter_500("SvcAction>query");
- MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- MockNodeQueryServiceInstanceById_404("f70e927b-6087-4974-9ef8-c5e4d5847ca4");
-
- Map<String, String> variables = setupVariables2();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
-
- System.out.println("---------------------------------------------------------------------------------");
- System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Completed ");
- System.out.println("---------------------------------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_VID_Success1() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID1 - CreateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign");
- MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
- MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariablesVID1();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- System.out.println("----------------------------------------------------------");
- System.out.println("- got workflow response -");
- System.out.println("----------------------------------------------------------");
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
-
- System.out.println("-----------------------------------------------------------");
- System.out.println(" Success VID1 - CreateNetworkInstanceInfra flow Completed ");
- System.out.println("-----------------------------------------------------------");
-
- }
-
- // *****************
- // Utility Section
- // *****************
-
- String networkModelInfo =
- " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' +
- " \"modelName\": \"mod_inst_z_123\", " + '\n' +
- " \"modelVersion\": \"mod-inst-uuid-123\", " + '\n' +
- " \"modelCustomizationUuid\": \"z_network_123\", " + '\n' +
- " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' +
- " }";
-
- String serviceModelInfo =
- " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' +
- " \"modelName\": \"HNGW Protected OAM\", " + '\n' +
- " \"modelVersion\": \"1.0\", " + '\n' +
- " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' +
- " }";
-
- // Success Scenario
- private Map<String, String> setupVariables1() {
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "networkId");
- variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // macro
- variables.put("failIfExists", "false");
- variables.put("sdncVersion", "1702");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("globalSubscriberId", "globalId_45678905678");
- variables.put("networkModelInfo", networkModelInfo);
- variables.put("serviceModelInfo", serviceModelInfo);
-
-
- return variables;
-
- }
-
- // Success Scenario 2
- private Map<String, String> setupVariables2() {
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "networkId");
- variables.put("networkName", "myOwn_Network"); // Name Not found in AA&I
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // 1702
- variables.put("failIfExists", "false");
- //variables.put("sdncVersion", "1702");
- variables.put("sdncVersion", "1707");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("globalSubscriberId", "globalId_45678905678");
- variables.put("networkModelInfo", networkModelInfo);
- variables.put("serviceModelInfo", serviceModelInfo);
-
- return variables;
-
- }
-
- // Active Scenario
- private Map<String, String> setupVariablesActive() {
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "networkId");
- variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Unique name for Active
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("suppressRollback", "false");
- variables.put("disableRollback", "false");
- variables.put("failIfExists", "false");
- variables.put("sdncVersion", "1702");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("globalSubscriberId", "globalId_45678905678");
- variables.put("networkModelInfo", networkModelInfo);
- variables.put("serviceModelInfo", serviceModelInfo);
-
- return variables;
-
- }
-
- // Missing Name Scenario
- private Map<String, String> setupVariablesMissingName() {
- Map<String, String> variables = new HashMap<>();
- //variables.put("bpmnRequest", getCreateNetworkRequestMissingName());
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "networkId");
- // variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Missing 'name' variable
- // variables.put("networkName", ""); // Missing 'value' of name variable
- variables.put("modelName", "CONTRAIL_EXTERNAL");
- variables.put("cloudConfiguration", "RDM2WAGPLCP");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("suppressRollback", "true");
- variables.put("failIfExists", "false");
-
- return variables;
-
- }
-
- // SDNC Rollback Scenario
- private Map<String, String> setupVariablesSDNCRollback() {
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "networkId");
- variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_3"); // Unique name for Rollback
- variables.put("modelName", "CONTRAIL_EXTERNAL");
- variables.put("cloudConfiguration", "RDM2WAGPLCP");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("suppressRollback", "true");
- variables.put("disableRollback", "false");
-
- return variables;
-
- }
-
- // old
- public String getCreateNetworkRequestActive() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelCustomizationUuid\": \"modelCustUuid\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_2\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"false\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
- return request;
-
- }
-
- public String getCreateNetworkRequestSDNCRollback() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"true\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
-
- return request;
- }
-
-
- // VID json input
- private Map<String, String> setupVariablesVID1() {
- Map<String, String> variables = new HashMap<>();
- variables.put("bpmnRequest", getCreateNetworkRequestVID1());
- variables.put("mso-request-id", "testRequestId");
- //variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "CREATE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- //variables.put("networkId", "networkId");
- variables.put("serviceType", "vMOG");
- variables.put("vfModuleType", "");
- variables.put("networkType", "modelName");
-
- return variables;
-
- }
-
- public String getCreateNetworkRequestVID1() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1.0\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"false\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": false, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
- return request;
- }
+ @WorkflowTestTransformer
+ public static final ResponseTransformer sdncAdapterMockTransformer =
+ new SDNCAdapterNetworkTopologyMockTransformer();
+
+ @Rule
+ public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
+ new SDNCAdapterCallbackRule(processEngineRule);
+
+ /**
+ * End-to-End flow - Unit test for CreateNetworkInstance.bpmn
+ * - String input & String response
+ */
+
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstanceRollback.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success1() throws Exception {
+
+ System.out.println("-----------------------------------------------------------------");
+ System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Started! ");
+ System.out.println("-----------------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
+ MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
+ MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
+ MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
+ MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
+ MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
+ MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
+ MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
+ MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
+ MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
+ MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
+
+ Map<String, String> variables = setupVariables1();
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ System.out.println("----------------------------------------------------------");
+ System.out.println("- got workflow response -");
+ System.out.println("----------------------------------------------------------");
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
+ assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
+ Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse");
+ Assert.assertNotNull(workflowResp);
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Completed ");
+ System.out.println("----------------------------------------------------------");
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstanceRollback.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success2() throws Exception {
+
+ System.out.println("----------------------------------------------------------------");
+ System.out.println(" Success viPER 2 - CreateNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
+ MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
+ MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network");
+ MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
+ MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
+ MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
+ MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
+ MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
+ MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
+ MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
+ MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
+
+ Map<String, String> variables = setupVariables2();
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
+ assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
+ Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
+
+ String completeMsoProcessRequest =
+ "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
+ + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
+ + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
+ + " <request-info>" + '\n'
+ + " <request-id>testRequestId</request-id>" + '\n'
+ + " <action>CREATE</action>" + '\n'
+ + " <source>VID</source>" + '\n'
+ + " </request-info>" + '\n'
+ + " <aetgt:status-message>Network has been created successfully.</aetgt:status-message>" + '\n'
+ + " <aetgt:mso-bpel-name>BPMN Network action: CREATE</aetgt:mso-bpel-name>" + '\n'
+ + "</aetgt:MsoCompletionRequest>";
+
+ Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
+
+ System.out.println("---------------------------------------------------------");
+ System.out.println(" Success viPER 2 - CreateNetworkInstance flow Completed ");
+ System.out.println("---------------------------------------------------------");
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstanceRollback.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceCreateNetworkInstance_VID_1610_Network_SDNC_Rollback() throws Exception {
+
+ System.out.println("--------------------------------------------------------------------------");
+ System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! ");
+ System.out.println("--------------------------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign");
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>rollback");
+ MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
+ MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
+ MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
+ MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
+ MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
+ MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
+ MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
+ MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
+ MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
+ MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
+
+ Map<String, String> variables = setupVariablesVID1();
+ executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
+ assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
+ Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
+
+ System.out.println("--------------------------------------------------------------------");
+ System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed ");
+ System.out.println("--------------------------------------------------------------------");
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstanceRollback.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceCreateNetworkInstance_vIPER_1702_Network_SDNC_Rollback() throws Exception {
+
+ System.out.println("--------------------------------------------------------------------------");
+ System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! ");
+ System.out.println("--------------------------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>unassign");
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>deactivate");
+ MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
+ MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
+ MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
+ MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
+ MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
+ MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
+ MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
+ MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
+ MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
+ MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
+
+ Map<String, String> variables = setupVariables1();
+ executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
+ assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
+ Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
+
+ System.out.println("--------------------------------------------------------------------");
+ System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed ");
+ System.out.println("--------------------------------------------------------------------");
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstanceRollback.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceCreateNetworkInstance_sdncFailure() throws Exception {
+
+ System.out.println("----------------------------------------------------------------");
+ System.out.println(" SNDC Failure - CreateNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapter_500("SvcAction>query");
+ MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network");
+ MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
+ MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
+
+ Map<String, String> variables = setupVariables2();
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
+ assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
+ Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
+
+ System.out.println("---------------------------------------------------------");
+ System.out.println(" SNDC Failure - CreateNetworkInstance flow Completed ");
+ System.out.println("---------------------------------------------------------");
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstanceRollback.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceCreateNetworkInstance_queryServiceInstance404() throws Exception {
+
+ System.out.println("----------------------------------------------------------------------------------");
+ System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------------------------------");
+
+ //setup simulators
+ mockSDNCAdapter_500("SvcAction>query");
+ MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network");
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ MockNodeQueryServiceInstanceById_404("f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+
+ Map<String, String> variables = setupVariables2();
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
+ assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
+ Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
+
+ System.out.println("---------------------------------------------------------------------------------");
+ System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Completed ");
+ System.out.println("---------------------------------------------------------------------------------");
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstance.bpmn",
+ "subprocess/DoCreateNetworkInstanceRollback.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceCreateNetworkInstance_VID_Success1() throws Exception {
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success VID1 - CreateNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign");
+ MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
+ MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
+ MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
+ MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
+ MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
+ MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
+ MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
+ MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
+ MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
+ MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
+
+ Map<String, String> variables = setupVariablesVID1();
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
+ System.out.println("----------------------------------------------------------");
+ System.out.println("- got workflow response -");
+ System.out.println("----------------------------------------------------------");
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
+ Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse");
+ Assert.assertNotNull(workflowResp);
+
+ System.out.println("-----------------------------------------------------------");
+ System.out.println(" Success VID1 - CreateNetworkInstanceInfra flow Completed ");
+ System.out.println("-----------------------------------------------------------");
+
+ }
+
+ // *****************
+ // Utility Section
+ // *****************
+
+ String networkModelInfo =
+ " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' +
+ " \"modelName\": \"mod_inst_z_123\", " + '\n' +
+ " \"modelVersion\": \"mod-inst-uuid-123\", " + '\n' +
+ " \"modelCustomizationUuid\": \"z_network_123\", " + '\n' +
+ " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' +
+ " }";
+
+ String serviceModelInfo =
+ " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' +
+ " \"modelName\": \"HNGW Protected OAM\", " + '\n' +
+ " \"modelVersion\": \"1.0\", " + '\n' +
+ " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' +
+ " }";
+
+ // Success Scenario
+ private Map<String, String> setupVariables1() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("networkId", "networkId");
+ variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1");
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("disableRollback", "false"); // macro
+ variables.put("failIfExists", "false");
+ variables.put("sdncVersion", "1702");
+ variables.put("subscriptionServiceType", "MSO-dev-service-type");
+ variables.put("globalSubscriberId", "globalId_45678905678");
+ variables.put("networkModelInfo", networkModelInfo);
+ variables.put("serviceModelInfo", serviceModelInfo);
+
+
+ return variables;
+
+ }
+
+ // Success Scenario 2
+ private Map<String, String> setupVariables2() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("networkId", "networkId");
+ variables.put("networkName", "myOwn_Network"); // Name Not found in AA&I
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("disableRollback", "false"); // 1702
+ variables.put("failIfExists", "false");
+ //variables.put("sdncVersion", "1702");
+ variables.put("sdncVersion", "1707");
+ variables.put("subscriptionServiceType", "MSO-dev-service-type");
+ variables.put("globalSubscriberId", "globalId_45678905678");
+ variables.put("networkModelInfo", networkModelInfo);
+ variables.put("serviceModelInfo", serviceModelInfo);
+
+ return variables;
+
+ }
+
+ // Active Scenario
+ private Map<String, String> setupVariablesActive() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("networkId", "networkId");
+ variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Unique name for Active
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("suppressRollback", "false");
+ variables.put("disableRollback", "false");
+ variables.put("failIfExists", "false");
+ variables.put("sdncVersion", "1702");
+ variables.put("subscriptionServiceType", "MSO-dev-service-type");
+ variables.put("globalSubscriberId", "globalId_45678905678");
+ variables.put("networkModelInfo", networkModelInfo);
+ variables.put("serviceModelInfo", serviceModelInfo);
+
+ return variables;
+
+ }
+
+ // Missing Name Scenario
+ private Map<String, String> setupVariablesMissingName() {
+ Map<String, String> variables = new HashMap<>();
+ //variables.put("bpmnRequest", getCreateNetworkRequestMissingName());
+ variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("networkId", "networkId");
+ // variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Missing 'name' variable
+ // variables.put("networkName", ""); // Missing 'value' of name variable
+ variables.put("modelName", "CONTRAIL_EXTERNAL");
+ variables.put("cloudConfiguration", "RDM2WAGPLCP");
+ variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("suppressRollback", "true");
+ variables.put("failIfExists", "false");
+
+ return variables;
+
+ }
+
+ // SDNC Rollback Scenario
+ private Map<String, String> setupVariablesSDNCRollback() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("networkId", "networkId");
+ variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_3"); // Unique name for Rollback
+ variables.put("modelName", "CONTRAIL_EXTERNAL");
+ variables.put("cloudConfiguration", "RDM2WAGPLCP");
+ variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("suppressRollback", "true");
+ variables.put("disableRollback", "false");
+
+ return variables;
+
+ }
+
+ // old
+ public String getCreateNetworkRequestActive() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelId\": \"modelId\", " + '\n' +
+ " \"modelCustomizationUuid\": \"modelCustUuid\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_2\", " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"callbackUrl\": \"\", " + '\n' +
+ " \"suppressRollback\": \"false\" ," + '\n' +
+ " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"userParams\": [] " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+
+ return request;
+
+ }
+
+ public String getCreateNetworkRequestSDNCRollback() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelId\": \"modelId\", " + '\n' +
+ " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"callbackUrl\": \"\", " + '\n' +
+ " \"suppressRollback\": \"true\" ," + '\n' +
+ " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"userParams\": [] " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+
+
+ return request;
+ }
+
+
+ // VID json input
+ private Map<String, String> setupVariablesVID1() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("bpmnRequest", getCreateNetworkRequestVID1());
+ variables.put("mso-request-id", "testRequestId");
+ //variables.put("msoRequestId", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "CREATE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "");
+ //variables.put("networkId", "networkId");
+ variables.put("serviceType", "vMOG");
+ variables.put("vfModuleType", "");
+ variables.put("networkType", "modelName");
+
+ return variables;
+
+ }
+
+ public String getCreateNetworkRequestVID1() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1.0\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"callbackUrl\": \"\", " + '\n' +
+ " \"suppressRollback\": \"false\" ," + '\n' +
+ " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"backoutOnFailure\": false, " + '\n' +
+ " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
+ " \"userParams\": [] " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+
+ return request;
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java
index a28e95ad0d..a4d92a9b5b 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -31,6 +31,7 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
+
import org.junit.Ignore;
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Test;
@@ -42,250 +43,250 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit test cases for CreateVfModuleInfra.bpmn
*/
public class CreateVfModuleInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public CreateVfModuleInfraTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfCreate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
- }
-
-
- /**
- * Sunny day VID scenario with preloads.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "process/CreateVfModuleInfra.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void sunnyDayVIDWithPreloads() throws Exception {
-
- logStart();
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleRequest =
- FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
- "v1", businessKey, createVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
-
- logEnd();
- }
-
- /**
- * Sunny day VID scenario with no preloads.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "process/CreateVfModuleInfra.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void sunnyDayVIDNoPreloads() throws Exception {
-
- logStart();
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleRequest =
- FileUtil.readResourceFile("__files/CreateVfModule_VID_request_noPreloads.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
- "v1", businessKey, createVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- //variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "CREATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
- /**
- * Sunny day VID with volume attach scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore
- @Deployment(resources = {
- "process/CreateVfModuleInfra.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
-
- public void sunnyDayVIDWithVolumeGroupAttach() throws Exception {
-
- logStart();
-
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleRequest =
- FileUtil.readResourceFile("__files/CreateVfModuleVolumeGroup_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVIDWVolumeAttach();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
- "v1", businessKey, createVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVIDWVolumeAttach() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "CREATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "78987");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
-
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public CreateVfModuleInfraTest() throws IOException {
+ callbacks.put("assign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfCreate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
+ }
+
+
+ /**
+ * Sunny day VID scenario with preloads.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Deployment(resources = {
+ "process/CreateVfModuleInfra.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericNotificationService.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ public void sunnyDayVIDWithPreloads() throws Exception {
+
+ logStart();
+
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ MockSDNCAdapterVfModule();
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleRequest =
+ FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
+ "v1", businessKey, createVfModuleRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectSDNCCallbacks(callbacks, "assign, query");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ /**
+ * Sunny day VID scenario with no preloads.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Deployment(resources = {
+ "process/CreateVfModuleInfra.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/GenericNotificationService.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ public void sunnyDayVIDNoPreloads() throws Exception {
+
+ logStart();
+
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ MockSDNCAdapterVfModule();
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleRequest =
+ FileUtil.readResourceFile("__files/CreateVfModule_VID_request_noPreloads.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
+ "v1", businessKey, createVfModuleRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectSDNCCallbacks(callbacks, "assign, query");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ //variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", false);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "CREATE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ return variables;
+
+ }
+
+ /**
+ * Sunny day VID with volume attach scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "process/CreateVfModuleInfra.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/GenericNotificationService.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+
+ public void sunnyDayVIDWithVolumeGroupAttach() throws Exception {
+
+ logStart();
+
+
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ MockSDNCAdapterVfModule();
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleRequest =
+ FileUtil.readResourceFile("__files/CreateVfModuleVolumeGroup_VID_request.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVIDWVolumeAttach();
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
+ "v1", businessKey, createVfModuleRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectSDNCCallbacks(callbacks, "assign, query");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVIDWVolumeAttach() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", false);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "CREATE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "78987");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ return variables;
+
+ }
+
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java
index 23999c99ad..a5f51a8a57 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -48,321 +48,321 @@ import org.openecomp.mso.bpmn.mock.StubResponseAAI;
public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest {
- public static final String _prefix = "CVFMODVOL2_";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public CreateVfModuleVolumeInfraV1Test() throws IOException {
- callbacks.put("volumeGroupCreate", FileUtil.readResourceFile(
- "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml"));
- callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
- callbacks.put("volumeGroupException", FileUtil.readResourceFile(
- "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml"));
- callbacks.put("volumeGroupRollback", FileUtil.readResourceFile(
- "__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml"));
- }
-
- /**
- * Happy path scenario for VID
- *****************************/
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV2.bpmn",
+ public static final String _prefix = "CVFMODVOL2_";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public CreateVfModuleVolumeInfraV1Test() throws IOException {
+ callbacks.put("volumeGroupCreate", FileUtil.readResourceFile(
+ "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml"));
+ callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
+ "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
+ callbacks.put("volumeGroupException", FileUtil.readResourceFile(
+ "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml"));
+ callbacks.put("volumeGroupRollback", FileUtil.readResourceFile(
+ "__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml"));
+ }
+
+ /**
+ * Happy path scenario for VID
+ *****************************/
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/VnfAdapterRestV1.bpmn"})
- public void TestSuccess() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201);
- MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
- MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200);
- mockPostVNFVolumeGroup(202);
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", true);
-
- logEnd();
- }
-
- /**
- * Fail - trigger rollback
- *****************************/
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV2.bpmn",
- "subprocess/DoCreateVfModuleVolumeRollback.bpmn",
+ public void TestSuccess() throws Exception {
+
+ logStart();
+
+ MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
+ MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
+ MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201);
+ MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
+ MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200);
+ mockPostVNFVolumeGroup(202);
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", true);
+
+ logEnd();
+ }
+
+ /**
+ * Fail - trigger rollback
+ *****************************/
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/DoCreateVfModuleVolumeV2.bpmn",
+ "subprocess/DoCreateVfModuleVolumeRollback.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/VnfAdapterRestV1.bpmn"})
- public void TestRollback() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201);
- mockPostVNFVolumeGroup(202);
- mockPutVNFVolumeGroupRollback("TEST-VOLUME-GROUP-ID-0123", 202);
- MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 202);
- StubResponseAAI.MockGetVolumeGroupByName_404("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- StubResponseAAI.MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
- StubResponseAAI.MockDeleteVolumeGroup("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360");
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
- injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Happy path scenario for VID
- *****************************/
- @Test
- @Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV1.bpmn",
+ public void TestRollback() throws Exception {
+
+ logStart();
+
+ MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
+ MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
+ MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201);
+ mockPostVNFVolumeGroup(202);
+ mockPutVNFVolumeGroupRollback("TEST-VOLUME-GROUP-ID-0123", 202);
+ MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 202);
+ StubResponseAAI.MockGetVolumeGroupByName_404("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ StubResponseAAI.MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
+ StubResponseAAI.MockDeleteVolumeGroup("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360");
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
+ injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Happy path scenario for VID
+ *****************************/
+ @Test
+ @Ignore
+ @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/DoCreateVfModuleVolumeV1.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/VnfAdapterRestV1.bpmn"})
- public void TestVolumeGroupAlreadyExists() throws Exception {
-
- logStart();
-
- MockGetVolumeGroupByName("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
- MockGetGenericVnfById("TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- *Vnf Create fail
- *****************************/
- @Test
- @Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV1.bpmn",
+ public void TestVolumeGroupAlreadyExists() throws Exception {
+
+ logStart();
+
+ MockGetVolumeGroupByName("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
+ MockGetGenericVnfById("TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
+ MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Vnf Create fail
+ *****************************/
+ @Test
+ @Ignore
+ @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/DoCreateVfModuleVolumeV1.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/VnfAdapterRestV1.bpmn"})
- public void TestVNfCreateFail() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201);
- MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
- MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200);
- mockPostVNFVolumeGroup(202);
- MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 204);
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupException");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-
-
- /**
- * Error scenario - vnf not found
- ********************************/
- @Test
- @Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV1.bpmn",
+ public void TestVNfCreateFail() throws Exception {
+
+ logStart();
+
+ MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
+ MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
+ MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201);
+ MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
+ MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200);
+ mockPostVNFVolumeGroup(202);
+ MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 204);
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupException");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+
+ /**
+ * Error scenario - vnf not found
+ ********************************/
+ @Test
+ @Ignore
+ @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/DoCreateVfModuleVolumeV1.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/VnfAdapterRestV1.bpmn"})
- public void TestFailVnfNotFound() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Error scenario - error in validation
- **************************************/
- @Test
- @Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV1.bpmn",
+ public void TestFailVnfNotFound() throws Exception {
+
+ logStart();
+
+ MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Error scenario - error in validation
+ **************************************/
+ @Test
+ @Ignore
+ @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/DoCreateVfModuleVolumeV1.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/VnfAdapterRestV1.bpmn"})
- public void TestFailNoVnfPassed() throws Exception {
-
- logStart();
-
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- //testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Error scenario - service instance not found
- *********************************************/
- @Test
- @Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV1.bpmn",
+ public void TestFailNoVnfPassed() throws Exception {
+
+ logStart();
+
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ //testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Error scenario - service instance not found
+ *********************************************/
+ @Test
+ @Ignore
+ @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/DoCreateVfModuleVolumeV1.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/VnfAdapterRestV1.bpmn"})
- public void TestFailServiceInstanceNotFound() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- //testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
+ public void TestFailServiceInstanceNotFound() throws Exception {
+
+ logStart();
+
+ MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ //testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java
index d5f94965fe..1c64dd7952 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java
@@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -56,168 +56,168 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
*/
public class CreateVnfInfraTest extends WorkflowTest {
- private String createVnfInfraRequest;
- private final CallbackSet callbacks = new CallbackSet();
+ private String createVnfInfraRequest;
+ private final CallbackSet callbacks = new CallbackSet();
+
+
+ public CreateVnfInfraTest() throws IOException {
+ createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json");
+ callbacks.put("assign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/DoCreateVnf.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericPutVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "process/CreateVnfInfra.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn"})
+ public void testCreateVnfInfra_success() throws Exception {
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ MockGetGenericVnfByName_404();
+ MockPutGenericVnf();
+ mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVnfInfra",
+ "v1", businessKey, createVnfInfraRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ //injectSDNCCallbacks(callbacks, "assign, query");
+ //injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ String status = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "CreateVnfInfraStatus");
+ assertEquals("Success", status);
+
+ logEnd();
+ //WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
+ // injectSDNCCallbacks(callbacks, "assign");
+ // injectSDNCCallbacks(callbacks, "activate");
+ //waitForProcessEnd(businessKey, 10000);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- public CreateVnfInfraTest() throws IOException {
- createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json");
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- }
+ //assertVariables("true", "true", "false", "true", "Success", null);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"})
+ public void testCreateVnfInfra_error_badRequest() throws Exception {
+
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, null, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertVariables(null, null, null, null, null, "WorkflowException[processKey=CreateVnfInfra,errorCode=2500,errorMessage=Internal Error - WorkflowException Object and/or RequestInfo is null! CreateVnfInfra]");
+
+ }
+
+ @Test
+ @Ignore
+ @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", "subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"})
+ public void testCreateVnfInfra_error_siNotFound() throws Exception {
+
+ MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=404,errorMessage=Service Instance Not Found]");
+
+ }
+
+ @Test
+ @Ignore
+ @Deployment(resources = {"subprocess/DoCreateVnf.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericPutVnf.bpmn",
+ "process/CreateVnfInfra.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn"})
+ public void testCreateVnfInfra_error_vnfExist() throws Exception {
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
+
+ MockPutGenericVnf();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- @Test
- @Deployment(resources = {"subprocess/DoCreateVnf.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "process/CreateVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testCreateVnfInfra_success() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- MockGetGenericVnfByName_404();
- MockPutGenericVnf();
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=5000,errorMessage=Generic Vnf Already Exist.]");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVnfInfra",
- "v1", businessKey, createVnfInfraRequest, variables);
+ }
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+ private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
+ String siFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_FoundIndicator");
+ String siSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_SuccessIndicator");
+ String vnfFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_FoundIndicator");
+ String vnfSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_SuccessIndicator");
+ String response = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "SavedWorkflowException1");
- //injectSDNCCallbacks(callbacks, "assign, query");
- //injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
+ assertEquals(exSIFound, siFound);
+ assertEquals(exSISucc, siSucc);
+ assertEquals(exVnfFound, vnfFound);
+ assertEquals(exVnfSucc, vnfSucc);
+ assertEquals(exResponse, response);
+ assertEquals(exWorkflowException, workflowException);
+ }
- waitForProcessEnd(businessKey, 10000);
- String status = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "CreateVnfInfraStatus");
- assertEquals("Success", status);
-
- logEnd();
-
- //WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
- // injectSDNCCallbacks(callbacks, "assign");
- // injectSDNCCallbacks(callbacks, "activate");
- //waitForProcessEnd(businessKey, 10000);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- //assertVariables("true", "true", "false", "true", "Success", null);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"})
- public void testCreateVnfInfra_error_badRequest() throws Exception{
-
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, null, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertVariables(null, null, null, null, null, "WorkflowException[processKey=CreateVnfInfra,errorCode=2500,errorMessage=Internal Error - WorkflowException Object and/or RequestInfo is null! CreateVnfInfra]");
-
- }
-
- @Test
- @Ignore
- @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", "subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"})
- public void testCreateVnfInfra_error_siNotFound() throws Exception{
-
- MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=404,errorMessage=Service Instance Not Found]");
-
- }
-
- @Test
- @Ignore
- @Deployment(resources = {"subprocess/DoCreateVnf.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "process/CreateVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testCreateVnfInfra_error_vnfExist() throws Exception{
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
-
- MockPutGenericVnf();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=5000,errorMessage=Generic Vnf Already Exist.]");
-
- }
-
- private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
-
- String siFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_FoundIndicator");
- String siSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_SuccessIndicator");
- String vnfFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_FoundIndicator");
- String vnfSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_SuccessIndicator");
- String response = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "SavedWorkflowException1");
-
- assertEquals(exSIFound, siFound);
- assertEquals(exSISucc, siSucc);
- assertEquals(exVnfFound, vnfFound);
- assertEquals(exVnfSucc, vnfSucc);
- assertEquals(exResponse, response);
- assertEquals(exWorkflowException, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", request);
- variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- //variables.put("bpmnRequest", request);
- //variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("requestId", requestId);
- variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- }
+ private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("bpmnRequest", request);
+ variables.put("mso-request-id", requestId);
+ variables.put("serviceInstanceId", siId);
+ variables.put("testVnfId", "testVnfId123");
+ variables.put("vnfType", "STMTN");
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ //variables.put("bpmnRequest", request);
+ //variables.put("mso-request-id", requestId);
+ variables.put("serviceInstanceId", siId);
+ variables.put("requestId", requestId);
+ variables.put("testVnfId", "testVnfId123");
+ variables.put("vnfType", "STMTN");
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java
index aa05953493..2cceba0f1b 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java
@@ -46,66 +46,66 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
*/
public class DeleteGenericALaCarteServiceInstanceTest extends WorkflowTest {
- public DeleteGenericALaCarteServiceInstanceTest() throws IOException {
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
+ public DeleteGenericALaCarteServiceInstanceTest() throws IOException {
+ }
+
+ /**
+ * Sunny day VID scenario.
+ *
+ * @throws Exception
+ */
@Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Test
- @Deployment(resources = {
- "process/DeleteGenericALaCarteServiceInstance.bpmn",
- "subprocess/DoDeleteServiceInstance.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn" })
- public void sunnyDayAlaCarte() throws Exception {
-
- logStart();
-
- //AAI
- MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
- MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- //DB
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, String> variables = setupVariables();
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteGenericALaCarteServiceInstance", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowResponse");
- //assertNotNull(workflowResp);
- System.out.println("Workflow (Synch) Response:\n" + workflowResp);
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowException");
- String completionReq = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "completionRequest");
- System.out.println("completionReq:\n" + completionReq);
- System.out.println("workflowException:\n" + workflowException);
- assertNotNull(completionReq);
- assertEquals(null, workflowException);
-
- logEnd();
- }
-
- // Success Scenario
- private Map<String, String> setupVariables() {
- Map<String, String> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", getRequest());
- variables.put("mso-request-id", "RaaTestRequestId-1");
- variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
- return variables;
- }
-
- public String getRequest() {
- String request = "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SDN-ETHERNET-INTERNET\",\"subscriberName\":\"\"},\"requestInfo\":{\"instanceName\":\"1604-MVM-26\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"123456789\",\"aLaCarte\":\"false\",\"userParams\":\"somep\"}}}";
- return request;
- }
+ @Test
+ @Deployment(resources = {
+ "process/DeleteGenericALaCarteServiceInstance.bpmn",
+ "subprocess/DoDeleteServiceInstance.bpmn",
+ "subprocess/GenericDeleteService.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"})
+ public void sunnyDayAlaCarte() throws Exception {
+
+ logStart();
+
+ //AAI
+ MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
+ MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ //DB
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, String> variables = setupVariables();
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteGenericALaCarteServiceInstance", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowResponse");
+ //assertNotNull(workflowResp);
+ System.out.println("Workflow (Synch) Response:\n" + workflowResp);
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowException");
+ String completionReq = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "completionRequest");
+ System.out.println("completionReq:\n" + completionReq);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNotNull(completionReq);
+ assertEquals(null, workflowException);
+
+ logEnd();
+ }
+
+ // Success Scenario
+ private Map<String, String> setupVariables() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("bpmnRequest", getRequest());
+ variables.put("mso-request-id", "RaaTestRequestId-1");
+ variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
+ return variables;
+ }
+
+ public String getRequest() {
+ String request = "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SDN-ETHERNET-INTERNET\",\"subscriberName\":\"\"},\"requestInfo\":{\"instanceName\":\"1604-MVM-26\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"123456789\",\"aLaCarte\":\"false\",\"userParams\":\"somep\"}}}";
+ return request;
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java
index 4317a57405..0e72b769a5 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java
@@ -48,294 +48,293 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
/**
* Unit test cases for DeleteNetworkInstance.bpmn
- *
*/
//@Ignore
public class DeleteNetworkInstanceTest extends WorkflowTest {
- @WorkflowTestTransformer
- public static final ResponseTransformer sdncAdapterMockTransformer =
- new SDNCAdapterNetworkTopologyMockTransformer();
-
- @Rule
- public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- new SDNCAdapterCallbackRule(processEngineRule);
-
- /**
- * End-to-End flow - Unit test for DeleteNetworkInstance.bpmn
- * - String input & String response
- */
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceDeleteNetworkInstance_VID_Success() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID - DeleteNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>delete");
- MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
- MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
-
- Map<String, String> variables = new HashMap<>();
- variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "DELETE");
- variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("vnfId", "");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- variables.put("networkType", "modelName");
- variables.put("bpmnRequest", getDeleteNetworkInstanceInfraRequest());
-
- executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
-
- Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
- Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
- System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_Success() WorkflowResponse:\n" + workflowResp);
-
- String completeMsoProcessRequest =
- "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
- + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
- + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
- + " <request-info>" + '\n'
- + " <request-id>testRequestId</request-id>" + '\n'
- + " <action>DELETE</action>" + '\n'
- + " <source>VID</source>" + '\n'
- + " </request-info>" + '\n'
- + " <aetgt:status-message>Network has been deleted successfully.</aetgt:status-message>" + '\n'
- + " <aetgt:mso-bpel-name>BPMN Network action: DELETE</aetgt:mso-bpel-name>" + '\n'
- + "</aetgt:MsoCompletionRequest>";
-
- Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID - DeleteNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstance.bpmn",
- //"subprocess/DoDeleteNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success vIPER - DeleteNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>unassign");
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate");
- MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
- MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
-
- String networkModelInfo = " {\"modelName\": \"modelName\", " + '\n' +
- " \"networkType\": \"modelName\" }";
-
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
- variables.put("networkName", "HSL_direct_net_2");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // 1702
- variables.put("failIfExists", "false");
- //variables.put("sdncVersion", "1702");
- variables.put("sdncVersion", "1707");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("networkModelInfo", networkModelInfo);
-
- executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
-
- Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
- Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
- System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() WorkflowResponse:\n" + workflowResp);
-
- String completeMsoProcessRequest =
- "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
- + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
- + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
- + " <request-info>" + '\n'
- + " <request-id>testRequestId</request-id>" + '\n'
- + " <action>DELETE</action>" + '\n'
- + " <source>VID</source>" + '\n'
- + " </request-info>" + '\n'
- + " <aetgt:status-message>Network has been deleted successfully.</aetgt:status-message>" + '\n'
- + " <aetgt:mso-bpel-name>BPMN Network action: DELETE</aetgt:mso-bpel-name>" + '\n'
- + "</aetgt:MsoCompletionRequest>";
-
- Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID - DeleteNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceDeleteNetworkInstanceInfra_vIPER_Rollback() throws Exception {
+ @WorkflowTestTransformer
+ public static final ResponseTransformer sdncAdapterMockTransformer =
+ new SDNCAdapterNetworkTopologyMockTransformer();
+
+ @Rule
+ public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
+ new SDNCAdapterCallbackRule(processEngineRule);
+
+ /**
+ * End-to-End flow - Unit test for DeleteNetworkInstance.bpmn
+ * - String input & String response
+ */
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
+ "subprocess/DoDeleteNetworkInstance.bpmn",
+ "subprocess/DoDeleteNetworkInstanceRollback.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceDeleteNetworkInstance_VID_Success() throws Exception {
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success VID - DeleteNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>delete");
+ MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
+ MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "DELETE");
+ variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("vnfId", "");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "");
+ variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ variables.put("networkType", "modelName");
+ variables.put("bpmnRequest", getDeleteNetworkInstanceInfraRequest());
+
+ executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
+
+ Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
+ Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
+ Assert.assertNotNull(workflowResp);
+ System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_Success() WorkflowResponse:\n" + workflowResp);
+
+ String completeMsoProcessRequest =
+ "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
+ + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
+ + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
+ + " <request-info>" + '\n'
+ + " <request-id>testRequestId</request-id>" + '\n'
+ + " <action>DELETE</action>" + '\n'
+ + " <source>VID</source>" + '\n'
+ + " </request-info>" + '\n'
+ + " <aetgt:status-message>Network has been deleted successfully.</aetgt:status-message>" + '\n'
+ + " <aetgt:mso-bpel-name>BPMN Network action: DELETE</aetgt:mso-bpel-name>" + '\n'
+ + "</aetgt:MsoCompletionRequest>";
+
+ Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success VID - DeleteNetworkInstance flow Completed ");
+ System.out.println("----------------------------------------------------------");
+
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
+ "subprocess/DoDeleteNetworkInstance.bpmn",
+ //"subprocess/DoDeleteNetworkInstanceRollback.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() throws Exception {
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success vIPER - DeleteNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>unassign");
+ mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate");
+ MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
+ MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+
+ String networkModelInfo = " {\"modelName\": \"modelName\", " + '\n' +
+ " \"networkType\": \"modelName\" }";
+
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
+ variables.put("networkName", "HSL_direct_net_2");
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("disableRollback", "false"); // 1702
+ variables.put("failIfExists", "false");
+ //variables.put("sdncVersion", "1702");
+ variables.put("sdncVersion", "1707");
+ variables.put("subscriptionServiceType", "MSO-dev-service-type");
+ variables.put("networkModelInfo", networkModelInfo);
+
+ executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
+
+ Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
+ Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
+ Assert.assertNotNull(workflowResp);
+ System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() WorkflowResponse:\n" + workflowResp);
+
+ String completeMsoProcessRequest =
+ "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
+ + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
+ + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
+ + " <request-info>" + '\n'
+ + " <request-id>testRequestId</request-id>" + '\n'
+ + " <action>DELETE</action>" + '\n'
+ + " <source>VID</source>" + '\n'
+ + " </request-info>" + '\n'
+ + " <aetgt:status-message>Network has been deleted successfully.</aetgt:status-message>" + '\n'
+ + " <aetgt:mso-bpel-name>BPMN Network action: DELETE</aetgt:mso-bpel-name>" + '\n'
+ + "</aetgt:MsoCompletionRequest>";
+
+ Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success VID - DeleteNetworkInstance flow Completed ");
+ System.out.println("----------------------------------------------------------");
+
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
+ "subprocess/DoDeleteNetworkInstance.bpmn",
+ "subprocess/DoDeleteNetworkInstanceRollback.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceDeleteNetworkInstanceInfra_vIPER_Rollback() throws Exception {
// Rollback is not Applicable for DeleteNetwork (no requirements). Rollback should not be invoked.
- System.out.println("----------------------------------------------------------");
- System.out.println(" Rollback - DeleteNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulatores
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>unassign", 500, "");
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
- MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
- MockNetworkAdapterContainingRequest("createNetworkRequest", 200, "CreateNetworkV2/createNetworkResponse_Success.xml");
- MockGetNetworkByIdWithDepth ("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
-
- String networkModelInfo = " {\"modelCustomizationId\": \"uuid-nrc-001-1234\", " + '\n' +
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Rollback - DeleteNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------");
+
+ // setup simulatores
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>unassign", 500, "");
+ mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate");
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
+ MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
+ MockNetworkAdapterContainingRequest("createNetworkRequest", 200, "CreateNetworkV2/createNetworkResponse_Success.xml");
+ MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+
+ String networkModelInfo = " {\"modelCustomizationId\": \"uuid-nrc-001-1234\", " + '\n' +
" \"modelInvariantId\": \"was-ist-das-001-1234\" }";
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
- variables.put("networkName", "HSL_direct_net_2");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // 1702
- variables.put("failIfExists", "false");
- variables.put("sdncVersion", "1702");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("networkModelInfo", networkModelInfo);
-
- executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
-
- Assert.assertNotNull("DELNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_FalloutHandlerRequest"));
- Assert.assertEquals("false", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
- Assert.assertEquals("false", BPMNUtil.getVariable(processEngineRule, "DoDeleteNetworkInstance", "DELNWKI_Success"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Rollback - DeleteNetworkInstanceModular flow Completed ");
- System.out.println("----------------------------------------------------------");
-
-
- }
-
-
- // *****************
- // Utility Section
- // *****************
-
- public String getDeleteNetworkInstanceInfraRequest() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1.0\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"HSL_direct_net_2\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"suppressRollback\": \"false\", " + '\n' +
- " \"callbackUrl\": \"\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": true, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": {} " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
- return request;
-
- }
-
-
- public String getDeleteNetworkInstanceInfraRequest_MissingId() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"HSL_direct_net_2\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": true, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
- return request;
-
- }
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
+ variables.put("networkName", "HSL_direct_net_2");
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("disableRollback", "false"); // 1702
+ variables.put("failIfExists", "false");
+ variables.put("sdncVersion", "1702");
+ variables.put("subscriptionServiceType", "MSO-dev-service-type");
+ variables.put("networkModelInfo", networkModelInfo);
+
+ executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
+ Assert.assertNotNull(workflowResp);
+
+ Assert.assertNotNull("DELNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_FalloutHandlerRequest"));
+ Assert.assertEquals("false", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
+ Assert.assertEquals("false", BPMNUtil.getVariable(processEngineRule, "DoDeleteNetworkInstance", "DELNWKI_Success"));
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Rollback - DeleteNetworkInstanceModular flow Completed ");
+ System.out.println("----------------------------------------------------------");
+
+
+ }
+
+
+ // *****************
+ // Utility Section
+ // *****************
+
+ public String getDeleteNetworkInstanceInfraRequest() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1.0\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"instanceName\": \"HSL_direct_net_2\", " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"suppressRollback\": \"false\", " + '\n' +
+ " \"callbackUrl\": \"\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"backoutOnFailure\": true, " + '\n' +
+ " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
+ " \"userParams\": {} " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+ return request;
+
+ }
+
+
+ public String getDeleteNetworkInstanceInfraRequest_MissingId() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelId\": \"modelId\", " + '\n' +
+ " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"instanceName\": \"HSL_direct_net_2\", " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"callbackUrl\": \"\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"backoutOnFailure\": true, " + '\n' +
+ " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
+ " \"userParams\": [] " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+ return request;
+
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java
index 4c478e6143..413e35a326 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -46,534 +46,535 @@ import org.openecomp.mso.bpmn.core.WorkflowException;
import org.openecomp.mso.bpmn.mock.FileUtil;
import com.github.tomakehurst.wiremock.client.WireMock;
+
/**
* Unit test for DoDeleteVfModule.bpmn.
*/
public class DeleteVfModuleInfraTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <vfModuleOutputs>" + EOL +
- " <entry>" + EOL +
- " <key>policyKey1_contrail_network_policy_fqdn</key>" + EOL +
- " <value>MSOTest:DefaultPolicyFQDN1</value>" + EOL +
- "</entry>" + EOL +
- "<entry>" + EOL +
- "<key>policyKey2_contrail_network_policy_fqdn</key>" + EOL +
- "<value>MSOTest:DefaultPolicyFQDN2</value>" + EOL +
- "</entry>" + EOL +
- " <entry>" + EOL +
- " <key>oam_management_v4_address</key>" + EOL +
- " <value>1234</value>" + EOL +
- "</entry>" + EOL +
- " <entry>" + EOL +
- " <key>oam_management_v6_address</key>" + EOL +
- " <value>1234</value>" + EOL +
- "</entry>" + EOL +
- "</vfModuleOutputs>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DeleteVfModuleInfraTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- @Test
- @Deployment(resources = {
- "process/Infrastructure/DeleteVfModuleInfra.bpmn",
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- @Ignore
- public void TestDeleteVfModuleSuccess() throws Exception {
- // delete the Base Module
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <request-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</request-id>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- WireMock.reset();
-
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>changedelete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>delete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
-
- mockVNFDelete(".*", "/.*", 202);
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private static final String EOL = "\n";
+
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <vfModuleOutputs>" + EOL +
+ " <entry>" + EOL +
+ " <key>policyKey1_contrail_network_policy_fqdn</key>" + EOL +
+ " <value>MSOTest:DefaultPolicyFQDN1</value>" + EOL +
+ "</entry>" + EOL +
+ "<entry>" + EOL +
+ "<key>policyKey2_contrail_network_policy_fqdn</key>" + EOL +
+ "<value>MSOTest:DefaultPolicyFQDN2</value>" + EOL +
+ "</entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>oam_management_v4_address</key>" + EOL +
+ " <value>1234</value>" + EOL +
+ "</entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>oam_management_v6_address</key>" + EOL +
+ " <value>1234</value>" + EOL +
+ "</entry>" + EOL +
+ "</vfModuleOutputs>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ private final String vnfAdapterDeleteCallbackFail =
+ "<vfModuleException>" + EOL +
+ " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
+ " <category>INTERNAL</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL;
+
+ private final String sdncAdapterDeleteCallback =
+ "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DeleteVfModuleInfraTest() throws IOException {
+ callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
+ callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+ callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
+ }
+
+ @Test
+ @Deployment(resources = {
+ "process/Infrastructure/DeleteVfModuleInfra.bpmn",
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ @Ignore
+ public void TestDeleteVfModuleSuccess() throws Exception {
+ // delete the Base Module
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <request-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</request-id>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ WireMock.reset();
+
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>changedelete"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>delete"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+
+ mockVNFDelete(".*", "/.*", 202);
// MockAAIGenericVnfSearch();
// MockAAIVfModulePUT(false);
// MockAAIDeleteGenericVnf();
// MockAAIDeleteVfModule();
- mockUpdateRequestDB(200, "VfModularity/DBUpdateResponse.xml");
-
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
-
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse()
- .withStatus(200)));
-
-
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MMSC"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
- .willReturn(aResponse()
- .withStatus(200)));
-
- String body;
-
- // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- // The following stubs are for DeleteAAIVfModule
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000020</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000074</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000075</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000019</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000076</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000077</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000018</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000078</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- String businessKey = UUID.randomUUID().toString();
- String deleteVfModuleRequest =
- FileUtil.readResourceFile("__files/DeleteVfModule_VID_request.json");
- //Map<String, Object> variables = new HashMap<String, Object>();
-
- //variables.put("isDebugLogEnabled","true");
+ mockUpdateRequestDB(200, "VfModularity/DBUpdateResponse.xml");
+
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
+
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+
+
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("MMSC"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("PCRF"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+
+ String body;
+
+ // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>1508691</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>1508691</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ // The following stubs are for DeleteAAIVfModule
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000021</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000073</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000020</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000074</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000075</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000019</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000076</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000077</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000018</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000078</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000021</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000073</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ String businessKey = UUID.randomUUID().toString();
+ String deleteVfModuleRequest =
+ FileUtil.readResourceFile("__files/DeleteVfModule_VID_request.json");
+ //Map<String, Object> variables = new HashMap<String, Object>();
+
+ //variables.put("isDebugLogEnabled","true");
// variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
// variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleInfra",
- "v1", businessKey, deleteVfModuleRequest, variables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleInfra",
+ "v1", businessKey, deleteVfModuleRequest, variables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
- // "changedelete" operation not required for deleting a Vf Module
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "DeleteVfModuleInfraSuccessIndicator", true);
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestDeleteVfModuleInfraSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "DELETE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
-
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ checkVariable(businessKey, "DeleteVfModuleInfraSuccessIndicator", true);
+ checkVariable(businessKey, "WorkflowException", null);
+ if (wfe != null) {
+ System.out.println("TestDeleteVfModuleInfraSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", "true");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "DELETE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("volumeGroupId", "");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ return variables;
+
+ }
+
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java
index 84050c40e5..bdeb9aaf6a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -36,131 +36,131 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit test cases for UpdateVfModuleVolume.bpmn
*/
public class DeleteVfModuleVolumeInfraV1Test extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DeleteVfModuleVolumeInfraV1Test() throws IOException {
- callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
- }
-
- /**
- * Happy path scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore // BROKEN TEST
- @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DeleteVfModuleVolumeInfraV1Test() throws IOException {
+ callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
+ "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
+ }
+
+ /**
+ * Happy path scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Ignore // BROKEN TEST
+ @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/VnfAdapterRestV1.bpmn"})
- public void happyPath() throws Exception {
+ public void happyPath() throws Exception {
+
+ logStart();
- logStart();
-
// DeleteVfModuleVolumeInfraV1_success();
-
- String businessKey = UUID.randomUUID().toString();
- String deleteVfModuleVolRequest =
- FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
- "v1", businessKey, deleteVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", true);
-
- logEnd();
- }
-
- /**
- * Test fails - vf module in use
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
+
+ String businessKey = UUID.randomUUID().toString();
+ String deleteVfModuleVolRequest =
+ FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
+ "v1", businessKey, deleteVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ /**
+ * Test fails - vf module in use
+ *
+ * @throws Exception
+ */
+ @Test
+ @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/VnfAdapterRestV1.bpmn"})
- public void TestVfModuleInUseError() throws Exception {
+ public void TestVfModuleInUseError() throws Exception {
+
+ logStart();
- logStart();
-
// DeleteVfModuleVolumeInfraV1_inUseError(); // no assertions to check
-
- String businessKey = UUID.randomUUID().toString();
- String deleteVfModuleVolRequest =
- FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("volumeGroupId", "78987");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
- "v1", businessKey, deleteVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Test fails on vnf adapter call
- *
- * @throws Exception
- */
- @Test
- @Ignore // BROKEN TEST
- @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
+
+ String businessKey = UUID.randomUUID().toString();
+ String deleteVfModuleVolRequest =
+ FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("volumeGroupId", "78987");
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
+ "v1", businessKey, deleteVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ //injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Test fails on vnf adapter call
+ *
+ * @throws Exception
+ */
+ @Test
+ @Ignore // BROKEN TEST
+ @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/VnfAdapterRestV1.bpmn"})
- public void TestVnfAdapterCallfail() throws Exception {
+ public void TestVnfAdapterCallfail() throws Exception {
+
+ logStart();
- logStart();
-
// DeleteVfModuleVolumeInfraV1_fail();
-
- String businessKey = UUID.randomUUID().toString();
- String deleteVfModuleVolRequest =
- FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("volumeGroupId", "78987");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
- "v1", businessKey, deleteVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false);
-
- logEnd();
- }
+
+ String businessKey = UUID.randomUUID().toString();
+ String deleteVfModuleVolRequest =
+ FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("volumeGroupId", "78987");
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
+ "v1", businessKey, deleteVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ //injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false);
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java
index 89bf141247..7c79625439 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java
@@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -49,152 +49,151 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
/**
* Please describe the DeleteVnfInfra.java class
- *
*/
public class DeleteVnfInfraTest extends WorkflowTest {
- private String deleteVnfInfraRequest;
- private String deleteVnfInfraRequestCascadeDelete;
-
- public DeleteVnfInfraTest () throws IOException {
- deleteVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json");
- deleteVnfInfraRequestCascadeDelete = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json");
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn",
- "process/DeleteVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testDeleteVnfInfra_success() throws Exception{
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
-
- MockDeleteGenericVnf();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
- Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete");
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "DELVI_vnfInUse");
- String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException");
-
- assertEquals(false, cascadeDelete);
- assertEquals("true", found);
- assertEquals("false", inUse);
- assertEquals("Success", response);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Ignore // DoDeleteVnfAndModules not complete yet
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnfAndModules.bpmn",
- "process/DeleteVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testDeleteVnfInfra_cascadeDelete() throws Exception{
- MockGetGenericVnfById();
- MockDeleteGenericVnf();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, deleteVnfInfraRequestCascadeDelete, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException");
- Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete");
-
- assertEquals(true, cascadeDelete);
- assertEquals("true", found);
- assertEquals("false", inUse);
- assertEquals("Success", response);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn",
- "process/DeleteVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testDeleteVnfInfra_success_vnfNotFound() throws Exception{
-
- MockDeleteGenericVnf_404();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
-
- assertEquals("false", found);
- assertEquals("false", inUse);
- assertEquals("Success", response);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn",
- "process/DeleteVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testDeleteVnfInfra_error_vnfInUse() throws Exception{
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
- MockDeleteGenericVnf();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "SavedWorkflowException1");
-
- String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]";
-
- assertEquals("true", found);
- assertEquals("true", inUse);
- assertEquals(exWfex, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", request);
- variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("vnfId","testVnfId123");
- }
+ private String deleteVnfInfraRequest;
+ private String deleteVnfInfraRequestCascadeDelete;
+
+ public DeleteVnfInfraTest() throws IOException {
+ deleteVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json");
+ deleteVnfInfraRequestCascadeDelete = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json");
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn",
+ "process/DeleteVnfInfra.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn"})
+ public void testDeleteVnfInfra_success() throws Exception {
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
+
+ MockDeleteGenericVnf();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+ Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete");
+ String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator");
+ String inUse = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "DELVI_vnfInUse");
+ String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException");
+
+ assertEquals(false, cascadeDelete);
+ assertEquals("true", found);
+ assertEquals("false", inUse);
+ assertEquals("Success", response);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Ignore // DoDeleteVnfAndModules not complete yet
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnfAndModules.bpmn",
+ "process/DeleteVnfInfra.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn"})
+ public void testDeleteVnfInfra_cascadeDelete() throws Exception {
+ MockGetGenericVnfById();
+ MockDeleteGenericVnf();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, deleteVnfInfraRequestCascadeDelete, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator");
+ String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
+ String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException");
+ Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete");
+
+ assertEquals(true, cascadeDelete);
+ assertEquals("true", found);
+ assertEquals("false", inUse);
+ assertEquals("Success", response);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn",
+ "process/DeleteVnfInfra.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn"})
+ public void testDeleteVnfInfra_success_vnfNotFound() throws Exception {
+
+ MockDeleteGenericVnf_404();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator");
+ String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
+ String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
+
+ assertEquals("false", found);
+ assertEquals("false", inUse);
+ assertEquals("Success", response);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn",
+ "process/DeleteVnfInfra.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn"})
+ public void testDeleteVnfInfra_error_vnfInUse() throws Exception {
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
+ MockDeleteGenericVnf();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator");
+ String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "SavedWorkflowException1");
+
+ String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]";
+
+ assertEquals("true", found);
+ assertEquals("true", inUse);
+ assertEquals(exWfex, workflowException);
+ }
+
+ private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("bpmnRequest", request);
+ variables.put("mso-request-id", requestId);
+ variables.put("serviceInstanceId", siId);
+ variables.put("vnfId", "testVnfId123");
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java
index 16433caa4c..453e562f75 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java
@@ -43,157 +43,157 @@ import org.openecomp.mso.bpmn.core.RollbackData;
* Unit test cases for DoCreateServiceInstanceRollback.bpmn
*/
public class DoCreateSIRollbackTest extends WorkflowTest {
- private static final String EOL = "\n";
- private final CallbackSet callbacks = new CallbackSet();
- private final String sdncAdapterCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoCreateSIRollbackTest() throws IOException {
- callbacks.put("deactivate", sdncAdapterCallback);
- callbacks.put("delete", sdncAdapterCallback);
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
- @Test
- @Deployment(resources = {
- "subprocess/DoCreateServiceInstanceRollback.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn" })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- //AAI
- MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
- MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- //SDNC
- mockSDNCAdapter(200);
- //DB
- mockUpdateRequestDB(200, "DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> variables = new HashMap<>();
- setupVariables(variables);
- invokeSubProcess("DoCreateServiceInstanceRollback", businessKey, variables);
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstanceRollback", "WorkflowException");
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
-
- logEnd();
- }
-
- // Success Scenario
- private void setupVariables(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "RaaTestRequestId-1");
- variables.put("mso-request-id", "RaaTestRequestId-1");
- variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
-
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
- rollbackData.put("SERVICEINSTANCE", "globalCustomerId", "SDN-ETHERNET-INTERNET");
- rollbackData.put("SERVICEINSTANCE", "serviceSubscriptionType", "123456789");
- rollbackData.put("SERVICEINSTANCE", "disablerollback", "false");
- rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true");
- rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true");
-
- String req = "<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"" + EOL +
- "xmlns:sdncadapter=\"http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1\" " + EOL +
- "xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\">" + EOL +
- "<sdncadapter:RequestHeader>" + EOL +
- "<sdncadapter:RequestId>b043d290-140d-4a38-a9b6-95d3b8bd27d4</sdncadapter:RequestId>" + EOL +
- "<sdncadapter:SvcInstanceId>MIS%252F1604%252F0026%252FSW_INTERNET</sdncadapter:SvcInstanceId>" + EOL +
- "<sdncadapter:SvcAction>deactivate</sdncadapter:SvcAction>" + EOL +
- "<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>" + EOL +
- "<sdncadapter:CallbackUrl>http://localhost:8080/mso/SDNCAdapterCallbackService</sdncadapter:CallbackUrl>" + EOL +
- "</sdncadapter:RequestHeader>" + EOL +
- "<sdncadapterworkflow:SDNCRequestData>" + EOL +
- "<request-information>" + EOL +
- "<request-id>RaaTestRequestId-1</request-id>" + EOL +
- "<source>MSO</source>" + EOL +
- "<notification-url/>" + EOL +
- "<order-number/>" + EOL +
- "<order-version/>" + EOL +
- "<request-action>DeleteServiceInstance</request-action>" + EOL +
- "</request-information>" + EOL +
- "<service-information>" + EOL +
- "<service-id/>" + EOL +
- "<subscription-service-type>123456789</subscription-service-type>" + EOL +
- "<onap-model-information>" + EOL +
- "<model-invariant-uuid/>" + EOL +
- "<model-uuid/>" + EOL +
- "<model-version/>" + EOL +
- "<model-name/>" + EOL +
- "</onap-model-information>" + EOL +
- "<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
- "<subscriber-name/>" + EOL +
- "<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
- "</service-information>" + EOL +
- "<service-request-input>" + EOL +
- "<service-instance-name/>" + EOL +
- "</service-request-input>" + EOL +
- "</sdncadapterworkflow:SDNCRequestData>" + EOL +
- "</sdncadapterworkflow:SDNCAdapterWorkflowRequest>";
-
- String req1 = "<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"" + EOL +
- "xmlns:sdncadapter=\"http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1\" " + EOL +
- "xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\">" + EOL +
- "<sdncadapter:RequestHeader>" + EOL +
- "<sdncadapter:RequestId>bca4fede-0804-4c13-af69-9e80b378150f</sdncadapter:RequestId>" + EOL +
- "<sdncadapter:SvcInstanceId>MIS%252F1604%252F0026%252FSW_INTERNET</sdncadapter:SvcInstanceId>" + EOL +
- "<sdncadapter:SvcAction>delete</sdncadapter:SvcAction>" + EOL +
- "<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>" + EOL +
- "<sdncadapter:CallbackUrl>http://localhost:8080/mso/SDNCAdapterCallbackService</sdncadapter:CallbackUrl>" + EOL +
- "</sdncadapter:RequestHeader>" + EOL +
- "<sdncadapterworkflow:SDNCRequestData>" + EOL +
- "<request-information>" + EOL +
- "<request-id>RaaTestRequestId-1</request-id>" + EOL +
- "<source>MSO</source>" + EOL +
- "<notification-url/>" + EOL +
- "<order-number/>" + EOL +
- "<order-version/>" + EOL +
- "<request-action>DeleteServiceInstance</request-action>" + EOL +
- "</request-information>" + EOL +
- "<service-information>" + EOL +
- "<service-id/>" + EOL +
- "<subscription-service-type>123456789</subscription-service-type>" + EOL +
- "<onap-model-information>" + EOL +
- "<model-invariant-uuid/>" + EOL +
- "<model-uuid/>" + EOL +
- "<model-version/>" + EOL +
- "<model-name/>" + EOL +
- "</onap-model-information>" + EOL +
- "<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
- "<subscriber-name/>" + EOL +
- "<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
- "</service-information>" + EOL +
- "<service-request-input>" + EOL +
- "<service-instance-name/>" + EOL +
- "</service-request-input>" + EOL +
- "</sdncadapterworkflow:SDNCRequestData>" + EOL +
- "</sdncadapterworkflow:SDNCAdapterWorkflowRequest>";
-
- rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", req);
-
- rollbackData.put("SERVICEINSTANCE", "sdncDelete",req1);
- variables.put("rollbackData",rollbackData);
-
- }
+ private static final String EOL = "\n";
+ private final CallbackSet callbacks = new CallbackSet();
+ private final String sdncAdapterCallback =
+ "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DoCreateSIRollbackTest() throws IOException {
+ callbacks.put("deactivate", sdncAdapterCallback);
+ callbacks.put("delete", sdncAdapterCallback);
+ }
+
+ /**
+ * Sunny day VID scenario.
+ *
+ * @throws Exception
+ */
+ //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoCreateServiceInstanceRollback.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericDeleteService.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"})
+ public void sunnyDay() throws Exception {
+
+ logStart();
+
+ //AAI
+ MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
+ MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ //SDNC
+ mockSDNCAdapter(200);
+ //DB
+ mockUpdateRequestDB(200, "DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> variables = new HashMap<>();
+ setupVariables(variables);
+ invokeSubProcess("DoCreateServiceInstanceRollback", businessKey, variables);
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ waitForProcessEnd(businessKey, 10000);
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstanceRollback", "WorkflowException");
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+
+ logEnd();
+ }
+
+ // Success Scenario
+ private void setupVariables(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "RaaTestRequestId-1");
+ variables.put("mso-request-id", "RaaTestRequestId-1");
+ variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
+
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
+ rollbackData.put("SERVICEINSTANCE", "globalCustomerId", "SDN-ETHERNET-INTERNET");
+ rollbackData.put("SERVICEINSTANCE", "serviceSubscriptionType", "123456789");
+ rollbackData.put("SERVICEINSTANCE", "disablerollback", "false");
+ rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true");
+ rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true");
+
+ String req = "<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"" + EOL +
+ "xmlns:sdncadapter=\"http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1\" " + EOL +
+ "xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\">" + EOL +
+ "<sdncadapter:RequestHeader>" + EOL +
+ "<sdncadapter:RequestId>b043d290-140d-4a38-a9b6-95d3b8bd27d4</sdncadapter:RequestId>" + EOL +
+ "<sdncadapter:SvcInstanceId>MIS%252F1604%252F0026%252FSW_INTERNET</sdncadapter:SvcInstanceId>" + EOL +
+ "<sdncadapter:SvcAction>deactivate</sdncadapter:SvcAction>" + EOL +
+ "<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>" + EOL +
+ "<sdncadapter:CallbackUrl>http://localhost:8080/mso/SDNCAdapterCallbackService</sdncadapter:CallbackUrl>" + EOL +
+ "</sdncadapter:RequestHeader>" + EOL +
+ "<sdncadapterworkflow:SDNCRequestData>" + EOL +
+ "<request-information>" + EOL +
+ "<request-id>RaaTestRequestId-1</request-id>" + EOL +
+ "<source>MSO</source>" + EOL +
+ "<notification-url/>" + EOL +
+ "<order-number/>" + EOL +
+ "<order-version/>" + EOL +
+ "<request-action>DeleteServiceInstance</request-action>" + EOL +
+ "</request-information>" + EOL +
+ "<service-information>" + EOL +
+ "<service-id/>" + EOL +
+ "<subscription-service-type>123456789</subscription-service-type>" + EOL +
+ "<onap-model-information>" + EOL +
+ "<model-invariant-uuid/>" + EOL +
+ "<model-uuid/>" + EOL +
+ "<model-version/>" + EOL +
+ "<model-name/>" + EOL +
+ "</onap-model-information>" + EOL +
+ "<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
+ "<subscriber-name/>" + EOL +
+ "<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
+ "</service-information>" + EOL +
+ "<service-request-input>" + EOL +
+ "<service-instance-name/>" + EOL +
+ "</service-request-input>" + EOL +
+ "</sdncadapterworkflow:SDNCRequestData>" + EOL +
+ "</sdncadapterworkflow:SDNCAdapterWorkflowRequest>";
+
+ String req1 = "<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"" + EOL +
+ "xmlns:sdncadapter=\"http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1\" " + EOL +
+ "xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\">" + EOL +
+ "<sdncadapter:RequestHeader>" + EOL +
+ "<sdncadapter:RequestId>bca4fede-0804-4c13-af69-9e80b378150f</sdncadapter:RequestId>" + EOL +
+ "<sdncadapter:SvcInstanceId>MIS%252F1604%252F0026%252FSW_INTERNET</sdncadapter:SvcInstanceId>" + EOL +
+ "<sdncadapter:SvcAction>delete</sdncadapter:SvcAction>" + EOL +
+ "<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>" + EOL +
+ "<sdncadapter:CallbackUrl>http://localhost:8080/mso/SDNCAdapterCallbackService</sdncadapter:CallbackUrl>" + EOL +
+ "</sdncadapter:RequestHeader>" + EOL +
+ "<sdncadapterworkflow:SDNCRequestData>" + EOL +
+ "<request-information>" + EOL +
+ "<request-id>RaaTestRequestId-1</request-id>" + EOL +
+ "<source>MSO</source>" + EOL +
+ "<notification-url/>" + EOL +
+ "<order-number/>" + EOL +
+ "<order-version/>" + EOL +
+ "<request-action>DeleteServiceInstance</request-action>" + EOL +
+ "</request-information>" + EOL +
+ "<service-information>" + EOL +
+ "<service-id/>" + EOL +
+ "<subscription-service-type>123456789</subscription-service-type>" + EOL +
+ "<onap-model-information>" + EOL +
+ "<model-invariant-uuid/>" + EOL +
+ "<model-uuid/>" + EOL +
+ "<model-version/>" + EOL +
+ "<model-name/>" + EOL +
+ "</onap-model-information>" + EOL +
+ "<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
+ "<subscriber-name/>" + EOL +
+ "<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
+ "</service-information>" + EOL +
+ "<service-request-input>" + EOL +
+ "<service-instance-name/>" + EOL +
+ "</service-request-input>" + EOL +
+ "</sdncadapterworkflow:SDNCRequestData>" + EOL +
+ "</sdncadapterworkflow:SDNCAdapterWorkflowRequest>";
+
+ rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", req);
+
+ rollbackData.put("SERVICEINSTANCE", "sdncDelete", req1);
+ variables.put("rollbackData", rollbackData);
+
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java
index f6c5d904bd..5f2ee94fb5 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java
@@ -44,75 +44,75 @@ import org.openecomp.mso.bpmn.common.WorkflowTest;
* Unit test cases for DoCreateServiceInstance.bpmn
*/
public class DoCreateServiceInstanceTest extends WorkflowTest {
- private static final String EOL = "\n";
- private final CallbackSet callbacks = new CallbackSet();
- private final String sdncAdapterCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoCreateServiceInstanceTest() throws IOException {
- callbacks.put("assign", sdncAdapterCallback);
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
- @Test
- @Deployment(resources = {
- "subprocess/DoCreateServiceInstance.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericPutService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/DoCreateServiceInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn" })
- public void sunnyDay() throws Exception {
+ private static final String EOL = "\n";
+ private final CallbackSet callbacks = new CallbackSet();
+ private final String sdncAdapterCallback =
+ "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
- logStart();
+ public DoCreateServiceInstanceTest() throws IOException {
+ callbacks.put("assign", sdncAdapterCallback);
+ }
- //AAI
- MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml");
- MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "");
- MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "GenericFlows/getServiceInstance.xml");
- MockNodeQueryServiceInstanceByName("RAATest-si", "");
-
- MockNodeQueryServiceInstanceById("RaaTest-si-id", "");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
- MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- //SDNC
- mockSDNCAdapter(200);
- //DB
- mockUpdateRequestDB(200, "DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
+ /**
+ * Sunny day VID scenario.
+ *
+ * @throws Exception
+ */
+ //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoCreateServiceInstance.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericPutService.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/DoCreateServiceInstanceRollback.bpmn",
+ "subprocess/FalloutHandler.bpmn"})
+ public void sunnyDay() throws Exception {
- Map<String, Object> variables = new HashMap<>();
- setupVariables(variables);
- invokeSubProcess("DoCreateServiceInstance", businessKey, variables);
- injectSDNCCallbacks(callbacks, "assign");
- waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstance", "WorkflowException");
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
+ logStart();
- logEnd();
- }
+ //AAI
+ MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml");
+ MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "");
+ MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "GenericFlows/getServiceInstance.xml");
+ MockNodeQueryServiceInstanceByName("RAATest-si", "");
- // Success Scenario
- private void setupVariables(Map<String, Object> variables) {
- variables.put("mso-request-id", "RaaDSITest1");
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "RaaDSITestRequestId-1");
- variables.put("serviceInstanceId","RaaTest-si-id");
- variables.put("serviceModelInfo", "{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"}");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("globalSubscriberId", "MCBH-1610");
- variables.put("subscriptionServiceType", "viprsvc");
- variables.put("instanceName", "RAATest-1");
- }
+ MockNodeQueryServiceInstanceById("RaaTest-si-id", "");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
+ MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ //SDNC
+ mockSDNCAdapter(200);
+ //DB
+ mockUpdateRequestDB(200, "DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> variables = new HashMap<>();
+ setupVariables(variables);
+ invokeSubProcess("DoCreateServiceInstance", businessKey, variables);
+ injectSDNCCallbacks(callbacks, "assign");
+ waitForProcessEnd(businessKey, 10000);
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstance", "WorkflowException");
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+
+ logEnd();
+ }
+
+ // Success Scenario
+ private void setupVariables(Map<String, Object> variables) {
+ variables.put("mso-request-id", "RaaDSITest1");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "RaaDSITestRequestId-1");
+ variables.put("serviceInstanceId", "RaaTest-si-id");
+ variables.put("serviceModelInfo", "{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"}");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("globalSubscriberId", "MCBH-1610");
+ variables.put("subscriptionServiceType", "viprsvc");
+ variables.put("instanceName", "RAATest-1");
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java
index 25787c79b6..366327a9da 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -46,116 +46,115 @@ import org.openecomp.mso.bpmn.core.WorkflowException;
* Unit test for DoDeleteVfModule.bpmn.
*/
public class DoCreateVfModuleRollbackTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoCreateVfModuleRollbackTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModuleRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestCreateVfModuleRollbackSuccess() {
- logStart();
-
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockVNFDelete("a27ce5a9-29c4-4c22-a017-6615ac73c721", "/973ed047-d251-4fb9-bf1a-65b8949e0a73", 202);
- MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021", 200);
- MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200);
- MockPutVfModuleIdNoResponse("a27ce5a9-29c4-4c22-a017-6615ac73c721", "MMSC", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockPutGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml");
- MockGetVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "DoCreateVfModuleRollback/GenericVnfVfModule.xml", 200);
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
- rollbackData.put("VFMODULE", "source", "PORTAL");
- rollbackData.put("VFMODULE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE", "oamManagementV4Address", "127.0.0.1");
-
- rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "true");
-
-
-
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("rollbackData", rollbackData);
- variables.put("sdncVersion", "1702");
- invokeSubProcess("DoCreateVfModuleRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private static final String EOL = "\n";
+
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ private final String vnfAdapterDeleteCallbackFail =
+ "<vfModuleException>" + EOL +
+ " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
+ " <category>INTERNAL</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL;
+
+ private final String sdncAdapterDeleteCallback =
+ "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DoCreateVfModuleRollbackTest() throws IOException {
+ callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
+ callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+ callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
+ }
+
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/DoCreateVfModuleRollback.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestCreateVfModuleRollbackSuccess() {
+ logStart();
+
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
+ mockVNFDelete("a27ce5a9-29c4-4c22-a017-6615ac73c721", "/973ed047-d251-4fb9-bf1a-65b8949e0a73", 202);
+ MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021", 200);
+ MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200);
+ MockPutVfModuleIdNoResponse("a27ce5a9-29c4-4c22-a017-6615ac73c721", "MMSC", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ MockPutGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml");
+ MockGetVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "DoCreateVfModuleRollback/GenericVnfVfModule.xml", 200);
+ MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = new RollbackData();
+ rollbackData.put("VFMODULE", "source", "PORTAL");
+ rollbackData.put("VFMODULE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE", "vnfname", "STMTN5MMSC21");
+ rollbackData.put("VFMODULE", "vnftype", "asc_heat-int");
+ rollbackData.put("VFMODULE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ rollbackData.put("VFMODULE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
+ rollbackData.put("VFMODULE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
+ rollbackData.put("VFMODULE", "aiccloudregion", "RDM2WAGPLCP");
+ rollbackData.put("VFMODULE", "heatstackid", "thisisaheatstack");
+ rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
+ rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
+ rollbackData.put("VFMODULE", "oamManagementV6Address", "2000:abc:bce:1111");
+ rollbackData.put("VFMODULE", "oamManagementV4Address", "127.0.0.1");
+
+ rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true");
+ rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "true");
+ rollbackData.put("VFMODULE", "rollbackUpdateAAIVfModule", "true");
+ rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "true");
+ rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "true");
+ rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true");
+ rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "true");
+
+
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("rollbackData", rollbackData);
+ variables.put("sdncVersion", "1702");
+ invokeSubProcess("DoCreateVfModuleRollback", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
-
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ checkVariable(businessKey, "WorkflowException", null);
+ if (wfe != null) {
+ System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java
index d62c7598cb..02c8a98401 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -49,248 +49,248 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit tests for DoCreateVfModuleTest.bpmn.
*/
public class DoCreateVfModuleTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateVfModuleTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("queryVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
- callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
- callbacks.put("queryModule", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfCreate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
- }
-
- /**
- * Test the sunny day scenario.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay() throws IOException {
-
- logStart();
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the sunny day scenario with 1702 SDNC interaction.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay_1702() throws IOException {
-
- logStart();
-
- MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
- MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockPutGenericVnf("skask");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- variables.put("sdncVersion", "1702");
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
-
- injectSDNCCallbacks(callbacks, "assign, queryModule");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the sunny day scenario.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay_withVfModuleNameGeneration() throws IOException {
-
- logStart();
-
- MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
- MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockPutGenericVnf("skask");
- MockAAIVfModule();
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- variables.put("vfModuleName", null);
- variables.put("vfModuleLabel", "MODULELABEL");
- variables.put("sdncVersion", "1702");
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
-
- private Map<String, Object> setupVariablesSunnyDayBuildingBlocks() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
-
- variables.put("mso-request-id", "testRequestId");
-
- variables.put("msoRequestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("disableRollback", "true");
- //variables.put("recipeTimeout", "0");
- //variables.put("requestAction", "CREATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfName", "vnfname");
- variables.put("vfModuleName", "PCRF::module-0-2");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- variables.put("isVidRequest", "true");
- variables.put("asdcServiceModelVersion", "1.0");
- variables.put("usePreload", true);
-
- String vfModuleModelInfo = "{ "+ "\"modelType\": \"vfModule\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"MODEL-123\"" + "}";
- variables.put("vfModuleModelInfo", vfModuleModelInfo);
-
- variables.put("sdncVersion", "1707");
-
- variables.put("lcpCloudRegionId", "MDTWNJ21");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"aa5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"bb6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"SVC-STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
-
- String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"445256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"f26478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- variables.put("vnfQueryPath", "/restconf/vnfQueryPath");
-
- return variables;
-
- }
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateVfModuleTest() throws IOException {
+ callbacks.put("assign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("queryVnf", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
+ callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
+ callbacks.put("queryModule", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfCreate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
+ }
+
+ /**
+ * Test the sunny day scenario.
+ */
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn"
+ })
+ public void sunnyDay() throws IOException {
+
+ logStart();
+
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPost("", 202, "skask");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ //RuntimeService runtimeService = processEngineRule.getRuntimeService();
+
+ Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
+ //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
+ invokeSubProcess("DoCreateVfModule", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "queryVnf");
+ injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the sunny day scenario with 1702 SDNC interaction.
+ */
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn"
+ })
+ public void sunnyDay_1702() throws IOException {
+
+ logStart();
+
+ MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
+ MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
+ MockPutGenericVnf("skask");
+ mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPost("", 202, "skask");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+
+ String businessKey = UUID.randomUUID().toString();
+ //RuntimeService runtimeService = processEngineRule.getRuntimeService();
+
+ Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
+ variables.put("sdncVersion", "1702");
+ //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
+ invokeSubProcess("DoCreateVfModule", businessKey, variables);
+
+
+ injectSDNCCallbacks(callbacks, "assign, queryModule");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the sunny day scenario.
+ */
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/GenerateVfModuleName.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn"
+ })
+ public void sunnyDay_withVfModuleNameGeneration() throws IOException {
+
+ logStart();
+
+ MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
+ MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
+ MockPutGenericVnf("skask");
+ MockAAIVfModule();
+ mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPost("", 202, "skask");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+
+ String businessKey = UUID.randomUUID().toString();
+ //RuntimeService runtimeService = processEngineRule.getRuntimeService();
+
+ Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
+ variables.put("vfModuleName", null);
+ variables.put("vfModuleLabel", "MODULELABEL");
+ variables.put("sdncVersion", "1702");
+ //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
+ invokeSubProcess("DoCreateVfModule", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "assign, query");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
+
+ logEnd();
+ }
+
+
+ private Map<String, Object> setupVariablesSunnyDayBuildingBlocks() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+
+ variables.put("mso-request-id", "testRequestId");
+
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("isBaseVfModule", false);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("disableRollback", "true");
+ //variables.put("recipeTimeout", "0");
+ //variables.put("requestAction", "CREATE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfName", "vnfname");
+ variables.put("vfModuleName", "PCRF::module-0-2");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ variables.put("isVidRequest", "true");
+ variables.put("asdcServiceModelVersion", "1.0");
+ variables.put("usePreload", true);
+
+ String vfModuleModelInfo = "{ " + "\"modelType\": \"vfModule\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," +
+ "\"modelVersion\": \"1\"," +
+ "\"modelCustomizationUuid\": \"MODEL-123\"" + "}";
+ variables.put("vfModuleModelInfo", vfModuleModelInfo);
+
+ variables.put("sdncVersion", "1707");
+
+ variables.put("lcpCloudRegionId", "MDTWNJ21");
+ variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
+
+ String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"aa5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"bb6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"SVC-STMTN5MMSC21-MMSC::model-1-0\"," +
+ "\"modelVersion\": \"1\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+
+ String vnfModelInfo = "{ " + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"445256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"f26478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," +
+ "\"modelVersion\": \"1\"," +
+ "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ variables.put("vnfQueryPath", "/restconf/vnfQueryPath");
+
+ return variables;
+
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java
index e9082d9d65..aeb47c00a9 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java
@@ -35,206 +35,210 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
@Ignore
public class DoCreateVfModuleVolumeV2Test extends WorkflowTest {
-
- public static final String _prefix = "CVFMODVOL2_";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateVfModuleVolumeV2Test() throws IOException {
- callbacks.put("volumeGroupCreate", FileUtil.readResourceFile(
- "__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml"));
- callbacks.put("volumeGroupRollback", FileUtil.readResourceFile(
- "__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml"));
- }
-
- /**
- * Happy Path
- * @throws Exception
- */
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
+
+ public static final String _prefix = "CVFMODVOL2_";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateVfModuleVolumeV2Test() throws IOException {
+ callbacks.put("volumeGroupCreate", FileUtil.readResourceFile(
+ "__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml"));
+ callbacks.put("volumeGroupRollback", FileUtil.readResourceFile(
+ "__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml"));
+ }
+
+ /**
+ * Happy Path
+ *
+ * @throws Exception
+ */
+ @Test
+ //@Ignore
+ @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/vnfAdapterRestV1.bpmn",
"subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestHappyPath() throws Exception {
+ public void TestHappyPath() throws Exception {
+
+ logStart();
- logStart();
-
// DoCreateVfModuleVolume_Success();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("lcpCloudRegionId", "AAIAIC25");
- testVariables.put("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-01");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- //testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", true);
-
- logEnd();
- }
-
- @Test
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ testVariables.put("lcpCloudRegionId", "AAIAIC25");
+ testVariables.put("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-01");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ //testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", true);
+
+ logEnd();
+ }
+
+ @Test
// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
+ @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/vnfAdapterRestV1.bpmn",
"subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestVolumeGroupExistError() throws Exception {
+ public void TestVolumeGroupExistError() throws Exception {
+
+ logStart();
- logStart();
-
// DoCreateVfModuleVolume_VolumeGroupExistsFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
- Assert.assertTrue(wfe.getErrorCode() == 2500);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Will trigger AAI create rollback
- * @throws Exception
- */
- @Test
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
+ testVariables.put("vnf-id", "TEST-VNF-ID-0123");
+ testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
+
+ //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
+
+ waitForProcessEnd(businessKey, 100000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
+ Assert.assertTrue(wfe.getErrorCode() == 2500);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
+ checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Will trigger AAI create rollback
+ *
+ * @throws Exception
+ */
+ @Test
// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
+ @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/vnfAdapterRestV1.bpmn",
"subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestVnfVolumeGroupCreateError() throws Exception {
+ public void TestVnfVolumeGroupCreateError() throws Exception {
+
+ logStart();
- logStart();
-
// DoCreateVfModuleVolume_VnfCreateVolumeGroupFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Will trigger AAI create rollback
- * @throws Exception
- */
- @Test
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
+ testVariables.put("vnf-id", "TEST-VNF-ID-0123");
+ testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
+
+ //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Will trigger AAI create rollback
+ *
+ * @throws Exception
+ */
+ @Test
// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
+ @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/vnfAdapterRestV1.bpmn",
"subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestUpdateAaiVolumeGroupError() throws Exception {
+ public void TestUpdateAaiVolumeGroupError() throws Exception {
+
+ logStart();
- logStart();
-
// DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- // VNF callback not needed fort this failure scenario
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
+ testVariables.put("vnf-id", "TEST-VNF-ID-0123");
+ testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
+
+ // VNF callback not needed fort this failure scenario
// injectVNFRestCallbacks(callbacks, "volumeGroupCreate,volumeGroupRollback");
-
- waitForProcessEnd(businessKey, 100000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
- Assert.assertTrue(wfe.getErrorCode() == 2500);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Will trigger not trigger rollback
- * @throws Exception
- */
- @Test
+
+ waitForProcessEnd(businessKey, 100000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
+ Assert.assertTrue(wfe.getErrorCode() == 2500);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
+ checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Will trigger not trigger rollback
+ *
+ * @throws Exception
+ */
+ @Test
// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
+ @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/vnfAdapterRestV1.bpmn",
"subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestUpdateAaiVolumeGroupErrorNoRollback() throws Exception {
+ public void TestUpdateAaiVolumeGroupErrorNoRollback() throws Exception {
+
+ logStart();
- logStart();
-
// DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- // VNF callback not needed fort this failure scenario
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
+ testVariables.put("vnf-id", "TEST-VNF-ID-0123");
+ testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
+
+ // VNF callback not needed fort this failure scenario
// injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
- Assert.assertTrue(wfe.getErrorCode() == 2500);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
+
+ waitForProcessEnd(businessKey, 100000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
+ Assert.assertTrue(wfe.getErrorCode() == 2500);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
+ checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java
index fb2160d970..adcbbb4d72 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java
@@ -55,371 +55,370 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit test for DoCreateVnfAndModulesRollback.bpmn.
*/
public class DoCreateVnfAndModulesRollbackTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
-
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoCreateVnfAndModulesRollbackTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- callbacks.put("deactivate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- }
-
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/DoCreateVfModuleRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn"
- })
- public void TestDoCreateVnfAndModulesRollbackSuccess_BaseOnly() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockVNFDelete(".*", "/.*", 202);
- mockVfModuleDelete("78987");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml");
- MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721.*", "DoCreateVfModule_getVnfResponse.xml", 200);
- MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021");
- MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("VFMODULE_BASE", "source", "PORTAL");
- rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1");
-
- rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true");
-
- rollbackData.put("VNF", "vnfId", "testVnfId123");
-
- rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0");
-
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- variables.put("rollbackData", rollbackData);
- invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private static final String EOL = "\n";
+
+
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ private final String vnfAdapterDeleteCallbackFail =
+ "<vfModuleException>" + EOL +
+ " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
+ " <category>INTERNAL</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL;
+
+ private final String sdncAdapterDeleteCallback =
+ "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DoCreateVnfAndModulesRollbackTest() throws IOException {
+ callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
+ callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+ callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
+ callbacks.put("deactivate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ }
+
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn",
+ "subprocess/DoCreateVfModuleRollback.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn"
+ })
+ public void TestDoCreateVnfAndModulesRollbackSuccess_BaseOnly() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
+ mockVNFDelete(".*", "/.*", 202);
+ mockVfModuleDelete("78987");
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml");
+ MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721.*", "DoCreateVfModule_getVnfResponse.xml", 200);
+ MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021");
+ MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put("VFMODULE_BASE", "source", "PORTAL");
+ rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21");
+ rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int");
+ rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
+ rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
+ rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP");
+ rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack");
+ rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
+ rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
+ rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111");
+ rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1");
+
+ rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true");
+
+ rollbackData.put("VNF", "vnfId", "testVnfId123");
+
+ rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0");
+
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+ variables.put("rollbackData", rollbackData);
+ invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn"
- })
- public void TestDoCreateVnfAndModulesRollbackSuccess_vnfOnly() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- MockDoDeleteVfModule_SDNCSuccess();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("VNF", "vnfId", "testVnfId123");
- rollbackData.put("VNF", "rollbackVnfCreate", "true");
- rollbackData.put("VNF", "rollbackSDNCAssign", "true");
- rollbackData.put("VNF", "rollbackSDNCActivate", "true");
- rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0");
-
-
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
-
- variables.put("rollbackData", rollbackData);
- variables.put("sdncVersion", "1707");
- invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ checkVariable(businessKey, "WorkflowException", null);
+ if (wfe != null) {
+ System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn"
+ })
+ public void TestDoCreateVnfAndModulesRollbackSuccess_vnfOnly() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ MockDoDeleteVfModule_SDNCSuccess();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put("VNF", "vnfId", "testVnfId123");
+ rollbackData.put("VNF", "rollbackVnfCreate", "true");
+ rollbackData.put("VNF", "rollbackSDNCAssign", "true");
+ rollbackData.put("VNF", "rollbackSDNCActivate", "true");
+ rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0");
+
+
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+
+ variables.put("rollbackData", rollbackData);
+ variables.put("sdncVersion", "1707");
+ invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
- // injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/DoCreateVfModuleRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn"
- })
- public void TestDoCreateVnfAndModulesRollbackSuccess_AddOn() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockVNFDelete(".*", "/.*", 202);
- mockVfModuleDelete("78987");
- MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml");
- MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721", "DoCreateVfModule_getVnfResponse.xml", 200);
- MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021");
- MockDeleteVfModuleId("", "", "", 200);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("VFMODULE_BASE", "source", "PORTAL");
- rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1");
- rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true");
- rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
-
- rollbackData.put("VFMODULE_ADDON_1", "source", "PORTAL");
- rollbackData.put("VFMODULE_ADDON_1", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_ADDON_1", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE_ADDON_1", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE_ADDON_1", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE_ADDON_1", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE_ADDON_1", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE_ADDON_1", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE_ADDON_1", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE_ADDON_1", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE_ADDON_1", "oamManagementV4Address", "127.0.0.1");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateVnfAAI", "true");
- rollbackData.put("VFMODULE_ADDON_1", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_ADDON_1", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- rollbackData.put("VNF", "vnfId", "testVnfId123");
-
- rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "1");
-
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
-
- variables.put("rollbackData", rollbackData);
- invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
- // injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
+ //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
+ // injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ checkVariable(businessKey, "WorkflowException", null);
+ if (wfe != null) {
+ System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn",
+ "subprocess/DoCreateVfModuleRollback.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn"
+ })
+ public void TestDoCreateVnfAndModulesRollbackSuccess_AddOn() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
+ mockVNFDelete(".*", "/.*", 202);
+ mockVfModuleDelete("78987");
+ MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml");
+ MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721", "DoCreateVfModule_getVnfResponse.xml", 200);
+ MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml");
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021");
+ MockDeleteVfModuleId("", "", "", 200);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put("VFMODULE_BASE", "source", "PORTAL");
+ rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21");
+ rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int");
+ rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
+ rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
+ rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP");
+ rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack");
+ rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
+ rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
+ rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111");
+ rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1");
+ rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true");
+ rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+
+ rollbackData.put("VFMODULE_ADDON_1", "source", "PORTAL");
+ rollbackData.put("VFMODULE_ADDON_1", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_ADDON_1", "vnfname", "STMTN5MMSC21");
+ rollbackData.put("VFMODULE_ADDON_1", "vnftype", "asc_heat-int");
+ rollbackData.put("VFMODULE_ADDON_1", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ rollbackData.put("VFMODULE_ADDON_1", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
+ rollbackData.put("VFMODULE_ADDON_1", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
+ rollbackData.put("VFMODULE_ADDON_1", "aiccloudregion", "RDM2WAGPLCP");
+ rollbackData.put("VFMODULE_ADDON_1", "heatstackid", "thisisaheatstack");
+ rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
+ rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
+ rollbackData.put("VFMODULE_ADDON_1", "oamManagementV6Address", "2000:abc:bce:1111");
+ rollbackData.put("VFMODULE_ADDON_1", "oamManagementV4Address", "127.0.0.1");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackPrepareUpdateVfModule", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackVnfAdapterCreate", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackSDNCRequestActivate", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateNetworkPoliciesAAI", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateVnfAAI", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_ADDON_1", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+ rollbackData.put("VNF", "vnfId", "testVnfId123");
+
+ rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "1");
+
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+
+ variables.put("rollbackData", rollbackData);
+ invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
+ // injectSDNCCallbacks(callbacks, "sdncChangeDelete");
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ checkVariable(businessKey, "WorkflowException", null);
+ if (wfe != null) {
+ System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+ public static void MockDoDeleteVfModule_SDNCSuccess() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>deactivate"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>unassign"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java
index c8f97cac04..37a5b4b806 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java
@@ -53,322 +53,320 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
/**
* Unit Test for the DoCreateVnfAndModules Flow
- *
*/
public class DoCreateVnfAndModulesTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateVnfAndModulesTest() throws IOException {
-
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("queryVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
- callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
- callbacks.put("queryModule", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
- callbacks.put("vnfCreate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
- }
-
- @Test
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateVnfAndModulesTest() throws IOException {
+
+ callbacks.put("assign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("queryVnf", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
+ callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
+ callbacks.put("queryModule", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
+ callbacks.put("vnfCreate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
+ }
+
+ @Test
@Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Deployment(resources = {"subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/DoCreateVnf.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/DoCreateVnfAndModules.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DoCreateVnfAndModulesRollback.bpmn"})
- public void testDoCreateVnfAndModulesBaseOnly_success() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- MockGetGenericVnfById_404("testVnfId");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoCreateVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "query");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("true", "true", "false", "true", "Success", null);
-
- }
-
- @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericPutVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/DoCreateVnf.bpmn",
+ "subprocess/GenerateVfModuleName.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/DoCreateVnfAndModules.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn"})
+ public void testDoCreateVnfAndModulesBaseOnly_success() throws Exception {
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ MockGetGenericVnfById_404("testVnfId");
+ MockPutGenericVnf(".*");
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ invokeSubProcess("DoCreateVnfAndModules", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "query");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryVnf");
+ injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ assertVariables("true", "true", "false", "true", "Success", null);
+
+ }
+
+ @Test
@Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Deployment(resources = {"subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/DoCreateVnf.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/DoCreateVnfAndModules.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DoCreateVnfAndModulesRollback.bpmn"})
- public void testDoCreateVnfAndModulesWithAddon_success() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- MockGetGenericVnfById_404("testVnfId");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesAddonSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoCreateVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "query");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("true", "true", "false", "true", "Success", null);
-
- }
-
- private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
-
- String siFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_FoundIndicator");
- String siSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_SuccessIndicator");
- String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_FoundIndicator");
- String vnfSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_SuccessIndicator");
- String response = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1");
-
- //assertEquals(exSIFound, siFound);
- //assertEquals(exSISucc, siSucc);
- //assertEquals(exVnfFound, vnfFound);
- //assertEquals(exVnfSucc, vnfSucc);
- //assertEquals(exResponse, response);
- assertEquals(exWorkflowException, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", request);
- variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("requestId", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("disableRollback", "true");
- //variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
- variables.put("cloudConfiguration", cloudConfiguration);
- variables.put("sdncVersion", "1707");
- variables.put("globalSubscriberId", "subscriber123");
-
- try {
- String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json");
- ServiceDecomposition sd = new ServiceDecomposition();
- ModelInfo serviceModel = new ModelInfo();
- serviceModel.setModelName("servicewithVNFs");
- sd.setModelInfo(serviceModel);
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.constructVnfType("vnf1");
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelVersion("1");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- sd.addVnfResource(vr);
-
- variables.put("serviceDecomposition", sd);
- variables.put("isTest", true);
- } catch(Exception e) {
-
- }
-
- }
-
- private void setVariablesAddonSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("requestId", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("disableRollback", "true");
- //variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
- variables.put("cloudConfiguration", cloudConfiguration);
- variables.put("sdncVersion", "1707");
- variables.put("globalSubscriberId", "subscriber123");
-
- try {
- String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json");
- ServiceDecomposition sd = new ServiceDecomposition();
- ModelInfo serviceModel = new ModelInfo();
- serviceModel.setModelName("servicewithVNFs");
- sd.setModelInfo(serviceModel);
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelVersion("1");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- ModuleResource mr1 = new ModuleResource();
- ModelInfo mvmr1 = new ModelInfo();
- mvmr1.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr1.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr1.setModelVersion("1");
- mvmr1.setModelCustomizationUuid("MODEL-123");
- mr1.setModelInfo(mvmr1);
- mr1.setIsBase(false);
- mr1.setVfModuleLabel("MODULELABEL");
- mr1.setInitialCount(1);
- vr.addVfModule(mr1);
-
- sd.addVnfResource(vr);
-
- variables.put("serviceDecomposition", sd);
- variables.put("isTest", true);
- } catch(Exception e) {
-
-
-
- }
- }
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericPutVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/DoCreateVnf.bpmn",
+ "subprocess/GenerateVfModuleName.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/DoCreateVnfAndModules.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn"})
+ public void testDoCreateVnfAndModulesWithAddon_success() throws Exception {
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ MockGetGenericVnfById_404("testVnfId");
+ MockPutGenericVnf(".*");
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesAddonSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ invokeSubProcess("DoCreateVnfAndModules", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "query");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryVnf");
+ injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryVnf");
+ injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ assertVariables("true", "true", "false", "true", "Success", null);
+
+ }
+
+ private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
+
+ String siFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_FoundIndicator");
+ String siSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_SuccessIndicator");
+ String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_FoundIndicator");
+ String vnfSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_SuccessIndicator");
+ String response = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1");
+
+ //assertEquals(exSIFound, siFound);
+ //assertEquals(exSISucc, siSucc);
+ //assertEquals(exVnfFound, vnfFound);
+ //assertEquals(exVnfSucc, vnfSucc);
+ //assertEquals(exResponse, response);
+ assertEquals(exWorkflowException, workflowException);
+ }
+
+ private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("bpmnRequest", request);
+ variables.put("mso-request-id", requestId);
+ variables.put("serviceInstanceId", siId);
+ variables.put("testVnfId", "testVnfId123");
+ variables.put("vnfType", "STMTN");
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("requestId", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId", siId);
+ variables.put("disableRollback", "true");
+ //variables.put("testVnfId","testVnfId123");
+ variables.put("vnfType", "STMTN");
+
+ String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
+ "\"lcpCloudRegionId\": \"mdt1\"," +
+ "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
+ variables.put("cloudConfiguration", cloudConfiguration);
+ variables.put("sdncVersion", "1707");
+ variables.put("globalSubscriberId", "subscriber123");
+
+ try {
+ String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json");
+ ServiceDecomposition sd = new ServiceDecomposition();
+ ModelInfo serviceModel = new ModelInfo();
+ serviceModel.setModelName("servicewithVNFs");
+ sd.setModelInfo(serviceModel);
+ VnfResource vr = new VnfResource();
+ ModelInfo mvr = new ModelInfo();
+ mvr.setModelName("vSAMP12");
+ mvr.setModelInstanceName("v123");
+ mvr.setModelInvariantUuid("");
+ mvr.setModelVersion("1.0");
+ mvr.setModelCustomizationUuid("MODEL-ID-1234");
+ vr.setModelInfo(mvr);
+ vr.constructVnfType("vnf1");
+ vr.setNfType("somenftype");
+ vr.setNfRole("somenfrole");
+ vr.setNfFunction("somenffunction");
+ vr.setNfNamingCode("somenamingcode");
+ ModuleResource mr = new ModuleResource();
+ ModelInfo mvmr = new ModelInfo();
+ mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
+ mvmr.setModelVersion("1");
+ mvmr.setModelCustomizationUuid("MODEL-123");
+ mr.setModelInfo(mvmr);
+ mr.setIsBase(true);
+ mr.setVfModuleLabel("MODULELABEL");
+ vr.addVfModule(mr);
+ sd.addVnfResource(vr);
+
+ variables.put("serviceDecomposition", sd);
+ variables.put("isTest", true);
+ } catch (Exception e) {
+
+ }
+
+ }
+
+ private void setVariablesAddonSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("requestId", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId", siId);
+ variables.put("disableRollback", "true");
+ //variables.put("testVnfId","testVnfId123");
+ variables.put("vnfType", "STMTN");
+
+ String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
+ "\"lcpCloudRegionId\": \"mdt1\"," +
+ "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
+ variables.put("cloudConfiguration", cloudConfiguration);
+ variables.put("sdncVersion", "1707");
+ variables.put("globalSubscriberId", "subscriber123");
+
+ try {
+ String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json");
+ ServiceDecomposition sd = new ServiceDecomposition();
+ ModelInfo serviceModel = new ModelInfo();
+ serviceModel.setModelName("servicewithVNFs");
+ sd.setModelInfo(serviceModel);
+ VnfResource vr = new VnfResource();
+ ModelInfo mvr = new ModelInfo();
+ mvr.setModelName("vSAMP12");
+ mvr.setModelInstanceName("v123");
+ mvr.setModelInvariantUuid("");
+ mvr.setModelVersion("1.0");
+ mvr.setModelCustomizationUuid("MODEL-ID-1234");
+ vr.setModelInfo(mvr);
+ vr.setNfType("somenftype");
+ vr.setNfRole("somenfrole");
+ vr.setNfFunction("somenffunction");
+ vr.setNfNamingCode("somenamingcode");
+ ModuleResource mr = new ModuleResource();
+ ModelInfo mvmr = new ModelInfo();
+ mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
+ mvmr.setModelVersion("1");
+ mvmr.setModelCustomizationUuid("MODEL-123");
+ mr.setModelInfo(mvmr);
+ mr.setIsBase(true);
+ mr.setVfModuleLabel("MODULELABEL");
+ vr.addVfModule(mr);
+ ModuleResource mr1 = new ModuleResource();
+ ModelInfo mvmr1 = new ModelInfo();
+ mvmr1.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ mvmr1.setModelName("STMTN5MMSC21-MMSC::model-1-0");
+ mvmr1.setModelVersion("1");
+ mvmr1.setModelCustomizationUuid("MODEL-123");
+ mr1.setModelInfo(mvmr1);
+ mr1.setIsBase(false);
+ mr1.setVfModuleLabel("MODULELABEL");
+ mr1.setInitialCount(1);
+ vr.addVfModule(mr1);
+
+ sd.addVnfResource(vr);
+
+ variables.put("serviceDecomposition", sd);
+ variables.put("isTest", true);
+ } catch (Exception e) {
+
+
+ }
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java
index 90d562e101..efd832735f 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java
@@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -46,83 +46,82 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
/**
* Unit Test for the DoCreateVnf Flow
- *
*/
public class DoCreateVnfTest extends WorkflowTest {
- private String createVnfInfraRequest;
- private final CallbackSet callbacks = new CallbackSet();
-
-
- public DoCreateVnfTest() throws IOException {
- createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json");
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/DoCreateVnf.bpmn"})
- public void testDoCreateVnfInfra_success() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- MockGetGenericVnfByName_404("testVnfName123");
- MockPutGenericVnf("testVnfId123");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoCreateVnf", businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("true", "true", "false", "true", "Success", null);
- }
-
- private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1");
-
- assertEquals(exWorkflowException, workflowException);
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- //variables.put("bpmnRequest", request);
- variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("vnfName", "testVnfName123");
- variables.put("disableRollback", "true");
- variables.put("requestId", requestId);
- variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{ " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}";
- variables.put("cloudConfiguration", cloudConfiguration);
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("globalSubscriberId", "MSO-1610");
- }
+ private String createVnfInfraRequest;
+ private final CallbackSet callbacks = new CallbackSet();
+
+
+ public DoCreateVnfTest() throws IOException {
+ createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json");
+ callbacks.put("assign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/DoCreateVnf.bpmn"})
+ public void testDoCreateVnfInfra_success() throws Exception {
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ MockGetGenericVnfByName_404("testVnfName123");
+ MockPutGenericVnf("testVnfId123");
+ mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ invokeSubProcess("DoCreateVnf", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ assertVariables("true", "true", "false", "true", "Success", null);
+ }
+
+ private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1");
+
+ assertEquals(exWorkflowException, workflowException);
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ //variables.put("bpmnRequest", request);
+ variables.put("mso-request-id", requestId);
+ variables.put("serviceInstanceId", siId);
+ variables.put("vnfName", "testVnfName123");
+ variables.put("disableRollback", "true");
+ variables.put("requestId", requestId);
+ variables.put("testVnfId", "testVnfId123");
+ variables.put("vnfType", "STMTN");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ String vnfModelInfo = "{ " + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
+ "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ String cloudConfiguration = "{ " +
+ "\"lcpCloudRegionId\": \"mdt1\"," +
+ "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}";
+ variables.put("cloudConfiguration", cloudConfiguration);
+
+ String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ variables.put("globalSubscriberId", "MSO-1610");
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java
index 37814999ba..a5d4a95ad1 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java
@@ -43,66 +43,66 @@ import org.openecomp.mso.bpmn.common.WorkflowTest;
*/
public class DoDeleteServiceInstanceTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
- private static final String EOL = "\n";
- private final String sdncAdapterCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoDeleteServiceInstanceTest() throws IOException {
- callbacks.put("deactivate", sdncAdapterCallback);
- callbacks.put("delete", sdncAdapterCallback);
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteServiceInstance.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn" })
- public void sunnyDay() throws Exception {
+ private final CallbackSet callbacks = new CallbackSet();
+ private static final String EOL = "\n";
+ private final String sdncAdapterCallback =
+ "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
- logStart();
+ public DoDeleteServiceInstanceTest() throws IOException {
+ callbacks.put("deactivate", sdncAdapterCallback);
+ callbacks.put("delete", sdncAdapterCallback);
+ }
- //AAI
- MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "", 204);
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
- MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- //SDNC
- mockSDNCAdapter(200);
- //DB
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
+ /**
+ * Sunny day VID scenario.
+ *
+ * @throws Exception
+ */
+ //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteServiceInstance.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericDeleteService.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"})
+ public void sunnyDay() throws Exception {
- Map<String, Object> variables = new HashMap<>();
- setupVariables(variables);
- invokeSubProcess("DoDeleteServiceInstance", businessKey, variables);
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteServiceInstance", "WorkflowException");
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
+ logStart();
- logEnd();
- }
+ //AAI
+ MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "", 204);
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
+ MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ //SDNC
+ mockSDNCAdapter(200);
+ //DB
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
- // Success Scenario
- private void setupVariables(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "RaaDDSIRequestId-1");
- variables.put("mso-request-id", "RaaDDSIRequestId-1");
- variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
- }
+ Map<String, Object> variables = new HashMap<>();
+ setupVariables(variables);
+ invokeSubProcess("DoDeleteServiceInstance", businessKey, variables);
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ waitForProcessEnd(businessKey, 10000);
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteServiceInstance", "WorkflowException");
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+
+ logEnd();
+ }
+
+ // Success Scenario
+ private void setupVariables(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "RaaDDSIRequestId-1");
+ variables.put("mso-request-id", "RaaDDSIRequestId-1");
+ variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java
index 13b2f5432d..16f3acfa8a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java
@@ -41,137 +41,136 @@ import org.openecomp.mso.bpmn.common.WorkflowTest;
import org.openecomp.mso.bpmn.core.WorkflowException;
public class DoDeleteVfModuleFromVnfTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoDeleteVfModuleFromVnfTest() throws IOException {
- callbacks.put("deactivate", sdncAdapterDeleteCallback);
- callbacks.put("unassign", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- private final String wfeString = "WorkflowException";
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModuleFromVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestDoDeleteVfModuleFromVnfSuccess() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIDeleteVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
- variables.put("sdncVersion", "1707");
-
- invokeSubProcess("DoDeleteVfModuleFromVnf", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- checkVariable(businessKey, wfeString, null);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
-
- // start of mocks used locally and by other VF Module unit tests
-
-
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
-
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private static final String EOL = "\n";
+
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ private final String vnfAdapterDeleteCallbackFail =
+ "<vfModuleException>" + EOL +
+ " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
+ " <category>INTERNAL</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL;
+
+ private final String sdncAdapterDeleteCallback =
+ "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DoDeleteVfModuleFromVnfTest() throws IOException {
+ callbacks.put("deactivate", sdncAdapterDeleteCallback);
+ callbacks.put("unassign", sdncAdapterDeleteCallback);
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+ callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
+ }
+
+ private final String wfeString = "WorkflowException";
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModuleFromVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn"
+ })
+ public void TestDoDeleteVfModuleFromVnfSuccess() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIDeleteVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
+ variables.put("sdncVersion", "1707");
+
+ invokeSubProcess("DoDeleteVfModuleFromVnf", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ //waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ checkVariable(businessKey, wfeString, null);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+
+ // start of mocks used locally and by other VF Module unit tests
+
+
+ public static void MockDoDeleteVfModule_SDNCSuccess() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>deactivate"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>unassign"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ }
+
+
+ public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
+ stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+
} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java
index 578fda3910..e3ecf30f7a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -49,516 +49,516 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit test for DoDeleteVfModule.bpmn.
*/
public class DoDeleteVfModuleTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoDeleteVfModuleTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleCallbackResponse.xml"));
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- private final String wfeString = "WorkflowException";
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleSuccess() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest",request);
- variables.put("isVidRequest", "true");
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private static final String EOL = "\n";
+
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ private final String vnfAdapterDeleteCallbackFail =
+ "<vfModuleException>" + EOL +
+ " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
+ " <category>INTERNAL</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL;
+
+ private final String sdncAdapterDeleteCallback =
+ "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DoDeleteVfModuleTest() throws IOException {
+ callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
+ callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
+ callbacks.put("vnfDelete", FileUtil.readResourceFile(
+ "__files/DeleteVfModuleCallbackResponse.xml"));
+ callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
+ }
+
+ private final String wfeString = "WorkflowException";
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModuleSuccess() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("DoDeleteVfModuleRequest", request);
+ variables.put("isVidRequest", "true");
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- checkVariable(businessKey, wfeString, null);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModule_Building_Block_Success() {
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
-
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("requestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("isDebugLogEnabled","true");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
- variables.put("sdncVersion", "1610");
- variables.put("isVidRequest", "true");
- variables.put("retainResources", false);
- String vfModuleModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("vfModuleModelInfo", vfModuleModelInfo);
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"RDM2WAGPLCP\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- variables.put("cloudConfiguration", cloudConfiguration);
-
-
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ checkVariable(businessKey, wfeString, null);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModule_Building_Block_Success() {
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("requestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
+ variables.put("sdncVersion", "1610");
+ variables.put("isVidRequest", "true");
+ variables.put("retainResources", false);
+ String vfModuleModelInfo = "{" + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
+ "}";
+ variables.put("vfModuleModelInfo", vfModuleModelInfo);
+
+ String cloudConfiguration = "{" +
+ "\"lcpCloudRegionId\": \"RDM2WAGPLCP\"," +
+ "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
+ variables.put("cloudConfiguration", cloudConfiguration);
+
+
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- checkVariable(businessKey, wfeString, null);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModule_Building_Block_Success: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleSDNCFailure() {
- // delete the Base Module and Generic Vnf - SDNCAdapter failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCFailure();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest", request);
- variables.put("isVidRequest", "true");
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ checkVariable(businessKey, wfeString, null);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModule_Building_Block_Success: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModuleSDNCFailure() {
+ // delete the Base Module and Generic Vnf - SDNCAdapter failure
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ logStart();
+ MockDoDeleteVfModule_SDNCFailure();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("DoDeleteVfModuleRequest", request);
+ variables.put("isVidRequest", "true");
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- // cause a failure by not injecting a callback
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ // cause a failure by not injecting a callback
// injectSDNCCallbacks(callbacks, "sdncDelete");
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSDNCFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 7000);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Could not communicate"));
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleSDNCCallbackFailure() {
- // delete the Base Module and Generic Vnf - SDNCAdapter Callback failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest",request);
- variables.put("isVidRequest", "true");
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ Assert.assertNotNull(wfe);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleSDNCFailure: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ Assert.assertTrue(wfe.getErrorCode() == 7000);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Could not communicate"));
+ }
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModuleSDNCCallbackFailure() {
+ // delete the Base Module and Generic Vnf - SDNCAdapter Callback failure
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("DoDeleteVfModuleRequest", request);
+ variables.put("isVidRequest", "true");
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete:ERR");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- // return a failure in the callback
- injectSDNCCallbacks(callbacks, "sdncDelete:ERR");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSDNCCallbackFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 5310);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from SDN-C"));
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleVNFFailure() {
- // delete the Base Module and Generic Vnf - VNFAdapter failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFFailure();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest",request);
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ // return a failure in the callback
+ injectSDNCCallbacks(callbacks, "sdncDelete:ERR");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ Assert.assertNotNull(wfe);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleSDNCCallbackFailure: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ Assert.assertTrue(wfe.getErrorCode() == 5310);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from SDN-C"));
+ }
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModuleVNFFailure() {
+ // delete the Base Module and Generic Vnf - VNFAdapter failure
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFFailure();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("DoDeleteVfModuleRequest", request);
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- // cause a failure by not injecting a callback
+ // cause a failure by not injecting a callback
// injectVNFRestCallbacks(callbacks, "vnfDelete");
// waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
// injectSDNCCallbacks(callbacks, "sdncDelete");
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleVNFFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 7020);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from VnfAdapter"));
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleVNFCallbackFailure() {
- // delete the Base Module and Generic Vnf - VNFAdapter Callback failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest",request);
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ Assert.assertNotNull(wfe);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleVNFFailure: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ Assert.assertTrue(wfe.getErrorCode() == 7020);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from VnfAdapter"));
+ }
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModuleVNFCallbackFailure() {
+ // delete the Base Module and Generic Vnf - VNFAdapter Callback failure
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("DoDeleteVfModuleRequest", request);
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDeleteFail");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectVNFRestCallbacks(callbacks, "vnfDeleteFail");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
// injectSDNCCallbacks(callbacks, "sdncDelete");
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleVNFCallbackFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 7020);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Received vfModuleException from VnfAdapter"));
- }
- logEnd();
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockAAIVfModulePUT(boolean isCreate){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MMSC"))
- .willReturn(aResponse()
- .withStatus(isCreate ? 201 : 200)));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>changedelete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>delete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
- public static void MockDoDeleteVfModule_SDNCFailure() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>changedelete"))
- .willReturn(aResponse()
- .withStatus(500)));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>delete"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void MockDoDeleteVfModule_DeleteVNFFailure() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/xml")));
- }
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ Assert.assertNotNull(wfe);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleVNFCallbackFailure: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ Assert.assertTrue(wfe.getErrorCode() == 7020);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Received vfModuleException from VnfAdapter"));
+ }
+ logEnd();
+ }
+
+ // start of mocks used locally and by other VF Module unit tests
+ public static void MockAAIVfModulePUT(boolean isCreate) {
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("MMSC"))
+ .willReturn(aResponse()
+ .withStatus(isCreate ? 201 : 200)));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("PCRF"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockDoDeleteVfModule_SDNCSuccess() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>changedelete"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>delete"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ }
+
+ public static void MockDoDeleteVfModule_SDNCFailure() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>changedelete"))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>delete"))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
+ stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void MockDoDeleteVfModule_DeleteVNFFailure() {
+ stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "application/xml")));
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java
index 165debe7f1..8d2991e7f2 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java
@@ -40,159 +40,159 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
public class DoDeleteVfModuleVolumeV2Test extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoDeleteVfModuleVolumeV2Test() throws IOException {
- callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void happyPath() throws Exception {
-
- logStart();
-
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockPutVNFVolumeGroup("78987", 202);
- mockVfModuleDelete("78987");
- MockDeleteVolumeGroupById("AAIAIC25", "78987", "0000020", 200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetVolumeGroupById("AAIAIC25", "78987", "VfModularity/VolumeGroup.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- //testVariables.put("lcpCloudRegionId", "MDTWNJ21");
- //testVariables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "true");
-
- logEnd();
- }
-
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void testVolumeGroupInUse() throws Exception {
-
- logStart();
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockVfModuleDelete("78987");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "false");
- WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
-
-
- logEnd();
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void testTenantIdMismatch() throws Exception {
-
- logStart();
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockVfModuleDelete("78987", 404);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421xxx\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "false");
- WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
-
-
- logEnd();
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void testVnfAdapterCallfail() throws Exception {
-
- logStart();
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockVfModuleDelete("78987", 404);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "false");
- WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
-
- logEnd();
- }
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoDeleteVfModuleVolumeV2Test() throws IOException {
+ callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
+ "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
+ public void happyPath() throws Exception {
+
+ logStart();
+
+ MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+ MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
+ MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
+ mockPutVNFVolumeGroup("78987", 202);
+ mockVfModuleDelete("78987");
+ MockDeleteVolumeGroupById("AAIAIC25", "78987", "0000020", 200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockGetVolumeGroupById("AAIAIC25", "78987", "VfModularity/VolumeGroup.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
+ testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("isDebugLogEnabled", "true");
+ //testVariables.put("lcpCloudRegionId", "MDTWNJ21");
+ //testVariables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
+
+ String cloudConfiguration = "{" +
+ "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
+ "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
+ testVariables.put("cloudConfiguration", cloudConfiguration);
+
+ invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "wasDeleted", "true");
+
+ logEnd();
+ }
+
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
+ public void testVolumeGroupInUse() throws Exception {
+
+ logStart();
+ MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+ MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml");
+ MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
+ mockVfModuleDelete("78987");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
+ testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("isDebugLogEnabled", "true");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
+
+ String cloudConfiguration = "{" +
+ "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
+ "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
+ testVariables.put("cloudConfiguration", cloudConfiguration);
+
+ invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "wasDeleted", "false");
+ WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
+
+
+ logEnd();
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
+ public void testTenantIdMismatch() throws Exception {
+
+ logStart();
+ MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+ MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
+ MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
+ mockVfModuleDelete("78987", 404);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
+ testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("isDebugLogEnabled", "true");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
+
+ String cloudConfiguration = "{" +
+ "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
+ "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421xxx\"" + "}";
+ testVariables.put("cloudConfiguration", cloudConfiguration);
+
+ invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "wasDeleted", "false");
+ WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
+
+
+ logEnd();
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
+ public void testVnfAdapterCallfail() throws Exception {
+
+ logStart();
+ MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+ MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
+ MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
+ mockVfModuleDelete("78987", 404);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
+ testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("isDebugLogEnabled", "true");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
+
+ String cloudConfiguration = "{" +
+ "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
+ "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
+ testVariables.put("cloudConfiguration", cloudConfiguration);
+
+ invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "wasDeleted", "false");
+ WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java
index a9dde90327..033f77c106 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java
@@ -49,162 +49,162 @@ import org.openecomp.mso.bpmn.common.WorkflowTest;
import org.openecomp.mso.bpmn.mock.FileUtil;
public class DoDeleteVnfAndModulesTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
- private static final String EOL = "\n";
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- public DoDeleteVnfAndModulesTest () throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModule.bpmn"})
- public void testDoDeleteVnfAndModules_successVnfOnly() throws Exception{
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(200);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesVnfOnly(variables);
- invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
-
- assertEquals(null, workflowException);
- }
-
-
- private void setVariablesVnfOnly(Map<String, Object> variables) {
- variables.put("mso-request-id", "testRequestId123");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId","testVnfId123");
- variables.put("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET");
- //variables.put("vnfName", "testVnfName123");
- variables.put("disableRollback", "true");
- variables.put("msoRequestId", "testVnfId123");
- variables.put("testVnfId","testVnfId123");
- //variables.put("vnfType", "STMTN");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- //variables.put("vnfModelInfo", vnfModelInfo);
-
- variables.put("lcpCloudRegionId", "mdt1");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- //variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("globalSubscriberId", "MSO-1610");
- variables.put("sdncVersion", "1707");
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModuleFromVnf.bpmn", "subprocess/VnfAdapterRestV1.bpmn", "subprocess/DeleteAAIVfModule.bpmn"})
- public void testDoDeleteVnfAndModules_successVnfAndModules() throws Exception{
- MockAAIGenericVnfSearch();
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(200);
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIDeleteVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesVnfAndModules(variables);
- invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "deactivate");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- injectSDNCCallbacks(callbacks, "unassign");
- MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
- injectSDNCCallbacks(callbacks, "unassign");
- //MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
-
- assertEquals(null, workflowException);
- }
-
-
- private void setVariablesVnfAndModules(Map<String, Object> variables) {
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId","a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- //variables.put("testVnfId","testVnfId123");
-
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
-
- variables.put("sdncVersion", "1707");
-
- }
-
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
+ private final CallbackSet callbacks = new CallbackSet();
+ private static final String EOL = "\n";
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ public DoDeleteVnfAndModulesTest() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModule.bpmn"})
+ public void testDoDeleteVnfAndModules_successVnfOnly() throws Exception {
+ MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(200);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesVnfOnly(variables);
+ invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
+
+ assertEquals(null, workflowException);
+ }
+
+
+ private void setVariablesVnfOnly(Map<String, Object> variables) {
+ variables.put("mso-request-id", "testRequestId123");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfId", "testVnfId123");
+ variables.put("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ //variables.put("vnfName", "testVnfName123");
+ variables.put("disableRollback", "true");
+ variables.put("msoRequestId", "testVnfId123");
+ variables.put("testVnfId", "testVnfId123");
+ //variables.put("vnfType", "STMTN");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ String vnfModelInfo = "{ " + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
+ "}";
+ //variables.put("vnfModelInfo", vnfModelInfo);
+
+ variables.put("lcpCloudRegionId", "mdt1");
+ variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
+
+ String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ //variables.put("serviceModelInfo", serviceModelInfo);
+ variables.put("globalSubscriberId", "MSO-1610");
+ variables.put("sdncVersion", "1707");
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModuleFromVnf.bpmn", "subprocess/VnfAdapterRestV1.bpmn", "subprocess/DeleteAAIVfModule.bpmn"})
+ public void testDoDeleteVnfAndModules_successVnfAndModules() throws Exception {
+ MockAAIGenericVnfSearch();
+ MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(200);
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIDeleteVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesVnfAndModules(variables);
+ invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ injectSDNCCallbacks(callbacks, "unassign");
+ MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
+ injectSDNCCallbacks(callbacks, "unassign");
+ //MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
+
+ assertEquals(null, workflowException);
+ }
+
+
+ private void setVariablesVnfAndModules(Map<String, Object> variables) {
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+ variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ //variables.put("testVnfId","testVnfId123");
+
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
+
+ variables.put("sdncVersion", "1707");
+
+ }
+
+
+ public static void MockDoDeleteVfModule_SDNCSuccess() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>deactivate"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>unassign"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ }
+
+
+ public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
+ stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java
index 8caa9f22a2..95c275f85d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java
@@ -19,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -40,101 +40,100 @@ import org.openecomp.mso.bpmn.common.WorkflowTest;
/**
* Please describe the DeleteVnfInfra.java class
- *
*/
public class DoDeleteVnfTest extends WorkflowTest {
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"})
- public void testDoDeleteVnf_success() throws Exception{
-
- MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
- invokeSubProcess("DoDeleteVnf", businessKey, variables);
- // Disabled until SDNC support is there
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"})
+ public void testDoDeleteVnf_success() throws Exception {
+
+ MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml");
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+ invokeSubProcess("DoDeleteVnf", businessKey, variables);
+ // Disabled until SDNC support is there
// injectSDNCCallbacks(callbacks, "assign");
// injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
-
- assertEquals("true", found);
- assertEquals("false", inUse);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"})
- public void testDeleteVnfInfra_success_vnfNotFound() throws Exception{
-
- MockDeleteGenericVnf("testVnfId123", "testReVer123", 404);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
-
- invokeSubProcess("DoDeleteVnf", businessKey, variables);
- // Disabled until SDNC support is there
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator");
+ String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
+
+ assertEquals("true", found);
+ assertEquals("false", inUse);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"})
+ public void testDeleteVnfInfra_success_vnfNotFound() throws Exception {
+
+ MockDeleteGenericVnf("testVnfId123", "testReVer123", 404);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("DoDeleteVnf", businessKey, variables);
+ // Disabled until SDNC support is there
// injectSDNCCallbacks(callbacks, "assign");
// injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
+ waitForProcessEnd(businessKey, 10000);
- assertEquals("false", found);
- assertEquals("false", inUse);
- assertEquals(null, workflowException);
- }
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator");
+ String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"})
- public void testDeleteVnfInfra_error_vnfInUse() throws Exception{
+ assertEquals("false", found);
+ assertEquals("false", inUse);
+ assertEquals(null, workflowException);
+ }
- MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfResponse_hasRelationships.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ @Test
+ @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"})
+ public void testDeleteVnfInfra_error_vnfInUse() throws Exception {
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
+ MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfResponse_hasRelationships.xml");
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- invokeSubProcess("DoDeleteVnf", businessKey, variables);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("DoDeleteVnf", businessKey, variables);
// Disabled until SDNC support is there
// injectSDNCCallbacks(callbacks, "assign");
// injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
- String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]";
-
- assertEquals("true", found);
- assertEquals("true", inUse);
- assertEquals(exWfex, workflowException);
- }
-
- private void setVariables(Map<String, Object> variables) {
- variables.put("mso-request-id", "123");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId","testVnfId123");
- }
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator");
+ String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
+ String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]";
+
+ assertEquals("true", found);
+ assertEquals("true", inUse);
+ assertEquals(exWfex, workflowException);
+ }
+
+ private void setVariables(Map<String, Object> variables) {
+ variables.put("mso-request-id", "123");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfId", "testVnfId123");
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java
index 9fa93235b7..40564a9b26 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java
@@ -16,12 +16,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
-
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
@@ -56,158 +55,158 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit tests for DoUpdateVfModule.bpmn.
*/
public class DoUpdateVfModuleTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoUpdateVfModuleTest() throws IOException {
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Test the happy path through the flow.
- */
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn"
- })
- public void happyPath() throws IOException {
-
- logStart();
-
- String doUpdateVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/DoUpdateVfModuleRequest.xml");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockGetVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockGetVolumeGroupById("MDTWNJ21", "78987", "VfModularity/VolumeGroup.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- MockPutGenericVnf("skask");
- MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "DEV-VF-0011");
- variables.put("isDebugLogEnabled","true");
- variables.put("DoUpdateVfModuleRequest", doUpdateVfModuleRequest);
- invokeSubProcess("DoUpdateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true);
-
- String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId");
- System.out.println("Heat stack Id from AAI: " + heatStackId);
-
- logEnd();
- }
-
- /**
- * Test the happy path through the flow with Building Blocks interface.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn"
- })
- public void happyPathBB() throws IOException {
-
- logStart();
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "DEV-VF-0011");
- variables.put("isDebugLogEnabled","true");
- variables.put("msoRequestId", "DEV-VF-0011");
- variables.put("isBaseVfModule", "false");
- variables.put("isDebugLogEnabled", "true");
- variables.put("disableRollback", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vfModuleId", "supercool");
- variables.put("vnfType", "pcrf-capacity");
- variables.put("isVidRequest", "true");
- variables.put("volumeGroupId", "78987");
- variables.put("usePreload", true);
-
- variables.put("sdncVersion", "1702");
-
- variables.put("lcpCloudRegionId", "MDTWNJ21");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
-
- String vfModuleModelInfo = "{ "+ "\"modelType\": \"vfModule\"," +
- "\"modelInvariantUuid\": \"introvert\"," +
- "\"modelUuid\": \"3.14\"," +
- "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"MODEL-123\"" + "}";
- variables.put("vfModuleModelInfo", vfModuleModelInfo);
-
- String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"introvert\"," +
- "\"modelUuid\": \"3.14\"," +
- "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- invokeSubProcess("DoUpdateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true);
-
- String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId");
- System.out.println("Heat stack Id from AAI: " + heatStackId);
-
- logEnd();
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockSDNCAdapterVfModule() {
- // simplified the implementation to return "success" for all requests
- stubFor(post(urlEqualTo("/SDNCAdapter"))
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoUpdateVfModuleTest() throws IOException {
+ callbacks.put("changeassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
+ }
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn"
+ })
+ public void happyPath() throws IOException {
+
+ logStart();
+
+ String doUpdateVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/DoUpdateVfModuleRequest.xml");
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockGetVfModuleIdNoResponse("skask", "PCRF", "supercool");
+ MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
+ MockGetVolumeGroupById("MDTWNJ21", "78987", "VfModularity/VolumeGroup.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPut("skask", "/supercool", 202);
+ MockPutGenericVnf("skask");
+ MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "DEV-VF-0011");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("DoUpdateVfModuleRequest", doUpdateVfModuleRequest);
+ invokeSubProcess("DoUpdateVfModule", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true);
+
+ String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId");
+ System.out.println("Heat stack Id from AAI: " + heatStackId);
+
+ logEnd();
+ }
+
+ /**
+ * Test the happy path through the flow with Building Blocks interface.
+ */
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn"
+ })
+ public void happyPathBB() throws IOException {
+
+ logStart();
+
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ MockSDNCAdapterVfModule();
+ MockVNFAdapterRestVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "DEV-VF-0011");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "DEV-VF-0011");
+ variables.put("isBaseVfModule", "false");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("disableRollback", "true");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vfModuleId", "supercool");
+ variables.put("vnfType", "pcrf-capacity");
+ variables.put("isVidRequest", "true");
+ variables.put("volumeGroupId", "78987");
+ variables.put("usePreload", true);
+
+ variables.put("sdncVersion", "1702");
+
+ variables.put("lcpCloudRegionId", "MDTWNJ21");
+ variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
+
+ String vfModuleModelInfo = "{ " + "\"modelType\": \"vfModule\"," +
+ "\"modelInvariantUuid\": \"introvert\"," +
+ "\"modelUuid\": \"3.14\"," +
+ "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," +
+ "\"modelVersion\": \"1\"," +
+ "\"modelCustomizationUuid\": \"MODEL-123\"" + "}";
+ variables.put("vfModuleModelInfo", vfModuleModelInfo);
+
+ String vnfModelInfo = "{ " + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"introvert\"," +
+ "\"modelUuid\": \"3.14\"," +
+ "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," +
+ "\"modelVersion\": \"1\"," +
+ "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ invokeSubProcess("DoUpdateVfModule", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true);
+
+ String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId");
+ System.out.println("Heat stack Id from AAI: " + heatStackId);
+
+ logEnd();
+ }
+
+ // start of mocks used locally and by other VF Module unit tests
+ public static void MockSDNCAdapterVfModule() {
+ // simplified the implementation to return "success" for all requests
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
// .withRequestBody(containing("SvcInstanceId><"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
// stubFor(post(urlEqualTo("/SDNCAdapter"))
// .withRequestBody(containing("vnf-type>STMTN"))
// .willReturn(aResponse()
@@ -220,25 +219,25 @@ public class DoUpdateVfModuleTest extends WorkflowTest {
// .withStatus(200)
// .withHeader("Content-Type", "text/xml")
// .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
- }
-
- public static void MockVNFAdapterRestVfModule() {
- stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
+ }
+
+ public static void MockVNFAdapterRestVfModule() {
+ stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java
index 4def56cf6a..5dbad094d4 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java
@@ -55,172 +55,170 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
/**
* Unit Test for the DoUpdateVnfAndModules Flow
- *
*/
public class DoUpdateVnfAndModulesTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoUpdateVnfAndModulesTest() throws IOException {
-
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- @Test
-
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/DoUpdateVnfAndModules.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"})
- public void testDoUpdateVnfAndModules_success() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockVNFPut("skask", "/lukewarm", 202);
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoUpdateVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("2", "200", null);
-
- }
-
-
-
- private void assertVariables(String exModuleCount, String exVnfFound, String exWorkflowException) {
-
- String moduleCount = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_moduleCount");
- String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_queryAAIVfModuleResponseCode");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "SavedWorkflowException1");
-
- assertEquals(exModuleCount, moduleCount);
- assertEquals(exVnfFound, vnfFound);
- assertEquals(exWorkflowException, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", request);
- variables.put("msoRequestUdid", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
-
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("requestId", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("disableRollback", "true");
- //variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- variables.put("vnfId", "skask");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
- variables.put("lcpCloudRegionId", "mdt1");
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
- variables.put("cloudConfiguration", cloudConfiguration);
- variables.put("sdncVersion", "1702");
- variables.put("globalSubscriberId", "subscriber123");
- variables.put("asdcServiceModelVersion", "serviceVersion01");
-
- try {
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("extrovert");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.constructVnfType("vnf1");
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("introvert");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelVersion("1");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- ModuleResource mr1 = new ModuleResource();
- ModelInfo mvmr1 = new ModelInfo();
- mvmr1.setModelInvariantUuid("extrovert");
- mvmr1.setModelName("SECONDMODELNAME");
- mvmr1.setModelVersion("1");
- mvmr1.setModelCustomizationUuid("MODEL-123");
- mr1.setModelInfo(mvmr1);
- mr1.setIsBase(false);
- mr1.setVfModuleLabel("MODULELABEL1");
- vr.addVfModule(mr1);
- variables.put("vnfResourceDecomposition", vr);
- variables.put("isTest", true);
- } catch(Exception e) {
-
- }
-
- }
-
-
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoUpdateVnfAndModulesTest() throws IOException {
+
+ callbacks.put("changeassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("vnfUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
+ }
+
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/DoUpdateVnfAndModules.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn"})
+ public void testDoUpdateVnfAndModules_success() throws Exception {
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ //MockGetGenericVnfById_404("testVnfId");
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf(".*");
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPut("skask", "/supercool", 202);
+ mockVNFPut("skask", "/lukewarm", 202);
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ invokeSubProcess("DoUpdateVnfAndModules", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ assertVariables("2", "200", null);
+
+ }
+
+
+ private void assertVariables(String exModuleCount, String exVnfFound, String exWorkflowException) {
+
+ String moduleCount = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_moduleCount");
+ String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_queryAAIVfModuleResponseCode");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "SavedWorkflowException1");
+
+ assertEquals(exModuleCount, moduleCount);
+ assertEquals(exVnfFound, vnfFound);
+ assertEquals(exWorkflowException, workflowException);
+ }
+
+ private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("bpmnRequest", request);
+ variables.put("msoRequestUdid", requestId);
+ variables.put("serviceInstanceId", siId);
+ variables.put("testVnfId", "testVnfId123");
+ variables.put("vnfType", "STMTN");
+
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("requestId", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId", siId);
+ variables.put("disableRollback", "true");
+ //variables.put("testVnfId","testVnfId123");
+ variables.put("vnfType", "STMTN");
+ variables.put("vnfId", "skask");
+ variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
+ variables.put("lcpCloudRegionId", "mdt1");
+
+ String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
+ "\"lcpCloudRegionId\": \"mdt1\"," +
+ "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
+ variables.put("cloudConfiguration", cloudConfiguration);
+ variables.put("sdncVersion", "1702");
+ variables.put("globalSubscriberId", "subscriber123");
+ variables.put("asdcServiceModelVersion", "serviceVersion01");
+
+ try {
+ VnfResource vr = new VnfResource();
+ ModelInfo mvr = new ModelInfo();
+ mvr.setModelName("vSAMP12");
+ mvr.setModelInstanceName("v123");
+ mvr.setModelInvariantUuid("extrovert");
+ mvr.setModelVersion("1.0");
+ mvr.setModelCustomizationUuid("MODEL-ID-1234");
+ vr.setModelInfo(mvr);
+ vr.constructVnfType("vnf1");
+ vr.setNfType("somenftype");
+ vr.setNfRole("somenfrole");
+ vr.setNfFunction("somenffunction");
+ vr.setNfNamingCode("somenamingcode");
+ ModuleResource mr = new ModuleResource();
+ ModelInfo mvmr = new ModelInfo();
+ mvmr.setModelInvariantUuid("introvert");
+ mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
+ mvmr.setModelVersion("1");
+ mvmr.setModelCustomizationUuid("MODEL-123");
+ mr.setModelInfo(mvmr);
+ mr.setIsBase(true);
+ mr.setVfModuleLabel("MODULELABEL");
+ vr.addVfModule(mr);
+ ModuleResource mr1 = new ModuleResource();
+ ModelInfo mvmr1 = new ModelInfo();
+ mvmr1.setModelInvariantUuid("extrovert");
+ mvmr1.setModelName("SECONDMODELNAME");
+ mvmr1.setModelVersion("1");
+ mvmr1.setModelCustomizationUuid("MODEL-123");
+ mr1.setModelInfo(mvmr1);
+ mr1.setIsBase(false);
+ mr1.setVfModuleLabel("MODULELABEL1");
+ vr.addVfModule(mr1);
+ variables.put("vnfResourceDecomposition", vr);
+ variables.put("isTest", true);
+ } catch (Exception e) {
+
+ }
+
+ }
+
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java
index 64852dfb5f..82208d9f64 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -69,191 +69,191 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit test cases for UpdateVnfInfra.bpmn
*/
public class ReplaceVnfInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
- private static final String EOL = "\n";
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- public ReplaceVnfInfraTest() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
+
+ private final CallbackSet callbacks = new CallbackSet();
+ private static final String EOL = "\n";
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ public ReplaceVnfInfraTest() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+ callbacks.put("changeassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("vnfUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
+ }
+
+ /**
+ * Sunny day scenario.
+ *
+ * @throws Exception
+ */
+ @Test
@Ignore
- @Deployment(resources = {
- "process/ReplaceVnfInfra.bpmn",
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/DoDeleteVnfAndModules.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/DoDeleteVnfAndModules.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn",
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/DoCreateVnf.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/DoCreateVnfAndModules.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
- "subprocess/BuildingBlock/RainyDayHandler.bpmn",
- "subprocess/BuildingBlock/ManualHandling.bpmn"
-
- })
- public void sunnyDay() throws Exception {
-
- logStart();
- MockAAIGenericVnfSearch();
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(200);
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIDeleteVfModule();
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json");
- //MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- //MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", ".*");
- //mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- //mockVNFPut("skask", "/supercool", 202);
- //mockVNFPut("skask", "/lukewarm", 202);
- //MockVNFAdapterRestVfModule();
- //MockDBUpdateVfModule();
- //MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
- //MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockSetInMaintFlagByVnfId("skask", 200);
- MockPolicySkip();
-
- //mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- //mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVnfRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/ReplaceVnf_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("ReplaceVnfInfra",
- "v1", businessKey, updaetVnfRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectSDNCCallbacks(callbacks, "deactivate");
- //injectSDNCCallbacks(callbacks, "deactivate");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //injectSDNCCallbacks(callbacks, "unassign");
- MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
- injectSDNCCallbacks(callbacks, "unassign");
-
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "ReplaceVfModuleInfraSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isDebugLogEnabled", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vnfType", "vSAMP12");
- variables.put("serviceType", "MOG");
-
- return variables;
-
- }
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
+ @Deployment(resources = {
+ "process/ReplaceVnfInfra.bpmn",
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/DoDeleteVnfAndModules.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/DoDeleteVnfAndModules.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn",
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericPutVnf.bpmn",
+ "subprocess/DoCreateVnf.bpmn",
+ "subprocess/GenerateVfModuleName.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/DoCreateVnfAndModules.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn",
+ "subprocess/BuildingBlock/DecomposeService.bpmn",
+ "subprocess/BuildingBlock/RainyDayHandler.bpmn",
+ "subprocess/BuildingBlock/ManualHandling.bpmn"
+
+ })
+ public void sunnyDay() throws Exception {
+
+ logStart();
+ MockAAIGenericVnfSearch();
+ MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(200);
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIDeleteVfModule();
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ //MockGetGenericVnfById_404("testVnfId");
+ MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json");
+ //MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ //MockPutGenericVnf(".*");
+ MockAAIVfModule();
+ MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", ".*");
+ //mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ //mockVNFPut("skask", "/supercool", 202);
+ //mockVNFPut("skask", "/lukewarm", 202);
+ //MockVNFAdapterRestVfModule();
+ //MockDBUpdateVfModule();
+ //MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
+ //MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
+ MockSetInMaintFlagByVnfId("skask", 200);
+ MockPolicySkip();
+
+ //mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ //mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String updaetVnfRequest =
+ FileUtil.readResourceFile("__files/InfrastructureFlows/ReplaceVnf_VID_request.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("ReplaceVnfInfra",
+ "v1", businessKey, updaetVnfRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ //injectSDNCCallbacks(callbacks, "deactivate");
+ //injectSDNCCallbacks(callbacks, "deactivate");
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ //injectSDNCCallbacks(callbacks, "unassign");
+ MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "ReplaceVfModuleInfraSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("serviceType", "MOG");
+
+ return variables;
+
+ }
+
+ public static void MockDoDeleteVfModule_SDNCSuccess() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>deactivate"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>unassign"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ }
+
+
+ public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
+ stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java
index 8f16ed3b1e..02ed13e2fb 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java
@@ -16,153 +16,150 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
+
-
package org.openecomp.mso.bpmn.infrastructure;
import org.junit.Test;
import org.openecomp.mso.bpmn.common.WorkflowTest;
import org.openecomp.mso.bpmn.mock.StubResponseAAI;
-public class StubResponseAAITest extends WorkflowTest{
+public class StubResponseAAITest extends WorkflowTest {
+
+ @Test
+ public void testStubResponseAAIforNullAndDefaultInputs() {
+ try {
+ StubResponseAAI.MockPutTunnelXConnect(null, null, null, null, null);
+ StubResponseAAI.MockGetAllottedResource(null, null, null, null, null);
+ StubResponseAAI.MockPutAllottedResource(null, null, null, null);
+ StubResponseAAI.MockPutAllottedResource_500(null, null, null, null);
+ StubResponseAAI.MockDeleteAllottedResource(null, null, null, null, null);
+ StubResponseAAI.MockPatchAllottedResource(null, null, null, null);
+ StubResponseAAI.MockQueryAllottedResourceById(null, null);
+ StubResponseAAI.MockGetServiceInstance(null, null, null, null);
+ StubResponseAAI.MockGetServiceInstance_404(null, null, null);
+ StubResponseAAI.MockGetServiceInstance_500(null, null, null);
+ StubResponseAAI.MockGetServiceInstance_500(null, null, null, null);
+ StubResponseAAI.MockNodeQueryServiceInstanceByName(null, null);
+ StubResponseAAI.MockNodeQueryServiceInstanceByName_404(null);
+ StubResponseAAI.MockNodeQueryServiceInstanceByName_500(null);
+ StubResponseAAI.MockNodeQueryServiceInstanceById(null, null);
+ StubResponseAAI.MockNodeQueryServiceInstanceById_404(null);
+ StubResponseAAI.MockNodeQueryServiceInstanceById_500(null);
+ StubResponseAAI.MockDeleteServiceInstance(null, null, null, null);
+ StubResponseAAI.MockGetServiceInstance(null, null, null, null, 0);
+ StubResponseAAI.MockGetServiceInstance(null, null, null, 0);
+ StubResponseAAI.MockDeleteServiceInstance(null, null, null, null, 0);
+ StubResponseAAI.MockDeleteServiceInstance(null, null, null, 0);
+ StubResponseAAI.MockDeleteServiceInstance_404(null, null, null, null);
+ StubResponseAAI.MockDeleteServiceInstance_500(null, null, null, null);
+ StubResponseAAI.MockPutServiceInstance(null, null, null, null);
+ StubResponseAAI.MockPutServiceInstance_500(null, null, null);
+ StubResponseAAI.MockGetServiceSubscription(null, null, null);
+ StubResponseAAI.MockDeleteServiceSubscription(null, null, 0);
+ StubResponseAAI.MockDeleteServiceInstanceId(null, null, null);
+ StubResponseAAI.MockPutServiceSubscription(null, null);
+ StubResponseAAI.MockGetServiceSubscription(null, null, 0);
+ StubResponseAAI.MockGetCustomer(null, null);
+ StubResponseAAI.MockDeleteCustomer(null);
+ StubResponseAAI.MockPutCustomer(null);
+ StubResponseAAI.MockPutCustomer_500(null);
+ StubResponseAAI.MockGetGenericVnfById(null, null);
+ StubResponseAAI.MockGetGenericVnfById(null, null, 0);
+ StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, 0, null);
+ StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, null, 0, null, 0);
+ StubResponseAAI.MockGetGenericVnfByIdWithDepth(null, 0, null);
+ StubResponseAAI.MockGetGenericVnfById_404(null);
+ StubResponseAAI.MockGetGenericVnfById_500(null);
+ StubResponseAAI.MockGetGenericVnfByName(null, null);
+ StubResponseAAI.MockGetGenericVnfByNameWithDepth(null, 0, null);
+ StubResponseAAI.MockGetGenericVnfByName_404(null);
+ StubResponseAAI.MockDeleteGenericVnf(null, null);
+ StubResponseAAI.MockDeleteGenericVnf(null, null, 0);
+ StubResponseAAI.MockDeleteGenericVnf_500(null, null);
+ StubResponseAAI.MockPutGenericVnf(null);
+ StubResponseAAI.MockPutGenericVnf(null, null, 0);
+ StubResponseAAI.MockPutGenericVnf(null, 0);
+ StubResponseAAI.MockPutGenericVnf_Bad(null, 0);
+ StubResponseAAI.MockPatchGenericVnf(null);
+ StubResponseAAI.MockGetVceById(null, null);
+ StubResponseAAI.MockGetVceByName(null, null);
+ StubResponseAAI.MockDeleteVce(null, null, 0);
+ StubResponseAAI.MockPutVce(null);
+ StubResponseAAI.MockGetGenericVceByNameWithDepth(null, 0, null);
+ StubResponseAAI.MockGetVceGenericQuery(null, 0, 0, null);
+ StubResponseAAI.MockGetTenantGenericQuery(null, null, null);
+ StubResponseAAI.MockGetTenant(null, null);
+ StubResponseAAI.MockGetNetwork(null, null, 0);
+ StubResponseAAI.MockGetNetworkByIdWithDepth(null, null, null);
+ StubResponseAAI.MockGetNetworkCloudRegion(null, null);
+ StubResponseAAI.MockGetNetworkByName(null, null);
+ StubResponseAAI.MockGetNetworkByName_404(null, null);
+ StubResponseAAI.MockGetNetworkCloudRegion_404(null);
+ StubResponseAAI.MockPutNetwork(null, 0, null);
+ StubResponseAAI.MockPutNetwork(null, null, 0);
+ StubResponseAAI.MockGetNetworkName(null, null, 0);
+ StubResponseAAI.MockGetNetworkVpnBinding(null, null);
+ StubResponseAAI.MockGetNetworkPolicy(null, null);
+ StubResponseAAI.MockGetNetworkVpnBinding(null, null, 0);
+ StubResponseAAI.MockGetNetworkPolicy(null, null, 0);
+ StubResponseAAI.MockGetNetworkTableReference(null, null);
+ StubResponseAAI.MockPutNetworkIdWithDepth(null, null, null);
+ StubResponseAAI.MockGetNetworkPolicyfqdn(null, null, 0);
+ StubResponseAAI.MockGetNetworkRouteTable(null, null, 0);
+ StubResponseAAI.MockPatchVfModuleId(null, null);
+ StubResponseAAI.MockVNFAdapterRestVfModule();
+ StubResponseAAI.MockDBUpdateVfModule();
+ StubResponseAAI.MockSDNCAdapterVfModule();
+ StubResponseAAI.MockAAIVfModule();
+ StubResponseAAI.MockGetCloudRegion(null, 0, null);
+ StubResponseAAI.MockGetVolumeGroupById(null, null, null);
+ StubResponseAAI.MockPutVolumeGroupById(null, null, null, 0);
+ StubResponseAAI.MockGetVolumeGroupByName(null, null, null, 0);
+ StubResponseAAI.MockDeleteVolumeGroupById(null, null, null, 0);
+ StubResponseAAI.MockGetVolumeGroupByName_404(null, null);
+ StubResponseAAI.MockDeleteVolumeGroup(null, null, null);
+ StubResponseAAI.MockGetVfModuleId(null, null, null, 0);
+ StubResponseAAI.MockGetVfModuleByNameWithDepth(null, null, 0, null, 0);
+ StubResponseAAI.MockGetVfModuleIdNoResponse(null, null, null);
+ StubResponseAAI.MockPutVfModuleIdNoResponse(null, null, null);
+ StubResponseAAI.MockPutVfModuleId(null, null);
+ StubResponseAAI.MockPutVfModuleId(null, null, 0);
+ StubResponseAAI.MockDeleteVfModuleId(null, null, null, 0);
+ StubResponseAAI.MockAAIVfModuleBadPatch(null, 0);
+ StubResponseAAI.MockGetPserverByVnfId(null, null, 0);
+ StubResponseAAI.MockGetGenericVnfsByVnfId(null, null, 0);
+ StubResponseAAI.MockSetInMaintFlagByVnfId(null, 0);
+ StubResponseAAI.MockGetVceById();
+ StubResponseAAI.MockGetVceByName();
+ StubResponseAAI.MockPutVce();
+ StubResponseAAI.MockDeleteVce();
+ StubResponseAAI.MockDeleteVce_404();
+ StubResponseAAI.MockDeleteServiceSubscription();
+ StubResponseAAI.MockGetServiceSubscription();
+ StubResponseAAI.MockGetServiceSubscription_200Empty();
+ StubResponseAAI.MockGetServiceSubscription_404();
+ StubResponseAAI.MockGENPSIPutServiceInstance();
+ StubResponseAAI.MockGENPSIPutServiceSubscription();
+ StubResponseAAI.MockGENPSIPutServiceInstance_get500();
+ StubResponseAAI.MockGetGenericVnfById();
+ StubResponseAAI.MockGetGenericVnfById_404();
+ StubResponseAAI.MockGetGenericVnfByName();
+ StubResponseAAI.MockGetGenericVnfByName_hasRelationships();
+ StubResponseAAI.MockGetGenericVnfById_hasRelationships();
+ StubResponseAAI.MockGetGenericVnfById_500();
+ StubResponseAAI.MockGetGenericVnfByName_404();
+ StubResponseAAI.MockPutGenericVnf();
+ StubResponseAAI.MockPutGenericVnf_400();
+ StubResponseAAI.MockDeleteGenericVnf();
+ StubResponseAAI.MockDeleteGenericVnf_404();
+ StubResponseAAI.MockDeleteGenericVnf_500();
+ StubResponseAAI.MockDeleteGenericVnf_412();
+ } catch (Exception ex) {
+
+ System.err.println(ex);
+ }
- @Test
- public void testStubResponseAAIforNullAndDefaultInputs()
- {
- try{
- StubResponseAAI.MockPutTunnelXConnect(null, null, null, null, null);
- StubResponseAAI.MockGetAllottedResource(null, null, null, null, null);
- StubResponseAAI.MockPutAllottedResource(null, null, null, null);
- StubResponseAAI.MockPutAllottedResource_500(null, null, null, null);
- StubResponseAAI.MockDeleteAllottedResource(null, null, null, null, null);
- StubResponseAAI.MockPatchAllottedResource(null, null, null, null);
- StubResponseAAI.MockQueryAllottedResourceById(null, null);
- StubResponseAAI.MockGetServiceInstance(null, null, null, null);
- StubResponseAAI.MockGetServiceInstance_404(null, null, null);
- StubResponseAAI.MockGetServiceInstance_500(null, null, null);
- StubResponseAAI.MockGetServiceInstance_500(null, null, null, null);
- StubResponseAAI.MockNodeQueryServiceInstanceByName(null, null);
- StubResponseAAI.MockNodeQueryServiceInstanceByName_404(null);
- StubResponseAAI.MockNodeQueryServiceInstanceByName_500(null);
- StubResponseAAI.MockNodeQueryServiceInstanceById(null, null);
- StubResponseAAI.MockNodeQueryServiceInstanceById_404(null);
- StubResponseAAI.MockNodeQueryServiceInstanceById_500(null);
- StubResponseAAI.MockDeleteServiceInstance(null, null, null, null);
- StubResponseAAI.MockGetServiceInstance(null, null, null, null, 0);
- StubResponseAAI.MockGetServiceInstance(null, null, null, 0);
- StubResponseAAI.MockDeleteServiceInstance(null, null, null, null, 0);
- StubResponseAAI.MockDeleteServiceInstance(null, null, null, 0);
- StubResponseAAI.MockDeleteServiceInstance_404(null, null, null, null);
- StubResponseAAI.MockDeleteServiceInstance_500(null, null, null, null);
- StubResponseAAI.MockPutServiceInstance(null, null, null, null);
- StubResponseAAI.MockPutServiceInstance_500(null, null, null);
- StubResponseAAI.MockGetServiceSubscription(null, null, null);
- StubResponseAAI.MockDeleteServiceSubscription(null, null, 0);
- StubResponseAAI.MockDeleteServiceInstanceId(null, null, null);
- StubResponseAAI.MockPutServiceSubscription(null, null);
- StubResponseAAI.MockGetServiceSubscription(null, null, 0);
- StubResponseAAI.MockGetCustomer(null, null);
- StubResponseAAI.MockDeleteCustomer(null);
- StubResponseAAI.MockPutCustomer(null);
- StubResponseAAI.MockPutCustomer_500(null);
- StubResponseAAI.MockGetGenericVnfById(null, null);
- StubResponseAAI.MockGetGenericVnfById(null, null, 0);
- StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, 0, null);
- StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, null, 0, null, 0);
- StubResponseAAI.MockGetGenericVnfByIdWithDepth(null, 0, null);
- StubResponseAAI.MockGetGenericVnfById_404(null);
- StubResponseAAI.MockGetGenericVnfById_500(null);
- StubResponseAAI.MockGetGenericVnfByName(null, null);
- StubResponseAAI.MockGetGenericVnfByNameWithDepth(null, 0, null);
- StubResponseAAI.MockGetGenericVnfByName_404(null);
- StubResponseAAI.MockDeleteGenericVnf(null, null);
- StubResponseAAI.MockDeleteGenericVnf(null, null, 0);
- StubResponseAAI.MockDeleteGenericVnf_500(null, null);
- StubResponseAAI.MockPutGenericVnf(null);
- StubResponseAAI.MockPutGenericVnf(null, null, 0);
- StubResponseAAI.MockPutGenericVnf(null, 0);
- StubResponseAAI.MockPutGenericVnf_Bad(null, 0);
- StubResponseAAI.MockPatchGenericVnf(null);
- StubResponseAAI.MockGetVceById(null, null);
- StubResponseAAI.MockGetVceByName(null, null);
- StubResponseAAI.MockDeleteVce(null, null, 0);
- StubResponseAAI.MockPutVce(null);
- StubResponseAAI.MockGetGenericVceByNameWithDepth(null, 0, null);
- StubResponseAAI.MockGetVceGenericQuery(null, 0, 0, null);
- StubResponseAAI.MockGetTenantGenericQuery(null, null, null);
- StubResponseAAI.MockGetTenant(null, null);
- StubResponseAAI.MockGetNetwork(null, null, 0);
- StubResponseAAI.MockGetNetworkByIdWithDepth(null, null, null);
- StubResponseAAI.MockGetNetworkCloudRegion(null, null);
- StubResponseAAI.MockGetNetworkByName(null, null);
- StubResponseAAI.MockGetNetworkByName_404(null, null);
- StubResponseAAI.MockGetNetworkCloudRegion_404(null);
- StubResponseAAI.MockPutNetwork(null, 0, null);
- StubResponseAAI.MockPutNetwork(null, null, 0);
- StubResponseAAI.MockGetNetworkName(null, null, 0);
- StubResponseAAI.MockGetNetworkVpnBinding(null, null);
- StubResponseAAI.MockGetNetworkPolicy(null, null);
- StubResponseAAI.MockGetNetworkVpnBinding(null, null, 0);
- StubResponseAAI.MockGetNetworkPolicy(null, null, 0);
- StubResponseAAI.MockGetNetworkTableReference(null, null);
- StubResponseAAI.MockPutNetworkIdWithDepth(null, null, null);
- StubResponseAAI.MockGetNetworkPolicyfqdn(null, null, 0);
- StubResponseAAI.MockGetNetworkRouteTable(null, null, 0);
- StubResponseAAI.MockPatchVfModuleId(null, null);
- StubResponseAAI.MockVNFAdapterRestVfModule();
- StubResponseAAI.MockDBUpdateVfModule();
- StubResponseAAI.MockSDNCAdapterVfModule();
- StubResponseAAI.MockAAIVfModule();
- StubResponseAAI.MockGetCloudRegion(null, 0, null);
- StubResponseAAI.MockGetVolumeGroupById(null, null, null);
- StubResponseAAI.MockPutVolumeGroupById(null, null, null, 0);
- StubResponseAAI.MockGetVolumeGroupByName(null, null, null, 0);
- StubResponseAAI.MockDeleteVolumeGroupById(null, null, null, 0);
- StubResponseAAI.MockGetVolumeGroupByName_404(null, null);
- StubResponseAAI.MockDeleteVolumeGroup(null, null, null);
- StubResponseAAI.MockGetVfModuleId(null, null, null, 0);
- StubResponseAAI.MockGetVfModuleByNameWithDepth(null, null, 0, null, 0);
- StubResponseAAI.MockGetVfModuleIdNoResponse(null, null, null);
- StubResponseAAI.MockPutVfModuleIdNoResponse(null, null, null);
- StubResponseAAI.MockPutVfModuleId(null, null);
- StubResponseAAI.MockPutVfModuleId(null, null, 0);
- StubResponseAAI.MockDeleteVfModuleId(null, null, null, 0);
- StubResponseAAI.MockAAIVfModuleBadPatch(null, 0);
- StubResponseAAI.MockGetPserverByVnfId(null, null, 0);
- StubResponseAAI.MockGetGenericVnfsByVnfId(null, null, 0);
- StubResponseAAI.MockSetInMaintFlagByVnfId(null, 0);
- StubResponseAAI.MockGetVceById();
- StubResponseAAI.MockGetVceByName();
- StubResponseAAI.MockPutVce();
- StubResponseAAI.MockDeleteVce();
- StubResponseAAI.MockDeleteVce_404();
- StubResponseAAI.MockDeleteServiceSubscription();
- StubResponseAAI.MockGetServiceSubscription();
- StubResponseAAI.MockGetServiceSubscription_200Empty();
- StubResponseAAI.MockGetServiceSubscription_404();
- StubResponseAAI.MockGENPSIPutServiceInstance();
- StubResponseAAI.MockGENPSIPutServiceSubscription();
- StubResponseAAI.MockGENPSIPutServiceInstance_get500();
- StubResponseAAI.MockGetGenericVnfById();
- StubResponseAAI.MockGetGenericVnfById_404();
- StubResponseAAI.MockGetGenericVnfByName();
- StubResponseAAI.MockGetGenericVnfByName_hasRelationships();
- StubResponseAAI.MockGetGenericVnfById_hasRelationships();
- StubResponseAAI.MockGetGenericVnfById_500();
- StubResponseAAI.MockGetGenericVnfByName_404();
- StubResponseAAI.MockPutGenericVnf();
- StubResponseAAI.MockPutGenericVnf_400();
- StubResponseAAI.MockDeleteGenericVnf();
- StubResponseAAI.MockDeleteGenericVnf_404();
- StubResponseAAI.MockDeleteGenericVnf_500();
- StubResponseAAI.MockDeleteGenericVnf_412();
- }
- catch(Exception ex)
- {
-
- System.err.println(ex);
- }
-
- }
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java
index 5b5e4e59d3..040294876a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java
@@ -46,443 +46,442 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
/**
* Unit test cases for DoUpdateNetworkInstance.bpmn
- *
*/
public class UpdateNetworkInstanceTest extends WorkflowTest {
- @WorkflowTestTransformer
- public static final ResponseTransformer sdncAdapterMockTransformer =
- new SDNCAdapterNetworkTopologyMockTransformer();
-
- @Rule
- public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- new SDNCAdapterCallbackRule(processEngineRule);
-
- /**
- * End-to-End flow - Unit test for DoUpdateNetworkInstance.bpmn
- * - String input & String response
- */
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
- "subprocess/DoUpdateNetworkInstance.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceUpdateNetworkInstance_SuccessVID1() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success1 - UpdateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign");
- MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariablesVID1();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- System.out.println("----------------------------------------------------------");
- System.out.println("- got workflow response -");
- System.out.println("----------------------------------------------------------");
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
- Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "UpdateNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success1 - UpdateNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
- "subprocess/DoUpdateNetworkInstance.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceUpdateNetworkInstance_SuccessVIPER1() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success2 - UpdateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign");
- MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariablesVIPER1();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
- Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest"));
-
- String completeMsoProcessRequest =
- "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
- + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
- + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
- + " <request-info>" + '\n'
- + " <request-id>testRequestId</request-id>" + '\n'
- + " <action>UPDATE</action>" + '\n'
- + " <source>VID</source>" + '\n'
- + " </request-info>" + '\n'
- + " <aetgt:status-message>Network has been updated successfully.</aetgt:status-message>" + '\n'
- + " <aetgt:mso-bpel-name>BPMN Network action: UPDATE</aetgt:mso-bpel-name>" + '\n'
- + "</aetgt:MsoCompletionRequest>";
-
- Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success2 - UpdateNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
- }
-
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
- "subprocess/DoUpdateNetworkInstance.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceUpdateNetworkInstance_MissingNetworkId() throws Exception {
-
- System.out.println("--------------------------------------------------------------------");
- System.out.println(" Missing networkId - UpdateNetworkInstance flow Started! ");
- System.out.println("--------------------------------------------------------------------");
-
- // setup simulators
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariablesMissingNetworkId();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
- Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest"));
-
- String falloutHandlerActual = getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest");
- String falloutHandlerExpected =
-"<aetgt:FalloutHandlerRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + "\n" +
-" xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + "\n" +
-" xmlns:wfsch=\"http://org.openecomp/mso/workflow/schema/v1\">" + "\n" +
-" <request-info xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + "\n" +
-" <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>" + "\n" +
-" <action>UPDATE</action>" + "\n" +
-" <source>VID</source>" + "\n" +
-" </request-info>" + "\n" +
-" <aetgt:WorkflowException xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\">" + "\n" +
-" <aetgt:ErrorMessage>Variable 'network-id' value/element is missing.</aetgt:ErrorMessage>" + "\n" +
-" <aetgt:ErrorCode>7000</aetgt:ErrorCode>" + "\n" +
-" </aetgt:WorkflowException>" + "\n" +
-" </aetgt:FalloutHandlerRequest>";
-
- assertEquals("Response", falloutHandlerExpected, falloutHandlerActual);
-
- System.out.println("------------------------------------------------------------------");
- System.out.println(" Missing networkId - UpdateNetworkInstance flow Completed ");
- System.out.println("------------------------------------------------------------------");
-
- }
-
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
- "subprocess/DoUpdateNetworkInstance.bpmn",
- "subprocess/DoUpdateNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceUpdateNetworkInstance_Network_SDNC_Rollback() throws Exception {
-
- System.out.println("---------------------------------------------------------------");
- System.out.println(" Network and SDNC Rollback - UpdateNetworkInstance flow Started! ");
- System.out.println("---------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign");
- mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback");
- MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariablesVID1();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
- Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest"));
-
- System.out.println("---------------------------------------------------------------------");
- System.out.println(" Network and SCNC Rollback - UpdateNetworkInstance flow Completed ");
- System.out.println("---------------------------------------------------------------------");
-
- }
-
- // *****************
- // Utility Section
- // *****************
-
- String networkModelInfo =
- " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' +
- " \"modelName\": \"mod_inst_z_123\", " + '\n' +
- " \"modelVersion\": \"1.0\", " + '\n' +
- " \"modelCustomizationUuid\": \"mod-inst-uuid-123\", " + '\n' +
- " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' +
- " }";
-
- String serviceModelInfo =
- " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' +
- " \"modelName\": \"HNGW Protected OAM\", " + '\n' +
- " \"modelVersion\": \"1.0\", " + '\n' +
- " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' +
- " }";
-
- // Success Scenario
- private Map<String, String> setupVariablesVID1() {
- Map<String, String> variables = new HashMap<>();
- variables.put("bpmnRequest", getCreateNetworkRequest1());
- variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "UPDATE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
- variables.put("serviceType", "vMOG");
- variables.put("vfModuleType", "");
- variables.put("networkType", "modelName");
- return variables;
-
- }
-
- public String getCreateNetworkRequest1() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1.0\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"false\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": true, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
- return request;
- }
-
- public String getCreateNetworkRequest2() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"myOwn_Network\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"true\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": true, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
- return request;
-
- }
-
- // Success Scenario
- private Map<String, String> setupVariablesVIPER1() {
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
- variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // macro
- variables.put("failIfExists", "false");
- //variables.put("sdncVersion", "1702");
- variables.put("sdncVersion", "1707");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("globalSubscriberId", "globalId_45678905678");
- variables.put("networkModelInfo", networkModelInfo);
- variables.put("serviceModelInfo", serviceModelInfo);
- return variables;
-
- }
-
- // Missing Name Scenario
- private Map<String, String> setupVariablesMissingNetworkId() {
- Map<String, String> variables = new HashMap<>();
- variables.put("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("bpmnRequest", getCreateNetworkRequestNetworkId());
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "UPDATE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- //variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); // missing, ok
- variables.put("serviceType", "vMOG");
- variables.put("vfModuleType", "");
- variables.put("networkType", "modelName");
-
- return variables;
-
- }
-
- public String getCreateNetworkRequestNetworkId() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"true\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
- return request;
-
- }
-
- public String getCreateNetworkRequestSDNCRollback() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"true\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
-
- return request;
- }
+ @WorkflowTestTransformer
+ public static final ResponseTransformer sdncAdapterMockTransformer =
+ new SDNCAdapterNetworkTopologyMockTransformer();
+
+ @Rule
+ public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
+ new SDNCAdapterCallbackRule(processEngineRule);
+
+ /**
+ * End-to-End flow - Unit test for DoUpdateNetworkInstance.bpmn
+ * - String input & String response
+ */
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
+ "subprocess/DoUpdateNetworkInstance.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceUpdateNetworkInstance_SuccessVID1() throws Exception {
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success1 - UpdateNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign");
+ MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
+ MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
+ MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
+ MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
+ MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
+ MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
+ MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
+ MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
+ MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
+
+ Map<String, String> variables = setupVariablesVID1();
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
+ executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
+ System.out.println("----------------------------------------------------------");
+ System.out.println("- got workflow response -");
+ System.out.println("----------------------------------------------------------");
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
+ Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest"));
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "UpdateNetworkInstance", "WorkflowResponse");
+ Assert.assertNotNull(workflowResp);
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success1 - UpdateNetworkInstance flow Completed ");
+ System.out.println("----------------------------------------------------------");
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
+ "subprocess/DoUpdateNetworkInstance.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceUpdateNetworkInstance_SuccessVIPER1() throws Exception {
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success2 - UpdateNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign");
+ MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
+ MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
+ MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
+ MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
+ MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
+ MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
+ MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
+ MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
+ MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
+
+ Map<String, String> variables = setupVariablesVIPER1();
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
+ executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
+ Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest"));
+
+ String completeMsoProcessRequest =
+ "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
+ + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
+ + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
+ + " <request-info>" + '\n'
+ + " <request-id>testRequestId</request-id>" + '\n'
+ + " <action>UPDATE</action>" + '\n'
+ + " <source>VID</source>" + '\n'
+ + " </request-info>" + '\n'
+ + " <aetgt:status-message>Network has been updated successfully.</aetgt:status-message>" + '\n'
+ + " <aetgt:mso-bpel-name>BPMN Network action: UPDATE</aetgt:mso-bpel-name>" + '\n'
+ + "</aetgt:MsoCompletionRequest>";
+
+ Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest"));
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success2 - UpdateNetworkInstance flow Completed ");
+ System.out.println("----------------------------------------------------------");
+
+ }
+
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
+ "subprocess/DoUpdateNetworkInstance.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceUpdateNetworkInstance_MissingNetworkId() throws Exception {
+
+ System.out.println("--------------------------------------------------------------------");
+ System.out.println(" Missing networkId - UpdateNetworkInstance flow Started! ");
+ System.out.println("--------------------------------------------------------------------");
+
+ // setup simulators
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
+ MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
+
+ Map<String, String> variables = setupVariablesMissingNetworkId();
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
+ executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
+ Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest"));
+
+ String falloutHandlerActual = getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest");
+ String falloutHandlerExpected =
+ "<aetgt:FalloutHandlerRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + "\n" +
+ " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + "\n" +
+ " xmlns:wfsch=\"http://org.openecomp/mso/workflow/schema/v1\">" + "\n" +
+ " <request-info xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + "\n" +
+ " <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>" + "\n" +
+ " <action>UPDATE</action>" + "\n" +
+ " <source>VID</source>" + "\n" +
+ " </request-info>" + "\n" +
+ " <aetgt:WorkflowException xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\">" + "\n" +
+ " <aetgt:ErrorMessage>Variable 'network-id' value/element is missing.</aetgt:ErrorMessage>" + "\n" +
+ " <aetgt:ErrorCode>7000</aetgt:ErrorCode>" + "\n" +
+ " </aetgt:WorkflowException>" + "\n" +
+ " </aetgt:FalloutHandlerRequest>";
+
+ assertEquals("Response", falloutHandlerExpected, falloutHandlerActual);
+
+ System.out.println("------------------------------------------------------------------");
+ System.out.println(" Missing networkId - UpdateNetworkInstance flow Completed ");
+ System.out.println("------------------------------------------------------------------");
+
+ }
+
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
+ "subprocess/DoUpdateNetworkInstance.bpmn",
+ "subprocess/DoUpdateNetworkInstanceRollback.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceUpdateNetworkInstance_Network_SDNC_Rollback() throws Exception {
+
+ System.out.println("---------------------------------------------------------------");
+ System.out.println(" Network and SDNC Rollback - UpdateNetworkInstance flow Started! ");
+ System.out.println("---------------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign");
+ mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback");
+ MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
+ MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
+ MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
+ MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
+ MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
+ MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
+ MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
+ MockUpdateRequestDB("DBUpdateResponse.xml");
+ //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
+ MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
+
+ Map<String, String> variables = setupVariablesVID1();
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
+ executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
+ Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest"));
+
+ System.out.println("---------------------------------------------------------------------");
+ System.out.println(" Network and SCNC Rollback - UpdateNetworkInstance flow Completed ");
+ System.out.println("---------------------------------------------------------------------");
+
+ }
+
+ // *****************
+ // Utility Section
+ // *****************
+
+ String networkModelInfo =
+ " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' +
+ " \"modelName\": \"mod_inst_z_123\", " + '\n' +
+ " \"modelVersion\": \"1.0\", " + '\n' +
+ " \"modelCustomizationUuid\": \"mod-inst-uuid-123\", " + '\n' +
+ " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' +
+ " }";
+
+ String serviceModelInfo =
+ " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' +
+ " \"modelName\": \"HNGW Protected OAM\", " + '\n' +
+ " \"modelVersion\": \"1.0\", " + '\n' +
+ " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' +
+ " }";
+
+ // Success Scenario
+ private Map<String, String> setupVariablesVID1() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("bpmnRequest", getCreateNetworkRequest1());
+ variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "UPDATE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "");
+ variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
+ variables.put("serviceType", "vMOG");
+ variables.put("vfModuleType", "");
+ variables.put("networkType", "modelName");
+ return variables;
+
+ }
+
+ public String getCreateNetworkRequest1() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1.0\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"callbackUrl\": \"\", " + '\n' +
+ " \"suppressRollback\": \"false\" ," + '\n' +
+ " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"backoutOnFailure\": true, " + '\n' +
+ " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
+ " \"userParams\": [] " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+
+ return request;
+ }
+
+ public String getCreateNetworkRequest2() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelId\": \"modelId\", " + '\n' +
+ " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"instanceName\": \"myOwn_Network\", " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"callbackUrl\": \"\", " + '\n' +
+ " \"suppressRollback\": \"true\" ," + '\n' +
+ " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"backoutOnFailure\": true, " + '\n' +
+ " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
+ " \"userParams\": [] " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+
+ return request;
+
+ }
+
+ // Success Scenario
+ private Map<String, String> setupVariablesVIPER1() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
+ variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1");
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("disableRollback", "false"); // macro
+ variables.put("failIfExists", "false");
+ //variables.put("sdncVersion", "1702");
+ variables.put("sdncVersion", "1707");
+ variables.put("subscriptionServiceType", "MSO-dev-service-type");
+ variables.put("globalSubscriberId", "globalId_45678905678");
+ variables.put("networkModelInfo", networkModelInfo);
+ variables.put("serviceModelInfo", serviceModelInfo);
+ return variables;
+
+ }
+
+ // Missing Name Scenario
+ private Map<String, String> setupVariablesMissingNetworkId() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("bpmnRequest", getCreateNetworkRequestNetworkId());
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "UPDATE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "");
+ //variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); // missing, ok
+ variables.put("serviceType", "vMOG");
+ variables.put("vfModuleType", "");
+ variables.put("networkType", "modelName");
+
+ return variables;
+
+ }
+
+ public String getCreateNetworkRequestNetworkId() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelId\": \"modelId\", " + '\n' +
+ " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"callbackUrl\": \"\", " + '\n' +
+ " \"suppressRollback\": \"true\" ," + '\n' +
+ " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"userParams\": [] " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+
+ return request;
+
+ }
+
+ public String getCreateNetworkRequestSDNCRollback() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelId\": \"modelId\", " + '\n' +
+ " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"callbackUrl\": \"\", " + '\n' +
+ " \"suppressRollback\": \"true\" ," + '\n' +
+ " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"userParams\": [] " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+
+
+ return request;
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java
index 37c548abf7..5c33ba4c11 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -43,103 +43,103 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit test cases for UpdateVfModule.bpmn
*/
public class UpdateVfModuleInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVfModuleInfraTest() throws IOException {
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore
- @Deployment(resources = {
- "process/UpdateVfModuleInfra.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
- mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVfModuleRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfra",
- "v1", businessKey, updaetVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "UPDATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "supercool");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public UpdateVfModuleInfraTest() throws IOException {
+ callbacks.put("changeassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
+ }
+
+ /**
+ * Sunny day scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "process/UpdateVfModuleInfra.bpmn",
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ public void sunnyDay() throws Exception {
+
+ logStart();
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
+ MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
+ mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPut("skask", "/supercool", 202);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String updaetVfModuleRequest =
+ FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfra",
+ "v1", businessKey, updaetVfModuleRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", false);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "UPDATE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("vfModuleId", "supercool");
+ variables.put("volumeGroupId", "");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ return variables;
+
+ }
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java
index 65a514c804..b5f7f64561 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -45,11 +45,11 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit test cases for UpdateVfModuleV2.bpmn
*/
public class UpdateVfModuleInfraV2Test extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
- public UpdateVfModuleInfraV2Test() throws IOException {
- /*callbacks.put("changeassign", FileUtil.readResourceFile(
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public UpdateVfModuleInfraV2Test() throws IOException {
+ /*callbacks.put("changeassign", FileUtil.readResourceFile(
"__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
callbacks.put("query", FileUtil.readResourceFile(
"__files/VfModularity/SDNCTopologyQueryCallback.xml"));
@@ -57,63 +57,63 @@ public class UpdateVfModuleInfraV2Test extends WorkflowTest {
"__files/VfModularity/SDNCTopologyActivateCallback.xml"));
callbacks.put("vnfUpdate", FileUtil.readResourceFile(
"__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));*/
- }
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Deployment(resources = {
- "process/UpdateVfModuleInfraV2.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- })
-
- public void sunnyDay() throws Exception {
- //logStart();
-
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
- mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- String updateVfModuleRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfraV2",
- "v1", businessKey, updateVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- //String responseBody = response.getResponse();
- //System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "UPDATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "supercool");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- variables.put("moduleUuid", "fe6985cd-ea33-3346-ac12-ab121484a3fe");
- return variables;
-
- }
-
+ }
+
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ @Deployment(resources = {
+ "process/UpdateVfModuleInfraV2.bpmn",
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ })
+
+ public void sunnyDay() throws Exception {
+ //logStart();
+
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
+ MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
+ mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPut("skask", "/supercool", 202);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+ String updateVfModuleRequest =
+ FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json");
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfraV2",
+ "v1", businessKey, updateVfModuleRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ //String responseBody = response.getResponse();
+ //System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ //logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", false);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "UPDATE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("vfModuleId", "supercool");
+ variables.put("volumeGroupId", "");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ variables.put("moduleUuid", "fe6985cd-ea33-3346-ac12-ab121484a3fe");
+ return variables;
+
+ }
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java
index b24eb56058..00efc575ef 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -41,103 +41,104 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit test cases for UpdateVfModuleVolume.bpmn
*/
public class UpdateVfModuleVolumeInfraV1Test extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVfModuleVolumeInfraV1Test() throws IOException {
- callbacks.put("volumeGroupUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml"));
- }
-
- /**
- * Happy path scenario.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "process/UpdateVfModuleVolumeInfraV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void happyPath() throws Exception {
-
- logStart();
-
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200);
- mockPutVNFVolumeGroup("78987", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVfModuleVolRequest =
- FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true);
-
- logEnd();
- }
-
- /**
- * VF Module Personal model id does not match request model invariant id
- * @throws Exception
- */
- @Test
- //@Ignore
- @Deployment(resources = {
- "process/UpdateVfModuleVolumeInfraV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void testPersonaModelIdNotMatch() throws Exception {
-
- logStart();
-
- MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200);
- mockPutVNFVolumeGroup("78987", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVfModuleVolRequest =
- FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true);
-
- logEnd();
- }
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public UpdateVfModuleVolumeInfraV1Test() throws IOException {
+ callbacks.put("volumeGroupUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml"));
+ }
+
+ /**
+ * Happy path scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Deployment(resources = {
+ "process/UpdateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericNotificationService.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ public void happyPath() throws Exception {
+
+ logStart();
+
+ MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
+ MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
+ MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200);
+ mockPutVNFVolumeGroup("78987", 202);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String updaetVfModuleVolRequest =
+ FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ /**
+ * VF Module Personal model id does not match request model invariant id
+ *
+ * @throws Exception
+ */
+ @Test
+ //@Ignore
+ @Deployment(resources = {
+ "process/UpdateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericNotificationService.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ public void testPersonaModelIdNotMatch() throws Exception {
+
+ logStart();
+
+ MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
+ MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
+ MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200);
+ mockPutVNFVolumeGroup("78987", 202);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String updaetVfModuleVolRequest =
+ FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true);
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java
index 391fc2308b..b83040e60f 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -56,119 +56,119 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
* Unit test cases for UpdateVnfInfra.bpmn
*/
public class UpdateVnfInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVnfInfraTest() throws IOException {
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Deployment(resources = {
- "process/UpdateVnfInfra.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/DoUpdateVnfAndModules.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
- "subprocess/BuildingBlock/RainyDayHandler.bpmn",
- "subprocess/BuildingBlock/ManualHandling.bpmn"
-
- })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockVNFPut("skask", "/lukewarm", 202);
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
- MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockSetInMaintFlagByVnfId("skask", 200);
- MockPolicySkip();
-
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVnfRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVnf_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVnfInfra",
- "v1", businessKey, updaetVnfRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isDebugLogEnabled", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("serviceType", "MOG");
-
- return variables;
-
- }
-
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public UpdateVnfInfraTest() throws IOException {
+ callbacks.put("changeassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("vnfUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
+ }
+
+ /**
+ * Sunny day scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ @Deployment(resources = {
+ "process/UpdateVnfInfra.bpmn",
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/DoUpdateVnfAndModules.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/BuildingBlock/DecomposeService.bpmn",
+ "subprocess/BuildingBlock/RainyDayHandler.bpmn",
+ "subprocess/BuildingBlock/ManualHandling.bpmn"
+
+ })
+ public void sunnyDay() throws Exception {
+
+ logStart();
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ //MockGetGenericVnfById_404("testVnfId");
+ MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json");
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf(".*");
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPut("skask", "/supercool", 202);
+ mockVNFPut("skask", "/lukewarm", 202);
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+ MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
+ MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
+ MockSetInMaintFlagByVnfId("skask", 200);
+ MockPolicySkip();
+
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String updaetVnfRequest =
+ FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVnf_VID_request.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVnfInfra",
+ "v1", businessKey, updaetVnfRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("serviceType", "MOG");
+
+ return variables;
+
+ }
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java
index e7b80f12ab..918311ba4b 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java
@@ -22,20 +22,20 @@ package org.openecomp.mso.bpmn.vcpe;
import org.openecomp.mso.bpmn.common.WorkflowTest;
public class AbstractTestBase extends WorkflowTest {
-
-
- public static final String CUST = "SDN-ETHERNET-INTERNET";
- public static final String SVC = "123456789";
- public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET";
- public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET";
- public static final String ARID = "arId-1";
- public static final String ARVERS = "1490627351232";
- public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET";
- public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET";
- public static final String VAR_SUCCESS_IND = "SuccessIndicator";
- public static final String VAR_WFEX = "SavedWorkflowException1";
- public static final String VAR_RESP_CODE = "CMSO_ResponseCode";
- public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest";
+ public static final String CUST = "SDN-ETHERNET-INTERNET";
+ public static final String SVC = "123456789";
+ public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET";
+ public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET";
+ public static final String ARID = "arId-1";
+ public static final String ARVERS = "1490627351232";
+
+ public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET";
+ public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET";
+
+ public static final String VAR_SUCCESS_IND = "SuccessIndicator";
+ public static final String VAR_WFEX = "SavedWorkflowException1";
+ public static final String VAR_RESP_CODE = "CMSO_ResponseCode";
+ public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest";
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java
index 1b3bfa8c76..10809bef11 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java
@@ -46,332 +46,332 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
public class CreateVcpeResCustServiceTest extends AbstractTestBase {
- private static final String PROCNAME = "CreateVcpeResCustService";
- private static final String Prefix = "CVRCS_";
-
- private final CallbackSet callbacks = new CallbackSet();
- private final String request;
-
- public CreateVcpeResCustServiceTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml"));
- callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml"));
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
-
- request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json");
- }
-
- @Test
- @Deployment(resources = {
- "process/CreateVcpeResCustService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericPutService.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
+ private static final String PROCNAME = "CreateVcpeResCustService";
+ private static final String Prefix = "CVRCS_";
+
+ private final CallbackSet callbacks = new CallbackSet();
+ private final String request;
+
+ public CreateVcpeResCustServiceTest() throws IOException {
+ callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml"));
+ callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml"));
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+
+ request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json");
+ }
+
+ @Test
+ @Deployment(resources = {
+ "process/CreateVcpeResCustService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericPutService.bpmn",
+ "subprocess/BuildingBlock/DecomposeService.bpmn",
"subprocess/DoCreateServiceInstance.bpmn",
- "subprocess/DoCreateAllottedResourceTXC.bpmn",
- "subprocess/DoCreateAllottedResourceBRG.bpmn",
+ "subprocess/DoCreateAllottedResourceTXC.bpmn",
+ "subprocess/DoCreateAllottedResourceBRG.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
// stubs
- "VCPE/stubprocess/Homing.bpmn",
+ "VCPE/stubprocess/Homing.bpmn",
"VCPE/stubprocess/DoCreateVnfAndModules.bpmn"})
-
- public void testCreateVcpeResCustService_Success() throws Exception {
-
- System.out.println("starting: testCreateVcpeResCustService_Success\n");
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
-
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = setupVariables();
-
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
-
- // for SI
- injectSDNCCallbacks(callbacks, "assign");
-
- // for TXC
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryTXC");
-
- // for BRG
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryBRG");
-
- waitForProcessEnd(businessKey, 10000);
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
-
- String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
- assertEquals(null, workflowException);
- assertTrue(completionReq.contains("request-id>testRequestId<"));
- assertTrue(completionReq.contains("action>CREATE<"));
- assertTrue(completionReq.contains("source>VID<"));
-
- assertEquals("1", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount"));
- }
-
- @Test
- @Deployment(resources = {
- "process/CreateVcpeResCustService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericPutService.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
+
+ public void testCreateVcpeResCustService_Success() throws Exception {
+
+ System.out.println("starting: testCreateVcpeResCustService_Success\n");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ // for SI
+ injectSDNCCallbacks(callbacks, "assign");
+
+ // for TXC
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryTXC");
+
+ // for BRG
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryBRG");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, workflowException);
+ assertTrue(completionReq.contains("request-id>testRequestId<"));
+ assertTrue(completionReq.contains("action>CREATE<"));
+ assertTrue(completionReq.contains("source>VID<"));
+
+ assertEquals("1", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + "VnfsCreatedCount"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "process/CreateVcpeResCustService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericPutService.bpmn",
+ "subprocess/BuildingBlock/DecomposeService.bpmn",
"subprocess/DoCreateServiceInstance.bpmn",
- "subprocess/DoCreateAllottedResourceTXC.bpmn",
- "subprocess/DoCreateAllottedResourceBRG.bpmn",
+ "subprocess/DoCreateAllottedResourceTXC.bpmn",
+ "subprocess/DoCreateAllottedResourceBRG.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
// stubs
- "VCPE/stubprocess/Homing.bpmn",
+ "VCPE/stubprocess/Homing.bpmn",
"VCPE/stubprocess/DoCreateVnfAndModules.bpmn"})
-
- public void testCreateVcpeResCustService_NoParts() throws Exception {
-
- System.out.println("starting: testCreateVcpeResCustService_NoParts\n" );
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
- MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-
- // TODO: should these really be PARENT_INST, or should they be INST?
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
-
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = setupVariables();
-
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
-
- // for SI
- injectSDNCCallbacks(callbacks, "assign");
-
- waitForProcessEnd(businessKey, 10000);
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
-
- String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
- assertEquals(null, workflowException);
- assertTrue(completionReq.contains("request-id>testRequestId<"));
- assertTrue(completionReq.contains("action>CREATE<"));
- assertTrue(completionReq.contains("source>VID<"));
-
- assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount"));
- }
-
- @Test
- @Deployment(resources = {
- "process/CreateVcpeResCustService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericPutService.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
+
+ public void testCreateVcpeResCustService_NoParts() throws Exception {
+
+ System.out.println("starting: testCreateVcpeResCustService_NoParts\n");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+ MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+
+ // TODO: should these really be PARENT_INST, or should they be INST?
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ // for SI
+ injectSDNCCallbacks(callbacks, "assign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, workflowException);
+ assertTrue(completionReq.contains("request-id>testRequestId<"));
+ assertTrue(completionReq.contains("action>CREATE<"));
+ assertTrue(completionReq.contains("source>VID<"));
+
+ assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + "VnfsCreatedCount"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "process/CreateVcpeResCustService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericPutService.bpmn",
+ "subprocess/BuildingBlock/DecomposeService.bpmn",
"subprocess/DoCreateServiceInstance.bpmn",
- "subprocess/DoCreateAllottedResourceBRG.bpmn",
+ "subprocess/DoCreateAllottedResourceBRG.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
// this stub will trigger a fault
- "VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn",
+ "VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn",
// stubs
- "VCPE/stubprocess/Homing.bpmn",
+ "VCPE/stubprocess/Homing.bpmn",
"VCPE/stubprocess/DoCreateVnfAndModules.bpmn"})
-
- public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception {
-
- System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n");
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
-
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = setupVariables();
-
- String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json");
-
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables);
-
- // for SI
- injectSDNCCallbacks(callbacks, "assign");
-
- waitForProcessEnd(businessKey, 10000);
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
-
- String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
- assertNotNull(workflowException);
-
- BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceBRGRollback");
- BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateVnfAndModulesRollback");
- BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceTXCRollback");
- }
-
- @Test
- @Deployment(resources = {
- "process/CreateVcpeResCustService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericPutService.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
+
+ public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception {
+
+ System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = setupVariables();
+
+ String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json");
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables);
+
+ // for SI
+ injectSDNCCallbacks(callbacks, "assign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+ assertNotNull(workflowException);
+
+ BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceBRGRollback");
+ BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateVnfAndModulesRollback");
+ BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceTXCRollback");
+ }
+
+ @Test
+ @Deployment(resources = {
+ "process/CreateVcpeResCustService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericPutService.bpmn",
+ "subprocess/BuildingBlock/DecomposeService.bpmn",
"subprocess/DoCreateServiceInstance.bpmn",
- "subprocess/DoCreateAllottedResourceTXC.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn",
+ "subprocess/DoCreateAllottedResourceTXC.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
// this stub will trigger a fault
- "VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn",
+ "VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn",
// stubs
- "VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn",
- "VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn",
+ "VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn",
+ "VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn",
"VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn",
- "VCPE/stubprocess/Homing.bpmn",
+ "VCPE/stubprocess/Homing.bpmn",
"VCPE/stubprocess/DoCreateVnfAndModules.bpmn"})
-
- public void testCreateVcpeResCustService_Fault_Rollback() throws Exception {
-
- System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n");
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
- MockGetAllottedResource(CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, PARENT_INST, ARID, ARVERS);
-
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = setupVariables();
-
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
-
- // for SI
- injectSDNCCallbacks(callbacks, "assign");
-
- // for TXC
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryTXC");
-
- // BRG is a stub so don't need SDNC callbacks
-
- // for TXC rollback
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
-
- String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
- assertEquals(null, completionReq);
- assertNotNull(workflowException);
-
- BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceBRGRollback");
- BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateVnfAndModulesRollback");
- BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceTXCRollback");
- }
-
- // *****************
- // Utility Section
- // *****************
-
- // Success Scenario
- private Map<String, Object> setupVariables() {
- Map<String, Object> variables = new HashMap<>();
- variables.put("requestId", "testRequestId");
- variables.put("request-id", "testRequestId");
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("allottedResourceId", ARID);
- return variables;
-
- }
+
+ public void testCreateVcpeResCustService_Fault_Rollback() throws Exception {
+
+ System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+ MockGetAllottedResource(CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, PARENT_INST, ARID, ARVERS);
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ // for SI
+ injectSDNCCallbacks(callbacks, "assign");
+
+ // for TXC
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryTXC");
+
+ // BRG is a stub so don't need SDNC callbacks
+
+ // for TXC rollback
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, completionReq);
+ assertNotNull(workflowException);
+
+ BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceBRGRollback");
+ BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateVnfAndModulesRollback");
+ BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceTXCRollback");
+ }
+
+ // *****************
+ // Utility Section
+ // *****************
+
+ // Success Scenario
+ private Map<String, Object> setupVariables() {
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("requestId", "testRequestId");
+ variables.put("request-id", "testRequestId");
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("allottedResourceId", ARID);
+ return variables;
+
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java
index d026b7a949..c8edc82a23 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java
@@ -50,248 +50,248 @@ import com.github.tomakehurst.wiremock.stubbing.Scenario;
public class DeleteVcpeResCustServiceTest extends AbstractTestBase {
- private static final String PROCNAME = "DeleteVcpeResCustService";
- private static final String Prefix = "DVRCS_";
- private static final String AR_BRG_ID = "ar-brgB";
- private static final String AR_TXC_ID = "ar-txcA";
-
- private final CallbackSet callbacks = new CallbackSet();
- private final String request;
-
- public DeleteVcpeResCustServiceTest() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
-
- request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json");
- }
-
- @Test
- @Deployment(resources = {
- "process/DeleteVcpeResCustService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
+ private static final String PROCNAME = "DeleteVcpeResCustService";
+ private static final String Prefix = "DVRCS_";
+ private static final String AR_BRG_ID = "ar-brgB";
+ private static final String AR_TXC_ID = "ar-txcA";
+
+ private final CallbackSet callbacks = new CallbackSet();
+ private final String request;
+
+ public DeleteVcpeResCustServiceTest() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+
+ request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json");
+ }
+
+ @Test
+ @Deployment(resources = {
+ "process/DeleteVcpeResCustService.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericDeleteService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
"subprocess/DoDeleteServiceInstance.bpmn",
- "subprocess/DoDeleteAllottedResourceBRG.bpmn",
- "subprocess/DoDeleteAllottedResourceTXC.bpmn",
+ "subprocess/DoDeleteAllottedResourceBRG.bpmn",
+ "subprocess/DoDeleteAllottedResourceTXC.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
// stubs
"VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"})
-
- public void testDeleteVcpeResCustService_Success() throws Exception {
- MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ public void testDeleteVcpeResCustService_Success() throws Exception {
- // TODO: use INST instead of DEC_INST
- /*
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+
+ // TODO: use INST instead of DEC_INST
+ /*
* Seems to be a bug in GenericDeleteService (or its subflows) as they
* fail to URL-encode the SI id before performing the query so we'll
* add a stub for that case, too.
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
/*
* cannot use MockGetServiceInstance(), because we need to return
* different responses as we traverse through the flow
- */
-
- // initially, the SI includes the ARs
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
- .inScenario("SI retrieval")
- .whenScenarioStateIs(Scenario.STARTED)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml"))
- .willSetStateTo("ARs Deleted"));
-
- // once the ARs have been deleted, the SI should be empty
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
- .inScenario("SI retrieval")
- .whenScenarioStateIs("ARs Deleted")
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml")));
-
- // for BRG
- MockQueryAllottedResourceById(AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
- MockGetAllottedResource(CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, AR_BRG_ID);
- MockDeleteAllottedResource(CUST, SVC, INST, AR_BRG_ID, ARVERS);
-
- // for TXC
- MockQueryAllottedResourceById(AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
- MockGetAllottedResource(CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, AR_TXC_ID);
- MockDeleteAllottedResource(CUST, SVC, INST, AR_TXC_ID, ARVERS);
-
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = setupVariables();
+ */
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
-
- // for BRG
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- // for TXC
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- // for SI
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
-
- waitForProcessEnd(businessKey, 10000);
+ // initially, the SI includes the ARs
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
+ .inScenario("SI retrieval")
+ .whenScenarioStateIs(Scenario.STARTED)
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml"))
+ .willSetStateTo("ARs Deleted"));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
+ // once the ARs have been deleted, the SI should be empty
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
+ .inScenario("SI retrieval")
+ .whenScenarioStateIs("ARs Deleted")
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml")));
- String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
- assertEquals(null, workflowException);
- assertTrue(completionReq.contains("<request-id>testRequestId<"));
- assertTrue(completionReq.contains("<action>DELETE<"));
- assertTrue(completionReq.contains("<source>VID<"));
-
- assertEquals("2", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"vnfsDeletedCount"));
-
- BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoDeleteVnfAndModules");
- }
-
- @Test
- @Deployment(resources = {
- "process/DeleteVcpeResCustService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
+ // for BRG
+ MockQueryAllottedResourceById(AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, AR_BRG_ID);
+ MockDeleteAllottedResource(CUST, SVC, INST, AR_BRG_ID, ARVERS);
+
+ // for TXC
+ MockQueryAllottedResourceById(AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, AR_TXC_ID);
+ MockDeleteAllottedResource(CUST, SVC, INST, AR_TXC_ID, ARVERS);
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ // for BRG
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ // for TXC
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ // for SI
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, workflowException);
+ assertTrue(completionReq.contains("<request-id>testRequestId<"));
+ assertTrue(completionReq.contains("<action>DELETE<"));
+ assertTrue(completionReq.contains("<source>VID<"));
+
+ assertEquals("2", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + "vnfsDeletedCount"));
+
+ BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoDeleteVnfAndModules");
+ }
+
+ @Test
+ @Deployment(resources = {
+ "process/DeleteVcpeResCustService.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericDeleteService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
"subprocess/DoDeleteServiceInstance.bpmn",
- "subprocess/DoDeleteAllottedResourceBRG.bpmn",
- "subprocess/DoDeleteAllottedResourceTXC.bpmn",
+ "subprocess/DoDeleteAllottedResourceBRG.bpmn",
+ "subprocess/DoDeleteAllottedResourceTXC.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
// stubs
"VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"})
-
- public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
- MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
+
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
- // TODO: use INST instead of DEC_INST
+ // TODO: use INST instead of DEC_INST
/*
* Seems to be a bug in GenericDeleteService (or its subflows) as they
* fail to URL-encode the SI id before performing the query so we'll
* add a stub for that case, too.
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
-
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = setupVariables();
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
-
- // for SI
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
-
- waitForProcessEnd(businessKey, 10000);
+ MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
- assertEquals(null, workflowException);
- assertTrue(completionReq.contains("<request-id>testRequestId<"));
- assertTrue(completionReq.contains("<action>DELETE<"));
- assertTrue(completionReq.contains("<source>VID<"));
-
- assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"vnfsDeletedCount"));
-
- BPMNUtil.assertNoProcessInstance(processEngineRule, "DoDeleteVnfAndModules");
- }
-
- @Test
- @Deployment(resources = {
- "process/DeleteVcpeResCustService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ // for SI
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, workflowException);
+ assertTrue(completionReq.contains("<request-id>testRequestId<"));
+ assertTrue(completionReq.contains("<action>DELETE<"));
+ assertTrue(completionReq.contains("<source>VID<"));
+
+ assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + "vnfsDeletedCount"));
+
+ BPMNUtil.assertNoProcessInstance(processEngineRule, "DoDeleteVnfAndModules");
+ }
+
+ @Test
+ @Deployment(resources = {
+ "process/DeleteVcpeResCustService.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericDeleteService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
"subprocess/DoDeleteServiceInstance.bpmn",
- "subprocess/DoDeleteAllottedResourceBRG.bpmn",
- "subprocess/DoDeleteAllottedResourceTXC.bpmn",
+ "subprocess/DoDeleteAllottedResourceBRG.bpmn",
+ "subprocess/DoDeleteAllottedResourceTXC.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
// stubs
"VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"})
-
- public void testDeleteVcpeResCustService_Fault() throws Exception {
- MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ public void testDeleteVcpeResCustService_Fault() throws Exception {
- // TODO: use INST instead of DEC_INST
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+
+ // TODO: use INST instead of DEC_INST
/*
* Seems to be a bug in GenericDeleteService (or its subflows) as they
* fail to URL-encode the SI id before performing the query so we'll
* add a stub for that case, too.
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
-
- // generate failure
- mockSDNCAdapter(404);
-
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = setupVariables();
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
-
- waitForProcessEnd(businessKey, 10000);
+ MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
+ // generate failure
+ mockSDNCAdapter(404);
+
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+ assertNotNull(workflowException);
+ }
+
+ private Map<String, Object> setupVariables() throws UnsupportedEncodingException {
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("requestId", "testRequestId");
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("sdncVersion", "1802");
+ variables.put("serviceInstanceName", "some-junk-name");
+ return variables;
+ }
- String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
- assertNotNull(workflowException);
- }
-
- private Map<String, Object> setupVariables() throws UnsupportedEncodingException {
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("sdncVersion", "1802");
- variables.put("serviceInstanceName", "some-junk-name");
- return variables;
- }
-
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java
index 0407e172e2..d467bbdb2a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java
@@ -43,303 +43,303 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
public class DoCreateAllottedResourceBRGRollbackTest extends AbstractTestBase {
- private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback";
- private static final String RbType = "DCARBRG_";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateAllottedResourceBRGRollbackTest() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
-
- rollbackData.put(RbType, "rollbackAAI", "false");
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception {
-
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
-
- // this will cause "rollbackSDNC" to be set to false
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
-
- rollbackData.put(RbType, "rollbackSDNCactivate", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
-
- rollbackData.put(RbType, "rollbackSDNCcreate", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
-
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
+ private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback";
+ private static final String RbType = "DCARBRG_";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceBRGRollbackTest() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+ rollbackData.put(RbType, "rollbackAAI", "false");
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception {
+
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+ // this will cause "rollbackSDNC" to be set to false
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+ rollbackData.put(RbType, "rollbackSDNCactivate", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+ rollbackData.put(RbType, "rollbackSDNCcreate", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
/*
* Note: if assign == false then the flow/script will set
* "skipRollback" to false, which will cause ALL of the SDNC steps
* to be skipped, not just the unassign step.
*/
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- variables.put("rollbackData", "string instead of rollback data");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failNotFound", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("allottedResourceId", ARID);
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
- rollbackData.put(RbType, "serviceSubscriptionType", SVC);
- rollbackData.put(RbType, "disablerollback", "false");
- rollbackData.put(RbType, "rollbackAAI", "true");
- rollbackData.put(RbType, "rollbackSDNCassign", "true");
- rollbackData.put(RbType, "rollbackSDNCactivate", "true");
- rollbackData.put(RbType, "rollbackSDNCcreate", "true");
- rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID);
-
- rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml"));
- rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml"));
- rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml"));
-
- variables.put("rollbackData",rollbackData);
-
- return rollbackData;
- }
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ variables.put("rollbackData", "string instead of rollback data");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
+ rollbackData.put(RbType, "serviceSubscriptionType", SVC);
+ rollbackData.put(RbType, "disablerollback", "false");
+ rollbackData.put(RbType, "rollbackAAI", "true");
+ rollbackData.put(RbType, "rollbackSDNCassign", "true");
+ rollbackData.put(RbType, "rollbackSDNCactivate", "true");
+ rollbackData.put(RbType, "rollbackSDNCcreate", "true");
+ rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID);
+
+ rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml"));
+
+ variables.put("rollbackData", rollbackData);
+
+ return rollbackData;
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java
index 0373266ce1..7b858c464e 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java
@@ -43,254 +43,254 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
public class DoCreateAllottedResourceBRGTest extends AbstractTestBase {
- private static final String PROCNAME = "DoCreateAllottedResourceBRG";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateAllottedResourceBRGTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRG.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRG_Success() throws Exception{
-
- // TODO: use INST instead of DEC_INST
- /*
+ private static final String PROCNAME = "DoCreateAllottedResourceBRG";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceBRGTest() throws IOException {
+ callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRG.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRG_Success() throws Exception {
+
+ // TODO: use INST instead of DEC_INST
+ /*
* should be INST instead of DEC_INST, but AAI utilities appear to
* have a bug in that they don't URL-encode the SI id before using
* it in the query
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "query");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- assertEquals(null, workflowException);
-
- assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRG.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRG_NoSI() throws Exception{
-
- // TODO: use INST instead of DEC_INST
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ assertEquals(null, workflowException);
+
+ assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRG.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRG_NoSI() throws Exception {
+
+ // TODO: use INST instead of DEC_INST
/*
* should be INST instead of DEC_INST, but AAI utilities appear to
* have a bug in that they don't URL-encode the SI id before using
* it in the query
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml");
- MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- assertNotNull(workflowException);
-
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRG.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception{
-
- // TODO: use INST instead of DEC_INST
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRG.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception {
+
+ // TODO: use INST instead of DEC_INST
/*
* should be INST instead of DEC_INST, but AAI utilities appear to
* have a bug in that they don't URL-encode the SI id before using
* it in the query
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- variables.put("failExists", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "query");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- assertEquals(null, workflowException);
-
- assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRG.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception{
-
- // TODO: use INST instead of DEC_INST
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ variables.put("failExists", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ assertEquals(null, workflowException);
+
+ assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRG.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception {
+
+ // TODO: use INST instead of DEC_INST
/*
* should be INST instead of DEC_INST, but AAI utilities appear to
* have a bug in that they don't URL-encode the SI id before using
* it in the query
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- assertNotNull(workflowException);
-
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRG.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception{
-
- // TODO: use INST instead of DEC_INST
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceBRG.bpmn",
+ "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+ public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception {
+
+ // TODO: use INST instead of DEC_INST
/*
* should be INST instead of DEC_INST, but AAI utilities appear to
* have a bug in that they don't URL-encode the SI id before using
* it in the query
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(404);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- assertNotNull(workflowException);
-
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failExists", "true");
- variables.put("disableRollback", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("sourceNetworkId", "snId");
- variables.put("sourceNetworkRole", "snRole");
- variables.put("allottedResourceRole", "txc");
- variables.put("allottedResourceType", "BRG");
- variables.put("allottedResourceId", ARID);
- variables.put("vni", "BRG");
- variables.put("vgmuxBearerIP", "bearerip");
- variables.put("brgWanMacAddress", "wanmac");
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- variables.put("serviceChainServiceInstanceId", "scsiId");
-
- String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("allottedResourceModelInfo", arModelInfo);
- }
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(404);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failExists", "true");
+ variables.put("disableRollback", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("sourceNetworkId", "snId");
+ variables.put("sourceNetworkRole", "snRole");
+ variables.put("allottedResourceRole", "txc");
+ variables.put("allottedResourceType", "BRG");
+ variables.put("allottedResourceId", ARID);
+ variables.put("vni", "BRG");
+ variables.put("vgmuxBearerIP", "bearerip");
+ variables.put("brgWanMacAddress", "wanmac");
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ variables.put("serviceChainServiceInstanceId", "scsiId");
+
+ String arModelInfo = "{ " + "\"modelType\": \"allotted-resource\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
+ "}";
+ variables.put("allottedResourceModelInfo", arModelInfo);
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java
index cdce56ee63..b8b0130159 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java
@@ -43,303 +43,303 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
public class DoCreateAllottedResourceTXCRollbackTest extends AbstractTestBase {
- private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback";
- private static final String RbType = "DCARTXC_";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateAllottedResourceTXCRollbackTest() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
-
- rollbackData.put(RbType, "rollbackAAI", "false");
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception {
-
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
-
- // this will cause "rollbackSDNC" to be set to false
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
-
- rollbackData.put(RbType, "rollbackSDNCactivate", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
-
- rollbackData.put(RbType, "rollbackSDNCcreate", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
-
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
+ private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback";
+ private static final String RbType = "DCARTXC_";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceTXCRollbackTest() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+ rollbackData.put(RbType, "rollbackAAI", "false");
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception {
+
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+ // this will cause "rollbackSDNC" to be set to false
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+ rollbackData.put(RbType, "rollbackSDNCactivate", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+ rollbackData.put(RbType, "rollbackSDNCcreate", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
/*
* Note: if assign == false then the flow/script will set
* "skipRollback" to false, which will cause ALL of the SDNC steps
* to be skipped, not just the unassign step.
*/
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception {
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- variables.put("rollbackData", "string instead of rollback data");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
- assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
- }
-
- private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failNotFound", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("allottedResourceId", ARID);
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
- rollbackData.put(RbType, "serviceSubscriptionType", SVC);
- rollbackData.put(RbType, "disablerollback", "false");
- rollbackData.put(RbType, "rollbackAAI", "true");
- rollbackData.put(RbType, "rollbackSDNCassign", "true");
- rollbackData.put(RbType, "rollbackSDNCactivate", "true");
- rollbackData.put(RbType, "rollbackSDNCcreate", "true");
- rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID);
-
- rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml"));
- rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml"));
- rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml"));
-
- variables.put("rollbackData",rollbackData);
-
- return rollbackData;
- }
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception {
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ variables.put("rollbackData", "string instead of rollback data");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+ assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+ }
+
+ private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
+ rollbackData.put(RbType, "serviceSubscriptionType", SVC);
+ rollbackData.put(RbType, "disablerollback", "false");
+ rollbackData.put(RbType, "rollbackAAI", "true");
+ rollbackData.put(RbType, "rollbackSDNCassign", "true");
+ rollbackData.put(RbType, "rollbackSDNCactivate", "true");
+ rollbackData.put(RbType, "rollbackSDNCcreate", "true");
+ rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID);
+
+ rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml"));
+
+ variables.put("rollbackData", rollbackData);
+
+ return rollbackData;
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java
index 9cf059c24c..643ff3cc01 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java
@@ -43,260 +43,260 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
public class DoCreateAllottedResourceTXCTest extends AbstractTestBase {
- private static final String PROCNAME = "DoCreateAllottedResourceTXC";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateAllottedResourceTXCTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXC.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXC_Success() throws Exception{
-
- // TODO: use INST instead of DEC_INST
- /*
+ private static final String PROCNAME = "DoCreateAllottedResourceTXC";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceTXCTest() throws IOException {
+ callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXC.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXC_Success() throws Exception {
+
+ // TODO: use INST instead of DEC_INST
+ /*
* should be INST instead of DEC_INST, but AAI utilities appear to
* have a bug in that they don't URL-encode the SI id before using
* it in the query
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "query");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- assertEquals(null, workflowException);
-
- assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
- assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni"));
- assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP"));
- assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXC.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXC_NoSI() throws Exception{
-
- // TODO: use INST instead of DEC_INST
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ assertEquals(null, workflowException);
+
+ assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+ assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni"));
+ assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP"));
+ assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXC.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXC_NoSI() throws Exception {
+
+ // TODO: use INST instead of DEC_INST
/*
* should be INST instead of DEC_INST, but AAI utilities appear to
* have a bug in that they don't URL-encode the SI id before using
* it in the query
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml");
- MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- assertNotNull(workflowException);
-
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXC.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception{
-
- // TODO: use INST instead of DEC_INST
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXC.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception {
+
+ // TODO: use INST instead of DEC_INST
/*
* should be INST instead of DEC_INST, but AAI utilities appear to
* have a bug in that they don't URL-encode the SI id before using
* it in the query
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- variables.put("failExists", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "query");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- assertEquals(null, workflowException);
-
- assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
- assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni"));
- assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP"));
- assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXC.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception{
-
- // TODO: use INST instead of DEC_INST
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ variables.put("failExists", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ assertEquals(null, workflowException);
+
+ assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+ assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni"));
+ assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP"));
+ assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXC.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception {
+
+ // TODO: use INST instead of DEC_INST
/*
* should be INST instead of DEC_INST, but AAI utilities appear to
* have a bug in that they don't URL-encode the SI id before using
* it in the query
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
-
- MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- assertNotNull(workflowException);
-
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXC.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception{
-
- // TODO: use INST instead of DEC_INST
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateAllottedResourceTXC.bpmn",
+ "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+ public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception {
+
+ // TODO: use INST instead of DEC_INST
/*
* should be INST instead of DEC_INST, but AAI utilities appear to
* have a bug in that they don't URL-encode the SI id before using
* it in the query
*/
- MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(404);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- assertNotNull(workflowException);
-
- assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
- // TODO: need all of these?
- variables.put("isDebugLogEnabled", "true");
- variables.put("failExists", "true");
- variables.put("disableRollback", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("sourceNetworkId", "snId");
- variables.put("sourceNetworkRole", "snRole");
- variables.put("allottedResourceRole", "brg");
- variables.put("allottedResourceType", "TXC");
- variables.put("allottedResourceId", ARID);
- variables.put("brgWanMacAddress", "wanmac");
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- variables.put("serviceChainServiceInstanceId", "scsiId");
-
- String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("allottedResourceModelInfo", arModelInfo);
- }
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(404);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ // TODO: need all of these?
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failExists", "true");
+ variables.put("disableRollback", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("sourceNetworkId", "snId");
+ variables.put("sourceNetworkRole", "snRole");
+ variables.put("allottedResourceRole", "brg");
+ variables.put("allottedResourceType", "TXC");
+ variables.put("allottedResourceId", ARID);
+ variables.put("brgWanMacAddress", "wanmac");
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ variables.put("serviceChainServiceInstanceId", "scsiId");
+
+ String arModelInfo = "{ " + "\"modelType\": \"allotted-resource\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
+ "}";
+ variables.put("allottedResourceModelInfo", arModelInfo);
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
index 03972da789..1395d7b9ed 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
@@ -43,120 +43,120 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
public class DoDeleteAllottedResourceBRGTest extends AbstractTestBase {
- private static final String PROCNAME = "DoDeleteAllottedResourceBRG";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoDeleteAllottedResourceBRGTest() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
- public void testDoDeleteAllottedResourceBRG_Success() throws Exception {
-
- MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
- public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() throws Exception {
-
- MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- variables.put("failNotFound", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivateNF");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- }
-
- // TODO - exception is not caught
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
- public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception {
-
- MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(500);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertNotNull(workflowException);
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failNotFound", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("allottedResourceId", ARID);
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
- }
+ private static final String PROCNAME = "DoDeleteAllottedResourceBRG";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoDeleteAllottedResourceBRGTest() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
+ public void testDoDeleteAllottedResourceBRG_Success() throws Exception {
+
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
+ public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() throws Exception {
+
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ variables.put("failNotFound", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivateNF");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ }
+
+ // TODO - exception is not caught
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
+ public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception {
+
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(500);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNotNull(workflowException);
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java
index 2b0364c3c9..6990cc0689 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java
@@ -43,120 +43,120 @@ import org.openecomp.mso.bpmn.mock.FileUtil;
public class DoDeleteAllottedResourceTXCTest extends AbstractTestBase {
- private static final String PROCNAME = "DoDeleteAllottedResourceTXC";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoDeleteAllottedResourceTXCTest() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoDeleteAllottedResourceTXC.bpmn"})
- public void testDoDeleteAllottedResourceTXC_Success() throws Exception {
-
- MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoDeleteAllottedResourceTXC.bpmn"})
- public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception {
-
- MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- variables.put("failNotFound", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivateNF");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- }
-
- // TODO - exception is not caught
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoDeleteAllottedResourceTXC.bpmn"})
- public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception {
-
- MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
- MockPatchAllottedResource(CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(500);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId1");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertNotNull(workflowException);
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failNotFound", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("allottedResourceId", ARID);
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
- }
+ private static final String PROCNAME = "DoDeleteAllottedResourceTXC";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoDeleteAllottedResourceTXCTest() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoDeleteAllottedResourceTXC.bpmn"})
+ public void testDoDeleteAllottedResourceTXC_Success() throws Exception {
+
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoDeleteAllottedResourceTXC.bpmn"})
+ public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception {
+
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ variables.put("failNotFound", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivateNF");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ }
+
+ // TODO - exception is not caught
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoDeleteAllottedResourceTXC.bpmn"})
+ public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception {
+
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(500);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNotNull(workflowException);
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+ }
}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/CryptoTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/CryptoTest.java
index 3415420c88..e38aed8285 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/CryptoTest.java
+++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/CryptoTest.java
@@ -34,46 +34,45 @@ import org.openecomp.mso.utils.CryptoUtils;
/**
* This class implements all test methods of the CryptoUtils features.
- *
- *
*/
public class CryptoTest {
- private static String testKey = "546573746F736973546573746F736973";
+ private static String testKey = "546573746F736973546573746F736973";
- /**
+ /**
* This method is called before any test occurs.
* It creates a fake tree from scratch
*/
@BeforeClass
- public static final void prepare () {
-
+ public static final void prepare() {
+
}
/**
* This method implements a test of tree structure, mainly the storage of the leaves structure.
- * @throws GeneralSecurityException
+ *
+ * @throws GeneralSecurityException
*/
@Test
- public final void testEncryption () throws GeneralSecurityException {
- String hexString = CryptoUtils.byteArrayToHexString("testosistestosi".getBytes());
-
- final String testData = "This is a test string";
- final String nonTestData = "This is not the right String";
-
- String encodeString = CryptoUtils.encrypt(testData, testKey);
-
- assertNotNull(encodeString);
-
- assertTrue(testData.equals(CryptoUtils.decrypt(encodeString, testKey)));
- assertFalse(nonTestData.equals(CryptoUtils.decrypt(encodeString, testKey)));
-
- String encode2String = CryptoUtils.encrypt(testData, testKey);
- assertNotNull(encode2String);
-
- assertEquals(encodeString,encode2String);
-
- assertEquals(CryptoUtils.decrypt(encodeString, testKey),CryptoUtils.decrypt(encode2String, testKey));
+ public final void testEncryption() throws GeneralSecurityException {
+ String hexString = CryptoUtils.byteArrayToHexString("testosistestosi".getBytes());
+
+ final String testData = "This is a test string";
+ final String nonTestData = "This is not the right String";
+
+ String encodeString = CryptoUtils.encrypt(testData, testKey);
+
+ assertNotNull(encodeString);
+
+ assertTrue(testData.equals(CryptoUtils.decrypt(encodeString, testKey)));
+ assertFalse(nonTestData.equals(CryptoUtils.decrypt(encodeString, testKey)));
+
+ String encode2String = CryptoUtils.encrypt(testData, testKey);
+ assertNotNull(encode2String);
+
+ assertEquals(encodeString, encode2String);
+
+ assertEquals(CryptoUtils.decrypt(encodeString, testKey), CryptoUtils.decrypt(encode2String, testKey));
}
}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoAlarmLoggerTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoAlarmLoggerTest.java
index f7d27acaf3..86b0bfb478 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoAlarmLoggerTest.java
+++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoAlarmLoggerTest.java
@@ -41,91 +41,89 @@ import org.openecomp.mso.properties.MsoPropertiesFactory;
/**
* This junit test very roughly the alarm logger
- *
*/
public class MsoAlarmLoggerTest {
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- public static MsoAlarmLogger msoAlarmLogger;
-
- @BeforeClass
- public static final void createObjects() throws MsoPropertiesException
- {
-
- File outputFile = new File ("target/alarm-test.log");
- if (outputFile.exists()) {
- outputFile.delete();
- }
- msoAlarmLogger = new MsoAlarmLogger("target/alarm-test.log");
- }
-
- @Test
- public void testAlarmConfig() throws MsoPropertiesException, IOException {
-
- msoAlarmLogger.sendAlarm("test", 0, "detail message");
-
- FileInputStream inputStream = new FileInputStream("target/alarm-test.log");
- BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
-
- String line = reader.readLine();
- String[] splitLine = line.split("\\|");
- assertTrue(splitLine.length==4);
- assertTrue("test".equals(splitLine[1]));
- assertTrue("0".equals(splitLine[2]));
- assertTrue("detail message".equals(splitLine[3]));
-
- line = reader.readLine();
- assertNull(line);
- reader.close();
- inputStream.close();
-
- // Reset the file for others tests
- PrintWriter writer = new PrintWriter(new File("target/alarm-test.log"));
- writer.print("");
- writer.close();
-
- }
-
- @Test
- public void testAlarm() throws IOException {
-
- msoAlarmLogger.sendAlarm("test", 0, "detail message");
- msoAlarmLogger.sendAlarm("test2", 1, "detail message2");
- msoAlarmLogger.sendAlarm("test3", 2, "detail message3");
-
- FileInputStream inputStream = new FileInputStream("target/alarm-test.log");
- BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
-
- String line = reader.readLine();
- String[] splitLine = line.split("\\|");
- assertTrue(splitLine.length==4);
- assertTrue("test".equals(splitLine[1]));
- assertTrue("0".equals(splitLine[2]));
- assertTrue("detail message".equals(splitLine[3]));
-
- line = reader.readLine();
- splitLine = line.split("\\|");
- assertTrue(splitLine.length==4);
- assertTrue("test2".equals(splitLine[1]));
- assertTrue("1".equals(splitLine[2]));
- assertTrue("detail message2".equals(splitLine[3]));
-
- line = reader.readLine();
- splitLine = line.split("\\|");
- assertTrue(splitLine.length==4);
- assertTrue("test3".equals(splitLine[1]));
- assertTrue("2".equals(splitLine[2]));
- assertTrue("detail message3".equals(splitLine[3]));
-
- line = reader.readLine();
- assertNull(line);
- reader.close();
- inputStream.close();
-
- // Reset the file for others tests
- PrintWriter writer = new PrintWriter(new File("target/alarm-test.log"));
- writer.print("");
- writer.close();
-
- }
+ public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ public static MsoAlarmLogger msoAlarmLogger;
+
+ @BeforeClass
+ public static final void createObjects() throws MsoPropertiesException {
+
+ File outputFile = new File("target/alarm-test.log");
+ if (outputFile.exists()) {
+ outputFile.delete();
+ }
+ msoAlarmLogger = new MsoAlarmLogger("target/alarm-test.log");
+ }
+
+ @Test
+ public void testAlarmConfig() throws MsoPropertiesException, IOException {
+
+ msoAlarmLogger.sendAlarm("test", 0, "detail message");
+
+ FileInputStream inputStream = new FileInputStream("target/alarm-test.log");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+
+ String line = reader.readLine();
+ String[] splitLine = line.split("\\|");
+ assertTrue(splitLine.length == 4);
+ assertTrue("test".equals(splitLine[1]));
+ assertTrue("0".equals(splitLine[2]));
+ assertTrue("detail message".equals(splitLine[3]));
+
+ line = reader.readLine();
+ assertNull(line);
+ reader.close();
+ inputStream.close();
+
+ // Reset the file for others tests
+ PrintWriter writer = new PrintWriter(new File("target/alarm-test.log"));
+ writer.print("");
+ writer.close();
+
+ }
+
+ @Test
+ public void testAlarm() throws IOException {
+
+ msoAlarmLogger.sendAlarm("test", 0, "detail message");
+ msoAlarmLogger.sendAlarm("test2", 1, "detail message2");
+ msoAlarmLogger.sendAlarm("test3", 2, "detail message3");
+
+ FileInputStream inputStream = new FileInputStream("target/alarm-test.log");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+
+ String line = reader.readLine();
+ String[] splitLine = line.split("\\|");
+ assertTrue(splitLine.length == 4);
+ assertTrue("test".equals(splitLine[1]));
+ assertTrue("0".equals(splitLine[2]));
+ assertTrue("detail message".equals(splitLine[3]));
+
+ line = reader.readLine();
+ splitLine = line.split("\\|");
+ assertTrue(splitLine.length == 4);
+ assertTrue("test2".equals(splitLine[1]));
+ assertTrue("1".equals(splitLine[2]));
+ assertTrue("detail message2".equals(splitLine[3]));
+
+ line = reader.readLine();
+ splitLine = line.split("\\|");
+ assertTrue(splitLine.length == 4);
+ assertTrue("test3".equals(splitLine[1]));
+ assertTrue("2".equals(splitLine[2]));
+ assertTrue("detail message3".equals(splitLine[3]));
+
+ line = reader.readLine();
+ assertNull(line);
+ reader.close();
+ inputStream.close();
+
+ // Reset the file for others tests
+ PrintWriter writer = new PrintWriter(new File("target/alarm-test.log"));
+ writer.print("");
+ writer.close();
+
+ }
}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java
index 473f5320df..faef522fbf 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java
+++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java
@@ -40,300 +40,340 @@ import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
+
/**
* This class implements all test methods of the MsoLogger features.
- *
- *
*/
public class MsoLoggerTest {
- static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
+ static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- /**
+ /**
* This method is called before any test occurs.
* It creates a fake tree from scratch
*/
@BeforeClass
- public static final void prepare () {
+ public static final void prepare() {
}
@Before
public final void cleanErrorLogFile() throws FileNotFoundException {
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log";
- PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
- asdcConfigFileWriter.print("");
- asdcConfigFileWriter.flush();
- asdcConfigFileWriter.close();
- }
-
+ URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) +
+ "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log";
+ PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
+ asdcConfigFileWriter.print("");
+ asdcConfigFileWriter.flush();
+ asdcConfigFileWriter.close();
+ }
+
@Before
public final void cleanMetricLogFile() throws FileNotFoundException {
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log";
- PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
- asdcConfigFileWriter.print("");
- asdcConfigFileWriter.flush();
- asdcConfigFileWriter.close();
- }
-
+ URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) +
+ "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log";
+ PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
+ asdcConfigFileWriter.print("");
+ asdcConfigFileWriter.flush();
+ asdcConfigFileWriter.close();
+ }
+
@Before
public final void cleanAuditLogFile() throws FileNotFoundException {
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/auditjbo ss.server.name_IS_UNDEFINED.log";
- PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
- asdcConfigFileWriter.print("");
- asdcConfigFileWriter.flush();
- asdcConfigFileWriter.close();
- }
-
+ URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/auditjbo ss.server.name_IS_UNDEFINED.log";
+ PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
+ asdcConfigFileWriter.print("");
+ asdcConfigFileWriter.flush();
+ asdcConfigFileWriter.close();
+ }
/**
* This method implements a test of getSeverifyLevel method.
*/
- @Test
- public final void testGetSeverityLevel () {
+ @Test
+ public final void testGetSeverityLevel() {
- try {
- String levelInfo = (String)invokePriveMethod("getSeverityLevel", "INFO");
- Assert.assertEquals (levelInfo, "0");
+ try {
+ String levelInfo = (String) invokePriveMethod("getSeverityLevel", "INFO");
+ Assert.assertEquals(levelInfo, "0");
- String levelWarn = (String)invokePriveMethod("getSeverityLevel", "WARN");
- Assert.assertEquals (levelWarn, "1");
+ String levelWarn = (String) invokePriveMethod("getSeverityLevel", "WARN");
+ Assert.assertEquals(levelWarn, "1");
- String levelERROR = (String)invokePriveMethod("getSeverityLevel", "ERROR");
- Assert.assertEquals (levelERROR, "2");
+ String levelERROR = (String) invokePriveMethod("getSeverityLevel", "ERROR");
+ Assert.assertEquals(levelERROR, "2");
- String levelDEBUG = (String)invokePriveMethod("getSeverityLevel", "DEBUG");
- Assert.assertEquals (levelDEBUG, "0");
+ String levelDEBUG = (String) invokePriveMethod("getSeverityLevel", "DEBUG");
+ Assert.assertEquals(levelDEBUG, "0");
- String levelFATAL = (String)invokePriveMethod("getSeverityLevel", "FATAL");
- Assert.assertEquals (levelFATAL, "3");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ String levelFATAL = (String) invokePriveMethod("getSeverityLevel", "FATAL");
+ Assert.assertEquals(levelFATAL, "3");
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
/**
* This method implements a test of getFinalServiceName method.
*/
- @Test
- public final void testGetFinalServiceName () {
- try {
- String serviceName1 = (String)invokePriveMethod("getFinalServiceName", "testServiceName1");
- Assert.assertEquals(serviceName1, "testServiceName1");
-
- MsoLogger.setServiceName("testServiceName2");
- String serviceName2 = (String)invokePriveMethod("getFinalServiceName", "testServiceName1");
- Assert.assertEquals(serviceName2, "testServiceName1");
-
- String msgNull = null;
- String serviceName3 = (String)invokePriveMethod("getFinalServiceName", msgNull);
- Assert.assertEquals(serviceName3, "testServiceName2");
-
- MsoLogger.resetServiceName();
- String serviceName4 = (String)invokePriveMethod("getFinalServiceName", msgNull);
- Assert.assertEquals(serviceName4, "invoke0");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ @Test
+ public final void testGetFinalServiceName() {
+ try {
+ String serviceName1 = (String) invokePriveMethod("getFinalServiceName",
+ "testServiceName1");
+ Assert.assertEquals(serviceName1, "testServiceName1");
+
+ MsoLogger.setServiceName("testServiceName2");
+ String serviceName2 = (String) invokePriveMethod("getFinalServiceName",
+ "testServiceName1");
+ Assert.assertEquals(serviceName2, "testServiceName1");
+
+ String msgNull = null;
+ String serviceName3 = (String) invokePriveMethod("getFinalServiceName", msgNull);
+ Assert.assertEquals(serviceName3, "testServiceName2");
+
+ MsoLogger.resetServiceName();
+ String serviceName4 = (String) invokePriveMethod("getFinalServiceName", msgNull);
+ Assert.assertEquals(serviceName4, "invoke0");
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
- @Test
- public final void testPrepareMsg () {
- try {
- String msgNull = null;
- MDC.clear();
- invokePrepareMsg("INFO", null, null);
-
- Assert.assertTrue (MDC.get(MsoLogger.REQUEST_ID).equals("trace-#") && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("trace-#") && MDC.get(MsoLogger.SERVICE_NAME).equals("invoke0")
- && MDC.get(MsoLogger.TIMER) == null && MDC.get(MsoLogger.ALERT_SEVERITY).equals("0"));
-
- MsoLogger.setLoggerParameters("testRemoteIp", "testUser");
- MsoLogger.setLogContext("testReqId", "testSvcId");
- invokePrepareMsg("ERROR", "testServiceName3", null);
- Assert.assertTrue (MDC.get(MsoLogger.REQUEST_ID).equals("testReqId") && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId") && MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName3")
- && MDC.get(MsoLogger.TIMER) == null && MDC.get(MsoLogger.ALERT_SEVERITY).equals("2") );
-
- MsoLogger.setServiceName("testServiceName2");
- invokePrepareMsg("WARN", msgNull, msgNull);
- Assert.assertTrue (MDC.get(MsoLogger.REQUEST_ID).equals("testReqId") && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId") && MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName2")
- && MDC.get(MsoLogger.TIMER) == null && MDC.get(MsoLogger.ALERT_SEVERITY).equals("1"));
-
- MDC.clear ();
- MsoRequest msoRequest = new MsoRequest ();
- msoRequest.setRequestId ("reqId2");
- msoRequest.setServiceInstanceId ("servId2");
- MsoLogger.setLogContext (msoRequest);
+ @Test
+ public final void testPrepareMsg() {
+ try {
+ String msgNull = null;
+ MDC.clear();
+ invokePrepareMsg("INFO", null, null);
+
+ Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("trace-#") &&
+ MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("trace-#") &&
+ MDC.get(MsoLogger.SERVICE_NAME).equals("invoke0")
+ && MDC.get(MsoLogger.TIMER) == null && MDC.get(MsoLogger.ALERT_SEVERITY).equals("0"));
+
+ MsoLogger.setLoggerParameters("testRemoteIp", "testUser");
+ MsoLogger.setLogContext("testReqId", "testSvcId");
+ invokePrepareMsg("ERROR", "testServiceName3", null);
+ Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("testReqId") &&
+ MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId") &&
+ MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName3")
+ && MDC.get(MsoLogger.TIMER) == null && MDC.get(MsoLogger.ALERT_SEVERITY).equals("2"));
+
+ MsoLogger.setServiceName("testServiceName2");
+ invokePrepareMsg("WARN", msgNull, msgNull);
+ Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("testReqId") &&
+ MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId") &&
+ MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName2")
+ && MDC.get(MsoLogger.TIMER) == null && MDC.get(MsoLogger.ALERT_SEVERITY).equals("1"));
+
+ MDC.clear();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("reqId2");
+ msoRequest.setServiceInstanceId("servId2");
+ MsoLogger.setLogContext(msoRequest);
invokePrepareMsg("FATAL", null, "123");
- Assert.assertTrue (MDC.get(MsoLogger.REQUEST_ID).equals("reqId2") && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("servId2") && MDC.get(MsoLogger.TIMER).equals("123") && MDC.get(MsoLogger.ALERT_SEVERITY).equals("3"));
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("reqId2") &&
+ MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("servId2") &&
+ MDC.get(MsoLogger.TIMER).equals("123") && MDC.get(MsoLogger.ALERT_SEVERITY).equals("3"));
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
+
/**
* This method implements a test of log methods
*/
- @Test
- public final void testLogMethods () {
- try {
- MDC.clear();
- MsoLogger.setLogContext("reqId2", "servId2");
- MsoLogger.setServiceName("MSO.testServiceName");
- msoLogger.info (MessageEnum.LOGGER_UPDATE_SUC, "testLogger", "INFO", "DEBUG", "target entity", "target service");
- msoLogger.warn (MessageEnum.GENERAL_WARNING, "warning test", "", "", MsoLogger.ErrorCode.UnknownError, "warning test");
- msoLogger.error (MessageEnum.GENERAL_EXCEPTION, "target entity", "target service", MsoLogger.ErrorCode.UnknownError, "error test");
-
- //Fetch from the error log
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log";
-
- Path filePath = new File(logFile).toPath();
- Charset charset = Charset.defaultCharset();
- List<String> stringList = Files.readAllLines(filePath, charset);
- String[] stringArray = stringList.toArray(new String[]{});
- int size = stringArray.length;
-
- Assert.assertTrue(stringArray[size-3].contains("|reqId2|main|MSO.testServiceName||target entity|target service|INFO|null||") && stringArray[size-3].contains("||MSO-GENERAL-5408I Successfully update Logger: testLogger from level INFO to level DEBUG"));
- Assert.assertTrue(stringArray[size-2].contains("|reqId2|main|MSO.testServiceName||||WARN|UnknownError|warning test|") && stringArray[size-2].contains("|MSO-GENERAL-5401W WARNING: warning test"));
- Assert.assertTrue(stringArray[size-1].contains("|reqId2|main|MSO.testServiceName||target entity|target service|ERROR|UnknownError|error test|") && stringArray[size-1].contains("|MSO-GENERAL-9401E Exception encountered"));
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ @Test
+ public final void testLogMethods() {
+ try {
+ MDC.clear();
+ MsoLogger.setLogContext("reqId2", "servId2");
+ MsoLogger.setServiceName("MSO.testServiceName");
+ msoLogger.info(MessageEnum.LOGGER_UPDATE_SUC, "testLogger", "INFO",
+ "DEBUG", "target entity", "target service");
+ msoLogger.warn(MessageEnum.GENERAL_WARNING, "warning test", "",
+ "", MsoLogger.ErrorCode.UnknownError, "warning test");
+ msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "target entity",
+ "target service", MsoLogger.ErrorCode.UnknownError, "error test");
+
+ //Fetch from the error log
+ URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) +
+ "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log";
+
+ Path filePath = new File(logFile).toPath();
+ Charset charset = Charset.defaultCharset();
+ List<String> stringList = Files.readAllLines(filePath, charset);
+ String[] stringArray = stringList.toArray(new String[]{});
+ int size = stringArray.length;
+
+ Assert.assertTrue(stringArray[size - 3].
+ contains("|reqId2|main|MSO.testServiceName||target entity|target service|INFO|null||") &&
+ stringArray[size - 3].contains("||MSO-GENERAL-5408I Successfully update Logger: " +
+ "testLogger from level INFO to level DEBUG"));
+ Assert.assertTrue(stringArray[size - 2].
+ contains("|reqId2|main|MSO.testServiceName||||WARN|UnknownError|warning test|") &&
+ stringArray[size - 2].contains("|MSO-GENERAL-5401W WARNING: warning test"));
+ Assert.assertTrue(stringArray[size - 1].
+ contains("|reqId2|main|MSO.testServiceName||target entity|target " +
+ "service|ERROR|UnknownError|error test|") && stringArray[size - 1].
+ contains("|MSO-GENERAL-9401E Exception encountered"));
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
- /**
+ /**
* This method implements a test of recordMetricEvent method.
*/
- @Test
- public final void testRecordMetricEvent () {
- try {
- MDC.clear();
- MsoLogger.setLogContext("reqId", "servId");
- msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful", "VNF" , "createVNF", null);
- MDC.put (MsoLogger.REMOTE_HOST, "127.0.0.1");
- MDC.put (MsoLogger.PARTNERNAME, "testUser");
- msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Exception", "SDNC", "removeSDNC", "testVNF");
-
- //Fetch from the metric log
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log";
-
- Path filePath = new File(logFile).toPath();
- Charset charset = Charset.defaultCharset();
- List<String> stringList = Files.readAllLines(filePath, charset);
- String[] stringArray = stringList.toArray(new String[]{});
- msoLogger.error (MessageEnum.GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.UnknownError, "test error msg");
-
- Assert.assertTrue(stringArray[0].contains("|reqId|servId|main||testRecordMetricEvent||VNF|createVNF|COMPLETE|0|Successful|Test UUID as JBoss not found|INFO|0|"));
- // count the occurance of symbol "|"
- Assert.assertTrue ((stringArray[0].length() - stringArray[0].replace("|", "").length()) == 28);
- Assert.assertTrue(stringArray[1].contains("|reqId|servId|main||testRecordMetricEvent|testUser|SDNC|removeSDNC|ERROR|501|Exception|Test UUID as JBoss not found|INFO|0|") && stringArray[1].contains("|127.0.0.1||||testVNF|||||"));
- Assert.assertTrue ((stringArray[1].length() - stringArray[1].replace("|", "").length()) == 28);
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ @Test
+ public final void testRecordMetricEvent() {
+ try {
+ MDC.clear();
+ MsoLogger.setLogContext("reqId", "servId");
+ msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successful", "VNF", "createVNF", null);
+ MDC.put(MsoLogger.REMOTE_HOST, "127.0.0.1");
+ MDC.put(MsoLogger.PARTNERNAME, "testUser");
+ msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.ServiceNotAvailable, "Exception", "SDNC",
+ "removeSDNC", "testVNF");
+
+ //Fetch from the metric log
+ URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) +
+ "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log";
+
+ Path filePath = new File(logFile).toPath();
+ Charset charset = Charset.defaultCharset();
+ List<String> stringList = Files.readAllLines(filePath, charset);
+ String[] stringArray = stringList.toArray(new String[]{});
+ msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "",
+ MsoLogger.ErrorCode.UnknownError, "test error msg");
+
+ Assert.assertTrue(stringArray[0].contains("|reqId|servId|main||testRecordMetricEvent||" +
+ "VNF|createVNF|COMPLETE|0|Successful|Test UUID as JBoss not found|INFO|0|"));
+ // count the occurance of symbol "|"
+ Assert.assertTrue((stringArray[0].length() - stringArray[0].replace("|",
+ "").length()) == 28);
+ Assert.assertTrue(stringArray[1].contains("|reqId|servId|main||testRecordMetricEvent|" +
+ "testUser|SDNC|removeSDNC|ERROR|501|Exception|Test UUID as JBoss not found|INFO|0|") &&
+ stringArray[1].contains("|127.0.0.1||||testVNF|||||"));
+ Assert.assertTrue((stringArray[1].length() - stringArray[1].replace("|",
+ "").length()) == 28);
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
/**
* This method implements a test of testRecordAuditEvent method.
*/
- @Test
- public final void testRecordAuditEvent () {
-
- try {
-
- MDC.clear();
- MsoLogger.setLogContext("reqId", "servId");
- msoLogger.recordAuditEvent(123456789L, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- MDC.put (MsoLogger.REMOTE_HOST, "127.0.0.1");
- MDC.put (MsoLogger.PARTNERNAME, "testUser");
- msoLogger.recordAuditEvent(123456789L, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Exception");
-
- //Fetch from the metric log
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/auditjboss.server.name_IS_UNDEFINED.log";
-
- Path filePath = new File(logFile).toPath();
- Charset charset = Charset.defaultCharset();
- List<String> stringList = Files.readAllLines(filePath, charset);
- String[] stringArray = stringList.toArray(new String[]{});
- msoLogger.error (MessageEnum.GENERAL_EXCEPTION, "", "", ErrorCode.UnknownError, "log error");
-
- Assert.assertTrue (stringArray[0].contains("|reqId|servId|main||testRecordAuditEvent||COMPLETE|0|Successful|Test UUID as JBoss not found|INFO|0|"));
- // count the occurance of symbol "|"
- Assert.assertTrue ((stringArray[0].length() - stringArray[0].replace("|", "").length()) == 25);
- Assert.assertTrue (stringArray[1].contains("|reqId|servId|main||testRecordAuditEvent|testUser|ERROR|501|Exception|Test UUID as JBoss not found|INFO|0|") && stringArray[1].contains("|127.0.0.1||||||||"));
- Assert.assertTrue ((stringArray[1].length() - stringArray[1].replace("|", "").length()) == 25);
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ @Test
+ public final void testRecordAuditEvent() {
+
+ try {
+
+ MDC.clear();
+ MsoLogger.setLogContext("reqId", "servId");
+ msoLogger.recordAuditEvent(123456789L, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successful");
+ MDC.put(MsoLogger.REMOTE_HOST, "127.0.0.1");
+ MDC.put(MsoLogger.PARTNERNAME, "testUser");
+ msoLogger.recordAuditEvent(123456789L, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.ServiceNotAvailable, "Exception");
+
+ //Fetch from the metric log
+ URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) +
+ "/MSO/Test/auditjboss.server.name_IS_UNDEFINED.log";
+
+ Path filePath = new File(logFile).toPath();
+ Charset charset = Charset.defaultCharset();
+ List<String> stringList = Files.readAllLines(filePath, charset);
+ String[] stringArray = stringList.toArray(new String[]{});
+ msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "",
+ ErrorCode.UnknownError, "log error");
+
+ Assert.assertTrue(stringArray[0].contains("|reqId|servId|main||testRecordAuditEvent||" +
+ "COMPLETE|0|Successful|Test UUID as JBoss not found|INFO|0|"));
+ // count the occurance of symbol "|"
+ Assert.assertTrue((stringArray[0].length() - stringArray[0].replace("|",
+ "").length()) == 25);
+ Assert.assertTrue(stringArray[1].contains("|reqId|servId|main||testRecordAuditEvent" +
+ "|testUser|ERROR|501|Exception|Test UUID as JBoss not found|INFO|0|") &&
+ stringArray[1].contains("|127.0.0.1||||||||"));
+ Assert.assertTrue((stringArray[1].length() - stringArray[1].replace("|",
+ "").length()) == 25);
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
-
-
// User reflection to invoke to avoid change the publicity of the method
- private static String invokePrepareMsg (String arg1, String arg2, String arg3) {
- Method method;
- try {
- method = MsoLogger.class.getDeclaredMethod("prepareMsg", String.class, String.class, String.class);
- method.setAccessible(true);
- return (String)method.invoke(msoLogger, arg1, arg2, arg3);
- } catch (NoSuchMethodException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SecurityException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalArgumentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
+ private static String invokePrepareMsg(String arg1, String arg2, String arg3) {
+ Method method;
+ try {
+ method = MsoLogger.class.getDeclaredMethod("prepareMsg", String.class, String.class, String.class);
+ method.setAccessible(true);
+ return (String) method.invoke(msoLogger, arg1, arg2, arg3);
+ } catch (NoSuchMethodException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
}
// User reflection to invoke to avoid change the publicity of the method
- private static Object invokePriveMethod (String methodName, String arg) {
- Method method;
- try {
- method = MsoLogger.class.getDeclaredMethod(methodName, String.class);
- method.setAccessible(true);
- return method.invoke(msoLogger, arg);
- } catch (NoSuchMethodException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SecurityException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalArgumentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
+ private static Object invokePriveMethod(String methodName, String arg) {
+ Method method;
+ try {
+ method = MsoLogger.class.getDeclaredMethod(methodName, String.class);
+ method.setAccessible(true);
+ return method.invoke(msoLogger, arg);
+ } catch (NoSuchMethodException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
}
}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryConcurrencyTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryConcurrencyTest.java
index a814c4ea9c..5caa137d33 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryConcurrencyTest.java
+++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryConcurrencyTest.java
@@ -44,131 +44,145 @@ import org.openecomp.mso.properties.MsoPropertiesFactory;
/**
* This class implements test methods of the MsoPropertiesFactory features.
- *
- *
*/
public class MsoPropertiesFactoryConcurrencyTest {
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- public static final String MSO_PROP_ID = "TEST_PROP";
- public static final String PATH_MSO_PROP1 = MsoJavaProperties.class.getClassLoader().getResource("mso.properties")
- .toString().substring(5);
- public static final String PATH_MSO_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.properties")
- .toString().substring(5);
-
- /**
- * This method is called before any test occurs. It creates a fake tree from
- * scratch
- *
- * @throws MsoPropertiesException
- */
- @BeforeClass
- public static final void prepare() throws MsoPropertiesException {
- // it's possible to have it already initialized, as tests are executed in the same JVM
- msoPropertiesFactory.removeAllMsoProperties ();
- msoPropertiesFactory.initializeMsoProperties(MSO_PROP_ID, PATH_MSO_PROP1);
- }
-
- private Callable<Integer> taskReload = new Callable<Integer>() {
- @Override
- public Integer call() {
- try {
- if (!msoPropertiesFactory.reloadMsoProperties()) {
- return 1;
- }
- } catch (Exception e) {
- e.printStackTrace ();
- return 1;
- }
- return 0;
- }
- };
-
- private Callable<Integer> taskRead = new Callable<Integer>() {
- @Override
- public Integer call() {
- try {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_ID);
- String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
- String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "MT");
- assertEquals(property2, "http://localhost:5000/v2.0");
- assertEquals(property3, "John");
- assertEquals(property4, "FD205490A48D48475607C36B9AD902BF");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "1234");
- assertEquals(property7, "true");
-
- } catch (MsoPropertiesException e) {
- e.printStackTrace ();
- return 1;
- }
- return 0;
- }
- };
-
- private Callable<Integer> taskReadAll = new Callable<Integer>() {
- @Override
- public Integer call() {
- try {
- List<AbstractMsoProperties> msoPropertiesList = msoPropertiesFactory.getAllMsoProperties();
- String property1 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("does.not.exist", "defaultValue");
- String property6 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "MT");
- assertEquals(property2, "http://localhost:5000/v2.0");
- assertEquals(property3, "John");
- assertEquals(property4, "FD205490A48D48475607C36B9AD902BF");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "1234");
- assertEquals(property7, "true");
- } catch (Exception e) {
- e.printStackTrace ();
- return 1;
- }
- return 0;
- }
- };
-
- @Test
- public final void testGetMsoProperties()
- throws MsoPropertiesException, InterruptedException, ExecutionException, FileNotFoundException {
-
- List<Future<Integer>> list = new ArrayList<>();
- ExecutorService executor = Executors.newFixedThreadPool(20);
-
- for (int i = 0; i <= 100000; i++) {
-
- Future<Integer> futureResult = executor.submit(taskRead);
- list.add(futureResult);
-
- futureResult = executor.submit(taskReload);
- list.add(futureResult);
-
- futureResult = executor.submit(taskReadAll);
- list.add(futureResult);
- }
- executor.shutdown();
- while (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
+ public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+
+ public static final String MSO_PROP_ID = "TEST_PROP";
+ public static final String PATH_MSO_PROP1 = MsoJavaProperties.class.getClassLoader().
+ getResource("mso.properties")
+ .toString().substring(5);
+ public static final String PATH_MSO_PROP2 = MsoJavaProperties.class.getClassLoader().
+ getResource("mso2.properties")
+ .toString().substring(5);
+
+ /**
+ * This method is called before any test occurs. It creates a fake tree from
+ * scratch
+ *
+ * @throws MsoPropertiesException
+ */
+ @BeforeClass
+ public static final void prepare() throws MsoPropertiesException {
+ // it's possible to have it already initialized, as tests are executed in the same JVM
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(MSO_PROP_ID, PATH_MSO_PROP1);
+ }
+
+ private Callable<Integer> taskReload = new Callable<Integer>() {
+ @Override
+ public Integer call() {
+ try {
+ if (!msoPropertiesFactory.reloadMsoProperties()) {
+ return 1;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ return 1;
+ }
+ return 0;
+ }
+ };
+
+ private Callable<Integer> taskRead = new Callable<Integer>() {
+ @Override
+ public Integer call() {
+ try {
+ MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_ID);
+ String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId",
+ "defaultValue");
+ String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl",
+ "defaultValue");
+ String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId",
+ "defaultValue");
+ String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId",
+ "defaultValue");
+ String property5 = msoProperties.getProperty("does.not.exist",
+ "defaultValue");
+ String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test",
+ "defaultValue");
+ String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean",
+ "defaultValue");
+
+ assertEquals(property1, "MT");
+ assertEquals(property2, "http://localhost:5000/v2.0");
+ assertEquals(property3, "John");
+ assertEquals(property4, "FD205490A48D48475607C36B9AD902BF");
+ assertEquals(property5, "defaultValue");
+ assertEquals(property6, "1234");
+ assertEquals(property7, "true");
+
+ } catch (MsoPropertiesException e) {
+ e.printStackTrace();
+ return 1;
+ }
+ return 0;
+ }
+ };
+
+ private Callable<Integer> taskReadAll = new Callable<Integer>() {
+ @Override
+ public Integer call() {
+ try {
+ List<AbstractMsoProperties> msoPropertiesList = msoPropertiesFactory.getAllMsoProperties();
+ String property1 = ((MsoJavaProperties) msoPropertiesList.get(0)).
+ getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
+ String property2 = ((MsoJavaProperties) msoPropertiesList.get(0)).
+ getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
+ String property3 = ((MsoJavaProperties) msoPropertiesList.get(0)).
+ getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
+ String property4 = ((MsoJavaProperties) msoPropertiesList.get(0)).
+ getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
+ String property5 = ((MsoJavaProperties) msoPropertiesList.get(0)).
+ getProperty("does.not.exist", "defaultValue");
+ String property6 = ((MsoJavaProperties) msoPropertiesList.get(0)).
+ getProperty("ecomp.mso.cloud.1.test", "defaultValue");
+ String property7 = ((MsoJavaProperties) msoPropertiesList.get(0)).
+ getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
+
+ assertEquals(property1, "MT");
+ assertEquals(property2, "http://localhost:5000/v2.0");
+ assertEquals(property3, "John");
+ assertEquals(property4, "FD205490A48D48475607C36B9AD902BF");
+ assertEquals(property5, "defaultValue");
+ assertEquals(property6, "1234");
+ assertEquals(property7, "true");
+ } catch (Exception e) {
+ e.printStackTrace();
+ return 1;
+ }
+ return 0;
+ }
+ };
+
+ @Test
+ public final void testGetMsoProperties()
+ throws MsoPropertiesException, InterruptedException, ExecutionException, FileNotFoundException {
+
+ List<Future<Integer>> list = new ArrayList<>();
+ ExecutorService executor = Executors.newFixedThreadPool(20);
+
+ for (int i = 0; i <= 100000; i++) {
+
+ Future<Integer> futureResult = executor.submit(taskRead);
+ list.add(futureResult);
+
+ futureResult = executor.submit(taskReload);
+ list.add(futureResult);
+
+ futureResult = executor.submit(taskReadAll);
+ list.add(futureResult);
+ }
+ executor.shutdown();
+ while (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
;
}
- for (Future<Integer> result : list) {
- assertTrue(result.get().equals(0));
- }
+ for (Future<Integer> result : list) {
+ assertTrue(result.get().equals(0));
+ }
- }
+ }
}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
index db58c5a49e..9f5e71785e 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
+++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
@@ -41,571 +41,597 @@ import com.fasterxml.jackson.databind.JsonNode;
/**
* This class implements test methods of the MsoPropertiesFactory features.
- *
- *
*/
public class MsoPropertiesFactoryTest {
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- public static final String MSO_JAVA_PROP_ID = "TEST_JAVA_PROP";
- public static final String MSO_JSON_PROP_ID = "TEST_JSON_PROP";
- public static final String PATH_MSO_JAVA_PROP1 = MsoJavaProperties.class.getClassLoader().getResource("mso.properties")
- .toString().substring(5);
- public static final String PATH_MSO_JAVA_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.properties")
- .toString().substring(5);
- public static final String PATH_MSO_JSON_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json")
- .toString().substring(5);
- public static final String PATH_MSO_JSON_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json")
- .toString().substring(5);
- public static final String PATH_MSO_JSON_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json")
- .toString().substring(5);
-
- @BeforeClass
- public static final void prepareBeforeAllTests() {
- msoPropertiesFactory.removeAllMsoProperties();
- }
- /**
- * This method is called before any test occurs. It creates a fake tree from
- * scratch
- *
- * @throws MsoPropertiesException
- */
- @Before
- public final void prepareBeforeEachTest() throws MsoPropertiesException {
-
- msoPropertiesFactory.initializeMsoProperties(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP1);
- msoPropertiesFactory.initializeMsoProperties(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP);
- }
-
- @After
- public final void cleanAfterEachTest() throws MsoPropertiesException {
- msoPropertiesFactory.removeAllMsoProperties ();
- }
-
- @Test
- public final void testNotRecognizedFile() {
- try {
- msoPropertiesFactory.initializeMsoProperties("BAD_FILE", "new_file.toto");
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Unable to load the MSO properties file because format is not recognized (only .json or .properties): new_file.toto").equals(ep.getMessage()));
- }
- }
-
- @Test
- public final void testDoubleInit() {
-
- try {
- msoPropertiesFactory.initializeMsoProperties(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP1);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("The factory contains already an instance of this mso properties: "+PATH_MSO_JAVA_PROP1).equals(ep.getMessage()));
- }
-
-
- }
-
- /**
- * This method implements a test for the getMsoJavaProperties method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetMsoJavaProperties() throws MsoPropertiesException {
- assertNotNull(msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID));
- assertTrue(msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID).size()==8);
-
- try {
- msoPropertiesFactory.getMsoJavaProperties(MSO_JSON_PROP_ID);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties is not JAVA_PROP properties type:" + MSO_JSON_PROP_ID).equals(ep.getMessage()));
- }
-
- try {
- msoPropertiesFactory.getMsoJavaProperties("DUMB_PROP");
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+"DUMB_PROP").equals(ep.getMessage()));
- }
-
- }
-
- /**
- * This method test the MsoJavaProperties Set, equals and hascode
- * @throws MsoPropertiesException
- */
- @Test
- public final void testSetMsoJavaProperties() throws MsoPropertiesException {
- MsoJavaProperties msoPropChanged = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- msoPropChanged.setProperty("testos", "testos");
- assertNotNull(msoPropChanged.getProperty("testos", null));
-
- // Check no modification occurred on cache one
- MsoJavaProperties msoPropCache = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- assertNull(msoPropCache.getProperty("testos", null));
- assertFalse(msoPropChanged.hashCode() != msoPropCache.hashCode());
-
- assertFalse(msoPropChanged.equals(null));
- assertFalse(msoPropChanged.equals(msoPropCache));
- assertFalse(msoPropChanged.equals(Boolean.TRUE));
-
- assertTrue(msoPropChanged.equals(msoPropChanged));
- }
-
-
- /**
- * This method implements a test for the testGetMsoJsonProperties method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetMsoJsonProperties() throws MsoPropertiesException {
- assertNotNull(msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID));
-
- try {
- msoPropertiesFactory.getMsoJsonProperties(MSO_JAVA_PROP_ID);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties is not JSON_PROP properties type:" + MSO_JAVA_PROP_ID).equals(ep.getMessage()));
- }
-
- try {
- msoPropertiesFactory.getMsoJsonProperties("DUMB_PROP");
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+"DUMB_PROP").equals(ep.getMessage()));
- }
-
- }
-
- /**
- * This method implements a test for the testGetAllMsoProperties method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetAllMsoProperties() throws MsoPropertiesException {
- assertNotNull(msoPropertiesFactory.getAllMsoProperties().size()==2);
-
- }
-
- /**
- * This method implements a test for the testGetAllMsoProperties method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testToString() throws MsoPropertiesException {
- String dump = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID).toString();
- assertTrue(dump != null && !dump.isEmpty());
-
- dump = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID).toString();
- assertTrue(dump != null && !dump.isEmpty());
-
- }
-
- /**
- * This method implements a test for the getProperty of JAVA_PROP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetProperties() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
-
- String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
- String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "MT");
- assertEquals(property2, "http://localhost:5000/v2.0");
- assertEquals(property3, "John");
- assertEquals(property4, "FD205490A48D48475607C36B9AD902BF");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "1234");
- assertEquals(property7, "true");
- }
-
- /**
- * This method implements a test for the getIntProperty JAVA_RPOP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetIntProperties() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- int property1 = msoProperties.getIntProperty("ecomp.mso.cloud.1.test", 345);
- int property2 = msoProperties.getIntProperty("ecomp.mso.cloud.1.publicNetId", 345);
- int property3 = msoProperties.getIntProperty("does.not.exist", 345);
- assertEquals(property1, 1234);
- assertEquals(property2, 345);
- assertEquals(property3, 345);
- }
-
- /**
- * This method implements a test for the getBooleanProperty JAVA_RPOP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetBooleanProperty() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- boolean property1 = msoProperties.getBooleanProperty("ecomp.mso.cloud.1.boolean", false);
- boolean property2 = msoProperties.getBooleanProperty("ecomp.mso.cloud.1.publicNetId", false);
- boolean property3NotThere = msoProperties.getBooleanProperty("ecomp.mso.cloud.1.publicNetIdBad", true);
-
- assertEquals(property1, true);
- assertEquals(property2, false);
- assertEquals(property3NotThere, true);
- }
-
- /**
- * This method implements a test for the getEncryptedProperty JAVA_RPOP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetEncryptedProperty() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- String property1 = msoProperties.getEncryptedProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue",
- "aa3871669d893c7fb8abbcda31b88b4f");
- String property2 = msoProperties.getEncryptedProperty("test", "defaultValue",
- "aa3871669d893c7fb8abbcda31b88b4f");
-
-
- String property3Wrong = msoProperties.getEncryptedProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue",
- "aa3871669d893c7fb8abbcda31b88b4");
-
-
- assertEquals(property1, "changeme");
- assertEquals(property2, "defaultValue");
- assertEquals(property3Wrong, "defaultValue");
- }
-
- /**
- * This method implements a test for the getEncryptedProperty JAVA_RPOP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testencryptProperty() {
-
- assertTrue("FD205490A48D48475607C36B9AD902BF"
- .contains(msoPropertiesFactory.encryptProperty("changeme", "aa3871669d893c7fb8abbcda31b88b4f").getEntity().toString()));
-
-
- assertTrue("Invalid AES key length: 15 bytes".contains(msoPropertiesFactory.encryptProperty("changeme", "aa3871669d893c7fb8abbcda31b88b4").getEntity().toString()));
-
- }
-
- /**
- * This method implements a test for the getJSON JSON_RPOP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetJsonNode() throws MsoPropertiesException {
- MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
-
- JsonNode propNode = msoProperties.getJsonRootNode();
- assertNotNull(propNode);
- assertFalse(propNode.toString().isEmpty());
- assertTrue(propNode.isContainerNode());
- assertNotNull(propNode.path("asdc-connections").path("asdc-controller1"));
- assertNotNull(propNode.path("asdc-connections").path("asdc-controller2"));
-
- }
-
- /**
- * This method implements a test for the reloadMsoProperties method.
- *
- * @throws MsoPropertiesException
- *
- */
- @Test
- public final void testReloadJavaMsoProperties() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
-
- // Do some additional test on propertiesHaveChanged method
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, null));
-
- // Change path with bad one
- try {
- msoPropertiesFactory.changeMsoPropertiesFilePath("DO_NOT_EXIST", PATH_MSO_JAVA_PROP2);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:DO_NOT_EXIST").equals(ep.getMessage()));
- }
-
-
- // Change path with right one
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP2);
- assertTrue(PATH_MSO_JAVA_PROP2.equals(msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID).getPropertiesFileName()));
-
- assertTrue(msoPropertiesFactory.reloadMsoProperties());
- assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
- // Do a second time as timer value is set to 2
- assertTrue(msoPropertiesFactory.reloadMsoProperties());
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
-
- // Get the new one
- msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
- String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "MT2");
- assertEquals(property2, "defaultValue");
- assertEquals(property3, "defaultValue");
- assertEquals(property4, "defaultValue");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "defaultValue");
- assertEquals(property7, "defaultValue");
-
- // Additional test on propertiesHaveChanged
- msoPropertiesFactory.removeAllMsoProperties();
-
- // Do some additional test on propertiesHaveChanged method
- try {
- msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, null);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+MSO_JAVA_PROP_ID).equals(ep.getMessage()));
- }
-
- try {
- msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+MSO_JAVA_PROP_ID).equals(ep.getMessage()));
- }
-
- }
-
- /**
- * This method implements a test for the reloadMsoProperties method.
- *
- * @throws MsoPropertiesException
- *
- */
- @Test
- public final void testReloadMoreThanAMinuteMsoProperties() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP2);
-
- // Simulate 2 minutes
- msoPropertiesFactory.reloadMsoProperties();
- assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
- msoPropertiesFactory.reloadMsoProperties();
-
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
-
- // Get the new one
- msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
- String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "MT2");
- assertEquals(property2, "defaultValue");
- assertEquals(property3, "defaultValue");
- assertEquals(property4, "defaultValue");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "defaultValue");
- assertEquals(property7, "defaultValue");
-
-
- }
-
- /**
- * This method implements a test for the reloadMsoProperties method.
- *
- * @throws MsoPropertiesException
- *
- */
- @Test
- public final void testReloadBadMsoProperties() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JAVA_PROP_ID, "file-does-not-exist.properties");
- msoPropertiesFactory.reloadMsoProperties();
- assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
- // Reload it a second time as initial timer parameter was set to 2
- msoPropertiesFactory.reloadMsoProperties();
-
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
-
- // Get the new one
- msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
- String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "defaultValue");
- assertEquals(property2, "defaultValue");
- assertEquals(property3, "defaultValue");
- assertEquals(property4, "defaultValue");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "defaultValue");
- assertEquals(property7, "defaultValue");
-
- }
-
- /**
- * This method implements a test for the reloadMsoProperties method.
- *
- * @throws MsoPropertiesException
- *
- */
- @Test
- public final void testReloadBadMsoJsonProperties() throws MsoPropertiesException {
- // Load a bad JSON file
- MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP_BAD);
-
- msoPropertiesFactory.reloadMsoProperties();
- assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
- // Reload it a second time as initial timer parameter was set to 2
- msoPropertiesFactory.reloadMsoProperties();
-
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
-
- // Get the new one
- msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
- assertNotNull(msoProperties);
- assertNotNull(msoProperties.getJsonRootNode());
- assertTrue(msoProperties.getJsonRootNode().size() == 0);
-
- }
-
- @Test
- public final void testRemoveMsoProperties() throws MsoPropertiesException {
- try {
- msoPropertiesFactory.removeMsoProperties("DUMB_PROP");
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+"DUMB_PROP").equals(ep.getMessage()));
- }
-
- msoPropertiesFactory.removeMsoProperties(MSO_JAVA_PROP_ID);
-
- try {
- msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+MSO_JAVA_PROP_ID).equals(ep.getMessage()));
- }
-
- }
-
- @Test
- public final void testInitializeWithNonExistingPropertiesFile () throws MsoPropertiesException {
- try {
- msoPropertiesFactory.initializeMsoProperties("NEW_BAD_FILE", "no_file.properties");
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Unable to load the MSO properties file because it has not been found:no_file.properties").equals(ep.getMessage()));
- }
-
- // empty object should be returned as no config has been loaded, anyway no exception should be raised because the config ID must be loaded in cache
- // This is there for automatic reload attempt
- assertTrue(msoPropertiesFactory.getMsoJavaProperties("NEW_BAD_FILE").size()==0);
- }
-
-
- @Test
- public final void testInitializeWithNonExistingJsonFile () throws MsoPropertiesException {
- try {
- msoPropertiesFactory.initializeMsoProperties("NEW_BAD_FILE", "no_file.json");
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Unable to load the MSO properties file because it has not been found:no_file.json").equals(ep.getMessage()));
- }
-
- // empty object should be returned as no config has been loaded, anyway no exception should be raised because the config ID must be loaded in cache
- // This is there for automatic reload attempt
- assertTrue(msoPropertiesFactory.getMsoJsonProperties("NEW_BAD_FILE").getJsonRootNode()!=null);
- assertTrue("{}".equals(msoPropertiesFactory.getMsoJsonProperties("NEW_BAD_FILE").getJsonRootNode().toString()));
- }
-
- @Test
- public final void testShowProperties() {
- assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().contains("/target/test-classes/mso.json(Timer:2mins)"));
- assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().contains("asdc-controller1"));
- assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().contains("/target/test-classes/mso.properties(Timer:2mins):"));
- assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().contains("ecomp.mso.cloud.1.keystoneUrl"));
-
- }
-
- @Test
- public final void testGetEncryptedPropertyJson() throws MsoPropertiesException {
- MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
- assertTrue("ThePassword".equals(msoProperties.getEncryptedProperty(msoProperties.getJsonRootNode().get("asdc-connections").get("asdc-controller1").get("asdcPassword"),"defautlvalue","566B754875657232314F5548556D3665")));
-
- assertTrue("defautlvalue".equals(msoProperties.getEncryptedProperty(msoProperties.getJsonRootNode().get("asdc-connections").get("asdc-controller1").get("asdcPassword"),"defautlvalue","566B754875657232314F5548556D366")));
-
-
- }
-
- @Test
- public final void testHashcodeAndEqualsMsoJsonProperties() throws MsoPropertiesException {
-
- MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP2);
-
- msoPropertiesFactory.reloadMsoProperties();
- assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
- // Reload it a second time as initial timer parameter was set to 2
- msoPropertiesFactory.reloadMsoProperties();
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
-
- // Get the new one
- MsoJsonProperties msoProperties2 = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
- assertFalse(msoProperties.hashCode()==msoProperties2.hashCode());
-
- assertFalse(msoProperties.equals(msoProperties2));
- assertTrue(msoProperties.equals(msoProperties));
- assertFalse(msoProperties.equals(null));
- assertFalse(msoProperties.toString().isEmpty());
-
- // Test a reload with timer set to 1 in PATH_MSO_JSON_PROP2
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP);
-
- msoPropertiesFactory.reloadMsoProperties();
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties2));
-
- }
-
+ public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+
+ public static final String MSO_JAVA_PROP_ID = "TEST_JAVA_PROP";
+ public static final String MSO_JSON_PROP_ID = "TEST_JSON_PROP";
+ public static final String PATH_MSO_JAVA_PROP1 = MsoJavaProperties.class.getClassLoader().
+ getResource("mso.properties")
+ .toString().substring(5);
+ public static final String PATH_MSO_JAVA_PROP2 = MsoJavaProperties.class.getClassLoader().
+ getResource("mso2.properties")
+ .toString().substring(5);
+ public static final String PATH_MSO_JSON_PROP = MsoJavaProperties.class.getClassLoader().
+ getResource("mso.json")
+ .toString().substring(5);
+ public static final String PATH_MSO_JSON_PROP2 = MsoJavaProperties.class.getClassLoader().
+ getResource("mso2.json")
+ .toString().substring(5);
+ public static final String PATH_MSO_JSON_PROP_BAD = MsoJavaProperties.class.getClassLoader().
+ getResource("mso-bad.json")
+ .toString().substring(5);
+
+ @BeforeClass
+ public static final void prepareBeforeAllTests() {
+ msoPropertiesFactory.removeAllMsoProperties();
+ }
+
+ /**
+ * This method is called before any test occurs. It creates a fake tree from
+ * scratch
+ *
+ * @throws MsoPropertiesException
+ */
+ @Before
+ public final void prepareBeforeEachTest() throws MsoPropertiesException {
+
+ msoPropertiesFactory.initializeMsoProperties(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP1);
+ msoPropertiesFactory.initializeMsoProperties(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP);
+ }
+
+ @After
+ public final void cleanAfterEachTest() throws MsoPropertiesException {
+ msoPropertiesFactory.removeAllMsoProperties();
+ }
+
+ @Test
+ public final void testNotRecognizedFile() {
+ try {
+ msoPropertiesFactory.initializeMsoProperties("BAD_FILE", "new_file.toto");
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Unable to load the MSO properties file because format is not recognized (only .json or" +
+ " .properties): new_file.toto").equals(ep.getMessage()));
+ }
+ }
+
+ @Test
+ public final void testDoubleInit() {
+
+ try {
+ msoPropertiesFactory.initializeMsoProperties(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP1);
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("The factory contains already an instance of this mso properties: " +
+ PATH_MSO_JAVA_PROP1).equals(ep.getMessage()));
+ }
+
+
+ }
+
+ /**
+ * This method implements a test for the getMsoJavaProperties method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testGetMsoJavaProperties() throws MsoPropertiesException {
+ assertNotNull(msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID));
+ assertTrue(msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID).size() == 8);
+
+ try {
+ msoPropertiesFactory.getMsoJavaProperties(MSO_JSON_PROP_ID);
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Mso properties is not JAVA_PROP properties type:" + MSO_JSON_PROP_ID).
+ equals(ep.getMessage()));
+ }
+
+ try {
+ msoPropertiesFactory.getMsoJavaProperties("DUMB_PROP");
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Mso properties not found in cache:" + "DUMB_PROP").equals(ep.getMessage()));
+ }
+
+ }
+
+ /**
+ * This method test the MsoJavaProperties Set, equals and hascode
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testSetMsoJavaProperties() throws MsoPropertiesException {
+ MsoJavaProperties msoPropChanged = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+ msoPropChanged.setProperty("testos", "testos");
+ assertNotNull(msoPropChanged.getProperty("testos", null));
+
+ // Check no modification occurred on cache one
+ MsoJavaProperties msoPropCache = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+ assertNull(msoPropCache.getProperty("testos", null));
+ assertFalse(msoPropChanged.hashCode() != msoPropCache.hashCode());
+
+ assertFalse(msoPropChanged.equals(null));
+ assertFalse(msoPropChanged.equals(msoPropCache));
+ assertFalse(msoPropChanged.equals(Boolean.TRUE));
+
+ assertTrue(msoPropChanged.equals(msoPropChanged));
+ }
+
+
+ /**
+ * This method implements a test for the testGetMsoJsonProperties method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testGetMsoJsonProperties() throws MsoPropertiesException {
+ assertNotNull(msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID));
+
+ try {
+ msoPropertiesFactory.getMsoJsonProperties(MSO_JAVA_PROP_ID);
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Mso properties is not JSON_PROP properties type:" + MSO_JAVA_PROP_ID).equals(ep.getMessage()));
+ }
+
+ try {
+ msoPropertiesFactory.getMsoJsonProperties("DUMB_PROP");
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Mso properties not found in cache:" + "DUMB_PROP").equals(ep.getMessage()));
+ }
+
+ }
+
+ /**
+ * This method implements a test for the testGetAllMsoProperties method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testGetAllMsoProperties() throws MsoPropertiesException {
+ assertNotNull(msoPropertiesFactory.getAllMsoProperties().size() == 2);
+
+ }
+
+ /**
+ * This method implements a test for the testGetAllMsoProperties method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testToString() throws MsoPropertiesException {
+ String dump = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID).toString();
+ assertTrue(dump != null && !dump.isEmpty());
+
+ dump = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID).toString();
+ assertTrue(dump != null && !dump.isEmpty());
+
+ }
+
+ /**
+ * This method implements a test for the getProperty of JAVA_PROP type method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testGetProperties() throws MsoPropertiesException {
+ MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+
+ String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
+ String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
+ String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
+ String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
+ String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
+ String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
+ String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
+
+ assertEquals(property1, "MT");
+ assertEquals(property2, "http://localhost:5000/v2.0");
+ assertEquals(property3, "John");
+ assertEquals(property4, "FD205490A48D48475607C36B9AD902BF");
+ assertEquals(property5, "defaultValue");
+ assertEquals(property6, "1234");
+ assertEquals(property7, "true");
+ }
+
+ /**
+ * This method implements a test for the getIntProperty JAVA_RPOP type method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testGetIntProperties() throws MsoPropertiesException {
+ MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+ int property1 = msoProperties.getIntProperty("ecomp.mso.cloud.1.test", 345);
+ int property2 = msoProperties.getIntProperty("ecomp.mso.cloud.1.publicNetId", 345);
+ int property3 = msoProperties.getIntProperty("does.not.exist", 345);
+ assertEquals(property1, 1234);
+ assertEquals(property2, 345);
+ assertEquals(property3, 345);
+ }
+
+ /**
+ * This method implements a test for the getBooleanProperty JAVA_RPOP type method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testGetBooleanProperty() throws MsoPropertiesException {
+ MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+ boolean property1 = msoProperties.getBooleanProperty("ecomp.mso.cloud.1.boolean", false);
+ boolean property2 = msoProperties.getBooleanProperty("ecomp.mso.cloud.1.publicNetId", false);
+ boolean property3NotThere = msoProperties.getBooleanProperty("ecomp.mso.cloud.1.publicNetIdBad",
+ true);
+
+ assertEquals(property1, true);
+ assertEquals(property2, false);
+ assertEquals(property3NotThere, true);
+ }
+
+ /**
+ * This method implements a test for the getEncryptedProperty JAVA_RPOP type method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testGetEncryptedProperty() throws MsoPropertiesException {
+ MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+ String property1 = msoProperties.getEncryptedProperty("ecomp.mso.cloud.1.publicNetId",
+ "defaultValue",
+ "aa3871669d893c7fb8abbcda31b88b4f");
+ String property2 = msoProperties.getEncryptedProperty("test", "defaultValue",
+ "aa3871669d893c7fb8abbcda31b88b4f");
+
+
+ String property3Wrong = msoProperties.getEncryptedProperty("ecomp.mso.cloud.1.publicNetId",
+ "defaultValue",
+ "aa3871669d893c7fb8abbcda31b88b4");
+
+
+ assertEquals(property1, "changeme");
+ assertEquals(property2, "defaultValue");
+ assertEquals(property3Wrong, "defaultValue");
+ }
+
+ /**
+ * This method implements a test for the getEncryptedProperty JAVA_RPOP type method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testencryptProperty() {
+
+ assertTrue("FD205490A48D48475607C36B9AD902BF"
+ .contains(msoPropertiesFactory.encryptProperty("changeme",
+ "aa3871669d893c7fb8abbcda31b88b4f").getEntity().toString()));
+
+
+ assertTrue("Invalid AES key length: 15 bytes".contains(msoPropertiesFactory.encryptProperty("changeme",
+ "aa3871669d893c7fb8abbcda31b88b4").getEntity().toString()));
+
+ }
+
+ /**
+ * This method implements a test for the getJSON JSON_RPOP type method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testGetJsonNode() throws MsoPropertiesException {
+ MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
+
+ JsonNode propNode = msoProperties.getJsonRootNode();
+ assertNotNull(propNode);
+ assertFalse(propNode.toString().isEmpty());
+ assertTrue(propNode.isContainerNode());
+ assertNotNull(propNode.path("asdc-connections").path("asdc-controller1"));
+ assertNotNull(propNode.path("asdc-connections").path("asdc-controller2"));
+
+ }
+
+ /**
+ * This method implements a test for the reloadMsoProperties method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testReloadJavaMsoProperties() throws MsoPropertiesException {
+ MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+
+ // Do some additional test on propertiesHaveChanged method
+ assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, null));
+
+ // Change path with bad one
+ try {
+ msoPropertiesFactory.changeMsoPropertiesFilePath("DO_NOT_EXIST", PATH_MSO_JAVA_PROP2);
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Mso properties not found in cache:DO_NOT_EXIST").equals(ep.getMessage()));
+ }
+
+
+ // Change path with right one
+ msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP2);
+ assertTrue(PATH_MSO_JAVA_PROP2.equals(msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID).
+ getPropertiesFileName()));
+
+ assertTrue(msoPropertiesFactory.reloadMsoProperties());
+ assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
+ // Do a second time as timer value is set to 2
+ assertTrue(msoPropertiesFactory.reloadMsoProperties());
+ assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
+
+ // Get the new one
+ msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+ String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
+ String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
+ String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
+ String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
+ String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
+ String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
+ String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
+
+ assertEquals(property1, "MT2");
+ assertEquals(property2, "defaultValue");
+ assertEquals(property3, "defaultValue");
+ assertEquals(property4, "defaultValue");
+ assertEquals(property5, "defaultValue");
+ assertEquals(property6, "defaultValue");
+ assertEquals(property7, "defaultValue");
+
+ // Additional test on propertiesHaveChanged
+ msoPropertiesFactory.removeAllMsoProperties();
+
+ // Do some additional test on propertiesHaveChanged method
+ try {
+ msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, null);
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Mso properties not found in cache:" + MSO_JAVA_PROP_ID).equals(ep.getMessage()));
+ }
+
+ try {
+ msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties);
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Mso properties not found in cache:" + MSO_JAVA_PROP_ID).equals(ep.getMessage()));
+ }
+
+ }
+
+ /**
+ * This method implements a test for the reloadMsoProperties method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testReloadMoreThanAMinuteMsoProperties() throws MsoPropertiesException {
+ MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+
+ msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP2);
+
+ // Simulate 2 minutes
+ msoPropertiesFactory.reloadMsoProperties();
+ assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
+ msoPropertiesFactory.reloadMsoProperties();
+
+ assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
+
+ // Get the new one
+ msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+ String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
+ String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
+ String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
+ String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
+ String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
+ String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
+ String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
+
+ assertEquals(property1, "MT2");
+ assertEquals(property2, "defaultValue");
+ assertEquals(property3, "defaultValue");
+ assertEquals(property4, "defaultValue");
+ assertEquals(property5, "defaultValue");
+ assertEquals(property6, "defaultValue");
+ assertEquals(property7, "defaultValue");
+
+
+ }
+
+ /**
+ * This method implements a test for the reloadMsoProperties method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testReloadBadMsoProperties() throws MsoPropertiesException {
+ MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+
+ msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JAVA_PROP_ID,
+ "file-does-not-exist.properties");
+ msoPropertiesFactory.reloadMsoProperties();
+ assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
+ // Reload it a second time as initial timer parameter was set to 2
+ msoPropertiesFactory.reloadMsoProperties();
+
+ assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
+
+ // Get the new one
+ msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+ String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
+ String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
+ String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
+ String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
+ String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
+ String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
+ String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
+
+ assertEquals(property1, "defaultValue");
+ assertEquals(property2, "defaultValue");
+ assertEquals(property3, "defaultValue");
+ assertEquals(property4, "defaultValue");
+ assertEquals(property5, "defaultValue");
+ assertEquals(property6, "defaultValue");
+ assertEquals(property7, "defaultValue");
+
+ }
+
+ /**
+ * This method implements a test for the reloadMsoProperties method.
+ *
+ * @throws MsoPropertiesException
+ */
+ @Test
+ public final void testReloadBadMsoJsonProperties() throws MsoPropertiesException {
+ // Load a bad JSON file
+ MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
+
+ msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP_BAD);
+
+ msoPropertiesFactory.reloadMsoProperties();
+ assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
+ // Reload it a second time as initial timer parameter was set to 2
+ msoPropertiesFactory.reloadMsoProperties();
+
+ assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
+
+ // Get the new one
+ msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
+ assertNotNull(msoProperties);
+ assertNotNull(msoProperties.getJsonRootNode());
+ assertTrue(msoProperties.getJsonRootNode().size() == 0);
+
+ }
+
+ @Test
+ public final void testRemoveMsoProperties() throws MsoPropertiesException {
+ try {
+ msoPropertiesFactory.removeMsoProperties("DUMB_PROP");
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Mso properties not found in cache:" + "DUMB_PROP").equals(ep.getMessage()));
+ }
+
+ msoPropertiesFactory.removeMsoProperties(MSO_JAVA_PROP_ID);
+
+ try {
+ msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
+
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Mso properties not found in cache:" + MSO_JAVA_PROP_ID).equals(ep.getMessage()));
+ }
+
+ }
+
+ @Test
+ public final void testInitializeWithNonExistingPropertiesFile() throws MsoPropertiesException {
+ try {
+ msoPropertiesFactory.initializeMsoProperties("NEW_BAD_FILE",
+ "no_file.properties");
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Unable to load the MSO properties file because it has not been found:no_file.properties").
+ equals(ep.getMessage()));
+ }
+
+ // empty object should be returned as no config has been loaded, anyway no exception should be raised
+ // because the config ID must be loaded in cache
+ // This is there for automatic reload attempt
+ assertTrue(msoPropertiesFactory.getMsoJavaProperties("NEW_BAD_FILE").size() == 0);
+ }
+
+
+ @Test
+ public final void testInitializeWithNonExistingJsonFile() throws MsoPropertiesException {
+ try {
+ msoPropertiesFactory.initializeMsoProperties("NEW_BAD_FILE", "no_file.json");
+ fail("MsoPropertiesException should have been raised");
+ } catch (MsoPropertiesException ep) {
+ assertTrue(("Unable to load the MSO properties file because it has not been found:no_file.json").
+ equals(ep.getMessage()));
+ }
+
+ // empty object should be returned as no config has been loaded, anyway no exception should be raised
+ // because the config ID must be loaded in cache
+ // This is there for automatic reload attempt
+ assertTrue(msoPropertiesFactory.getMsoJsonProperties("NEW_BAD_FILE").
+ getJsonRootNode() != null);
+ assertTrue("{}".equals(msoPropertiesFactory.getMsoJsonProperties("NEW_BAD_FILE").
+ getJsonRootNode().toString()));
+ }
+
+ @Test
+ public final void testShowProperties() {
+ assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().
+ contains("/target/test-classes/mso.json(Timer:2mins)"));
+ assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().
+ contains("asdc-controller1"));
+ assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().
+ contains("/target/test-classes/mso.properties(Timer:2mins):"));
+ assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().
+ contains("ecomp.mso.cloud.1.keystoneUrl"));
+
+ }
+
+ @Test
+ public final void testGetEncryptedPropertyJson() throws MsoPropertiesException {
+ MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
+ assertTrue("ThePassword".equals(msoProperties.getEncryptedProperty(msoProperties.getJsonRootNode().
+ get("asdc-connections").get("asdc-controller1").get("asdcPassword"),
+ "defautlvalue", "566B754875657232314F5548556D3665")));
+
+ assertTrue("defautlvalue".equals(msoProperties.getEncryptedProperty(msoProperties.getJsonRootNode().
+ get("asdc-connections").get("asdc-controller1").get("asdcPassword"),
+ "defautlvalue", "566B754875657232314F5548556D366")));
+
+
+ }
+
+ @Test
+ public final void testHashcodeAndEqualsMsoJsonProperties() throws MsoPropertiesException {
+
+ MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
+
+ msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP2);
+
+ msoPropertiesFactory.reloadMsoProperties();
+ assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
+ // Reload it a second time as initial timer parameter was set to 2
+ msoPropertiesFactory.reloadMsoProperties();
+ assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
+
+ // Get the new one
+ MsoJsonProperties msoProperties2 = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
+ assertFalse(msoProperties.hashCode() == msoProperties2.hashCode());
+
+ assertFalse(msoProperties.equals(msoProperties2));
+ assertTrue(msoProperties.equals(msoProperties));
+ assertFalse(msoProperties.equals(null));
+ assertFalse(msoProperties.toString().isEmpty());
+
+ // Test a reload with timer set to 1 in PATH_MSO_JSON_PROP2
+ msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP);
+
+ msoPropertiesFactory.reloadMsoProperties();
+ assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties2));
+
+ }
+
}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertyInitializerTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertyInitializerTest.java
index 419a82b8a4..3d9ed77983 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertyInitializerTest.java
+++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertyInitializerTest.java
@@ -41,48 +41,47 @@ import org.openecomp.mso.properties.MsoPropertyInitializer;
public class MsoPropertyInitializerTest {
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString().substring(5);
- public static ServletContextEvent servletContextEvent = Mockito.mock(ServletContextEvent.class);
- public static ServletContext servletContext = Mockito.mock(ServletContext.class);
+ public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString().substring(5);
+ public static ServletContextEvent servletContextEvent = Mockito.mock(ServletContextEvent.class);
+ public static ServletContext servletContext = Mockito.mock(ServletContext.class);
public MsoPropertyInitializer msoPropInitializer = new MsoPropertyInitializer();
-
- @BeforeClass
- public static final void prepareBeforeClass() throws MsoPropertiesException {
-
- Mockito.when(servletContextEvent.getServletContext()).thenReturn(servletContext);
- }
-
- @Before
- public final void preparebeforeEachTest() throws MsoPropertiesException {
- MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- msoPropertiesFactory.removeAllMsoProperties();
-
- }
-
- @Test
- public void testContextInitialized() throws MsoPropertiesException {
- Mockito.when(servletContext.getInitParameter("mso.configuration")).thenReturn("MSO_PROP_ASDC="+ASDC_PROP);
- msoPropInitializer.contextInitialized(servletContextEvent);
-
- MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- assertNotNull(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC"));
- assertFalse("{}".equals(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().toString()));
- assertTrue(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().get("asdc-connections")!= null);
- }
-
- @Test
- public void testContextInitializedFailure() throws MsoPropertiesException {
- Mockito.when(servletContext.getInitParameter("mso.configuration")).thenReturn("MSO_PROP_ASDC="+"Does_not_exist.json");
- msoPropInitializer.contextInitialized(servletContextEvent);
-
- // No exception should be raised, log instead
- MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- assertTrue("{}".equals(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().toString()));
- assertTrue(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().get("asdc-connections")== null);
-
-
-
- }
-
+
+ @BeforeClass
+ public static final void prepareBeforeClass() throws MsoPropertiesException {
+
+ Mockito.when(servletContextEvent.getServletContext()).thenReturn(servletContext);
+ }
+
+ @Before
+ public final void preparebeforeEachTest() throws MsoPropertiesException {
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ msoPropertiesFactory.removeAllMsoProperties();
+
+ }
+
+ @Test
+ public void testContextInitialized() throws MsoPropertiesException {
+ Mockito.when(servletContext.getInitParameter("mso.configuration")).thenReturn("MSO_PROP_ASDC=" + ASDC_PROP);
+ msoPropInitializer.contextInitialized(servletContextEvent);
+
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ assertNotNull(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC"));
+ assertFalse("{}".equals(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().toString()));
+ assertTrue(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().get("asdc-connections") != null);
+ }
+
+ @Test
+ public void testContextInitializedFailure() throws MsoPropertiesException {
+ Mockito.when(servletContext.getInitParameter("mso.configuration")).thenReturn("MSO_PROP_ASDC=" + "Does_not_exist.json");
+ msoPropInitializer.contextInitialized(servletContextEvent);
+
+ // No exception should be raised, log instead
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+
+ assertTrue("{}".equals(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().toString()));
+ assertTrue(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().get("asdc-connections") == null);
+
+
+ }
+
}
diff --git a/common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java b/common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java
index eeb7342d50..d81a885f4b 100644
--- a/common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java
+++ b/common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java
@@ -32,25 +32,25 @@ public class CheckResultsTest {
* Test method for {@link org.openecomp.mso.utils.CheckResults#getResults()}.
*/
@Test
- public final void testGetResults () {
- CheckResults cr = new CheckResults ();
- cr.addHostCheckResult ("host1", 0, "output");
- cr.addHostCheckResult ("host2", 2, "output2");
- cr.addServiceCheckResult ("host1", "service1", 0, "outputServ");
- cr.addServiceCheckResult ("host1", "service2", 2, "outputServ2");
- cr.addServiceCheckResult ("host2", "service1", 0, "output2Serv");
- cr.addServiceCheckResult ("host2", "service2", 2, "output2Serv2");
- List <CheckResult> res = cr.getResults ();
- assert(res.size () == 6);
- assert(res.get (0).getHostname ().equals ("host1"));
- assert(res.get (1).getHostname ().equals ("host2"));
- assert(res.get (2).getHostname ().equals ("host1"));
- assert(res.get (3).getHostname ().equals ("host1"));
- assert(res.get (4).getHostname ().equals ("host2"));
- assert(res.get (5).getHostname ().equals ("host2"));
- assert(res.get (0).getServicename () == null);
- assert(res.get (3).getServicename ().equals ("service2"));
- assert(res.get (5).getState () == 2);
+ public final void testGetResults() {
+ CheckResults cr = new CheckResults();
+ cr.addHostCheckResult("host1", 0, "output");
+ cr.addHostCheckResult("host2", 2, "output2");
+ cr.addServiceCheckResult("host1", "service1", 0, "outputServ");
+ cr.addServiceCheckResult("host1", "service2", 2, "outputServ2");
+ cr.addServiceCheckResult("host2", "service1", 0, "output2Serv");
+ cr.addServiceCheckResult("host2", "service2", 2, "output2Serv2");
+ List<CheckResult> res = cr.getResults();
+ assert(res.size() == 6);
+ assert(res.get(0).getHostname().equals("host1"));
+ assert(res.get(1).getHostname().equals("host2"));
+ assert(res.get(2).getHostname().equals("host1"));
+ assert(res.get(3).getHostname().equals("host1"));
+ assert(res.get(4).getHostname().equals("host2"));
+ assert(res.get(5).getHostname().equals("host2"));
+ assert(res.get(0).getServicename() == null);
+ assert(res.get(3).getServicename().equals("service2"));
+ assert(res.get(5).getState() == 2);
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java
index 4e4f0ee189..6fc396dd11 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java
@@ -50,77 +50,71 @@ import org.openecomp.mso.properties.MsoJavaProperties;
/**
* This class implements test methods of Camunda Beans.
- *
- *
*/
public class BPELRestClientTest {
+ @Mock
+ private HttpClient mockHttpClient;
- @Mock
- private HttpClient mockHttpClient;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void tesBPELPost() throws JsonGenerationException,
- JsonMappingException, IOException {
-
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
- String responseBody ="<layer3activate:service-response xmlns:layer3activate=\"http://org.openecomp/mso/request/layer3serviceactivate/schema/v1\""
- + "xmlns:reqtype=\"http://org.openecomp/mso/request/types/v1\""
- + "xmlns:aetgt=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\""
- + "xmlns:types=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\">"
- + "<reqtype:request-id>req5</reqtype:request-id>"
- + "<reqtype:request-action>Layer3ServiceActivateRequest</reqtype:request-action>"
- + "<reqtype:source>OMX</reqtype:source>"
- + "<reqtype:ack-final-indicator>n</reqtype:ack-final-indicator>"
- + "</layer3activate:service-response>";
-
- HttpResponse mockResponse = createResponse(200, responseBody);
- mockHttpClient = Mockito.mock(HttpClient.class);
- Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class)))
- .thenReturn(mockResponse);
+ @Test
+ public void tesBPELPost() throws JsonGenerationException,
+ JsonMappingException, IOException {
- String reqXML = "<xml>test</xml>";
- String orchestrationURI = "/active-bpel/services/REST/MsoLayer3ServiceActivate";
- MsoJavaProperties props = new MsoJavaProperties();
- props.setProperty(CommonConstants.BPEL_URL, "http://localhost:8089");
- props.setProperty("bpelAuth", "786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1");
+ String responseBody = "<layer3activate:service-response xmlns:layer3activate=\"http://org.openecomp/mso/request/layer3serviceactivate/schema/v1\""
+ + "xmlns:reqtype=\"http://org.openecomp/mso/request/types/v1\""
+ + "xmlns:aetgt=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\""
+ + "xmlns:types=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\">"
+ + "<reqtype:request-id>req5</reqtype:request-id>"
+ + "<reqtype:request-action>Layer3ServiceActivateRequest</reqtype:request-action>"
+ + "<reqtype:source>OMX</reqtype:source>"
+ + "<reqtype:ack-final-indicator>n</reqtype:ack-final-indicator>"
+ + "</layer3activate:service-response>";
- RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props);
- requestClient.setClient(mockHttpClient);
- HttpResponse response = requestClient.post(reqXML, "reqId", "timeout", "version", null, null);
+ HttpResponse mockResponse = createResponse(200, responseBody);
+ mockHttpClient = Mockito.mock(HttpClient.class);
+ Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class)))
+ .thenReturn(mockResponse);
+ String reqXML = "<xml>test</xml>";
+ String orchestrationURI = "/active-bpel/services/REST/MsoLayer3ServiceActivate";
- int statusCode = response.getStatusLine().getStatusCode();
- assertEquals(requestClient.getType(), CommonConstants.BPEL);
- assertEquals(statusCode, HttpStatus.SC_OK);
+ MsoJavaProperties props = new MsoJavaProperties();
+ props.setProperty(CommonConstants.BPEL_URL, "http://localhost:8089");
+ props.setProperty("bpelAuth", "786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1");
+ RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props);
+ requestClient.setClient(mockHttpClient);
+ HttpResponse response = requestClient.post(reqXML, "reqId", "timeout", "version", null, null);
- }
- private HttpResponse createResponse(int respStatus,
- String respBody) {
- HttpResponse response = new BasicHttpResponse(
- new BasicStatusLine(
- new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
- response.setStatusCode(respStatus);
- try {
- response.setEntity(new StringEntity(respBody));
- response.setHeader("Content-Type", "text/xml");
- } catch (Exception e) {
- e.printStackTrace();
- }
- return response;
- }
+ int statusCode = response.getStatusLine().getStatusCode();
+ assertEquals(requestClient.getType(), CommonConstants.BPEL);
+ assertEquals(statusCode, HttpStatus.SC_OK);
+ }
+ private HttpResponse createResponse(int respStatus,
+ String respBody) {
+ HttpResponse response = new BasicHttpResponse(
+ new BasicStatusLine(
+ new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
+ response.setStatusCode(respStatus);
+ try {
+ response.setEntity(new StringEntity(respBody));
+ response.setHeader("Content-Type", "text/xml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return response;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java
index 6ee637d864..ec3a4b025b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java
@@ -51,13 +51,10 @@ import org.openecomp.mso.properties.MsoJavaProperties;
/**
* This class implements test methods of Camunda Beans.
- *
- *
*/
public class CamundaClientTest {
-
@Mock
private HttpClient mockHttpClient;
@@ -68,15 +65,15 @@ public class CamundaClientTest {
@Test
public void tesCamundaPost() throws JsonGenerationException,
- JsonMappingException, IOException {
+ JsonMappingException, IOException {
- String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
+ String responseBody = "{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
HttpResponse mockResponse = createResponse(200, responseBody);
mockHttpClient = Mockito.mock(HttpClient.class);
Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class)))
- .thenReturn(mockResponse);
+ .thenReturn(mockResponse);
String reqXML = "<xml>test</xml>";
String orchestrationURI = "/engine-rest/process-definition/key/dummy/start";
@@ -93,7 +90,7 @@ public class CamundaClientTest {
assertEquals(requestClient.getType(), CommonConstants.CAMUNDA);
assertEquals(statusCode, HttpStatus.SC_OK);
- props.setProperty (CommonConstants.CAMUNDA_AUTH, "ABCD1234");
+ props.setProperty(CommonConstants.CAMUNDA_AUTH, "ABCD1234");
requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props);
requestClient.setClient(mockHttpClient);
response = requestClient.post(null, "reqId", null, null, null, null);
@@ -104,8 +101,8 @@ public class CamundaClientTest {
private HttpResponse createResponse(int respStatus,
String respBody) {
HttpResponse response = new BasicHttpResponse(
- new BasicStatusLine(
- new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
+ new BasicStatusLine(
+ new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
response.setStatusCode(respStatus);
try {
response.setEntity(new StringEntity(respBody));
@@ -117,7 +114,4 @@ public class CamundaClientTest {
}
-
-
-
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java
index 753ce9dee8..47252e92ad 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java
@@ -21,7 +21,6 @@
package org.openecomp.mso.camunda.tests;
-
import static org.junit.Assert.assertEquals;
import java.io.IOException;
@@ -38,44 +37,42 @@ import org.openecomp.mso.apihandler.common.CommonConstants;
/**
* This class implements test methods of Camunda Beans.
- *
- *
*/
public class CamundaRequestTest {
- @Test
- public final void testSerialization() throws JsonGenerationException,
- JsonMappingException, IOException {
- CamundaRequest camundaRequest = new CamundaRequest();
- CamundaInput camundaInput = new CamundaInput();
- CamundaInput host = new CamundaInput();
- CamundaInput schema = new CamundaInput();
- CamundaInput reqid = new CamundaInput();
- CamundaInput svcid = new CamundaInput();
- CamundaInput timeout = new CamundaInput();
- camundaInput
- .setValue("<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:request-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"><msoservtypes:request-id>155415ab-b4a7-4382-b4c6-d17d950604</msoservtypes:request-id><msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action><msoservtypes:source>OMX</msoservtypes:source><msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url><msoservtypes:order-number>5051563</msoservtypes:order-number><msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"><msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type><msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id><msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> <sdncadapterworkflow:cloudId>MTSNJA4LCP1</sdncadapterworkflow:cloudId> </aetgt:CreateTenantRequest>");
- camundaRequest.setServiceInput(camundaInput);
- host.setValue("localhost");
- camundaRequest.setHost(host);
- schema.setValue("v1");
- camundaRequest.setSchema(schema);
- reqid.setValue("reqid123");
- camundaRequest.setReqid(reqid);
- svcid.setValue("svcid123");
- camundaRequest.setSvcid(svcid);
- timeout.setValue("");
- camundaRequest.setTimeout(timeout);
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ @Test
+ public final void testSerialization() throws JsonGenerationException,
+ JsonMappingException, IOException {
+ CamundaRequest camundaRequest = new CamundaRequest();
+ CamundaInput camundaInput = new CamundaInput();
+ CamundaInput host = new CamundaInput();
+ CamundaInput schema = new CamundaInput();
+ CamundaInput reqid = new CamundaInput();
+ CamundaInput svcid = new CamundaInput();
+ CamundaInput timeout = new CamundaInput();
+ camundaInput
+ .setValue("<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:request-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"><msoservtypes:request-id>155415ab-b4a7-4382-b4c6-d17d950604</msoservtypes:request-id><msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action><msoservtypes:source>OMX</msoservtypes:source><msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url><msoservtypes:order-number>5051563</msoservtypes:order-number><msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"><msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type><msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id><msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> <sdncadapterworkflow:cloudId>MTSNJA4LCP1</sdncadapterworkflow:cloudId> </aetgt:CreateTenantRequest>");
+ camundaRequest.setServiceInput(camundaInput);
+ host.setValue("localhost");
+ camundaRequest.setHost(host);
+ schema.setValue("v1");
+ camundaRequest.setSchema(schema);
+ reqid.setValue("reqid123");
+ camundaRequest.setReqid(reqid);
+ svcid.setValue("svcid123");
+ camundaRequest.setSvcid(svcid);
+ timeout.setValue("");
+ camundaRequest.setTimeout(timeout);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
- String json = mapper.writeValueAsString(camundaRequest);
- System.out.println(json);
- assertEquals(
- "{\"variables\":{\""+CommonConstants.CAMUNDA_SERVICE_INPUT+"\":{\"value\":\"<aetgt:CreateTenantRequest xmlns:aetgt=\\\"http://org.openecomp/mso/workflow/schema/v1\\\" xmlns:sdncadapterworkflow=\\\"http://org.openecomp/mso/workflow/schema/v1\\\" xmlns:ns5=\\\"http://org.openecomp/mso/request/types/v1\\\"> <msoservtypes:request-information xmlns:msoservtypes=\\\"http://org.openecomp/mso/request/types/v1\\\"><msoservtypes:request-id>155415ab-b4a7-4382-b4c6-d17d950604</msoservtypes:request-id><msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action><msoservtypes:source>OMX</msoservtypes:source><msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url><msoservtypes:order-number>5051563</msoservtypes:order-number><msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> <msoservtypes:service-information xmlns:msoservtypes=\\\"http://org.openecomp/mso/request/types/v1\\\"><msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type><msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id><msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> <sdncadapterworkflow:cloudId>MTSNJA4LCP1</sdncadapterworkflow:cloudId> </aetgt:CreateTenantRequest>\",\"type\":\"String\"}" +
- ",\"host\":{\"value\":\"localhost\",\"type\":\"String\"},\"mso-schema-version\":{\"value\":\"v1\",\"type\":\"String\"},\"mso-request-id\":{\"value\":\"reqid123\",\"type\":\"String\"},\"mso-service-instance-id\":{\"value\":\"svcid123\",\"type\":\"String\"},\"mso-service-request-timeout\":{\"value\":\"\",\"type\":\"String\"}}}",
- json);
+ String json = mapper.writeValueAsString(camundaRequest);
+ System.out.println(json);
+ assertEquals(
+ "{\"variables\":{\"" + CommonConstants.CAMUNDA_SERVICE_INPUT + "\":{\"value\":\"<aetgt:CreateTenantRequest xmlns:aetgt=\\\"http://org.openecomp/mso/workflow/schema/v1\\\" xmlns:sdncadapterworkflow=\\\"http://org.openecomp/mso/workflow/schema/v1\\\" xmlns:ns5=\\\"http://org.openecomp/mso/request/types/v1\\\"> <msoservtypes:request-information xmlns:msoservtypes=\\\"http://org.openecomp/mso/request/types/v1\\\"><msoservtypes:request-id>155415ab-b4a7-4382-b4c6-d17d950604</msoservtypes:request-id><msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action><msoservtypes:source>OMX</msoservtypes:source><msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url><msoservtypes:order-number>5051563</msoservtypes:order-number><msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> <msoservtypes:service-information xmlns:msoservtypes=\\\"http://org.openecomp/mso/request/types/v1\\\"><msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type><msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id><msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> <sdncadapterworkflow:cloudId>MTSNJA4LCP1</sdncadapterworkflow:cloudId> </aetgt:CreateTenantRequest>\",\"type\":\"String\"}" +
+ ",\"host\":{\"value\":\"localhost\",\"type\":\"String\"},\"mso-schema-version\":{\"value\":\"v1\",\"type\":\"String\"},\"mso-request-id\":{\"value\":\"reqid123\",\"type\":\"String\"},\"mso-service-instance-id\":{\"value\":\"svcid123\",\"type\":\"String\"},\"mso-service-request-timeout\":{\"value\":\"\",\"type\":\"String\"}}}",
+ json);
- }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java
index c561f1a245..bc51685baf 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java
@@ -35,25 +35,23 @@ import org.openecomp.mso.apihandler.camundabeans.CamundaResponse;
/**
* This class implements test methods of Camunda Beans.
- *
- *
*/
public class CamundaResponseTest {
- @Test
- public final void testDeserialization() throws JsonGenerationException,
- JsonMappingException, IOException {
- ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
- mapper.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
-
- String responseBody = "{ \"response\": \"<xml>xml</xml>\","+
- "\"messageCode\": 200,"+
- "\"message\": \"Successfully started the process\"," +
- "\"processInstanceID\":null,\"variables\":null}";
-
- CamundaResponse response = mapper.readValue(responseBody, CamundaResponse.class);
- assertEquals(response.toString(), "CamundaResponse [response=<xml>xml</xml>, messageCode=200, message=Successfully started the process]");
-
- }
+ @Test
+ public final void testDeserialization() throws JsonGenerationException,
+ JsonMappingException, IOException {
+ ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
+ mapper.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+
+ String responseBody = "{ \"response\": \"<xml>xml</xml>\"," +
+ "\"messageCode\": 200," +
+ "\"message\": \"Successfully started the process\"," +
+ "\"processInstanceID\":null,\"variables\":null}";
+
+ CamundaResponse response = mapper.readValue(responseBody, CamundaResponse.class);
+ assertEquals(response.toString(), "CamundaResponse [response=<xml>xml</xml>, messageCode=200, message=Successfully started the process]");
+
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java
index 99a83d3ed9..d4d563a88b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java
@@ -40,90 +40,88 @@ import org.openecomp.mso.apihandler.common.ResponseHandler;
/**
* This class implements test methods of CamundaResoponseHandler.
- *
- *
*/
public class ResponseHandlerTest {
@Test
- public void tesParseCamundaResponse () throws JsonGenerationException, JsonMappingException, IOException {
+ public void tesParseCamundaResponse() throws JsonGenerationException, JsonMappingException, IOException {
// String body
// ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 200,"
- + "\"message\": \"Successfully started the process\"}";
+ + "\"message\": \"Successfully started the process\"}";
- HttpResponse response = createResponse (200, body, "application/json");
+ HttpResponse response = createResponse(200, body, "application/json");
- ResponseHandler respHandler = new ResponseHandler (response, 1);
+ ResponseHandler respHandler = new ResponseHandler(response, 1);
- int status = respHandler.getStatus ();
- assertEquals (status, HttpStatus.SC_ACCEPTED);
- assertEquals (respHandler.getResponse ().getMessage (), "Successfully started the process");
+ int status = respHandler.getStatus();
+ assertEquals(status, HttpStatus.SC_ACCEPTED);
+ assertEquals(respHandler.getResponse().getMessage(), "Successfully started the process");
}
@Test
- public void tesParseBpelResponse () throws JsonGenerationException, JsonMappingException, IOException {
+ public void tesParseBpelResponse() throws JsonGenerationException, JsonMappingException, IOException {
String body = "<layer3activate:service-response xmlns:layer3activate=\"http://org.openecomp/mso/request/layer3serviceactivate/schema/v1\""
- + "xmlns:reqtype=\"http://org.openecomp/mso/request/types/v1\""
- + "xmlns:aetgt=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\""
- + "xmlns:types=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\">"
- + "<reqtype:request-id>req5</reqtype:request-id>"
- + "<reqtype:request-action>Layer3ServiceActivateRequest</reqtype:request-action>"
- + "<reqtype:source>OMX</reqtype:source>"
- + "<reqtype:ack-final-indicator>n</reqtype:ack-final-indicator>"
- + "</layer3activate:service-response>";
-
- HttpResponse response = createResponse (200, body, "text/xml");
-
- ResponseHandler respHandler = new ResponseHandler (response, 0);
-
- int status = respHandler.getStatus ();
- assertEquals (status, HttpStatus.SC_ACCEPTED);
- assertTrue (respHandler.getResponseBody () != null);
+ + "xmlns:reqtype=\"http://org.openecomp/mso/request/types/v1\""
+ + "xmlns:aetgt=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\""
+ + "xmlns:types=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\">"
+ + "<reqtype:request-id>req5</reqtype:request-id>"
+ + "<reqtype:request-action>Layer3ServiceActivateRequest</reqtype:request-action>"
+ + "<reqtype:source>OMX</reqtype:source>"
+ + "<reqtype:ack-final-indicator>n</reqtype:ack-final-indicator>"
+ + "</layer3activate:service-response>";
+
+ HttpResponse response = createResponse(200, body, "text/xml");
+
+ ResponseHandler respHandler = new ResponseHandler(response, 0);
+
+ int status = respHandler.getStatus();
+ assertEquals(status, HttpStatus.SC_ACCEPTED);
+ assertTrue(respHandler.getResponseBody() != null);
}
@Test
- public void tes404ErrorResponse () throws JsonGenerationException, JsonMappingException, IOException {
+ public void tes404ErrorResponse() throws JsonGenerationException, JsonMappingException, IOException {
+
-
- HttpResponse response = createResponse (HttpStatus.SC_NOT_FOUND, "<html>error</html>", "text/html");
- ResponseHandler respHandler = new ResponseHandler (response, 1);
+ HttpResponse response = createResponse(HttpStatus.SC_NOT_FOUND, "<html>error</html>", "text/html");
+ ResponseHandler respHandler = new ResponseHandler(response, 1);
- int status = respHandler.getStatus ();
+ int status = respHandler.getStatus();
- assertEquals (HttpStatus.SC_NOT_IMPLEMENTED, status);
+ assertEquals(HttpStatus.SC_NOT_IMPLEMENTED, status);
}
@Test
- public void tesGenricErrorResponse () throws JsonGenerationException, JsonMappingException, IOException {
+ public void tesGenricErrorResponse() throws JsonGenerationException, JsonMappingException, IOException {
String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 500,"
- + "\"message\": \"Something went wrong\"}";
+ + "\"message\": \"Something went wrong\"}";
- HttpResponse response = createResponse (500, body, "application/json");
+ HttpResponse response = createResponse(500, body, "application/json");
- ResponseHandler respHandler = new ResponseHandler (response, 1);
+ ResponseHandler respHandler = new ResponseHandler(response, 1);
- int status = respHandler.getStatus ();
- assertEquals (HttpStatus.SC_BAD_GATEWAY, status);
- assertEquals (respHandler.getResponse ().getMessage (), "Something went wrong");
- System.out.println (respHandler.getResponseBody ());
+ int status = respHandler.getStatus();
+ assertEquals(HttpStatus.SC_BAD_GATEWAY, status);
+ assertEquals(respHandler.getResponse().getMessage(), "Something went wrong");
+ System.out.println(respHandler.getResponseBody());
}
- private HttpResponse createResponse (int respStatus, String respBody, String contentType) {
- HttpResponse response = new BasicHttpResponse (new BasicStatusLine (new ProtocolVersion ("HTTP", 1, 1),
- respStatus,
- ""));
- response.setStatusCode (respStatus);
+ private HttpResponse createResponse(int respStatus, String respBody, String contentType) {
+ HttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1),
+ respStatus,
+ ""));
+ response.setStatusCode(respStatus);
try {
- response.setEntity (new StringEntity (respBody));
- response.setHeader ("Content-Type", contentType);
+ response.setEntity(new StringEntity(respBody));
+ response.setHeader("Content-Type", contentType);
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
return response;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java
index 9028109735..1198cdb998 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java
@@ -27,33 +27,33 @@ import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfInputs;
public class BeanTest {
- @Test
- public void testVnfInputs(){
- VnfInputs bean = new VnfInputs();
- bean.setAicCloudRegion("south");
- bean.setAicNodeClli("38982");
- bean.setAsdcServiceModelVersion("v2");
- bean.setBackoutOnFailure(false);
- bean.setIsBaseVfModule(true);
- bean.setPersonaModelId("2017");
- bean.setPersonaModelVersion("v3");
- bean.setProvStatus("active");
- bean.setServiceId("123456");
- bean.setServiceInstanceId("aaa1234");
- bean.setServiceType("vnf");
- bean.setTenantId("89903042");
- bean.setVfModuleId("4993022");
- bean.setVfModuleModelName("m1");
- bean.setVnfId("34");
- bean.setVnfName("test");
- bean.setVnfPersonaModelId("1002");
- bean.setVnfPersonaModelVersion("v3");
- bean.setVnfType("fddf");
- bean.setVolumeGroupId("7889");
- bean.setVolumeGroupName("test");
-
- String str = bean.toString();
- assertTrue(str != null);
-
- }
+ @Test
+ public void testVnfInputs() {
+ VnfInputs bean = new VnfInputs();
+ bean.setAicCloudRegion("south");
+ bean.setAicNodeClli("38982");
+ bean.setAsdcServiceModelVersion("v2");
+ bean.setBackoutOnFailure(false);
+ bean.setIsBaseVfModule(true);
+ bean.setPersonaModelId("2017");
+ bean.setPersonaModelVersion("v3");
+ bean.setProvStatus("active");
+ bean.setServiceId("123456");
+ bean.setServiceInstanceId("aaa1234");
+ bean.setServiceType("vnf");
+ bean.setTenantId("89903042");
+ bean.setVfModuleId("4993022");
+ bean.setVfModuleModelName("m1");
+ bean.setVnfId("34");
+ bean.setVnfName("test");
+ bean.setVnfPersonaModelId("1002");
+ bean.setVnfPersonaModelVersion("v3");
+ bean.setVnfType("fddf");
+ bean.setVolumeGroupId("7889");
+ bean.setVolumeGroupName("test");
+
+ String str = bean.toString();
+ assertTrue(str != null);
+
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
index 664f810b35..04c6fc82b9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
@@ -59,698 +59,698 @@ import mockit.MockUp;
public class E2EServiceInstancesTest {
- @Test
- public void createE2EServiceInstanceTestSuccess() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName(String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
- String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI,
- MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction,
- String serviceInstanceId, String vnfId, String vfModuleId,
- String volumeGroupId, String networkId, String serviceType,
- String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd) {
- ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
- HttpResponse resp = new BasicHttpResponse(pv, 202,
- "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestBpelHTTPException() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName(String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
- String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI,
- MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction,
- String serviceInstanceId, String vnfId, String vfModuleId,
- String volumeGroupId, String networkId, String serviceType,
- String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd) {
- ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
- HttpResponse resp = new BasicHttpResponse(pv, 500,
- "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestBpelHTTPExceptionWithNullREsponseBody() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName(String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
- String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI,
- MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction,
- String serviceInstanceId, String vnfId, String vfModuleId,
- String volumeGroupId, String networkId, String serviceType,
- String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd) {
- ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
- HttpResponse resp = new BasicHttpResponse(pv, 500,
- "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestNullBPELResponse() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName(String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
- String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI,
- MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction,
- String serviceInstanceId, String vnfId, String vfModuleId,
- String volumeGroupId, String networkId, String serviceType,
- String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd) {
- HttpResponse resp = null;
- return resp;
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestBPMNNullREsponse() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName(String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
- String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI,
- MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion,
- String serviceInstanceId, String action) {
- HttpResponse resp = null;
- return resp;
- }
- };
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestNullBpmn() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
-
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName(String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
- String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestNullReceipe() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestNullDBResponse() {
-
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestInvalidRequest() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
-
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestEmptyDBQuery() {
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- // assertTrue(true);
- }
-
- @Test
- public void createE2EServiceInstanceTestDBQueryFail() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
-
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestForEmptyRequest() {
-
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr
- .contains("Mapping of request to JSON object failed. No content to map to Object due to end of input"));
- }
-
- @Test
- public void deleteE2EServiceInstanceTestNormal() {
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"globalSubscriberId\":\"299392392\",\"serviceType\":\"VoLTE\"}";
- Response resp = instance.deleteE2EServiceInstance(request, "v3",
- "12345678");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC1000"));
- }
-
- @Test
- public void getE2EServiceInstanceTest() {
-
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatus(String serviceId,
- String operationId) {
- OperationStatus os = new OperationStatus();
- os.setOperation("");
- os.setOperationContent("");
- os.setOperationId("123456");
- os.setProgress("");
- os.setServiceId("12345");
- os.setServiceName("VoLTE");
- os.setReason("");
- os.setResult("");
- os.setUserId("");
- return os;
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- Response resp = instance
- .getE2EServiceInstances("12345", "v3", "123456");
-
- }
-
- @Test
- public void updateE2EServiceInstanceTestNormal() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceId(
- String serviceID) {
- OperationStatus operationStatus = new OperationStatus();
- operationStatus.setProgress("100");
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName(String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
- String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI,
- MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction,
- String serviceInstanceId, String vnfId, String vfModuleId,
- String volumeGroupId, String networkId, String serviceType,
- String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd) {
- ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
- HttpResponse resp = new BasicHttpResponse(pv, 202,
- "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("success"));
- }
-
- @Test
- public void updateE2EServiceInstanceTestChkStatusFalse() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceId(
- String serviceID) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName(String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
- String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI,
- MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction,
- String serviceInstanceId, String vnfId, String vfModuleId,
- String volumeGroupId, String networkId, String serviceType,
- String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd) {
- ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
- HttpResponse resp = new BasicHttpResponse(pv, 202,
- "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
+ @Test
+ public void createE2EServiceInstanceTestSuccess() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 202,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBpelHTTPException() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 500,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBpelHTTPExceptionWithNullREsponseBody() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 500,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullBPELResponse() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ HttpResponse resp = null;
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBPMNNullREsponse() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String camundaReqXML, String requestId,
+ String requestTimeout, String schemaVersion,
+ String serviceInstanceId, String action) {
+ HttpResponse resp = null;
+ return resp;
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullBpmn() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullReceipe() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullDBResponse() {
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestInvalidRequest() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestEmptyDBQuery() {
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ // assertTrue(true);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestDBQueryFail() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestForEmptyRequest() {
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr
+ .contains("Mapping of request to JSON object failed. No content to map to Object due to end of input"));
+ }
+
+ @Test
+ public void deleteE2EServiceInstanceTestNormal() {
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"globalSubscriberId\":\"299392392\",\"serviceType\":\"VoLTE\"}";
+ Response resp = instance.deleteE2EServiceInstance(request, "v3",
+ "12345678");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC1000"));
+ }
+
+ @Test
+ public void getE2EServiceInstanceTest() {
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatus(String serviceId,
+ String operationId) {
+ OperationStatus os = new OperationStatus();
+ os.setOperation("");
+ os.setOperationContent("");
+ os.setOperationId("123456");
+ os.setProgress("");
+ os.setServiceId("12345");
+ os.setServiceName("VoLTE");
+ os.setReason("");
+ os.setResult("");
+ os.setUserId("");
+ return os;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ Response resp = instance
+ .getE2EServiceInstances("12345", "v3", "123456");
+
+ }
+
+ @Test
+ public void updateE2EServiceInstanceTestNormal() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceId(
+ String serviceID) {
+ OperationStatus operationStatus = new OperationStatus();
+ operationStatus.setProgress("100");
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 202,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("success"));
+ }
+
+ @Test
+ public void updateE2EServiceInstanceTestChkStatusFalse() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceId(
+ String serviceID) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 202,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java
index 5502d38268..95b0b2bcb5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java
@@ -37,24 +37,24 @@ import org.openecomp.mso.properties.MsoPropertiesFactory;
public class GlobalHealthcheckHandlerTest {
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
- public static final Response HEALTH_CHECK_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
-
- @Test
- public final void testGlobalHealthcheck() {
- try {
- MsoStatusUtil statusUtil = Mockito.mock(MsoStatusUtil.class);
- HealthCheckUtils utils = Mockito.mock(HealthCheckUtils.class);
- Mockito.when(utils.verifyGlobalHealthCheck(true, null)).thenReturn(true);
- Mockito.when(statusUtil.getSiteStatus(Mockito.anyString())).thenReturn(true);
- GlobalHealthcheckHandler gh = Mockito.mock(GlobalHealthcheckHandler.class);
- Mockito.when(gh.globalHealthcheck(Mockito.anyBoolean())).thenReturn(HEALTH_CHECK_RESPONSE);
- Response resp = gh.globalHealthcheck(true);
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
+ public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
+ public static final Response HEALTH_CHECK_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+
+ @Test
+ public final void testGlobalHealthcheck() {
+ try {
+ MsoStatusUtil statusUtil = Mockito.mock(MsoStatusUtil.class);
+ HealthCheckUtils utils = Mockito.mock(HealthCheckUtils.class);
+ Mockito.when(utils.verifyGlobalHealthCheck(true, null)).thenReturn(true);
+ Mockito.when(statusUtil.getSiteStatus(Mockito.anyString())).thenReturn(true);
+ GlobalHealthcheckHandler gh = Mockito.mock(GlobalHealthcheckHandler.class);
+ Mockito.when(gh.globalHealthcheck(Mockito.anyBoolean())).thenReturn(HEALTH_CHECK_RESPONSE);
+ Response resp = gh.globalHealthcheck(true);
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java
index e18bc5e911..fa414186a3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java
@@ -28,11 +28,11 @@ import javax.ws.rs.core.Response;
public class ManualTasksTest {
- ManualTasks task = new ManualTasks();
-
- @Test
- public void completeTaskTest(){
- Response resp = task.completeTask("test", "v2", "1882993");
- assertTrue(resp.getEntity().toString() != null);
- }
+ ManualTasks task = new ManualTasks();
+
+ @Test
+ public void completeTaskTest() {
+ Response resp = task.completeTask("test", "v2", "1882993");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
index c4a1c1fffc..58e17ff273 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
@@ -41,261 +41,259 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRe
public class MsoRequestTest {
-
- @Test
- public void testParseOrchestration() throws JsonParseException, JsonMappingException, IOException, ValidationException{
- ObjectMapper mapper = new ObjectMapper();
- String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parseOrchestration(sir);
- assertEquals(msoRequest.getRequestInfo().getSource(),"VID");
- assertEquals(msoRequest.getRequestInfo().getRequestorId(),"zz9999");
-
- }
-
- @Test(expected = ValidationException.class)
- public void testParseOrchestrationFailure() throws JsonParseException, JsonMappingException, IOException, ValidationException{
- ObjectMapper mapper = new ObjectMapper();
- String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\"}}}";
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parseOrchestration(sir);
-
- }
-
- @Test
- public void testParseV3VnfCreate() throws JsonParseException, JsonMappingException, IOException, ValidationException{
- String requestJSON;
- try {
- requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3VnfCreate.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3");
- assertEquals(msoRequest.getRequestInfo().getSource(),"VID");
- assertFalse(msoRequest.getALaCarteFlag());
- assertEquals(msoRequest.getReqVersion(),3);
- boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
- assertFalse(testIsALaCarteSet);
-
- }
-
- @Test(expected = ValidationException.class)
- public void testParseV3VolumeGroupFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{
- String requestJSON;
- try {
- requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3VolumeGroupBad.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
-
- }
-
- @Test
- public void testParseV3UpdateNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException{
- String requestJSON;
- try {
- requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3UpdateNetwork.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
-
- }
-
- @Test(expected = ValidationException.class)
- public void testParseV3UpdateNetworkFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{
- String requestJSON;
- try {
- requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3UpdateNetworkBad.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
-
- }
-
- @Test
- public void testParseV3DeleteNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException{
- String requestJSON;
- try {
- requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteNetwork.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
- }
-
- @Test
- public void testParseV3ServiceInstanceDelete() throws JsonParseException, JsonMappingException, IOException, ValidationException{
- String requestJSON1, requestJSON2;
- try {
- requestJSON1 = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstance.json"));
- requestJSON2 = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstanceALaCarte.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON1, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
- boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
- assertTrue(testIsALaCarteSet);
- assertFalse(msoRequest.getALaCarteFlag());
- sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class);
- msoRequest = new MsoRequest ("12345");
- msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
- testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
- assertTrue(testIsALaCarteSet);
- assertTrue(msoRequest.getALaCarteFlag());
-
- }
-
- @Test(expected = ValidationException.class)
- public void testParseV3ServiceInstanceCreateFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{
- String requestJSON2;
- try {
- requestJSON2 = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstanceALaCarte.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3");
-
- }
-
- @Test(expected = ValidationException.class)
- public void testParseV3ServiceInstanceDeleteMacroFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{
- String requestJSON;
- try {
- requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstanceBad.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
-
- }
-
- @Test
- public void testVfModuleV4UsePreLoad() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON;
- try {
- requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModule.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
-
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
-
-
-
- try {
- requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModuleNoCustomizationId.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
-
- mapper = new ObjectMapper();
- instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
- }
-
- @Test(expected = ValidationException.class)
- public void testV4UsePreLoadMissingModelCustomizationId() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON;
- try {
- requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModuleMissingModelCustomizationId.json"));
-
- } catch (IOException e) {
- fail ("Exception caught");
- e.printStackTrace ();
- return;
- }
-
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest ("1234");
- msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
- }
+ @Test
+ public void testParseOrchestration() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ ObjectMapper mapper = new ObjectMapper();
+ String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parseOrchestration(sir);
+ assertEquals(msoRequest.getRequestInfo().getSource(), "VID");
+ assertEquals(msoRequest.getRequestInfo().getRequestorId(), "zz9999");
+
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testParseOrchestrationFailure() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ ObjectMapper mapper = new ObjectMapper();
+ String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\"}}}";
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parseOrchestration(sir);
+
+ }
+
+ @Test
+ public void testParseV3VnfCreate() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3VnfCreate.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3");
+ assertEquals(msoRequest.getRequestInfo().getSource(), "VID");
+ assertFalse(msoRequest.getALaCarteFlag());
+ assertEquals(msoRequest.getReqVersion(), 3);
+ boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
+ assertFalse(testIsALaCarteSet);
+
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testParseV3VolumeGroupFail() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3VolumeGroupBad.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
+
+ }
+
+ @Test
+ public void testParseV3UpdateNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3UpdateNetwork.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
+
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testParseV3UpdateNetworkFail() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3UpdateNetworkBad.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
+
+ }
+
+ @Test
+ public void testParseV3DeleteNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteNetwork.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
+ }
+
+ @Test
+ public void testParseV3ServiceInstanceDelete() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON1, requestJSON2;
+ try {
+ requestJSON1 = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstance.json"));
+ requestJSON2 = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstanceALaCarte.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON1, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
+ boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
+ assertTrue(testIsALaCarteSet);
+ assertFalse(msoRequest.getALaCarteFlag());
+ sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class);
+ msoRequest = new MsoRequest("12345");
+ msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
+ testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
+ assertTrue(testIsALaCarteSet);
+ assertTrue(msoRequest.getALaCarteFlag());
+
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testParseV3ServiceInstanceCreateFail() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON2;
+ try {
+ requestJSON2 = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstanceALaCarte.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3");
+
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testParseV3ServiceInstanceDeleteMacroFail() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstanceBad.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
+
+ }
+
+ @Test
+ public void testVfModuleV4UsePreLoad() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v4CreateVfModule.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
+
+
+ try {
+ requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v4CreateVfModuleNoCustomizationId.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+
+ mapper = new ObjectMapper();
+ instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testV4UsePreLoadMissingModelCustomizationId() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v4CreateVfModuleMissingModelCustomizationId.json"));
+
+ } catch (IOException e) {
+ fail("Exception caught");
+ e.printStackTrace();
+ return;
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java
index 445fab329f..427b74ce87 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java
@@ -28,38 +28,38 @@ import org.openecomp.mso.requestsdb.InfraRequests;
public class NetworkInfoHandlerTest {
- NetworkInfoHandler handler = new NetworkInfoHandler();
-
- @Test
- public void fillVnfRequestTest(){
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v3");
- String vnfid = (String)qr.getNetworkParams();
- assertTrue(vnfid.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV2(){
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v2");
- String vnfid = (String)qr.getNetworkParams();
- assertTrue(vnfid.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV1(){
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v1");
- String vnfid = (String)qr.getNetworkParams();
- assertTrue(vnfid.equals("test"));
- }
+ NetworkInfoHandler handler = new NetworkInfoHandler();
+
+ @Test
+ public void fillVnfRequestTest() {
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v3");
+ String vnfid = (String) qr.getNetworkParams();
+ assertTrue(vnfid.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV2() {
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v2");
+ String vnfid = (String) qr.getNetworkParams();
+ assertTrue(vnfid.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV1() {
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v1");
+ String vnfid = (String) qr.getNetworkParams();
+ assertTrue(vnfid.equals("test"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
index c1da76e885..66dc9c28d6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
@@ -44,178 +44,181 @@ import org.openecomp.mso.requestsdb.RequestsDatabase;
public class NetworkRequestHandlerTest {
- NetworkRequestHandler handler = null;
-
-UriInfo uriInfo = null;
-
- @Before
- public void setup() throws Exception{
-
- uriInfo = Mockito.mock(UriInfo.class);
- Class<?> clazz = NetworkRequestHandler.class;
- handler = (NetworkRequestHandler)clazz.newInstance();
-
- Field f1 = handler.getClass().getDeclaredField("uriInfo");
-
- f1.setAccessible(true);
+ NetworkRequestHandler handler = null;
+
+ UriInfo uriInfo = null;
+
+ @Before
+ public void setup() throws Exception {
+
+ uriInfo = Mockito.mock(UriInfo.class);
+ Class<?> clazz = NetworkRequestHandler.class;
+ handler = (NetworkRequestHandler) clazz.newInstance();
+
+ Field f1 = handler.getClass().getDeclaredField("uriInfo");
+
+ f1.setAccessible(true);
f1.set(handler, uriInfo);
- }
-
- @Test
- public void manageVnfRequestTest(){
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
- assertTrue(null != resp);
- }
- @Test
- public void manageVnfRequestTestV1(){
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v1");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequestTestV3(){
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v3");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequestTestInvalidVersion(){
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v249");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2Test(){
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
- assertTrue(null != resp);
- }
-
- @Test
- public void fillNetworkRequestTestV1(){
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v1");
- String param = (String)qr.getNetworkParams();
- assertTrue(param.equals("test"));
- }
- @Test
- public void fillNetworkRequestTestV2(){
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v2");
- String param = (String)qr.getNetworkParams();
- assertTrue(param.equals("test"));
- }
- @Test
- public void fillNetworkRequestTestV3(){
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v3");
- String param = (String)qr.getNetworkParams();
- assertTrue(param.equals("test"));
- }
-
- @Test
- public void queryFiltersTest(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
- String queryValue,
- String requestType) {
- List <InfraActiveRequests> list = new ArrayList<>();
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- list.add(req);
- return list;
- }
- };
- Response resp = handler.queryFilters("networkType", "serviceType", "aicNodeClli", "tenantId", "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getRequestTest(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- return req;
- }
- };
- Response resp = handler.getRequest("388293", "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
-
+ }
+
+ @Test
+ public void manageVnfRequestTest() {
+ Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequestTestV1() {
+ Response resp = handler.manageNetworkRequest("<name>Test</name>", "v1");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequestTestV3() {
+ Response resp = handler.manageNetworkRequest("<name>Test</name>", "v3");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequestTestInvalidVersion() {
+ Response resp = handler.manageNetworkRequest("<name>Test</name>", "v249");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2Test() {
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void fillNetworkRequestTestV1() {
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v1");
+ String param = (String) qr.getNetworkParams();
+ assertTrue(param.equals("test"));
+ }
+
+ @Test
+ public void fillNetworkRequestTestV2() {
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v2");
+ String param = (String) qr.getNetworkParams();
+ assertTrue(param.equals("test"));
+ }
+
+ @Test
+ public void fillNetworkRequestTestV3() {
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v3");
+ String param = (String) qr.getNetworkParams();
+ assertTrue(param.equals("test"));
+ }
+
+ @Test
+ public void queryFiltersTest() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ List<InfraActiveRequests> list = new ArrayList<>();
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ list.add(req);
+ return list;
+ }
+ };
+ Response resp = handler.queryFilters("networkType", "serviceType", "aicNodeClli", "tenantId", "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getRequestTest() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType) {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ return req;
+ }
+ };
+ Response resp = handler.getRequest("388293", "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java
index 3738e2f94a..42c72fed07 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java
@@ -36,38 +36,38 @@ import org.openecomp.mso.db.catalog.beans.NetworkResource;
public class NetworkTypesHandlerTest {
- NetworkTypesHandler handler = new NetworkTypesHandler();
-
- @Test
- public void getNetworkTypesTest(){
- Response resp = handler.getNetworkTypes("v2");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getNetworkTypesTest2(){
- new MockUp<CatalogDatabase>() {
- @Mock
- public List <NetworkResource> getAllNetworkResources(){
- return null;
- }
- };
- Response resp = handler.getNetworkTypes("v2");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getNetworkTypesTest3(){
- List <NetworkResource> netList = new ArrayList<>();
- new MockUp<CatalogDatabase>() {
- @Mock
- public List <NetworkResource> getAllNetworkResources(){
- NetworkResource ns = new NetworkResource();
- netList.add(ns);
- return netList;
- }
- };
- Response resp = handler.getNetworkTypes("v2");
- assertTrue(resp.getEntity().toString() != null);
- }
+ NetworkTypesHandler handler = new NetworkTypesHandler();
+
+ @Test
+ public void getNetworkTypesTest() {
+ Response resp = handler.getNetworkTypes("v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getNetworkTypesTest2() {
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List<NetworkResource> getAllNetworkResources() {
+ return null;
+ }
+ };
+ Response resp = handler.getNetworkTypes("v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getNetworkTypesTest3() {
+ List<NetworkResource> netList = new ArrayList<>();
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List<NetworkResource> getAllNetworkResources() {
+ NetworkResource ns = new NetworkResource();
+ netList.add(ns);
+ return netList;
+ }
+ };
+ Response resp = handler.getNetworkTypes("v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java
index 5f2f39606f..04175fd113 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java
@@ -22,6 +22,7 @@ package org.openecomp.mso.apihandlerinfra;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+
import java.io.IOException;
import javax.ws.rs.core.Response;
@@ -43,159 +44,159 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRe
public class OrchestrationRequestsTest {
- private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
- public static final Response RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
- @Mock
- private static RequestsDatabase db;
- private static OrchestrationRequests orReq;
- private static GetOrchestrationResponse orRes;
-
- @Test
- public void testGetOrchestrationRequest() {
- orReq = Mockito.mock(OrchestrationRequests.class);
- orRes = new GetOrchestrationResponse();
- try {
- // create InfraActiveRequests object
- InfraActiveRequests infraRequests = new InfraActiveRequests();
- infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
- infraRequests.setNetworkType("CONTRAIL30_BASIC");
- infraRequests.setRequestType("createInstance");
- infraRequests.setSource("VID");
- infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
- infraRequests.setServiceInstanceId("bc305d54-75b4-431b-adb2-eb6b9e546014");
- infraRequests.setRequestStatus("IN_PROGRESS");
- infraRequests.setRequestorId("ab1234");
- String body = "{\"modelInfo\":{\"modelInvariantId\":\"9771b085-4705-4bf7-815d-8c0627bb7e36\",\"modelType\":\"service\",\"modelName\":\"Service with VNFs with modules\",\"modelVersion\":\"1.0\"}}";
- infraRequests.setRequestBody(body);
-
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
-
- ///// mock mapInfraActiveRequestToRequest()
- Request request = new Request();
- request.setRequestId(infraRequests.getRequestId());
- request.setRequestScope(infraRequests.getRequestScope());
- request.setRequestType(infraRequests.getRequestAction());
-
- InstanceReferences ir = new InstanceReferences();
- if (infraRequests.getNetworkId() != null)
- ir.setNetworkInstanceId(infraRequests.getNetworkId());
- if (infraRequests.getNetworkName() != null)
- ir.setNetworkInstanceName(infraRequests.getNetworkName());
- if (infraRequests.getServiceInstanceId() != null)
- ir.setServiceInstanceId(infraRequests.getServiceInstanceId());
- if (infraRequests.getServiceInstanceName() != null)
- ir.setServiceInstanceName(infraRequests.getServiceInstanceName());
- if (infraRequests.getVfModuleId() != null)
- ir.setVfModuleInstanceId(infraRequests.getVfModuleId());
- if (infraRequests.getVfModuleName() != null)
- ir.setVfModuleInstanceName(infraRequests.getVfModuleName());
- if (infraRequests.getVnfId() != null)
- ir.setVnfInstanceId(infraRequests.getVnfId());
- if (infraRequests.getVnfName() != null)
- ir.setVnfInstanceName(infraRequests.getVnfName());
- if (infraRequests.getVolumeGroupId() != null)
- ir.setVolumeGroupInstanceId(infraRequests.getVolumeGroupId());
- if (infraRequests.getVolumeGroupName() != null)
- ir.setVolumeGroupInstanceName(infraRequests.getVolumeGroupName());
- if (infraRequests.getRequestorId() != null)
- ir.setRequestorId(infraRequests.getRequestorId());
-
- request.setInstanceReferences(ir);
- RequestStatus status = new RequestStatus();
-
- if (infraRequests.getRequestStatus() != null) {
- status.setRequestState(infraRequests.getRequestStatus());
- }
-
- request.setRequestStatus(status);
- // RequestStatus reqStatus = request.getRequestStatus();
- orRes.setRequest(request);
- Mockito.when(orReq.getOrchestrationRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(RESPONSE);
- Response resp = orReq.getOrchestrationRequest("rq1234d1-5a33-55df-13ab-12abad84e333", "v3");
-
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestId(),
- "rq1234d1-5a33-55df-13ab-12abad84e333");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getSource(), "VID");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getTenantId(),
- "19123c2924c648eb8e42a3c1f14b7682");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getServiceInstanceId(),
- "bc305d54-75b4-431b-adb2-eb6b9e546014");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestStatus(),
- "IN_PROGRESS");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestorId(),
- "ab1234");
- assertEquals(request.getInstanceReferences().getServiceInstanceId(),"bc305d54-75b4-431b-adb2-eb6b9e546014");
- assertEquals(request.getInstanceReferences().getRequestorId(),"ab1234");
- assertEquals(orRes.getRequest().getRequestId(), "rq1234d1-5a33-55df-13ab-12abad84e333");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testGetOrchestrationRequestNotPresent() {
- orReq = Mockito.mock(OrchestrationRequests.class);
- orRes = new GetOrchestrationResponse();
- try {
- // create InfraActiveRequests object
- InfraActiveRequests infraRequests = Mockito.mock(InfraActiveRequests.class);
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
-
- Request request = new Request();
- RequestStatus status = new RequestStatus();
- request.setRequestStatus(status);
- orRes.setRequest(request);
- assertFalse("rq1234d1-5a33-55df-13ab-12abad84e333".equalsIgnoreCase(orRes.getRequest().getRequestId()));
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testUnlockOrchestrationRequest()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- ObjectMapper mapper = new ObjectMapper();
- String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"ab1234\"}}}";
-
- MsoRequest msoRequest = new MsoRequest("rq1234d1-5a33-55df-13ab-12abad84e333");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- msoRequest.parseOrchestration(sir);
-
- //create object instead of a DB call.
- InfraActiveRequests infraRequests = new InfraActiveRequests();
- infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
- infraRequests.setNetworkType("CONTRAIL30_BASIC");
- infraRequests.setSource("VID");
- infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
- infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
- infraRequests.setRequestStatus("IN-PROGRESS");
-
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
-
- Request request = new Request();
- InstanceReferences ir = new InstanceReferences();
- request.setInstanceReferences(ir);
- RequestStatus status = new RequestStatus();
-
- if (infraRequests.getRequestStatus() != null) {
- status.setRequestState(infraRequests.getRequestStatus());
- }
- request.setRequestStatus(status);
- RequestStatus reqStatus = request.getRequestStatus();
-
- assertEquals(reqStatus.getRequestState(),"IN-PROGRESS");
-
- if (reqStatus.getRequestState().equalsIgnoreCase("IN-PROGRESS")){
- reqStatus.setRequestState(Status.UNLOCKED.toString ());
- }
- assertEquals(reqStatus.getRequestState(),"UNLOCKED");
-
- }
+ private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
+ public static final Response RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+ @Mock
+ private static RequestsDatabase db;
+ private static OrchestrationRequests orReq;
+ private static GetOrchestrationResponse orRes;
+
+ @Test
+ public void testGetOrchestrationRequest() {
+ orReq = Mockito.mock(OrchestrationRequests.class);
+ orRes = new GetOrchestrationResponse();
+ try {
+ // create InfraActiveRequests object
+ InfraActiveRequests infraRequests = new InfraActiveRequests();
+ infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
+ infraRequests.setNetworkType("CONTRAIL30_BASIC");
+ infraRequests.setRequestType("createInstance");
+ infraRequests.setSource("VID");
+ infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
+ infraRequests.setServiceInstanceId("bc305d54-75b4-431b-adb2-eb6b9e546014");
+ infraRequests.setRequestStatus("IN_PROGRESS");
+ infraRequests.setRequestorId("ab1234");
+ String body = "{\"modelInfo\":{\"modelInvariantId\":\"9771b085-4705-4bf7-815d-8c0627bb7e36\",\"modelType\":\"service\",\"modelName\":\"Service with VNFs with modules\",\"modelVersion\":\"1.0\"}}";
+ infraRequests.setRequestBody(body);
+
+ db = Mockito.mock(RequestsDatabase.class);
+ Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
+
+ ///// mock mapInfraActiveRequestToRequest()
+ Request request = new Request();
+ request.setRequestId(infraRequests.getRequestId());
+ request.setRequestScope(infraRequests.getRequestScope());
+ request.setRequestType(infraRequests.getRequestAction());
+
+ InstanceReferences ir = new InstanceReferences();
+ if (infraRequests.getNetworkId() != null)
+ ir.setNetworkInstanceId(infraRequests.getNetworkId());
+ if (infraRequests.getNetworkName() != null)
+ ir.setNetworkInstanceName(infraRequests.getNetworkName());
+ if (infraRequests.getServiceInstanceId() != null)
+ ir.setServiceInstanceId(infraRequests.getServiceInstanceId());
+ if (infraRequests.getServiceInstanceName() != null)
+ ir.setServiceInstanceName(infraRequests.getServiceInstanceName());
+ if (infraRequests.getVfModuleId() != null)
+ ir.setVfModuleInstanceId(infraRequests.getVfModuleId());
+ if (infraRequests.getVfModuleName() != null)
+ ir.setVfModuleInstanceName(infraRequests.getVfModuleName());
+ if (infraRequests.getVnfId() != null)
+ ir.setVnfInstanceId(infraRequests.getVnfId());
+ if (infraRequests.getVnfName() != null)
+ ir.setVnfInstanceName(infraRequests.getVnfName());
+ if (infraRequests.getVolumeGroupId() != null)
+ ir.setVolumeGroupInstanceId(infraRequests.getVolumeGroupId());
+ if (infraRequests.getVolumeGroupName() != null)
+ ir.setVolumeGroupInstanceName(infraRequests.getVolumeGroupName());
+ if (infraRequests.getRequestorId() != null)
+ ir.setRequestorId(infraRequests.getRequestorId());
+
+ request.setInstanceReferences(ir);
+ RequestStatus status = new RequestStatus();
+
+ if (infraRequests.getRequestStatus() != null) {
+ status.setRequestState(infraRequests.getRequestStatus());
+ }
+
+ request.setRequestStatus(status);
+ // RequestStatus reqStatus = request.getRequestStatus();
+ orRes.setRequest(request);
+ Mockito.when(orReq.getOrchestrationRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(RESPONSE);
+ Response resp = orReq.getOrchestrationRequest("rq1234d1-5a33-55df-13ab-12abad84e333", "v3");
+
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestId(),
+ "rq1234d1-5a33-55df-13ab-12abad84e333");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getSource(), "VID");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getTenantId(),
+ "19123c2924c648eb8e42a3c1f14b7682");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getServiceInstanceId(),
+ "bc305d54-75b4-431b-adb2-eb6b9e546014");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestStatus(),
+ "IN_PROGRESS");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestorId(),
+ "ab1234");
+ assertEquals(request.getInstanceReferences().getServiceInstanceId(), "bc305d54-75b4-431b-adb2-eb6b9e546014");
+ assertEquals(request.getInstanceReferences().getRequestorId(), "ab1234");
+ assertEquals(orRes.getRequest().getRequestId(), "rq1234d1-5a33-55df-13ab-12abad84e333");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testGetOrchestrationRequestNotPresent() {
+ orReq = Mockito.mock(OrchestrationRequests.class);
+ orRes = new GetOrchestrationResponse();
+ try {
+ // create InfraActiveRequests object
+ InfraActiveRequests infraRequests = Mockito.mock(InfraActiveRequests.class);
+ db = Mockito.mock(RequestsDatabase.class);
+ Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
+
+ Request request = new Request();
+ RequestStatus status = new RequestStatus();
+ request.setRequestStatus(status);
+ orRes.setRequest(request);
+ assertFalse("rq1234d1-5a33-55df-13ab-12abad84e333".equalsIgnoreCase(orRes.getRequest().getRequestId()));
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testUnlockOrchestrationRequest()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ ObjectMapper mapper = new ObjectMapper();
+ String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"ab1234\"}}}";
+
+ MsoRequest msoRequest = new MsoRequest("rq1234d1-5a33-55df-13ab-12abad84e333");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ msoRequest.parseOrchestration(sir);
+
+ //create object instead of a DB call.
+ InfraActiveRequests infraRequests = new InfraActiveRequests();
+ infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
+ infraRequests.setNetworkType("CONTRAIL30_BASIC");
+ infraRequests.setSource("VID");
+ infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
+ infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
+ infraRequests.setRequestStatus("IN-PROGRESS");
+
+ db = Mockito.mock(RequestsDatabase.class);
+ Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
+
+ Request request = new Request();
+ InstanceReferences ir = new InstanceReferences();
+ request.setInstanceReferences(ir);
+ RequestStatus status = new RequestStatus();
+
+ if (infraRequests.getRequestStatus() != null) {
+ status.setRequestState(infraRequests.getRequestStatus());
+ }
+ request.setRequestStatus(status);
+ RequestStatus reqStatus = request.getRequestStatus();
+
+ assertEquals(reqStatus.getRequestState(), "IN-PROGRESS");
+
+ if (reqStatus.getRequestState().equalsIgnoreCase("IN-PROGRESS")) {
+ reqStatus.setRequestState(Status.UNLOCKED.toString());
+ }
+ assertEquals(reqStatus.getRequestState(), "UNLOCKED");
+
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java
index 3bc2edf8e2..f6d5b3fa2c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java
@@ -21,18 +21,20 @@
package org.openecomp.mso.apihandlerinfra;
import org.junit.After;
+
import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
+
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
public class RecipeLookupResultTest {
- RecipeLookupResult instance;
+ RecipeLookupResult instance;
public RecipeLookupResultTest() {
}
@@ -58,7 +60,7 @@ public class RecipeLookupResultTest {
assertEquals(expResult, result);
}
-
+
/**
* Test of setOrchestrationURI method.
*/
@@ -80,7 +82,7 @@ public class RecipeLookupResultTest {
assertEquals(expResult, result);
}
-
+
/**
* Test of setRecipeTimeout method.
*/
@@ -90,7 +92,7 @@ public class RecipeLookupResultTest {
instance.setRecipeTimeout(recipeTimeOut);
verify(instance).setRecipeTimeout(10);
}
-
-
+
+
}
\ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
index d3d995e851..8f21805be6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
@@ -56,850 +56,850 @@ import mockit.MockUp;
public class ServiceInstanceTest {
- /*** Create Service Instance Test Cases ***/
-
- @Test
- public void createServiceInstanceInvalidModelInfo(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v5");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. No valid model-info is specified"));
- }
-
- @Test
- public void createServiceInstanceNormalDuplicate(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ /*** Create Service Instance Test Cases ***/
+
+ @Test
+ public void createServiceInstanceInvalidModelInfo() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v5");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. No valid model-info is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceNormalDuplicate() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
return new InfraActiveRequests();
}
};
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains(
- "Locked instance - This service (testService) already has a request being worked with a status of null (RequestId - null). The existing request must finish or be cleaned up before proceeding."));
- }
-
- @Test
- public void createServiceInstanceTestDBException(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains(
+ "Locked instance - This service (testService) already has a request being worked with a status of null (RequestId - null). The existing request must finish or be cleaned up before proceeding."));
+ }
+
+ @Test
+ public void createServiceInstanceTestDBException() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName (String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName(String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
- ServiceRecipe recipe =new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
- }
- };
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Exception while creating record in DB null"));
- }
-
- @Test
- public void createServiceInstanceTestBpmnFail(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
+ ServiceRecipe recipe = new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
+ }
+ };
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Exception while creating record in DB null"));
+ }
+
+ @Test
+ public void createServiceInstanceTestBpmnFail() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName (String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName(String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
- ServiceRecipe recipe =new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
+ public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
+ ServiceRecipe recipe = new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
}
};
-
+
new MockUp<MsoRequest>() {
@Mock
- public void createRequestRecord (Status status, Action action) {
- return;
- }
- };
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Failed calling bpmn properties"));
- }
-
- @Test(expected = Exception.class)
- public void createServiceInstanceTest200Http(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ public void createRequestRecord(Status status, Action action) {
+ return;
+ }
+ };
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Failed calling bpmn properties"));
+ }
+
+ @Test(expected = Exception.class)
+ public void createServiceInstanceTest200Http() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName (String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName(String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
- ServiceRecipe recipe =new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
+ public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
+ ServiceRecipe recipe = new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
}
};
-
+
new MockUp<MsoRequest>() {
@Mock
- public void createRequestRecord (Status status, Action action) {
- return;
+ public void createRequestRecord(Status status, Action action) {
+ return;
}
};
-
+
new MockUp<RequestClientFactory>() {
@Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
}
};
-
+
new MockUp<CamundaClient>() {
@Mock
public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
- ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
- HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- }
-
- @Test
- public void createServiceInstanceTest500Http(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 200, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ }
+
+ @Test
+ public void createServiceInstanceTest500Http() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName (String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName(String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
- ServiceRecipe recipe =new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
+ public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
+ ServiceRecipe recipe = new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
}
};
-
+
new MockUp<MsoRequest>() {
@Mock
- public void createRequestRecord (Status status, Action action) {
- return;
+ public void createRequestRecord(Status status, Action action) {
+ return;
}
};
-
+
new MockUp<RequestClientFactory>() {
@Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
}
};
-
+
new MockUp<CamundaClient>() {
@Mock
public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
- ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
- HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Request Failed due to BPEL error with HTTP Status"));
- }
-
- @Test
- public void createServiceInstanceTestVnfModelType(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 500, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Request Failed due to BPEL error with HTTP Status"));
+ }
+
+ @Test
+ public void createServiceInstanceTestVnfModelType() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName (String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName(String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
- ServiceRecipe recipe =new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
+ public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
+ ServiceRecipe recipe = new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
}
};
-
+
new MockUp<MsoRequest>() {
@Mock
- public void createRequestRecord (Status status, Action action) {
- return;
+ public void createRequestRecord(Status status, Action action) {
+ return;
}
};
-
+
new MockUp<RequestClientFactory>() {
@Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
}
};
-
+
new MockUp<CamundaClient>() {
@Mock
public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
- ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
- HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"vnf\",\"modelName\":\"serviceModel\",\"modelCustomizationName\":\"test\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v5");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("No valid modelVersionId is specified"));
- }
-
- @Test
- public void createServiceInstanceTestNullHttpResp(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 500, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"vnf\",\"modelName\":\"serviceModel\",\"modelCustomizationName\":\"test\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v5");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("No valid modelVersionId is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceTestNullHttpResp() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName (String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName(String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
- ServiceRecipe recipe =new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
+ public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
+ ServiceRecipe recipe = new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
}
};
-
+
new MockUp<MsoRequest>() {
@Mock
- public void createRequestRecord (Status status, Action action) {
- return;
+ public void createRequestRecord(Status status, Action action) {
+ return;
}
};
-
+
new MockUp<RequestClientFactory>() {
@Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
}
};
-
+
new MockUp<CamundaClient>() {
@Mock
public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
- return null;
- }
- };
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("bpelResponse is null"));
- }
-
- @Test
- public void createServiceInstanceNormalNullDBFatch(){
- new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ return null;
+ }
+ };
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("bpelResponse is null"));
+ }
+
+ @Test
+ public void createServiceInstanceNormalNullDBFatch() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery(List<Criterion> criteria, Order order) {
return Collections.EMPTY_LIST;
}
};
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Recipe could not be retrieved from catalog DB null"));
- }
-
-
- @Test
- public void createServiceInstanceInvalidModelVersionId(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v5");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. No valid modelVersionId is specified"));
- }
-
- @Test
- public void createServiceInstanceNullInstanceName(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. No valid instanceName is specified"));
- }
-
-
- @Test
- public void createServiceInstanceNullModelInfo(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. No valid model-info is specified"));
- }
-
- @Test
- public void createServiceInstanceInvalidModelInvariantId(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"1234\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
- }
-
- @Test
- public void createServiceInstanceNullModelVersion(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
- }
-
-
- @Test
- public void createServiceInstanceNullModelType(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
- }
-
- @Test
- public void createServiceInstanceInvalidModelType(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"testmodel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Mapping of request to JSON object failed."));
- }
-
- @Test
- public void createServiceInstanceNullModelName(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. No valid modelName is specified"));
- }
-
- @Test
- public void createServiceInstanceInvalidVersionForAutoBuildVfModules(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": true},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. AutoBuildVfModule is not valid in the v2 version"));
- }
-
- @Test
- public void createServiceInstanceNullRequestParameter(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. No valid subscriptionServiceType is specified"));
- }
-
- @Test
- public void createServiceInstanceNullSubscriptionType(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("Error parsing request. No valid subscriptionServiceType is specified"));
- }
-
- @Test
- public void createServiceInstanceAnbormalInvalidJson(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"name\":\"test\"}";
- Response resp = instance.createServiceInstance(requestJson, "v2");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Mapping of request to JSON object failed"));
- }
-
- /*** Activate Service Instance Test Cases ***/
-
- @Test
- public void activateServiceInstanceAnbormalInvalidJson(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"name\":\"test\"}";
- Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Mapping of request to JSON object failed"));
- }
-
- @Test
- public void activateServiceInstanceInvalidModelVersionId(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
- }
-
- @Test
- public void activateServiceInstanceInvalidServiceInstanceId(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains(
- "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
- }
-
- @Test
- public void activateServiceInstanceTestNormal(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- /*** Deactivate Service Instance Test Cases ***/
-
- @Test
- public void deactivateServiceInstanceAnbormalInvalidJson(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"name\":\"test\"}";
- Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Mapping of request to JSON object failed"));
- }
-
- @Test
- public void deactivateServiceInstanceInvalidModelVersionId(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
- }
-
- @Test
- public void deactivateServiceInstanceInvalidServiceInstanceId(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains(
- "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
- }
-
- @Test
- public void deactivateServiceInstanceTestNormal(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- /*** Delete Service Instance Test Cases ***/
-
- @Test
- public void deleteServiceInstanceAnbormalInvalidJson(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"name\":\"test\"}";
- Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Mapping of request to JSON object failed"));
- }
-
- @Test
- public void deleteServiceInstanceInvalidModelVersionId(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Error parsing request. No valid modelVersionId is specified"));
- }
-
- @Test
- public void deleteServiceInstanceInvalidServiceInstanceId(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
- Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Error parsing request. No valid modelVersionId is specified"));
- }
-
- @Test
- public void deleteServiceInstanceTestNormal(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
- Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- /*** Create Vnf Instance Test Cases ***/
-
- @Test
- public void createVNFInstanceTestInvalidCloudConfiguration(){
- ServiceInstances instance = new ServiceInstances();
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
- Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Error parsing request. No valid cloudConfiguration is specified"));
- }
-
- @Test
- public void createVNFInstanceTestInvalidIcpCloudRegionId(){
- ServiceInstances instance = new ServiceInstances();
- String s = "\"cloudConfiguration\":{}";
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"cloudConfiguration\":{}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
- Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Error parsing request. No valid lcpCloudRegionId is specified"));
- }
-
- @Test
- public void createVNFInstanceTestInvalidTenantId(){
- ServiceInstances instance = new ServiceInstances();
- String s = "\"cloudConfiguration\":{}";
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
- Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("Error parsing request. No valid tenantId is specified"));
- }
-
- @Test
- public void createVNFInstanceTestNormal(){
- ServiceInstances instance = new ServiceInstances();
- String s = "\"cloudConfiguration\":{}";
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
- Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- /*** Replace Vnf Instance Test Cases ***/
- @Test
- public void replaceVNFInstanceTestNormal(){
- ServiceInstances instance = new ServiceInstances();
- String s = "\"cloudConfiguration\":{}";
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
- Response resp = instance.replaceVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- /*** Update Vnf Instance Test Cases ***/
-
- @Test
- public void updateVNFInstanceTestNormal(){
- ServiceInstances instance = new ServiceInstances();
- String s = "\"cloudConfiguration\":{}";
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
- Response resp = instance.updateVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- /*** Update Vnf Instance Test Cases ***/
-
- @Test
- public void deleteVNFInstanceTestNormal(){
- ServiceInstances instance = new ServiceInstances();
- String s = "\"cloudConfiguration\":{}";
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
- Response resp = instance.deleteVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Recipe could not be retrieved from catalog DB null"));
+ }
+
+
+ @Test
+ public void createServiceInstanceInvalidModelVersionId() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v5");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. No valid modelVersionId is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceNullInstanceName() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. No valid instanceName is specified"));
+ }
+
+
+ @Test
+ public void createServiceInstanceNullModelInfo() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. No valid model-info is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceInvalidModelInvariantId() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"1234\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceNullModelVersion() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
+ }
+
+
+ @Test
+ public void createServiceInstanceNullModelType() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceInvalidModelType() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"testmodel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Mapping of request to JSON object failed."));
+ }
+
+ @Test
+ public void createServiceInstanceNullModelName() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. No valid modelName is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceInvalidVersionForAutoBuildVfModules() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": true},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. AutoBuildVfModule is not valid in the v2 version"));
+ }
+
+ @Test
+ public void createServiceInstanceNullRequestParameter() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. No valid subscriptionServiceType is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceNullSubscriptionType() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("Error parsing request. No valid subscriptionServiceType is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceAnbormalInvalidJson() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
+ }
+
+ /*** Activate Service Instance Test Cases ***/
+
+ @Test
+ public void activateServiceInstanceAnbormalInvalidJson() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.activateServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
+ }
+
+ @Test
+ public void activateServiceInstanceInvalidModelVersionId() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.activateServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
+ }
+
+ @Test
+ public void activateServiceInstanceInvalidServiceInstanceId() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.activateServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains(
+ "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
+ }
+
+ @Test
+ public void activateServiceInstanceTestNormal() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.activateServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ /*** Deactivate Service Instance Test Cases ***/
+
+ @Test
+ public void deactivateServiceInstanceAnbormalInvalidJson() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.deactivateServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
+ }
+
+ @Test
+ public void deactivateServiceInstanceInvalidModelVersionId() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.deactivateServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
+ }
+
+ @Test
+ public void deactivateServiceInstanceInvalidServiceInstanceId() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.deactivateServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains(
+ "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
+ }
+
+ @Test
+ public void deactivateServiceInstanceTestNormal() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.deactivateServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ /*** Delete Service Instance Test Cases ***/
+
+ @Test
+ public void deleteServiceInstanceAnbormalInvalidJson() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.deleteServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
+ }
+
+ @Test
+ public void deleteServiceInstanceInvalidModelVersionId() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.deleteServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId is specified"));
+ }
+
+ @Test
+ public void deleteServiceInstanceInvalidServiceInstanceId() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.deleteServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId is specified"));
+ }
+
+ @Test
+ public void deleteServiceInstanceTestNormal() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.deleteServiceInstance(requestJson, "v5", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ /*** Create Vnf Instance Test Cases ***/
+
+ @Test
+ public void createVNFInstanceTestInvalidCloudConfiguration() {
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Error parsing request. No valid cloudConfiguration is specified"));
+ }
+
+ @Test
+ public void createVNFInstanceTestInvalidIcpCloudRegionId() {
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Error parsing request. No valid lcpCloudRegionId is specified"));
+ }
+
+ @Test
+ public void createVNFInstanceTestInvalidTenantId() {
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("Error parsing request. No valid tenantId is specified"));
+ }
+
+ @Test
+ public void createVNFInstanceTestNormal() {
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3", "557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ /*** Replace Vnf Instance Test Cases ***/
+ @Test
+ public void replaceVNFInstanceTestNormal() {
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.replaceVnfInstance(requestJson, "v3", "557ea944-c83e-43cf-9ed7-3a354abd6d34", "557ea944-c83e-43cf-9ed7-3a354abd6d93");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ /*** Update Vnf Instance Test Cases ***/
+
+ @Test
+ public void updateVNFInstanceTestNormal() {
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.updateVnfInstance(requestJson, "v3", "557ea944-c83e-43cf-9ed7-3a354abd6d34", "557ea944-c83e-43cf-9ed7-3a354abd6d93");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ /*** Update Vnf Instance Test Cases ***/
+
+ @Test
+ public void deleteVNFInstanceTestNormal() {
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ + "\"vnfInstanceId\":\"1882938\","
+ + "\"networkInstanceId\":\"1882937\","
+ + "\"volumeGroupInstanceId\":\"1882935\","
+ + "\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.deleteVnfInstance(requestJson, "v3", "557ea944-c83e-43cf-9ed7-3a354abd6d34", "557ea944-c83e-43cf-9ed7-3a354abd6d93");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java
index 666da25fe7..12e171cfc9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java
@@ -47,100 +47,100 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRe
public class ServiceInstancesTest {
- private static final String requestJSONCreate = "{ \"requestDetails\": { \"modelInfo\": { \"modelType\": \"service\", "
- + "\"modelInvariantId\": \"ff3514e3-5a33-55df-13ab-12abad84e7ff\","
- + " \"modelVersionId\": \"fe6985cd-ea33-3346-ac12-ab121484a3fe\", \"modelName\": \"Test\","
- + " \"modelVersion\": \"1.0\" }, \"cloudConfiguration\": "
- + "{ \"lcpCloudRegionId\": \"mdt1\", \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" },"
- + " \"subscriberInfo\": { \"globalSubscriberId\": \"{some subscriber id}\","
- + " \"subscriberName\": \"{some subscriber name}\" },"
- + " \"requestInfo\": { \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", "
- + "\"source\": \"VID\", \"suppressRollback\": true, \"requestorId\": \"az2016\" },"
- + " \"requestParameters\": { \"subscriptionServiceType\": \"MOG\", \"aLaCarte\": false,"
- + " \"userParams\": [ { \"name\": \"someUserParam\", \"value\": \"someValue\" } ] } } } ";
-
- private static final String requestJSONActivateDeacivate =
- "{ \"requestDetails\": { \"modelInfo\": { \"modelType\": \"service\","
- + " \"modelInvariantId\": \"ff3514e3-5a33-55df-13ab-12abad84e7ff\", "
- + "\"modelVersionId\": \"fe6985cd-ea33-3346-ac12-ab121484a3fe\", "
- + "\"modelName\": \"Test\", \"modelVersion\": \"1.0\" }, "
- + "\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"az2016\" }, "
- + "\"requestParameters\": { \"userParams\": [ { \"name\": \"aic_zone\", "
- + "\"value\": \"someValue\" } ] } } } ";
-
- private static final String requestJSONDelete =
- "{ \"requestDetails\": { \"modelInfo\": { \"modelType\":\"network\", "
- + "\"modelName\":\"CONTRAIL30_BASIC\" }, \"cloudConfiguration\": { \"lcpCloudRegionId\":\"mdt1\", "
- + "\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\" }, "
- + "\"requestInfo\": { \"source\":\"VID\", \"requestorId\":\"az2016\" } } }";
-
- @Test
- public void testCreateServiceInstance()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
- final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
-
- try {
- ServiceInstances sir = Mockito.mock(ServiceInstances.class);
- sir.createServiceInstance(requestJSONCreate, "v3");
- Mockito.when(sir.createServiceInstance(requestJSONCreate, "v3")).thenReturn(SERVICE_RESPONSE);
- Response resp = sir.createServiceInstance(requestJSONCreate, "v3");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testActivateServiceInstance()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
- final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
- try {
- ServiceInstances sir = Mockito.mock(ServiceInstances.class);
- Mockito.when(sir.activateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
- .thenReturn(SERVICE_RESPONSE);
- Response resp = sir.activateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testDeactivateServiceInstance()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
- final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
- try {
- ServiceInstances sir = Mockito.mock(ServiceInstances.class);
- Mockito.when(sir.deactivateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
- .thenReturn(SERVICE_RESPONSE);
- Response resp = sir.deactivateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testDeleteServiceInstance()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
- final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
- try {
- ServiceInstances sir = Mockito.mock(ServiceInstances.class);
- Mockito.when(sir.deleteServiceInstance(requestJSONDelete, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
- .thenReturn(SERVICE_RESPONSE);
- Response resp = sir.deleteServiceInstance(requestJSONDelete, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
+ private static final String requestJSONCreate = "{ \"requestDetails\": { \"modelInfo\": { \"modelType\": \"service\", "
+ + "\"modelInvariantId\": \"ff3514e3-5a33-55df-13ab-12abad84e7ff\","
+ + " \"modelVersionId\": \"fe6985cd-ea33-3346-ac12-ab121484a3fe\", \"modelName\": \"Test\","
+ + " \"modelVersion\": \"1.0\" }, \"cloudConfiguration\": "
+ + "{ \"lcpCloudRegionId\": \"mdt1\", \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" },"
+ + " \"subscriberInfo\": { \"globalSubscriberId\": \"{some subscriber id}\","
+ + " \"subscriberName\": \"{some subscriber name}\" },"
+ + " \"requestInfo\": { \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", "
+ + "\"source\": \"VID\", \"suppressRollback\": true, \"requestorId\": \"az2016\" },"
+ + " \"requestParameters\": { \"subscriptionServiceType\": \"MOG\", \"aLaCarte\": false,"
+ + " \"userParams\": [ { \"name\": \"someUserParam\", \"value\": \"someValue\" } ] } } } ";
+
+ private static final String requestJSONActivateDeacivate =
+ "{ \"requestDetails\": { \"modelInfo\": { \"modelType\": \"service\","
+ + " \"modelInvariantId\": \"ff3514e3-5a33-55df-13ab-12abad84e7ff\", "
+ + "\"modelVersionId\": \"fe6985cd-ea33-3346-ac12-ab121484a3fe\", "
+ + "\"modelName\": \"Test\", \"modelVersion\": \"1.0\" }, "
+ + "\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"az2016\" }, "
+ + "\"requestParameters\": { \"userParams\": [ { \"name\": \"aic_zone\", "
+ + "\"value\": \"someValue\" } ] } } } ";
+
+ private static final String requestJSONDelete =
+ "{ \"requestDetails\": { \"modelInfo\": { \"modelType\":\"network\", "
+ + "\"modelName\":\"CONTRAIL30_BASIC\" }, \"cloudConfiguration\": { \"lcpCloudRegionId\":\"mdt1\", "
+ + "\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\" }, "
+ + "\"requestInfo\": { \"source\":\"VID\", \"requestorId\":\"az2016\" } } }";
+
+ @Test
+ public void testCreateServiceInstance()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
+ final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+
+ try {
+ ServiceInstances sir = Mockito.mock(ServiceInstances.class);
+ sir.createServiceInstance(requestJSONCreate, "v3");
+ Mockito.when(sir.createServiceInstance(requestJSONCreate, "v3")).thenReturn(SERVICE_RESPONSE);
+ Response resp = sir.createServiceInstance(requestJSONCreate, "v3");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testActivateServiceInstance()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
+ final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+ try {
+ ServiceInstances sir = Mockito.mock(ServiceInstances.class);
+ Mockito.when(sir.activateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
+ .thenReturn(SERVICE_RESPONSE);
+ Response resp = sir.activateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDeactivateServiceInstance()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
+ final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+ try {
+ ServiceInstances sir = Mockito.mock(ServiceInstances.class);
+ Mockito.when(sir.deactivateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
+ .thenReturn(SERVICE_RESPONSE);
+ Response resp = sir.deactivateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDeleteServiceInstance()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
+ final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+ try {
+ ServiceInstances sir = Mockito.mock(ServiceInstances.class);
+ Mockito.when(sir.deleteServiceInstance(requestJSONDelete, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
+ .thenReturn(SERVICE_RESPONSE);
+ Response resp = sir.deleteServiceInstance(requestJSONDelete, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java
index 4926da77b1..b2acd33ab7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java
@@ -27,13 +27,13 @@ import javax.ws.rs.core.Response;
import org.junit.Test;
public class TasksHandlerTest {
-
- TasksHandler handler = new TasksHandler();
-
- @Test
- public void queryFiltersTest(){
- Response resp = handler.queryFilters("10020", "399495", "test", "nfRole", "buildingBlockName", "originalRequestDate", "originalRequestorId", "v2");
- assertTrue(resp.getEntity().toString() != null);
- }
+
+ TasksHandler handler = new TasksHandler();
+
+ @Test
+ public void queryFiltersTest() {
+ Response resp = handler.queryFilters("10020", "399495", "test", "nfRole", "buildingBlockName", "originalRequestDate", "originalRequestorId", "v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java
index 1c3c85653b..3991fbd79f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java
@@ -34,41 +34,42 @@ import org.openecomp.mso.db.catalog.beans.VfModule;
import org.openecomp.mso.db.catalog.beans.VnfResource;
import javax.ws.rs.core.Response;
+
public class VfModuleModelNamesHandlerTest {
- VfModuleModelNamesHandler handler = new VfModuleModelNamesHandler();
-
- @Test
- public void getVfModuleModelNamesTest(){
- Response resp = handler.getVfModuleModelNames("v2");
- assertTrue(resp.getEntity().toString()!= null);
- }
-
- @Test
- public void getVfModuleModelNamesTest2(){
- new MockUp<CatalogDatabase>() {
- @Mock
- public List <VfModule> getAllVfModules(){
- List <VfModule> list = new ArrayList<>();
- VfModule resource = new VfModule();
- list.add(resource);
- return list;
- }
- };
- Response resp = handler.getVfModuleModelNames("v2");
- assertTrue(resp.getEntity().toString()!= null);
- }
-
-
- @Test
- public void getVfModuleModelNamesTest3(){
- new MockUp<CatalogDatabase>() {
- @Mock
- public List <VfModule> getAllVfModules(){
- return null;
- }
- };
- Response resp = handler.getVfModuleModelNames("v2");
- assertTrue(resp.getEntity().toString()!= null);
- }
+ VfModuleModelNamesHandler handler = new VfModuleModelNamesHandler();
+
+ @Test
+ public void getVfModuleModelNamesTest() {
+ Response resp = handler.getVfModuleModelNames("v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getVfModuleModelNamesTest2() {
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List<VfModule> getAllVfModules() {
+ List<VfModule> list = new ArrayList<>();
+ VfModule resource = new VfModule();
+ list.add(resource);
+ return list;
+ }
+ };
+ Response resp = handler.getVfModuleModelNames("v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+
+ @Test
+ public void getVfModuleModelNamesTest3() {
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List<VfModule> getAllVfModules() {
+ return null;
+ }
+ };
+ Response resp = handler.getVfModuleModelNames("v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java
index fd22af012f..6c2f264b21 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java
@@ -28,27 +28,27 @@ import org.openecomp.mso.requestsdb.InfraRequests;
public class VnfInfoHandlerTest {
- VnfInfoHandler handler = new VnfInfoHandler();
-
- @Test
- public void fillVnfRequestTest(){
- VnfRequest qr = new VnfRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillVnfRequest(qr, ar, "v3");
- String vnfid = (String)qr.getVnfParams();
- assertTrue(vnfid.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV2(){
- VnfRequest qr = new VnfRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillVnfRequest(qr, ar, "v2");
- String vnfid = (String)qr.getVnfParams();
- assertTrue(vnfid.equals("test"));
- }
+ VnfInfoHandler handler = new VnfInfoHandler();
+
+ @Test
+ public void fillVnfRequestTest() {
+ VnfRequest qr = new VnfRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillVnfRequest(qr, ar, "v3");
+ String vnfid = (String) qr.getVnfParams();
+ assertTrue(vnfid.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV2() {
+ VnfRequest qr = new VnfRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillVnfRequest(qr, ar, "v2");
+ String vnfid = (String) qr.getVnfParams();
+ assertTrue(vnfid.equals("test"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java
index c8ab6b5612..31c7fecf9d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java
@@ -27,12 +27,12 @@ import org.openecomp.mso.apihandler.common.ValidationException;
import org.openecomp.mso.properties.MsoJavaProperties;
public class VnfMsoInfraRequestTest {
- VnfMsoInfraRequest request = new VnfMsoInfraRequest("29919020");
-
- @Test(expected=Exception.class)
- public void parseTest() throws ValidationException {
- String reqXML = "<vnf-request><request-info> <request-id>29993</request-id><request-status>COMPLETE</request-status></request-info></vnf-request>";
- request.parse(reqXML, "v1", new MsoJavaProperties());
- }
-
+ VnfMsoInfraRequest request = new VnfMsoInfraRequest("29919020");
+
+ @Test(expected = Exception.class)
+ public void parseTest() throws ValidationException {
+ String reqXML = "<vnf-request><request-info> <request-id>29993</request-id><request-status>COMPLETE</request-status></request-info></vnf-request>";
+ request.parse(reqXML, "v1", new MsoJavaProperties());
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java
index 9c9ebaee35..ac0fec076a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java
@@ -43,202 +43,206 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
public class VnfRequestHandlerTest {
- VnfRequestHandler handler = null;
- UriInfo uriInfo = null;
-
- @Before
- public void setup() throws Exception{
-
- uriInfo = Mockito.mock(UriInfo.class);
- Class<?> clazz = VnfRequestHandler.class;
- handler = (VnfRequestHandler)clazz.newInstance();
-
- Field f1 = handler.getClass().getDeclaredField("uriInfo");
-
- f1.setAccessible(true);
+ VnfRequestHandler handler = null;
+ UriInfo uriInfo = null;
+
+ @Before
+ public void setup() throws Exception {
+
+ uriInfo = Mockito.mock(UriInfo.class);
+ Class<?> clazz = VnfRequestHandler.class;
+ handler = (VnfRequestHandler) clazz.newInstance();
+
+ Field f1 = handler.getClass().getDeclaredField("uriInfo");
+
+ f1.setAccessible(true);
f1.set(handler, uriInfo);
- }
-
- @Test
- public void manageVnfRequestTestV2(){
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v2");
- assertTrue(null != resp);
- }
- @Test
- public void manageVnfRequestTestv1(){
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v1");
- assertTrue(null != resp);
- }
- @Test
- public void manageVnfRequestTestv3(){
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v3");
- assertTrue(null != resp);
- }
- @Test
- public void manageVnfRequestTestInvalidVersion(){
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v30");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2Test(){
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v2");
- assertTrue(null != resp);
- }
-
- @Test
- public void fillVnfRequestTest(){
- VnfRequest qr = new VnfRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- handler.fillVnfRequest(qr, ar, "v1");
- String param = (String)qr.getVnfParams();
- assertTrue(param.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV2(){
- VnfRequest qr = new VnfRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- handler.fillVnfRequest(qr, ar, "v2");
- String param = (String)qr.getVnfParams();
- assertTrue(param.equals("test"));
- }
- @Test
- public void fillVnfRequestTestV3(){
- VnfRequest qr = new VnfRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- ar.setServiceInstanceId("38829");
- handler.fillVnfRequest(qr, ar, "v3");
- String param = (String)qr.getVnfParams();
- assertTrue(param.equals("test"));
- }
-
- @Test
- public void queryFiltersTest(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
- String queryValue,
- String requestType) {
- List <InfraActiveRequests> list = new ArrayList<>();
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- list.add(req);
- return list;
- }
- };
- Response resp = handler.queryFilters("vnfType", "serviceType", "aicNodeClli", "tenantId", "volumeGroupId", "volumeGroupName", "vnfName", "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void queryFiltersTestNullVnfType(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
- String queryValue,
- String requestType) {
- List <InfraActiveRequests> list = new ArrayList<>();
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- list.add(req);
- return list;
- }
- };
- Response resp = handler.queryFilters(null, null, null, null, null, null, null, "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getRequestTest(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- return req;
- }
- };
- Response resp = handler.getRequest("388293", "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
+ }
+
+ @Test
+ public void manageVnfRequestTestV2() {
+ Response resp = handler.manageVnfRequest("<name>Test</name>", "v2");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequestTestv1() {
+ Response resp = handler.manageVnfRequest("<name>Test</name>", "v1");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequestTestv3() {
+ Response resp = handler.manageVnfRequest("<name>Test</name>", "v3");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequestTestInvalidVersion() {
+ Response resp = handler.manageVnfRequest("<name>Test</name>", "v30");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2Test() {
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ Response resp = handler.manageVnfRequest("<name>Test</name>", "v2");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void fillVnfRequestTest() {
+ VnfRequest qr = new VnfRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ handler.fillVnfRequest(qr, ar, "v1");
+ String param = (String) qr.getVnfParams();
+ assertTrue(param.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV2() {
+ VnfRequest qr = new VnfRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ handler.fillVnfRequest(qr, ar, "v2");
+ String param = (String) qr.getVnfParams();
+ assertTrue(param.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV3() {
+ VnfRequest qr = new VnfRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ ar.setServiceInstanceId("38829");
+ handler.fillVnfRequest(qr, ar, "v3");
+ String param = (String) qr.getVnfParams();
+ assertTrue(param.equals("test"));
+ }
+
+ @Test
+ public void queryFiltersTest() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ List<InfraActiveRequests> list = new ArrayList<>();
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ list.add(req);
+ return list;
+ }
+ };
+ Response resp = handler.queryFilters("vnfType", "serviceType", "aicNodeClli", "tenantId", "volumeGroupId", "volumeGroupName", "vnfName", "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void queryFiltersTestNullVnfType() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ List<InfraActiveRequests> list = new ArrayList<>();
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ list.add(req);
+ return list;
+ }
+ };
+ Response resp = handler.queryFilters(null, null, null, null, null, null, null, "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getRequestTest() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType) {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ return req;
+ }
+ };
+ Response resp = handler.getRequest("388293", "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java
index 1800bb4695..59bf6361c5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java
@@ -36,40 +36,40 @@ import org.openecomp.mso.db.catalog.beans.VnfResource;
import javax.ws.rs.core.Response;
public class VnfTypesHandlerTest {
-
- VnfTypesHandler handler = new VnfTypesHandler();
-
- @Test
- public void getVnfTypesTest(){
- Response resp = handler.getVnfTypes(null, "v2");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getVnfTypesTest2(){
- new MockUp<CatalogDatabase>() {
- @Mock
- public List <VnfResource> getAllVnfResources(){
- return null;
- }
- };
- Response resp = handler.getVnfTypes(null, "v2");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getVnfTypesTest3(){
- new MockUp<CatalogDatabase>() {
- @Mock
- public List <VnfResource> getAllVnfResources(){
- List <VnfResource> list = new ArrayList<>();
- VnfResource resource = new VnfResource();
- list.add(resource);
- return list;
- }
- };
- Response resp = handler.getVnfTypes(null, "v2");
- assertTrue(resp.getEntity().toString() != null);
- }
+
+ VnfTypesHandler handler = new VnfTypesHandler();
+
+ @Test
+ public void getVnfTypesTest() {
+ Response resp = handler.getVnfTypes(null, "v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getVnfTypesTest2() {
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List<VnfResource> getAllVnfResources() {
+ return null;
+ }
+ };
+ Response resp = handler.getVnfTypes(null, "v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getVnfTypesTest3() {
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List<VnfResource> getAllVnfResources() {
+ List<VnfResource> list = new ArrayList<>();
+ VnfResource resource = new VnfResource();
+ list.add(resource);
+ return list;
+ }
+ };
+ Response resp = handler.getVnfTypes(null, "v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java
index 78ed076b55..bfe67c4796 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java
@@ -28,27 +28,27 @@ import org.openecomp.mso.requestsdb.InfraRequests;
public class VolumeInfoHandlerTest {
- VolumeInfoHandler handler = new VolumeInfoHandler();
-
- @Test
- public void fillVnfRequestTestV3(){
- VolumeRequest qr = new VolumeRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillVolumeRequest(qr, ar, "v3");
- String vnfid = (String)qr.getVolumeParams();
- assertTrue(vnfid.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV2(){
- VolumeRequest qr = new VolumeRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillVolumeRequest(qr, ar, "v2");
- String vnfid = (String)qr.getVolumeParams();
- assertTrue(vnfid.equals("test"));
- }
+ VolumeInfoHandler handler = new VolumeInfoHandler();
+
+ @Test
+ public void fillVnfRequestTestV3() {
+ VolumeRequest qr = new VolumeRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillVolumeRequest(qr, ar, "v3");
+ String vnfid = (String) qr.getVolumeParams();
+ assertTrue(vnfid.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV2() {
+ VolumeRequest qr = new VolumeRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillVolumeRequest(qr, ar, "v2");
+ String vnfid = (String) qr.getVolumeParams();
+ assertTrue(vnfid.equals("test"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java
index fa5e094336..020c5667b7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java
@@ -43,169 +43,173 @@ import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
public class VolumeRequestHandlerTest {
- VolumeRequestHandler handler = null;
-
+ VolumeRequestHandler handler = null;
+
UriInfo uriInfo = null;
-
- @Before
- public void setup() throws Exception{
-
- uriInfo = Mockito.mock(UriInfo.class);
- Class<?> clazz = VolumeRequestHandler.class;
- handler = (VolumeRequestHandler)clazz.newInstance();
-
- Field f1 = handler.getClass().getDeclaredField("uriInfo");
-
- f1.setAccessible(true);
+
+ @Before
+ public void setup() throws Exception {
+
+ uriInfo = Mockito.mock(UriInfo.class);
+ Class<?> clazz = VolumeRequestHandler.class;
+ handler = (VolumeRequestHandler) clazz.newInstance();
+
+ Field f1 = handler.getClass().getDeclaredField("uriInfo");
+
+ f1.setAccessible(true);
f1.set(handler, uriInfo);
- }
-
- @Test
- public void manageVnfRequestTest(){
- Response resp = handler.manageVolumeRequest("<name>Test</name>", "v2");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2TestV1InvalidRequestData(){
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- String request = "{\"result\":\"success\"}";
- Response resp = handler.manageVolumeRequest(request, "v1");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2TestV1(){
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v1\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
- Response resp = handler.manageVolumeRequest(request, "v1");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2TestV2(){
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v2\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
- Response resp = handler.manageVolumeRequest(request, "v2");
- assertTrue(null != resp);
- }
- @Test
- public void manageVnfRequest2TestV3(){
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v3\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
- Response resp = handler.manageVolumeRequest(request, "v3");
- assertTrue(null != resp);
- }
- @Test
- public void manageVnfRequest2TestInvalidVersion(){
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v1\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
- Response resp = handler.manageVolumeRequest(request, "v33");
- assertTrue(null != resp);
- }
-
- @Test
- public void queryFiltersTest(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
- String queryValue,
- String requestType) {
- List <InfraActiveRequests> list = new ArrayList<>();
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- list.add(req);
- return list;
- }
- };
- Response resp = handler.queryFilters("vnfType", "serviceType", "aic", "19929293", "288393923", "test", "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
- @Test
- public void getRequestTestV3(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- return req;
- }
- };
- Response resp = handler.getRequest("399293", "v3");
- assertTrue(resp.getEntity().toString() != null);
- }
- @Test
- public void getRequestTestV2(){
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- return req;
- }
- };
- Response resp = handler.getRequest("399293", "v2");
- assertTrue(resp.getEntity().toString() != null);
- }
+ }
+
+ @Test
+ public void manageVnfRequestTest() {
+ Response resp = handler.manageVolumeRequest("<name>Test</name>", "v2");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2TestV1InvalidRequestData() {
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ String request = "{\"result\":\"success\"}";
+ Response resp = handler.manageVolumeRequest(request, "v1");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2TestV1() {
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v1\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
+ Response resp = handler.manageVolumeRequest(request, "v1");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2TestV2() {
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v2\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
+ Response resp = handler.manageVolumeRequest(request, "v2");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2TestV3() {
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v3\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
+ Response resp = handler.manageVolumeRequest(request, "v3");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2TestInvalidVersion() {
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v1\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
+ Response resp = handler.manageVolumeRequest(request, "v33");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void queryFiltersTest() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ List<InfraActiveRequests> list = new ArrayList<>();
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ list.add(req);
+ return list;
+ }
+ };
+ Response resp = handler.queryFilters("vnfType", "serviceType", "aic", "19929293", "288393923", "test", "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getRequestTestV3() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType) {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ return req;
+ }
+ };
+ Response resp = handler.getRequest("399293", "v3");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getRequestTestV2() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType) {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ return req;
+ }
+ };
+ Response resp = handler.getRequest("399293", "v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java
index f257ca7a80..56f133df46 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java
@@ -21,54 +21,57 @@
package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
+
import static org.junit.Assert.assertTrue;
+
import org.junit.Before;
import org.junit.Test;
+
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import org.openecomp.mso.apihandlerinfra.tasksbeans.RequestDetails;
import org.openecomp.mso.apihandlerinfra.tasksbeans.RequestInfo;
-
public class RequestDetailsTest {
- RequestDetails _requestDetails;
- RequestInfo _requestInfo;
+ RequestDetails _requestDetails;
+ RequestInfo _requestInfo;
- public RequestDetailsTest() {
- }
+ public RequestDetailsTest() {
+ }
- @Before
- public void setUp() {
- _requestDetails = mock(RequestDetails.class);
- _requestInfo = new RequestInfo();
- when(_requestDetails.getRequestInfo()).thenReturn(_requestInfo);
- }
+ @Before
+ public void setUp() {
+ _requestDetails = mock(RequestDetails.class);
+ _requestInfo = new RequestInfo();
+ when(_requestDetails.getRequestInfo()).thenReturn(_requestInfo);
+ }
- @After
- public void tearDown() {
- _requestDetails = null;
- _requestInfo = null;
- }
+ @After
+ public void tearDown() {
+ _requestDetails = null;
+ _requestInfo = null;
+ }
- /**
- * Test of getRequestInfo method
- */
- @Test
- public void testGetRequestInfo() {
- _requestDetails.setRequestInfo(_requestInfo);
- assertTrue(_requestDetails.getRequestInfo().equals(_requestInfo));
+ /**
+ * Test of getRequestInfo method
+ */
+ @Test
+ public void testGetRequestInfo() {
+ _requestDetails.setRequestInfo(_requestInfo);
+ assertTrue(_requestDetails.getRequestInfo().equals(_requestInfo));
- }
+ }
- /**
- * Test setRequestInfo
- */
- @Test
- public void testSetRequestInfo() {
- _requestDetails.setRequestInfo(_requestInfo);
- verify(_requestDetails).setRequestInfo(_requestInfo);
- }
+ /**
+ * Test setRequestInfo
+ */
+ @Test
+ public void testSetRequestInfo() {
+ _requestDetails.setRequestInfo(_requestInfo);
+ verify(_requestDetails).setRequestInfo(_requestInfo);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java
index 3ff389124a..15d43549d5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java
@@ -23,6 +23,7 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
import org.openecomp.mso.apihandlerinfra.tasksbeans.RequestInfo;
@@ -34,87 +35,87 @@ import static org.mockito.Mockito.when;
public class RequestInfoTest {
- RequestInfo _requestInfo;
- String _source;
- ValidResponses _responseValue;
- String _requestorId;
-
- public RequestInfoTest() {
- }
-
- @Before
- public void setUp() {
- _requestInfo = mock(RequestInfo.class);
- _responseValue = ValidResponses.abort;
- _requestorId = "ab1234";
- _source = "VID";
- when(_requestInfo.getRequestorId()).thenReturn(_requestorId);
- when(_requestInfo.getSource()).thenReturn(_source);
- when(_requestInfo.getResponseValue()).thenReturn(_responseValue);
-
- }
-
- @After
- public void tearDown() {
- _requestInfo = null;
- _responseValue = null;
- }
-
- /**
- * Test of getSource method
- */
- @Test
- public void testGetSource() {
- String result = _requestInfo.getSource();
- assertEquals(_source, result);
-
- }
-
- /**
- * Test setSource
- */
- @Test
- public void testSetSource() {
- _requestInfo.setSource("VID");
- verify(_requestInfo).setSource(_source);
- }
-
- /**
- * Test of getRequestorId method
- */
- @Test
- public void testGetRequestorId() {
- String result = _requestInfo.getRequestorId();
- assertEquals(_requestorId, result);
-
- }
-
- /**
- * Test setRequestInfo
- */
- @Test
- public void testSetRequestorId() {
- _requestInfo.setRequestorId(_requestorId);
- verify(_requestInfo).setRequestorId(_requestorId);
- }
-
-
- /**
- * Test of getResponseValue method
- */
- @Test
- public void testGetResponseValue() {
- ValidResponses result = _requestInfo.getResponseValue();
- assertEquals(_responseValue, result);
-
- }
-
- /**
- * Test setResponseValues method
- */
- @Test
- public void testSetResponseValue() {
- _requestInfo.setResponseValue(ValidResponses.abort);
- verify(_requestInfo).setResponseValue(_responseValue);
- }
+ RequestInfo _requestInfo;
+ String _source;
+ ValidResponses _responseValue;
+ String _requestorId;
+
+ public RequestInfoTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _requestInfo = mock(RequestInfo.class);
+ _responseValue = ValidResponses.abort;
+ _requestorId = "ab1234";
+ _source = "VID";
+ when(_requestInfo.getRequestorId()).thenReturn(_requestorId);
+ when(_requestInfo.getSource()).thenReturn(_source);
+ when(_requestInfo.getResponseValue()).thenReturn(_responseValue);
+
+ }
+
+ @After
+ public void tearDown() {
+ _requestInfo = null;
+ _responseValue = null;
+ }
+
+ /**
+ * Test of getSource method
+ */
+ @Test
+ public void testGetSource() {
+ String result = _requestInfo.getSource();
+ assertEquals(_source, result);
+
+ }
+
+ /**
+ * Test setSource
+ */
+ @Test
+ public void testSetSource() {
+ _requestInfo.setSource("VID");
+ verify(_requestInfo).setSource(_source);
+ }
+
+ /**
+ * Test of getRequestorId method
+ */
+ @Test
+ public void testGetRequestorId() {
+ String result = _requestInfo.getRequestorId();
+ assertEquals(_requestorId, result);
+
+ }
+
+ /**
+ * Test setRequestInfo
+ */
+ @Test
+ public void testSetRequestorId() {
+ _requestInfo.setRequestorId(_requestorId);
+ verify(_requestInfo).setRequestorId(_requestorId);
+ }
+
+
+ /**
+ * Test of getResponseValue method
+ */
+ @Test
+ public void testGetResponseValue() {
+ ValidResponses result = _requestInfo.getResponseValue();
+ assertEquals(_responseValue, result);
+
+ }
+
+ /**
+ * Test setResponseValues method
+ */
+ @Test
+ public void testSetResponseValue() {
+ _requestInfo.setResponseValue(ValidResponses.abort);
+ verify(_requestInfo).setResponseValue(_responseValue);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java
index 293278955a..9f7e295109 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java
@@ -23,225 +23,228 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
+
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import org.json.JSONArray;
import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskList;
public class TaskListTest {
- TaskList _taskList;
- protected String _taskId;
- protected String _type;
- protected String _nfRole;
- protected String _subscriptionServiceType;
- protected String _originalRequestId;
- protected String _originalRequestorId;
- protected String _errorSource;
- protected String _errorCode;
- protected String _errorMessage;
- protected String _buildingBlockName;
- protected String _buildingBlockStep;
- protected JSONArray _validResponses;
-
- public TaskListTest() {
- }
-
- @Before
- public void setUp() {
- _taskList = mock(TaskList.class);
- _taskId = "_taskid";
- _type = "type";
- _nfRole = "nfrole";
- _subscriptionServiceType = "subscriptionservicetype";
- _originalRequestId = "originalrequestid";
- _originalRequestorId = "originalrequestorid";
- _errorSource = "errorsource";
- _errorCode = "errorcode";
- _errorMessage = "errormessage";
- _buildingBlockName = "buildingblockname";
- _buildingBlockStep = "buildingblockstep";
- _validResponses = mock(JSONArray.class);
-
- when(_taskList.getTaskId()).thenReturn(_taskId);
- when(_taskList.getType()).thenReturn(_type);
- when(_taskList.getNfRole()).thenReturn(_nfRole);
- when(_taskList.getSubscriptionServiceType()).thenReturn(_subscriptionServiceType);
- when(_taskList.getOriginalRequestId()).thenReturn(_originalRequestId);
- when(_taskList.getOriginalRequestorId()).thenReturn(_originalRequestorId);
- when(_taskList.getErrorSource()).thenReturn(_errorSource);
- when(_taskList.getErrorCode()).thenReturn(_errorCode);
- when(_taskList.getErrorMessage()).thenReturn(_errorMessage);
- when(_taskList.getBuildingBlockName()).thenReturn(_buildingBlockName);
- when(_taskList.getBuildingBlockStep()).thenReturn(_buildingBlockStep);
- when(_taskList.getValidResponses()).thenReturn(_validResponses);
- }
-
- @After
- public void tearDown() {
- _taskList = null;
- _validResponses = null;
- }
-
- @Test
- public void testGetTaskId() {
- String result = _taskList.getTaskId();
- assertEquals(_taskId, result);
-
- }
-
- @Test
- public void testSetTaskId() {
- _taskList.setTaskId("_taskid");
- verify(_taskList).setTaskId(_taskId);
- }
-
- @Test
- public void testGetType() {
- String result = _taskList.getType();
- assertEquals(_type, result);
-
- }
-
- @Test
- public void testSetType() {
- _taskList.setType(_type);
- verify(_taskList).setType(_type);
- }
-
- @Test
- public void testGetNfRole() {
- String result = _taskList.getNfRole();
- assertEquals(_nfRole, result);
-
- }
-
- @Test
- public void testSetNfRole() {
- _taskList.setType(_nfRole);
- verify(_taskList).setType(_nfRole);
- }
-
- @Test
- public void testGetSubscriptionServiceType() {
- String result = _taskList.getSubscriptionServiceType();
- assertEquals(_subscriptionServiceType, result);
-
- }
-
- @Test
- public void testSetSubscriptionServiceType() {
- _taskList.setSubscriptionServiceType(_subscriptionServiceType);
- verify(_taskList).setSubscriptionServiceType(_subscriptionServiceType);
- }
-
- @Test
- public void testGetOriginalRequestId() {
- String result = _taskList.getOriginalRequestId();
- assertEquals(_originalRequestId, result);
-
- }
-
- @Test
- public void testSetOriginalRequestId() {
- _taskList.setOriginalRequestId(_originalRequestId);
- verify(_taskList).setOriginalRequestId(_originalRequestId);
- }
-
- @Test
- public void testGetOriginalRequestorId() {
- String result = _taskList.getOriginalRequestorId();
- assertEquals(_originalRequestorId, result);
-
- }
-
- @Test
- public void testSetOriginalRequestorId() {
- _taskList.setOriginalRequestorId(_originalRequestorId);
- verify(_taskList).setOriginalRequestorId(_originalRequestorId);
- }
-
- @Test
- public void testGetErrorSource() {
- String result = _taskList.getErrorSource();
- assertEquals(_errorSource, result);
-
- }
-
- @Test
- public void testSetErrorSource() {
- _taskList.setErrorSource(_errorSource);
- verify(_taskList).setErrorSource(_errorSource);
- }
-
- @Test
- public void testGetErrorCode() {
- String result = _taskList.getErrorCode();
- assertEquals(_errorCode, result);
-
- }
-
- @Test
- public void testSetErrorCode() {
- _taskList.setErrorCode(_errorCode);
- verify(_taskList).setErrorCode(_errorCode);
- }
-
- @Test
- public void testGetErrorMessage() {
- String result = _taskList.getErrorMessage();
- assertEquals(_errorMessage, result);
-
- }
-
- @Test
- public void testSetErrorMessage() {
- _taskList.setErrorMessage(_errorMessage);
- verify(_taskList).setErrorMessage(_errorMessage);
- }
-
- @Test
- public void testGetBuildingBlockName() {
- String result = _taskList.getBuildingBlockName();
- assertEquals(_buildingBlockName, result);
-
- }
-
- @Test
- public void testSetBuildingBlockName() {
- _taskList.setBuildingBlockName(_buildingBlockName);
- verify(_taskList).setBuildingBlockName(_buildingBlockName);
- }
-
- @Test
- public void testGetBuildingBlockStep() {
- String result = _taskList.getBuildingBlockStep();
- assertEquals(_buildingBlockStep, result);
-
- }
-
- @Test
- public void testSetBuildingBlockStep() {
- _taskList.setBuildingBlockStep(_buildingBlockStep);
- verify(_taskList).setBuildingBlockStep(_buildingBlockStep);
- }
-
- @Test
- public void testGetValidResponses() {
-
- JSONArray result = _taskList.getValidResponses();
- assertEquals(_validResponses, result);
-
- }
-
- @Test
- public void testSetValidResponses() {
- _taskList.setValidResponses(_validResponses);
- verify(_taskList).setValidResponses(_validResponses);
- }
+ TaskList _taskList;
+ protected String _taskId;
+ protected String _type;
+ protected String _nfRole;
+ protected String _subscriptionServiceType;
+ protected String _originalRequestId;
+ protected String _originalRequestorId;
+ protected String _errorSource;
+ protected String _errorCode;
+ protected String _errorMessage;
+ protected String _buildingBlockName;
+ protected String _buildingBlockStep;
+ protected JSONArray _validResponses;
+
+ public TaskListTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _taskList = mock(TaskList.class);
+ _taskId = "_taskid";
+ _type = "type";
+ _nfRole = "nfrole";
+ _subscriptionServiceType = "subscriptionservicetype";
+ _originalRequestId = "originalrequestid";
+ _originalRequestorId = "originalrequestorid";
+ _errorSource = "errorsource";
+ _errorCode = "errorcode";
+ _errorMessage = "errormessage";
+ _buildingBlockName = "buildingblockname";
+ _buildingBlockStep = "buildingblockstep";
+ _validResponses = mock(JSONArray.class);
+
+ when(_taskList.getTaskId()).thenReturn(_taskId);
+ when(_taskList.getType()).thenReturn(_type);
+ when(_taskList.getNfRole()).thenReturn(_nfRole);
+ when(_taskList.getSubscriptionServiceType()).thenReturn(_subscriptionServiceType);
+ when(_taskList.getOriginalRequestId()).thenReturn(_originalRequestId);
+ when(_taskList.getOriginalRequestorId()).thenReturn(_originalRequestorId);
+ when(_taskList.getErrorSource()).thenReturn(_errorSource);
+ when(_taskList.getErrorCode()).thenReturn(_errorCode);
+ when(_taskList.getErrorMessage()).thenReturn(_errorMessage);
+ when(_taskList.getBuildingBlockName()).thenReturn(_buildingBlockName);
+ when(_taskList.getBuildingBlockStep()).thenReturn(_buildingBlockStep);
+ when(_taskList.getValidResponses()).thenReturn(_validResponses);
+ }
+
+ @After
+ public void tearDown() {
+ _taskList = null;
+ _validResponses = null;
+ }
+
+ @Test
+ public void testGetTaskId() {
+ String result = _taskList.getTaskId();
+ assertEquals(_taskId, result);
+
+ }
+
+ @Test
+ public void testSetTaskId() {
+ _taskList.setTaskId("_taskid");
+ verify(_taskList).setTaskId(_taskId);
+ }
+
+ @Test
+ public void testGetType() {
+ String result = _taskList.getType();
+ assertEquals(_type, result);
+
+ }
+
+ @Test
+ public void testSetType() {
+ _taskList.setType(_type);
+ verify(_taskList).setType(_type);
+ }
+
+ @Test
+ public void testGetNfRole() {
+ String result = _taskList.getNfRole();
+ assertEquals(_nfRole, result);
+
+ }
+
+ @Test
+ public void testSetNfRole() {
+ _taskList.setType(_nfRole);
+ verify(_taskList).setType(_nfRole);
+ }
+
+ @Test
+ public void testGetSubscriptionServiceType() {
+ String result = _taskList.getSubscriptionServiceType();
+ assertEquals(_subscriptionServiceType, result);
+
+ }
+
+ @Test
+ public void testSetSubscriptionServiceType() {
+ _taskList.setSubscriptionServiceType(_subscriptionServiceType);
+ verify(_taskList).setSubscriptionServiceType(_subscriptionServiceType);
+ }
+
+ @Test
+ public void testGetOriginalRequestId() {
+ String result = _taskList.getOriginalRequestId();
+ assertEquals(_originalRequestId, result);
+
+ }
+
+ @Test
+ public void testSetOriginalRequestId() {
+ _taskList.setOriginalRequestId(_originalRequestId);
+ verify(_taskList).setOriginalRequestId(_originalRequestId);
+ }
+
+ @Test
+ public void testGetOriginalRequestorId() {
+ String result = _taskList.getOriginalRequestorId();
+ assertEquals(_originalRequestorId, result);
+
+ }
+
+ @Test
+ public void testSetOriginalRequestorId() {
+ _taskList.setOriginalRequestorId(_originalRequestorId);
+ verify(_taskList).setOriginalRequestorId(_originalRequestorId);
+ }
+
+ @Test
+ public void testGetErrorSource() {
+ String result = _taskList.getErrorSource();
+ assertEquals(_errorSource, result);
+
+ }
+
+ @Test
+ public void testSetErrorSource() {
+ _taskList.setErrorSource(_errorSource);
+ verify(_taskList).setErrorSource(_errorSource);
+ }
+
+ @Test
+ public void testGetErrorCode() {
+ String result = _taskList.getErrorCode();
+ assertEquals(_errorCode, result);
+
+ }
+
+ @Test
+ public void testSetErrorCode() {
+ _taskList.setErrorCode(_errorCode);
+ verify(_taskList).setErrorCode(_errorCode);
+ }
+
+ @Test
+ public void testGetErrorMessage() {
+ String result = _taskList.getErrorMessage();
+ assertEquals(_errorMessage, result);
+
+ }
+
+ @Test
+ public void testSetErrorMessage() {
+ _taskList.setErrorMessage(_errorMessage);
+ verify(_taskList).setErrorMessage(_errorMessage);
+ }
+
+ @Test
+ public void testGetBuildingBlockName() {
+ String result = _taskList.getBuildingBlockName();
+ assertEquals(_buildingBlockName, result);
+
+ }
+
+ @Test
+ public void testSetBuildingBlockName() {
+ _taskList.setBuildingBlockName(_buildingBlockName);
+ verify(_taskList).setBuildingBlockName(_buildingBlockName);
+ }
+
+ @Test
+ public void testGetBuildingBlockStep() {
+ String result = _taskList.getBuildingBlockStep();
+ assertEquals(_buildingBlockStep, result);
+
+ }
+
+ @Test
+ public void testSetBuildingBlockStep() {
+ _taskList.setBuildingBlockStep(_buildingBlockStep);
+ verify(_taskList).setBuildingBlockStep(_buildingBlockStep);
+ }
+
+ @Test
+ public void testGetValidResponses() {
+
+ JSONArray result = _taskList.getValidResponses();
+ assertEquals(_validResponses, result);
+
+ }
+
+ @Test
+ public void testSetValidResponses() {
+ _taskList.setValidResponses(_validResponses);
+ verify(_taskList).setValidResponses(_validResponses);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java
index ec45592704..da00be855b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java
@@ -23,6 +23,7 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskRequestReference;
@@ -33,40 +34,41 @@ import static org.mockito.Mockito.when;
public class TaskRequestReferenceTest {
- TaskRequestReference _taskRequestReference;
+ TaskRequestReference _taskRequestReference;
protected String _taskId;
- public TaskRequestReferenceTest() {
- }
-
- @Before
- public void setUp() {
- _taskRequestReference = mock(TaskRequestReference.class);
- _taskId = "taskid";
-
- when(_taskRequestReference.getTaskId()).thenReturn(_taskId);
- }
- @After
- public void tearDown() {
- _taskRequestReference = null;
- }
+ public TaskRequestReferenceTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _taskRequestReference = mock(TaskRequestReference.class);
+ _taskId = "taskid";
+
+ when(_taskRequestReference.getTaskId()).thenReturn(_taskId);
+ }
+
+ @After
+ public void tearDown() {
+ _taskRequestReference = null;
+ }
- /**
- * Test getTaskRequestReference
- */
- @Test
- public void taskGetRequestReference() {
- String result = _taskRequestReference.getTaskId();
+ /**
+ * Test getTaskRequestReference
+ */
+ @Test
+ public void taskGetRequestReference() {
+ String result = _taskRequestReference.getTaskId();
assertEquals(_taskId, result);
- }
+ }
- /**
- * Test setTaskRequestReference
- */
- @Test
- public void testSetRequestInfo() {
- _taskRequestReference.setTaskId(_taskId);
- verify(_taskRequestReference).setTaskId(_taskId);
- }
+ /**
+ * Test setTaskRequestReference
+ */
+ @Test
+ public void testSetRequestInfo() {
+ _taskRequestReference.setTaskId(_taskId);
+ verify(_taskRequestReference).setTaskId(_taskId);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java
index b593036556..051bce94d0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java
@@ -23,92 +23,94 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskVariableValue;
public class TaskVariableValueTest {
- TaskVariableValue _taskVariableValue;
- protected String _name;
- protected String _value;
- protected String _operator;
-
- public TaskVariableValueTest() {
- }
-
- @Before
- public void setUp() {
- _taskVariableValue = mock(TaskVariableValue.class);
- _name = "name";
- _value = "value";
- _operator = "operator";
- when(_taskVariableValue.getName()).thenReturn(_name);
- when(_taskVariableValue.getValue()).thenReturn(_value);
- when(_taskVariableValue.getOperator()).thenReturn(_operator);
- }
-
- @After
- public void tearDown() {
- _taskVariableValue = null;
- }
-
- /**
- * Test of getName method
- */
- @Test
- public void testGetName() {
- _taskVariableValue.setName(_name);
- assertEquals(_taskVariableValue.getName(),_name);
-
- }
-
- /**
- * Test setName
- */
- @Test
- public void testSetName() {
- _taskVariableValue.setName(_name);
- verify(_taskVariableValue).setName(_name);
- }
-
- /**
- * Test of getName method
- */
- @Test
- public void testGetValue() {
- _taskVariableValue.setValue(_value);
- assertEquals(_taskVariableValue.getValue(),_value);
-
- }
-
- /**
- * Test setName
- */
- @Test
- public void testSetValue() {
- _taskVariableValue.setValue(_value);
- verify(_taskVariableValue).setValue(_value);
- }
-
- /**
- * Test of getName method
- */
- @Test
- public void testGetOperator() {
- _taskVariableValue.setOperator(_operator);
- assertEquals(_taskVariableValue.getOperator(),_operator);
-
- }
-
- /**
- * Test setName
- */
- @Test
- public void testSetRequestDetails() {
- _taskVariableValue.setOperator(_operator);
- verify(_taskVariableValue).setOperator(_operator);
- }
+ TaskVariableValue _taskVariableValue;
+ protected String _name;
+ protected String _value;
+ protected String _operator;
+
+ public TaskVariableValueTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _taskVariableValue = mock(TaskVariableValue.class);
+ _name = "name";
+ _value = "value";
+ _operator = "operator";
+ when(_taskVariableValue.getName()).thenReturn(_name);
+ when(_taskVariableValue.getValue()).thenReturn(_value);
+ when(_taskVariableValue.getOperator()).thenReturn(_operator);
+ }
+
+ @After
+ public void tearDown() {
+ _taskVariableValue = null;
+ }
+
+ /**
+ * Test of getName method
+ */
+ @Test
+ public void testGetName() {
+ _taskVariableValue.setName(_name);
+ assertEquals(_taskVariableValue.getName(), _name);
+
+ }
+
+ /**
+ * Test setName
+ */
+ @Test
+ public void testSetName() {
+ _taskVariableValue.setName(_name);
+ verify(_taskVariableValue).setName(_name);
+ }
+
+ /**
+ * Test of getName method
+ */
+ @Test
+ public void testGetValue() {
+ _taskVariableValue.setValue(_value);
+ assertEquals(_taskVariableValue.getValue(), _value);
+
+ }
+
+ /**
+ * Test setName
+ */
+ @Test
+ public void testSetValue() {
+ _taskVariableValue.setValue(_value);
+ verify(_taskVariableValue).setValue(_value);
+ }
+
+ /**
+ * Test of getName method
+ */
+ @Test
+ public void testGetOperator() {
+ _taskVariableValue.setOperator(_operator);
+ assertEquals(_taskVariableValue.getOperator(), _operator);
+
+ }
+
+ /**
+ * Test setName
+ */
+ @Test
+ public void testSetRequestDetails() {
+ _taskVariableValue.setOperator(_operator);
+ verify(_taskVariableValue).setOperator(_operator);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java
index b08729b0ff..1a9baba487 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java
@@ -23,6 +23,7 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskVariableValue;
@@ -36,36 +37,36 @@ import java.util.List;
public class TaskVariablesTest {
- TaskVariables _taskVariables;
- private List<TaskVariableValue> _taskVariableValueList;
+ TaskVariables _taskVariables;
+ private List<TaskVariableValue> _taskVariableValueList;
- public TaskVariablesTest() {
- }
+ public TaskVariablesTest() {
+ }
- @SuppressWarnings("unchecked")
- @Before
- public void setUp() {
- _taskVariables = mock(TaskVariables.class);
- _taskVariableValueList = mock(List.class);
- when(_taskVariables.getTaskVariables()).thenReturn(_taskVariableValueList);
- }
+ @SuppressWarnings("unchecked")
+ @Before
+ public void setUp() {
+ _taskVariables = mock(TaskVariables.class);
+ _taskVariableValueList = mock(List.class);
+ when(_taskVariables.getTaskVariables()).thenReturn(_taskVariableValueList);
+ }
- @After
- public void tearDown() {
- _taskVariables = null;
- }
+ @After
+ public void tearDown() {
+ _taskVariables = null;
+ }
- @Test
- public void testGetTaskVariables() {
- List<TaskVariableValue> result = _taskVariables.getTaskVariables();
- assertEquals(_taskVariableValueList, result);
+ @Test
+ public void testGetTaskVariables() {
+ List<TaskVariableValue> result = _taskVariables.getTaskVariables();
+ assertEquals(_taskVariableValueList, result);
- }
+ }
- @Test
- public void testSetTaskVariables() {
- _taskVariables.setTaskVariables(_taskVariableValueList);
- verify(_taskVariables).setTaskVariables(_taskVariableValueList);
+ @Test
+ public void testSetTaskVariables() {
+ _taskVariables.setTaskVariables(_taskVariableValueList);
+ verify(_taskVariables).setTaskVariables(_taskVariableValueList);
- }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java
index eeb745d3bf..2832833a62 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java
@@ -23,6 +23,7 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskList;
@@ -36,36 +37,36 @@ import java.util.List;
public class TasksGetResponseTest {
- TasksGetResponse _tasksGetResponse;
- private List<TaskList> _taskList;
+ TasksGetResponse _tasksGetResponse;
+ private List<TaskList> _taskList;
- public TasksGetResponseTest() {
- }
+ public TasksGetResponseTest() {
+ }
- @SuppressWarnings("unchecked")
- @Before
- public void setUp() {
- _tasksGetResponse = mock(TasksGetResponse.class);
- _taskList = mock(List.class);
- when(_tasksGetResponse.getTaskList()).thenReturn(_taskList);
- }
+ @SuppressWarnings("unchecked")
+ @Before
+ public void setUp() {
+ _tasksGetResponse = mock(TasksGetResponse.class);
+ _taskList = mock(List.class);
+ when(_tasksGetResponse.getTaskList()).thenReturn(_taskList);
+ }
- @After
- public void tearDown() {
- _tasksGetResponse = null;
- }
+ @After
+ public void tearDown() {
+ _tasksGetResponse = null;
+ }
- @Test
- public void testGetTaskList() {
- List<TaskList> result = _tasksGetResponse.getTaskList();
- assertEquals(_taskList, result);
+ @Test
+ public void testGetTaskList() {
+ List<TaskList> result = _tasksGetResponse.getTaskList();
+ assertEquals(_taskList, result);
- }
+ }
- @Test
- public void testSetTaskList() {
- _tasksGetResponse.setTaskList(_taskList);
- verify(_tasksGetResponse).setTaskList(_taskList);
+ @Test
+ public void testSetTaskList() {
+ _tasksGetResponse.setTaskList(_taskList);
+ verify(_tasksGetResponse).setTaskList(_taskList);
- }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java
index 8bfdb645d7..0f3dad357d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java
@@ -21,52 +21,56 @@
package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
+
import static org.junit.Assert.assertTrue;
+
import org.junit.Before;
import org.junit.Test;
+
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import org.openecomp.mso.apihandlerinfra.tasksbeans.RequestDetails;
import org.openecomp.mso.apihandlerinfra.tasksbeans.TasksRequest;
public class TasksRequestTest {
- TasksRequest _tasksRequest;
- private RequestDetails _requestDetails;
+ TasksRequest _tasksRequest;
+ private RequestDetails _requestDetails;
- public TasksRequestTest() {
- }
+ public TasksRequestTest() {
+ }
- @Before
- public void setUp() {
- _tasksRequest = mock(TasksRequest.class);
- _requestDetails = new RequestDetails();
- when(_tasksRequest.getRequestDetails()).thenReturn(_requestDetails);
- }
+ @Before
+ public void setUp() {
+ _tasksRequest = mock(TasksRequest.class);
+ _requestDetails = new RequestDetails();
+ when(_tasksRequest.getRequestDetails()).thenReturn(_requestDetails);
+ }
- @After
- public void tearDown() {
- _tasksRequest = null;
- }
+ @After
+ public void tearDown() {
+ _tasksRequest = null;
+ }
- /**
- * Test of getRequestDetails method
- */
- @Test
- public void testGetRequestDetails() {
- _tasksRequest.setRequestDetails(_requestDetails);
- assertTrue(_tasksRequest.getRequestDetails().equals(_requestDetails));
+ /**
+ * Test of getRequestDetails method
+ */
+ @Test
+ public void testGetRequestDetails() {
+ _tasksRequest.setRequestDetails(_requestDetails);
+ assertTrue(_tasksRequest.getRequestDetails().equals(_requestDetails));
- }
+ }
- /**
- * Test setRequestDetails
- */
- @Test
- public void testSetRequestDetails() {
- _tasksRequest.setRequestDetails(_requestDetails);
- verify(_tasksRequest).setRequestDetails(_requestDetails);
- }
+ /**
+ * Test setRequestDetails
+ */
+ @Test
+ public void testSetRequestDetails() {
+ _tasksRequest.setRequestDetails(_requestDetails);
+ verify(_tasksRequest).setRequestDetails(_requestDetails);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java
index 41b43c06d8..2aa2861178 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java
@@ -23,47 +23,49 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import org.openecomp.mso.apihandlerinfra.tasksbeans.Value;
public class ValueTest {
- Value _valueInstance;
- protected String _value;
+ Value _valueInstance;
+ protected String _value;
- public ValueTest() {
- }
+ public ValueTest() {
+ }
- @Before
- public void setUp() {
- _valueInstance = mock(Value.class);
- _value = "_value";
- when(_valueInstance.getValue()).thenReturn(_value);
- }
+ @Before
+ public void setUp() {
+ _valueInstance = mock(Value.class);
+ _value = "_value";
+ when(_valueInstance.getValue()).thenReturn(_value);
+ }
- @After
- public void tearDown() {
- _valueInstance = null;
- }
+ @After
+ public void tearDown() {
+ _valueInstance = null;
+ }
- /**
- * Test of getValue method
- */
- @Test
- public void testGetValue() {
- _valueInstance.setValue(_value);
- assertEquals(_valueInstance.getValue(),_value);
+ /**
+ * Test of getValue method
+ */
+ @Test
+ public void testGetValue() {
+ _valueInstance.setValue(_value);
+ assertEquals(_valueInstance.getValue(), _value);
- }
+ }
- /**
- * Test setValue
- */
- @Test
- public void testSetValue() {
- _valueInstance.setValue(_value);
- verify(_valueInstance).setValue(_value);
- }
+ /**
+ * Test setValue
+ */
+ @Test
+ public void testSetValue() {
+ _valueInstance.setValue(_value);
+ verify(_valueInstance).setValue(_value);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java
index fdfd5a16bc..3b84e764e2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java
@@ -23,75 +23,77 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import org.openecomp.mso.apihandlerinfra.tasksbeans.Variables;
import org.openecomp.mso.apihandlerinfra.tasksbeans.Value;
public class VariablesTest {
- Variables _variables;
- protected Value _source;
- protected Value _responseValue;
+ Variables _variables;
+ protected Value _source;
+ protected Value _responseValue;
protected Value _requestorId;
-
+
@Before
- public void setUp() {
- _variables = mock(Variables.class);
+ public void setUp() {
+ _variables = mock(Variables.class);
_source = mock(Value.class);
_responseValue = mock(Value.class);
_requestorId = mock(Value.class);
-
- when(_variables.getSource()).thenReturn(_source);
- when(_variables.getRequestorId()).thenReturn(_requestorId);
- when(_variables.getResponseValue()).thenReturn(_responseValue);
-
- }
-
- @After
- public void tearDown() {
- _variables = null;
- _source = null;
- _responseValue = null;
- _requestorId = null;
- }
-
- @Test
+
+ when(_variables.getSource()).thenReturn(_source);
+ when(_variables.getRequestorId()).thenReturn(_requestorId);
+ when(_variables.getResponseValue()).thenReturn(_responseValue);
+
+ }
+
+ @After
+ public void tearDown() {
+ _variables = null;
+ _source = null;
+ _responseValue = null;
+ _requestorId = null;
+ }
+
+ @Test
public void testGetSource() {
- _variables.setSource(_source);
- assertTrue(_variables.getSource().equals(_source));
+ _variables.setSource(_source);
+ assertTrue(_variables.getSource().equals(_source));
+ }
+
+ @Test
+ public void testSetSource() {
+ _variables.setSource(_source);
+ verify(_variables).setSource(_source);
}
- @Test
- public void testSetSource(){
- _variables.setSource(_source);
- verify(_variables).setSource(_source);
- }
-
- @Test
+ @Test
public void testGetResponseValue() {
- _variables.setResponseValue(_responseValue);
- assertTrue(_variables.getResponseValue().equals(_responseValue));
+ _variables.setResponseValue(_responseValue);
+ assertTrue(_variables.getResponseValue().equals(_responseValue));
}
- @Test
- public void testSetResponseValue(){
- _variables.setResponseValue(_responseValue);
- verify(_variables).setResponseValue(_responseValue);
- }
-
- @Test
+ @Test
+ public void testSetResponseValue() {
+ _variables.setResponseValue(_responseValue);
+ verify(_variables).setResponseValue(_responseValue);
+ }
+
+ @Test
public void testGetRequestorId() {
- _variables.setRequestorId(_requestorId);
- assertTrue(_variables.getRequestorId().equals(_requestorId));
+ _variables.setRequestorId(_requestorId);
+ assertTrue(_variables.getRequestorId().equals(_requestorId));
+ }
+
+ @Test
+ public void testSetRequestorId() {
+ _variables.setRequestorId(_requestorId);
+ verify(_variables).setRequestorId(_requestorId);
}
- @Test
- public void testSetRequestorId(){
- _variables.setRequestorId(_requestorId);
- verify(_variables).setRequestorId(_requestorId);
- }
-
}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
index 0bb126fa42..198e603f0a 100644
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
@@ -52,9 +52,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked SQLQuery query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createSQLQuery(" show tables "); result = query;
- query.list(); result = Arrays.asList("table1", "table2");
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createSQLQuery(" show tables ");
+ result = query;
+ query.list();
+ result = Arrays.asList("table1", "table2");
}};
assertTrue(requestsDatabase.healthCheck());
@@ -65,8 +68,10 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.executeUpdate(); result = 1;
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ query.executeUpdate();
+ result = 1;
}};
assertEquals(1, requestsDatabase.updateInfraStatus("123", "unknown", "unknown"));
}
@@ -76,8 +81,10 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.executeUpdate(); result = 1;
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ query.executeUpdate();
+ result = 1;
}};
assertEquals(1, requestsDatabase.updateInfraStatus("123", "unknown", 0, "unknown"));
}
@@ -87,8 +94,10 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.executeUpdate(); result = 1;
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ query.executeUpdate();
+ result = 1;
}};
assertEquals(1, requestsDatabase.updateInfraFinalStatus("123",
"unknown",
@@ -103,8 +112,10 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.uniqueResult(); result = new InfraActiveRequests("123", "action");
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ query.uniqueResult();
+ result = new InfraActiveRequests("123", "action");
}};
assertEquals("123",
requestsDatabase.getRequestFromInfraActive("123").getRequestId());
@@ -116,9 +127,12 @@ public class RequestsDatabaseTest {
@Mocked Criteria criteria) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createCriteria(InfraActiveRequests.class); result = criteria;
- criteria.list(); result = Arrays.asList(new InfraActiveRequests("123", "action"));
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createCriteria(InfraActiveRequests.class);
+ result = criteria;
+ criteria.list();
+ result = Arrays.asList(new InfraActiveRequests("123", "action"));
}};
assertEquals(1,
requestsDatabase.getRequestListFromInfraActive("queryattr",
@@ -131,9 +145,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType"); result = query;
- query.uniqueResult(); result = new InfraActiveRequests("123", "action");
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType");
+ result = query;
+ query.uniqueResult();
+ result = new InfraActiveRequests("123", "action");
}};
assertEquals("123",
requestsDatabase.getRequestFromInfraActive("123", "requestType").getRequestId());
@@ -144,9 +161,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Criteria criteria) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createCriteria(InfraActiveRequests.class); result = criteria;
- criteria.list(); result = Arrays.asList(new InfraActiveRequests());
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createCriteria(InfraActiveRequests.class);
+ result = criteria;
+ criteria.list();
+ result = Arrays.asList(new InfraActiveRequests());
}};
assertEquals(1,
requestsDatabase.getRequestListFromInfraActive("queryAttr",
@@ -159,9 +179,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC"); result = query;
- query.list(); result = Arrays.asList(new InfraActiveRequests("123", "action"));
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC");
+ result = query;
+ query.list();
+ result = Arrays.asList(new InfraActiveRequests("123", "action"));
}};
assertEquals("123",
requestsDatabase.checkDuplicateByVnfName("vnfname",
@@ -174,9 +197,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC"); result = query;
- query.list(); result = Arrays.asList(new InfraActiveRequests("123", "action"));
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC");
+ result = query;
+ query.list();
+ result = Arrays.asList(new InfraActiveRequests("123", "action"));
}};
assertEquals("123",
requestsDatabase.checkDuplicateByVnfId("vnfname",
@@ -194,9 +220,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM SiteStatus WHERE siteName = :site_name"); result = query;
- query.uniqueResult(); result = new SiteStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM SiteStatus WHERE siteName = :site_name");
+ result = query;
+ query.uniqueResult();
+ result = new SiteStatus();
}};
assertEquals(SiteStatus.class,
requestsDatabase.getSiteStatus("site").getClass());
@@ -207,9 +236,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM SiteStatus WHERE siteName = :site_name"); result = query;
- query.uniqueResult(); result = new SiteStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM SiteStatus WHERE siteName = :site_name");
+ result = query;
+ query.uniqueResult();
+ result = new SiteStatus();
}};
requestsDatabase.updateSiteStatus("site", true);
}
@@ -219,9 +251,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"); result = query;
- query.uniqueResult(); result = new OperationStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id");
+ result = query;
+ query.uniqueResult();
+ result = new OperationStatus();
}};
assertEquals(OperationStatus.class,
requestsDatabase.getOperationStatus("123",
@@ -233,9 +268,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id"); result = query;
- query.uniqueResult(); result = new OperationStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id");
+ result = query;
+ query.uniqueResult();
+ result = new OperationStatus();
}};
assertEquals(OperationStatus.class,
requestsDatabase.getOperationStatusByServiceId("123").getClass());
@@ -246,9 +284,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_NAME = :service_name"); result = query;
- query.uniqueResult(); result = new OperationStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM OperationStatus WHERE SERVICE_NAME = :service_name");
+ result = query;
+ query.uniqueResult();
+ result = new OperationStatus();
}};
assertEquals(OperationStatus.class,
requestsDatabase.getOperationStatusByServiceName("servicename").getClass());
@@ -259,9 +300,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"); result = query;
- query.uniqueResult(); result = new OperationStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id");
+ result = query;
+ query.uniqueResult();
+ result = new OperationStatus();
}};
requestsDatabase.updateOperationStatus(new OperationStatus());
}
@@ -271,9 +315,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM ResourceOperationStatus WHERE serviceId = :service_id and operationId = :operation_id and resourceTemplateUUID= :uuid"); result = query;
- query.uniqueResult(); result = new ResourceOperationStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM ResourceOperationStatus WHERE serviceId = :service_id and operationId = :operation_id and resourceTemplateUUID= :uuid");
+ result = query;
+ query.uniqueResult();
+ result = new ResourceOperationStatus();
}};
assertEquals(ResourceOperationStatus.class,
requestsDatabase.getResourceOperationStatus("serviceId",
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java
index 3cab4f243b..c51cd624a4 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java
@@ -63,13 +63,13 @@ public class CatalogDatabaseTest {
CatalogDatabase cd = null;
@Before
- public void setup(){
+ public void setup() {
cd = CatalogDatabase.getInstance();
}
@Test
- public void getAllHeatTemplatesTest(){
+ public void getAllHeatTemplatesTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -93,12 +93,12 @@ public class CatalogDatabaseTest {
}
};
- List <HeatTemplate> list = cd.getAllHeatTemplates();
+ List<HeatTemplate> list = cd.getAllHeatTemplates();
assertEquals(list.size(), 1);
}
@Test
- public void getHeatTemplateByIdTest(){
+ public void getHeatTemplateByIdTest() {
MockUp<Session> mockedSession = new MockUp<Session>() {
@Mock
@@ -121,7 +121,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getHeatTemplateByNameEmptyListTest(){
+ public void getHeatTemplateByNameEmptyListTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -150,7 +150,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getHeatTemplateByNameTest(){
+ public void getHeatTemplateByNameTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -209,7 +209,7 @@ public class CatalogDatabaseTest {
}
};
- HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
+ HeatTemplate ht = cd.getHeatTemplate("heat123", "v2");
assertEquals("1234-uuid", ht.getAsdcUuid());
}
@@ -237,12 +237,12 @@ public class CatalogDatabaseTest {
}
};
- HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
+ HeatTemplate ht = cd.getHeatTemplate("heat123", "v2");
assertEquals(null, ht);
}
@Test
- public void getHeatTemplateByArtifactUuidException(){
+ public void getHeatTemplateByArtifactUuidException() {
MockUp<Session> mockedSession = new MockUp<Session>() {
@Mock
@@ -265,7 +265,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getHeatTemplateByArtifactUuidTest(){
+ public void getHeatTemplateByArtifactUuidTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -296,7 +296,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = HibernateException.class)
- public void getHeatTemplateByArtifactUuidHibernateErrorTest(){
+ public void getHeatTemplateByArtifactUuidHibernateErrorTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -324,7 +324,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = NonUniqueResultException.class)
- public void getHeatTemplateByArtifactUuidNonUniqueResultTest(){
+ public void getHeatTemplateByArtifactUuidNonUniqueResultTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -352,7 +352,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void getHeatTemplateByArtifactUuidGenericExceptionTest(){
+ public void getHeatTemplateByArtifactUuidGenericExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -380,7 +380,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getParametersForHeatTemplateTest(){
+ public void getParametersForHeatTemplateTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -410,7 +410,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = HibernateException.class)
- public void getParametersForHeatTemplateHibernateExceptionTest(){
+ public void getParametersForHeatTemplateHibernateExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -437,7 +437,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void getParametersForHeatTemplateExceptionTest(){
+ public void getParametersForHeatTemplateExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -464,7 +464,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getHeatEnvironmentByArtifactUuidTest(){
+ public void getHeatEnvironmentByArtifactUuidTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -495,7 +495,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = HibernateException.class)
- public void getHeatEnvironmentByArtifactUuidHibernateExceptionTest(){
+ public void getHeatEnvironmentByArtifactUuidHibernateExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -523,7 +523,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void getHeatEnvironmentByArtifactUuidExceptionTest(){
+ public void getHeatEnvironmentByArtifactUuidExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -551,7 +551,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getServiceByInvariantUUIDTest(){
+ public void getServiceByInvariantUUIDTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -582,7 +582,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getServiceByInvariantUUIDEmptyResultTest(){
+ public void getServiceByInvariantUUIDEmptyResultTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -611,7 +611,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getServiceTest(){
+ public void getServiceTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -642,7 +642,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = NonUniqueResultException.class)
- public void getServiceNoUniqueResultTest(){
+ public void getServiceNoUniqueResultTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -670,7 +670,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = HibernateException.class)
- public void getServiceHibernateExceptionTest(){
+ public void getServiceHibernateExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -698,7 +698,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void getServiceExceptionTest(){
+ public void getServiceExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -726,7 +726,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getServiceByModelUUIDTest(){
+ public void getServiceByModelUUIDTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -756,7 +756,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getService2Test(){
+ public void getService2Test() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -789,7 +789,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getServiceByModelNameTest(){
+ public void getServiceByModelNameTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -819,7 +819,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getServiceByModelNameEmptyTest(){
+ public void getServiceByModelNameEmptyTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -847,7 +847,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getServiceByVersionAndInvariantIdTest() throws Exception{
+ public void getServiceByVersionAndInvariantIdTest() throws Exception {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -872,12 +872,12 @@ public class CatalogDatabaseTest {
return mockedSession.getMockInstance();
}
};
- Service service = cd.getServiceByVersionAndInvariantId("123","tetwe");
+ Service service = cd.getServiceByVersionAndInvariantId("123", "tetwe");
assertEquals("123-uuid", service.getModelUUID());
}
@Test(expected = Exception.class)
- public void getServiceByVersionAndInvariantIdNonUniqueResultTest() throws Exception{
+ public void getServiceByVersionAndInvariantIdNonUniqueResultTest() throws Exception {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -900,12 +900,12 @@ public class CatalogDatabaseTest {
return mockedSession.getMockInstance();
}
};
- Service service = cd.getServiceByVersionAndInvariantId("123","tetwe");
+ Service service = cd.getServiceByVersionAndInvariantId("123", "tetwe");
}
@Test(expected = Exception.class)
- public void getServiceRecipeTestException() throws Exception{
- ServiceRecipe ht = cd.getServiceRecipe("123","tetwe");
+ public void getServiceRecipeTestException() throws Exception {
+ ServiceRecipe ht = cd.getServiceRecipe("123", "tetwe");
}
@Test
@@ -932,7 +932,7 @@ public class CatalogDatabaseTest {
return mockedSession.getMockInstance();
}
};
- ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
+ ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123", "tetwe");
assertEquals(1, serviceRecipe.getId());
}
@@ -958,12 +958,12 @@ public class CatalogDatabaseTest {
return mockedSession.getMockInstance();
}
};
- ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
+ ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123", "tetwe");
assertEquals(null, serviceRecipe);
}
@Test
- public void getServiceRecipesTestException() throws Exception{
+ public void getServiceRecipesTestException() throws Exception {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<ServiceRecipe> list() {
@@ -991,7 +991,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getServiceRecipesEmptyTest() throws Exception{
+ public void getServiceRecipesEmptyTest() throws Exception {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<ServiceRecipe> list() {
@@ -1017,12 +1017,12 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void getVnfComponentTestException() throws Exception{
- VnfComponent ht = cd.getVnfComponent(123,"vnf");
+ public void getVnfComponentTestException() throws Exception {
+ VnfComponent ht = cd.getVnfComponent(123, "vnf");
}
@Test
- public void getVnfResourceTest() throws Exception{
+ public void getVnfResourceTest() throws Exception {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfResource> list() {
@@ -1050,7 +1050,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getVnfResourceEmptyTest() throws Exception{
+ public void getVnfResourceEmptyTest() throws Exception {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfResource> list() {
@@ -1100,7 +1100,7 @@ public class CatalogDatabaseTest {
return mockedSession.getMockInstance();
}
};
- VnfResource vnfResource = cd.getVnfResource("vnf","3992");
+ VnfResource vnfResource = cd.getVnfResource("vnf", "3992");
assertEquals("123-uuid", vnfResource.getModelUuid());
}
@@ -1127,7 +1127,7 @@ public class CatalogDatabaseTest {
return mockedSession.getMockInstance();
}
};
- VnfResource vnfResource = cd.getVnfResource("vnf","3992");
+ VnfResource vnfResource = cd.getVnfResource("vnf", "3992");
}
@Test(expected = HibernateException.class)
@@ -1153,7 +1153,7 @@ public class CatalogDatabaseTest {
return mockedSession.getMockInstance();
}
};
- VnfResource vnfResource = cd.getVnfResource("vnf","3992");
+ VnfResource vnfResource = cd.getVnfResource("vnf", "3992");
}
@Test(expected = Exception.class)
@@ -1179,7 +1179,7 @@ public class CatalogDatabaseTest {
return mockedSession.getMockInstance();
}
};
- VnfResource vnfResource = cd.getVnfResource("vnf","3992");
+ VnfResource vnfResource = cd.getVnfResource("vnf", "3992");
}
@Test
@@ -1209,7 +1209,7 @@ public class CatalogDatabaseTest {
};
VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992");
- assertEquals("123-uuid",vnfResource.getModelUuid());
+ assertEquals("123-uuid", vnfResource.getModelUuid());
}
@Test(expected = NonUniqueResultException.class)
@@ -1268,12 +1268,12 @@ public class CatalogDatabaseTest {
@Test(expected = Exception.class)
- public void getServiceRecipeTest2Exception() throws Exception{
- ServiceRecipe ht = cd.getServiceRecipe(1001,"3992");
+ public void getServiceRecipeTest2Exception() throws Exception {
+ ServiceRecipe ht = cd.getServiceRecipe(1001, "3992");
}
@Test
- public void getVnfResourceCustomizationByModelCustomizationNameTest(){
+ public void getVnfResourceCustomizationByModelCustomizationNameTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfResourceCustomization> list() throws Exception {
@@ -1301,7 +1301,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getVnfResourceCustomizationByModelCustomizationNameEmptyTest(){
+ public void getVnfResourceCustomizationByModelCustomizationNameEmptyTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfResourceCustomization> list() throws Exception {
@@ -1327,11 +1327,11 @@ public class CatalogDatabaseTest {
}
@Test
- public void getVnfResourceByModelInvariantIdTest(){
+ public void getVnfResourceByModelInvariantIdTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
- public Object uniqueResult(){
+ public Object uniqueResult() {
VnfResource vnfResource = new VnfResource();
vnfResource.setModelUuid("123-uuid");
return vnfResource;
@@ -1356,11 +1356,11 @@ public class CatalogDatabaseTest {
}
@Test(expected = NonUniqueResultException.class)
- public void getVnfResourceByModelInvariantIdNURExceptionTest(){
+ public void getVnfResourceByModelInvariantIdNURExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
- public Object uniqueResult(){
+ public Object uniqueResult() {
throw new NonUniqueResultException(-1);
}
};
@@ -1382,11 +1382,11 @@ public class CatalogDatabaseTest {
}
@Test(expected = HibernateException.class)
- public void getVnfResourceByModelInvariantIdHibernateExceptionTest(){
+ public void getVnfResourceByModelInvariantIdHibernateExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
- public Object uniqueResult(){
+ public Object uniqueResult() {
throw new HibernateException("hibernate exception");
}
};
@@ -1408,7 +1408,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void getVnfResourceByModelInvariantIdExceptionTest(){
+ public void getVnfResourceByModelInvariantIdExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -1434,12 +1434,12 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void getVnfResourceByIdTestException(){
+ public void getVnfResourceByIdTestException() {
VnfResource vnf = cd.getVnfResourceById(19299);
}
@Test
- public void getVfModuleModelName(){
+ public void getVfModuleModelName() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VfModule> list() throws Exception {
@@ -1467,7 +1467,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getVfModuleModelNameExceptionTest(){
+ public void getVfModuleModelNameExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VfModule> list() throws Exception {
@@ -1518,7 +1518,7 @@ public class CatalogDatabaseTest {
}
};
- VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
+ VfModule vfModule = cd.getVfModuleModelName("tetes", "4kidsl");
assertEquals("123-uuid", vfModule.getModelUUID());
}
@@ -1546,7 +1546,7 @@ public class CatalogDatabaseTest {
}
};
- VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
+ VfModule vfModule = cd.getVfModuleModelName("tetes", "4kidsl");
}
@Test(expected = HibernateException.class)
@@ -1573,7 +1573,7 @@ public class CatalogDatabaseTest {
}
};
- VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
+ VfModule vfModule = cd.getVfModuleModelName("tetes", "4kidsl");
}
@Test(expected = Exception.class)
@@ -1600,11 +1600,11 @@ public class CatalogDatabaseTest {
}
};
- VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
+ VfModule vfModule = cd.getVfModuleModelName("tetes", "4kidsl");
}
@Test
- public void ggetVfModuleCustomizationByModelNameTest(){
+ public void ggetVfModuleCustomizationByModelNameTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VfModuleCustomization> list() throws Exception {
@@ -1632,7 +1632,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void ggetVfModuleCustomizationByModelNameEmptyTest(){
+ public void ggetVfModuleCustomizationByModelNameEmptyTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VfModuleCustomization> list() throws Exception {
@@ -1658,7 +1658,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getNetworkResourceTest(){
+ public void getNetworkResourceTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<NetworkResource> list() throws Exception {
@@ -1686,7 +1686,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getNetworkResourceTestEmptyException(){
+ public void getNetworkResourceTestEmptyException() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<NetworkResource> list() throws Exception {
@@ -1712,7 +1712,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getVnfRecipeTest(){
+ public void getVnfRecipeTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -1737,12 +1737,12 @@ public class CatalogDatabaseTest {
}
};
- VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","ergfedrf","4993493");
+ VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes", "ergfedrf", "4993493");
assertEquals("123-id", vnfRecipe.getVfModuleId());
}
@Test
- public void getVnfRecipeEmptyTest(){
+ public void getVnfRecipeEmptyTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -1765,12 +1765,12 @@ public class CatalogDatabaseTest {
}
};
- VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","ergfedrf","4993493");
+ VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes", "ergfedrf", "4993493");
assertEquals(null, vnfRecipe);
}
@Test
- public void getVnfRecipe2Test(){
+ public void getVnfRecipe2Test() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfRecipe> list() throws Exception {
@@ -1793,12 +1793,12 @@ public class CatalogDatabaseTest {
return mockedSession.getMockInstance();
}
};
- VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","4993493");
+ VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes", "4993493");
assertEquals(1, vnfRecipe.getId());
}
@Test
- public void getVnfRecipe2EmptyTest(){
+ public void getVnfRecipe2EmptyTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfRecipe> list() throws Exception {
@@ -1819,12 +1819,12 @@ public class CatalogDatabaseTest {
return mockedSession.getMockInstance();
}
};
- VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","4993493");
+ VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes", "4993493");
assertEquals(null, vnfRecipe);
}
@Test
- public void getVnfRecipeByVfModuleIdTest(){
+ public void getVnfRecipeByVfModuleIdTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfRecipe> list() throws Exception {
@@ -1848,12 +1848,12 @@ public class CatalogDatabaseTest {
}
};
- VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
+ VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes", "4993493", "vnf");
assertEquals(1, vnfRecipe.getId());
}
@Test
- public void getVnfRecipeByVfModuleIdEmptyTest(){
+ public void getVnfRecipeByVfModuleIdEmptyTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfRecipe> list() throws Exception {
@@ -1875,21 +1875,22 @@ public class CatalogDatabaseTest {
}
};
- VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
+ VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes", "4993493", "vnf");
assertEquals(null, vnfRecipe);
}
@Test(expected = Exception.class)
- public void getVfModuleTypeTestException(){
+ public void getVfModuleTypeTestException() {
VfModule vnf = cd.getVfModuleType("4993493");
}
@Test(expected = Exception.class)
- public void getVfModuleType2TestException(){
- VfModule vnf = cd.getVfModuleType("4993493","vnf");
+ public void getVfModuleType2TestException() {
+ VfModule vnf = cd.getVfModuleType("4993493", "vnf");
}
+
@Test
- public void getVnfResourceByServiceUuidTest(){
+ public void getVnfResourceByServiceUuidTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -1918,7 +1919,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = NonUniqueResultException.class)
- public void getVnfResourceByServiceUuidNURExceptionTest(){
+ public void getVnfResourceByServiceUuidNURExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -1944,7 +1945,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = HibernateException.class)
- public void getVnfResourceByServiceUuidHibernateExceptionTest(){
+ public void getVnfResourceByServiceUuidHibernateExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -1970,7 +1971,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void getVnfResourceByServiceUuidExceptionTest(){
+ public void getVnfResourceByServiceUuidExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -1996,7 +1997,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getVnfResourceByVnfUuidTest(){
+ public void getVnfResourceByVnfUuidTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -2026,7 +2027,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = NonUniqueResultException.class)
- public void getVnfResourceByVnfUuidNURExceptionTest(){
+ public void getVnfResourceByVnfUuidNURExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -2053,7 +2054,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = HibernateException.class)
- public void getVnfResourceByVnfUuidHibernateExceptionTest(){
+ public void getVnfResourceByVnfUuidHibernateExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -2080,7 +2081,7 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void getVnfResourceByVnfUuidExceptionTest(){
+ public void getVnfResourceByVnfUuidExceptionTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@Mock
@@ -2107,7 +2108,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getVfModuleByModelInvariantUuidTest(){
+ public void getVfModuleByModelInvariantUuidTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -2138,7 +2139,7 @@ public class CatalogDatabaseTest {
}
@Test
- public void getVfModuleByModelInvariantUuidEmptyTest(){
+ public void getVfModuleByModelInvariantUuidEmptyTest() {
MockUp<Query> mockUpQuery = new MockUp<Query>() {
@@ -2167,370 +2168,450 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void getVfModuleByModelCustomizationUuidTestException(){
+ public void getVfModuleByModelCustomizationUuidTestException() {
VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getVfModuleByModelInvariantUuidAndModelVersionTestException(){
- VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf");
+ public void getVfModuleByModelInvariantUuidAndModelVersionTestException() {
+ VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493", "vnf");
}
+
@Test(expected = Exception.class)
- public void getVfModuleCustomizationByModelCustomizationIdTestException(){
+ public void getVfModuleCustomizationByModelCustomizationIdTestException() {
VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493");
}
+
@Test(expected = Exception.class)
- public void getVfModuleByModelUuidTestException(){
+ public void getVfModuleByModelUuidTestException() {
VfModule vnf = cd.getVfModuleByModelUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getVnfResourceCustomizationByModelCustomizationUuidTestException(){
+ public void getVnfResourceCustomizationByModelCustomizationUuidTestException() {
VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getVnfResourceCustomizationByModelVersionIdTestException(){
+ public void getVnfResourceCustomizationByModelVersionIdTestException() {
VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493");
}
+
@Test(expected = Exception.class)
- public void getVfModuleByModelCustomizationIdAndVersionTestException(){
- cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test");
+ public void getVfModuleByModelCustomizationIdAndVersionTestException() {
+ cd.getVfModuleByModelCustomizationIdAndVersion("4993493", "test");
}
+
@Test(expected = Exception.class)
- public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantIdTestException(){
- cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493","vnf","test");
+ public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantIdTestException() {
+ cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493", "vnf", "test");
}
+
@Test(expected = Exception.class)
- public void getVnfResourceCustomizationByModelInvariantIdTest(){
- cd.getVnfResourceCustomizationByModelInvariantId("4993493","vnf","test");
+ public void getVnfResourceCustomizationByModelInvariantIdTest() {
+ cd.getVnfResourceCustomizationByModelInvariantId("4993493", "vnf", "test");
}
+
@Test(expected = Exception.class)
- public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest(){
+ public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest() {
cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest(){
- cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493","test");
+ public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest() {
+ cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493", "test");
}
+
@Test(expected = Exception.class)
- public void getAllVfModuleCustomizationstest(){
+ public void getAllVfModuleCustomizationstest() {
cd.getAllVfModuleCustomizations("4993493");
}
+
@Test(expected = Exception.class)
- public void getVnfResourceByModelUuidTest(){
+ public void getVnfResourceByModelUuidTest() {
cd.getVnfResourceByModelUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getVnfResCustomToVfModuleTest(){
- cd.getVnfResCustomToVfModule("4993493","test");
+ public void getVnfResCustomToVfModuleTest() {
+ cd.getVnfResCustomToVfModule("4993493", "test");
}
+
@Test(expected = Exception.class)
- public void getVfModulesForVnfResourceTest(){
+ public void getVfModulesForVnfResourceTest() {
VnfResource vnfResource = new VnfResource();
vnfResource.setModelUuid("48839");
cd.getVfModulesForVnfResource(vnfResource);
}
+
@Test(expected = Exception.class)
- public void getVfModulesForVnfResource2Test(){
+ public void getVfModulesForVnfResource2Test() {
cd.getVfModulesForVnfResource("4993493");
}
+
@Test(expected = Exception.class)
- public void getServiceByUuidTest(){
+ public void getServiceByUuidTest() {
cd.getServiceByUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getNetworkResourceById2Test(){
+ public void getNetworkResourceById2Test() {
cd.getNetworkResourceById(4993493);
}
+
@Test(expected = Exception.class)
- public void getNetworkResourceByIdTest(){
+ public void getNetworkResourceByIdTest() {
cd.getVfModuleTypeByUuid("4993493");
}
+
@Test
- public void isEmptyOrNullTest(){
+ public void isEmptyOrNullTest() {
boolean is = cd.isEmptyOrNull("4993493");
assertFalse(is);
}
+
@Test(expected = Exception.class)
- public void getSTRTest(){
- cd.getSTR("4993493","test","vnf");
+ public void getSTRTest() {
+ cd.getSTR("4993493", "test", "vnf");
}
+
@Test(expected = Exception.class)
- public void getVRCtoVFMCTest(){
- cd.getVRCtoVFMC("4993493","388492");
+ public void getVRCtoVFMCTest() {
+ cd.getVRCtoVFMC("4993493", "388492");
}
+
@Test(expected = Exception.class)
- public void getVfModuleTypeByUuidTestException(){
+ public void getVfModuleTypeByUuidTestException() {
cd.getVfModuleTypeByUuid("4993493");
}
@Test(expected = Exception.class)
- public void getTempNetworkHeatTemplateLookupTest(){
+ public void getTempNetworkHeatTemplateLookupTest() {
cd.getTempNetworkHeatTemplateLookup("4993493");
}
@Test(expected = Exception.class)
- public void getAllNetworksByServiceModelUuidTest(){
+ public void getAllNetworksByServiceModelUuidTest() {
cd.getAllNetworksByServiceModelUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllNetworksByServiceModelInvariantUuidTest(){
+ public void getAllNetworksByServiceModelInvariantUuidTest() {
cd.getAllNetworksByServiceModelInvariantUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllNetworksByServiceModelInvariantUuid2Test(){
- cd.getAllNetworksByServiceModelInvariantUuid("4993493","test");
+ public void getAllNetworksByServiceModelInvariantUuid2Test() {
+ cd.getAllNetworksByServiceModelInvariantUuid("4993493", "test");
}
+
@Test(expected = Exception.class)
- public void getAllNetworksByNetworkModelCustomizationUuidTest(){
+ public void getAllNetworksByNetworkModelCustomizationUuidTest() {
cd.getAllNetworksByNetworkModelCustomizationUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllNetworksByNetworkTypeTest(){
+ public void getAllNetworksByNetworkTypeTest() {
cd.getAllNetworksByNetworkType("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllVfmcForVrcTest(){
+ public void getAllVfmcForVrcTest() {
VnfResourceCustomization re = new VnfResourceCustomization();
re.setModelCustomizationUuid("377483");
cd.getAllVfmcForVrc(re);
}
+
@Test(expected = Exception.class)
- public void getAllVnfsByServiceModelUuidTest(){
+ public void getAllVnfsByServiceModelUuidTest() {
cd.getAllVnfsByServiceModelUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllVnfsByServiceModelInvariantUuidTest(){
+ public void getAllVnfsByServiceModelInvariantUuidTest() {
cd.getAllVnfsByServiceModelInvariantUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllVnfsByServiceModelInvariantUuid2Test(){
- cd.getAllVnfsByServiceModelInvariantUuid("4993493","test");
+ public void getAllVnfsByServiceModelInvariantUuid2Test() {
+ cd.getAllVnfsByServiceModelInvariantUuid("4993493", "test");
}
+
@Test(expected = Exception.class)
- public void getAllVnfsByServiceNameTest(){
- cd.getAllVnfsByServiceName("4993493","test");
+ public void getAllVnfsByServiceNameTest() {
+ cd.getAllVnfsByServiceName("4993493", "test");
}
+
@Test(expected = Exception.class)
- public void getAllVnfsByServiceName2Test(){
+ public void getAllVnfsByServiceName2Test() {
cd.getAllVnfsByServiceName("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllVnfsByVnfModelCustomizationUuidTest(){
+ public void getAllVnfsByVnfModelCustomizationUuidTest() {
cd.getAllVnfsByVnfModelCustomizationUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllAllottedResourcesByServiceModelUuidTest(){
+ public void getAllAllottedResourcesByServiceModelUuidTest() {
cd.getAllAllottedResourcesByServiceModelUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllAllottedResourcesByServiceModelInvariantUuidTest(){
+ public void getAllAllottedResourcesByServiceModelInvariantUuidTest() {
cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllAllottedResourcesByServiceModelInvariantUuid2Test(){
- cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493","test");
+ public void getAllAllottedResourcesByServiceModelInvariantUuid2Test() {
+ cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493", "test");
}
+
@Test(expected = Exception.class)
- public void getAllAllottedResourcesByArModelCustomizationUuidTest(){
+ public void getAllAllottedResourcesByArModelCustomizationUuidTest() {
cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllottedResourceByModelUuidTest(){
+ public void getAllottedResourceByModelUuidTest() {
cd.getAllottedResourceByModelUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllResourcesByServiceModelUuidTest(){
+ public void getAllResourcesByServiceModelUuidTest() {
cd.getAllResourcesByServiceModelUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllResourcesByServiceModelInvariantUuidTest(){
+ public void getAllResourcesByServiceModelInvariantUuidTest() {
cd.getAllResourcesByServiceModelInvariantUuid("4993493");
}
@Test(expected = Exception.class)
- public void getAllResourcesByServiceModelInvariantUuid2Test(){
- cd.getAllResourcesByServiceModelInvariantUuid("4993493","test");
+ public void getAllResourcesByServiceModelInvariantUuid2Test() {
+ cd.getAllResourcesByServiceModelInvariantUuid("4993493", "test");
}
+
@Test(expected = Exception.class)
- public void getSingleNetworkByModelCustomizationUuidTest(){
+ public void getSingleNetworkByModelCustomizationUuidTest() {
cd.getSingleNetworkByModelCustomizationUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getSingleAllottedResourceByModelCustomizationUuidTest(){
+ public void getSingleAllottedResourceByModelCustomizationUuidTest() {
cd.getSingleAllottedResourceByModelCustomizationUuid("4993493");
}
+
@Test(expected = Exception.class)
- public void getVfModuleRecipeTest(){
- cd.getVfModuleRecipe("4993493","test","get");
+ public void getVfModuleRecipeTest() {
+ cd.getVfModuleRecipe("4993493", "test", "get");
}
+
@Test(expected = Exception.class)
- public void getVfModuleTest(){
- cd.getVfModule("4993493","test","get","v2","vnf");
+ public void getVfModuleTest() {
+ cd.getVfModule("4993493", "test", "get", "v2", "vnf");
}
+
@Test(expected = Exception.class)
- public void getVnfComponentsRecipeTest(){
- cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992");
+ public void getVnfComponentsRecipeTest() {
+ cd.getVnfComponentsRecipe("4993493", "test", "v2", "vnf", "get", "3992");
}
+
@Test(expected = Exception.class)
- public void getVnfComponentsRecipeByVfModuleTest(){
- List <VfModule> resultList = new ArrayList<>();
+ public void getVnfComponentsRecipeByVfModuleTest() {
+ List<VfModule> resultList = new ArrayList<>();
VfModule m = new VfModule();
resultList.add(m);
- cd.getVnfComponentsRecipeByVfModule(resultList,"4993493");
+ cd.getVnfComponentsRecipeByVfModule(resultList, "4993493");
}
+
@Test(expected = Exception.class)
- public void getAllVnfResourcesTest(){
+ public void getAllVnfResourcesTest() {
cd.getAllVnfResources();
}
+
@Test(expected = Exception.class)
- public void getVnfResourcesByRoleTest(){
+ public void getVnfResourcesByRoleTest() {
cd.getVnfResourcesByRole("4993493");
}
+
@Test(expected = Exception.class)
- public void getVnfResourceCustomizationsByRoleTest(){
+ public void getVnfResourceCustomizationsByRoleTest() {
cd.getVnfResourceCustomizationsByRole("4993493");
}
+
@Test(expected = Exception.class)
- public void getAllNetworkResourcesTest(){
+ public void getAllNetworkResourcesTest() {
cd.getAllNetworkResources();
}
+
@Test(expected = Exception.class)
- public void getAllNetworkResourceCustomizationsTest(){
+ public void getAllNetworkResourceCustomizationsTest() {
cd.getAllNetworkResourceCustomizations();
}
+
@Test(expected = Exception.class)
- public void getAllVfModulesTest(){
+ public void getAllVfModulesTest() {
cd.getAllVfModules();
}
+
@Test(expected = Exception.class)
- public void getAllVfModuleCustomizationsTest(){
+ public void getAllVfModuleCustomizationsTest() {
cd.getAllVfModuleCustomizations();
}
+
@Test(expected = Exception.class)
- public void getAllHeatEnvironmentTest(){
+ public void getAllHeatEnvironmentTest() {
cd.getAllHeatEnvironment();
}
+
@Test(expected = Exception.class)
- public void getHeatEnvironment2Test(){
+ public void getHeatEnvironment2Test() {
cd.getHeatEnvironment(4993493);
}
+
@Test(expected = Exception.class)
- public void getNestedTemplatesTest(){
+ public void getNestedTemplatesTest() {
cd.getNestedTemplates(4993493);
}
+
@Test(expected = Exception.class)
- public void getNestedTemplates2Test(){
+ public void getNestedTemplates2Test() {
cd.getNestedTemplates("4993493");
}
+
@Test(expected = Exception.class)
- public void getHeatFilesTest(){
+ public void getHeatFilesTest() {
cd.getHeatFiles(4993493);
}
+
@Test(expected = Exception.class)
- public void getVfModuleToHeatFilesEntryTest(){
- cd.getVfModuleToHeatFilesEntry("4993493","49959499");
+ public void getVfModuleToHeatFilesEntryTest() {
+ cd.getVfModuleToHeatFilesEntry("4993493", "49959499");
}
+
@Test(expected = Exception.class)
- public void getServiceToResourceCustomization(){
- cd.getServiceToResourceCustomization("4993493","599349","49900");
+ public void getServiceToResourceCustomization() {
+ cd.getServiceToResourceCustomization("4993493", "599349", "49900");
}
+
@Test(expected = Exception.class)
- public void getHeatFilesForVfModuleTest(){
+ public void getHeatFilesForVfModuleTest() {
cd.getHeatFilesForVfModule("4993493");
}
+
@Test(expected = Exception.class)
- public void getHeatTemplateTest(){
- cd.getHeatTemplate("4993493","test","heat");
+ public void getHeatTemplateTest() {
+ cd.getHeatTemplate("4993493", "test", "heat");
}
@Test(expected = Exception.class)
- public void saveHeatTemplateTest(){
+ public void saveHeatTemplateTest() {
HeatTemplate heat = new HeatTemplate();
- Set <HeatTemplateParam> paramSet = new HashSet<>();
- cd.saveHeatTemplate(heat,paramSet);
+ Set<HeatTemplateParam> paramSet = new HashSet<>();
+ cd.saveHeatTemplate(heat, paramSet);
}
+
@Test(expected = Exception.class)
- public void getHeatEnvironmentTest(){
- cd.getHeatEnvironment("4993493","test","heat");
+ public void getHeatEnvironmentTest() {
+ cd.getHeatEnvironment("4993493", "test", "heat");
}
+
@Test(expected = Exception.class)
- public void getHeatEnvironment3Test(){
- cd.getHeatEnvironment("4993493","test");
+ public void getHeatEnvironment3Test() {
+ cd.getHeatEnvironment("4993493", "test");
}
+
@Test(expected = Exception.class)
- public void saveHeatEnvironmentTest(){
+ public void saveHeatEnvironmentTest() {
HeatEnvironment en = new HeatEnvironment();
cd.saveHeatEnvironment(en);
}
+
@Test(expected = Exception.class)
- public void saveHeatTemplate2Test(){
+ public void saveHeatTemplate2Test() {
HeatTemplate heat = new HeatTemplate();
cd.saveHeatTemplate(heat);
}
+
@Test(expected = Exception.class)
- public void saveHeatFileTest(){
+ public void saveHeatFileTest() {
HeatFiles hf = new HeatFiles();
cd.saveHeatFile(hf);
}
+
@Test(expected = Exception.class)
- public void saveVnfRecipeTest(){
+ public void saveVnfRecipeTest() {
VnfRecipe vr = new VnfRecipe();
cd.saveVnfRecipe(vr);
}
+
@Test(expected = Exception.class)
- public void saveVnfComponentsRecipe(){
+ public void saveVnfComponentsRecipe() {
VnfComponentsRecipe vr = new VnfComponentsRecipe();
cd.saveVnfComponentsRecipe(vr);
}
+
@Test(expected = Exception.class)
- public void saveOrUpdateVnfResourceTest(){
+ public void saveOrUpdateVnfResourceTest() {
VnfResource vr = new VnfResource();
cd.saveOrUpdateVnfResource(vr);
}
+
@Test(expected = Exception.class)
- public void saveVnfResourceCustomizationTest(){
+ public void saveVnfResourceCustomizationTest() {
VnfResourceCustomization vr = new VnfResourceCustomization();
cd.saveVnfResourceCustomization(vr);
}
+
@Test(expected = Exception.class)
- public void saveAllottedResourceCustomizationTest(){
+ public void saveAllottedResourceCustomizationTest() {
AllottedResourceCustomization arc = new AllottedResourceCustomization();
cd.saveAllottedResourceCustomization(arc);
}
+
@Test(expected = Exception.class)
- public void saveAllottedResourceTest(){
+ public void saveAllottedResourceTest() {
AllottedResource ar = new AllottedResource();
cd.saveAllottedResource(ar);
}
+
@Test(expected = Exception.class)
public void saveNetworkResourceTest() throws RecordNotFoundException {
NetworkResource nr = new NetworkResource();
cd.saveNetworkResource(nr);
}
+
@Test(expected = Exception.class)
- public void saveToscaCsarTest()throws RecordNotFoundException {
+ public void saveToscaCsarTest() throws RecordNotFoundException {
ToscaCsar ts = new ToscaCsar();
cd.saveToscaCsar(ts);
}
+
@Test(expected = Exception.class)
- public void getToscaCsar(){
+ public void getToscaCsar() {
cd.getToscaCsar("4993493");
}
+
@Test(expected = Exception.class)
- public void saveTempNetworkHeatTemplateLookupTest(){
+ public void saveTempNetworkHeatTemplateLookupTest() {
TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup();
cd.saveTempNetworkHeatTemplateLookup(t);
}
+
@Test(expected = Exception.class)
- public void saveVfModuleToHeatFiles(){
+ public void saveVfModuleToHeatFiles() {
VfModuleToHeatFiles v = new VfModuleToHeatFiles();
cd.saveVfModuleToHeatFiles(v);
}
+
@Test(expected = Exception.class)
public void saveVnfResourceToVfModuleCustomizationTest() throws RecordNotFoundException {
- VnfResourceCustomization v =new VnfResourceCustomization();
+ VnfResourceCustomization v = new VnfResourceCustomization();
VfModuleCustomization vm = new VfModuleCustomization();
cd.saveVnfResourceToVfModuleCustomization(v, vm);
}
+
@Test(expected = Exception.class)
public void saveNetworkResourceCustomizationTest() throws RecordNotFoundException {
NetworkResourceCustomization nrc = new NetworkResourceCustomization();
@@ -2538,139 +2619,163 @@ public class CatalogDatabaseTest {
}
@Test(expected = Exception.class)
- public void saveServiceToNetworksTest(){
+ public void saveServiceToNetworksTest() {
AllottedResource ar = new AllottedResource();
cd.saveAllottedResource(ar);
}
+
@Test(expected = Exception.class)
- public void saveServiceToResourceCustomizationTest(){
+ public void saveServiceToResourceCustomizationTest() {
ServiceToResourceCustomization ar = new ServiceToResourceCustomization();
cd.saveServiceToResourceCustomization(ar);
}
+
@Test(expected = Exception.class)
- public void saveServiceTest(){
+ public void saveServiceTest() {
Service ar = new Service();
cd.saveService(ar);
}
+
@Test(expected = Exception.class)
- public void saveOrUpdateVfModuleTest(){
+ public void saveOrUpdateVfModuleTest() {
VfModule ar = new VfModule();
cd.saveOrUpdateVfModule(ar);
}
+
@Test(expected = Exception.class)
- public void saveOrUpdateVfModuleCustomizationTest(){
+ public void saveOrUpdateVfModuleCustomizationTest() {
VfModuleCustomization ar = new VfModuleCustomization();
cd.saveOrUpdateVfModuleCustomization(ar);
}
@Test(expected = Exception.class)
- public void getNestedHeatTemplateTest(){
- cd.getNestedHeatTemplate(101,201);
+ public void getNestedHeatTemplateTest() {
+ cd.getNestedHeatTemplate(101, 201);
}
+
@Test(expected = Exception.class)
- public void getNestedHeatTemplate2Test(){
- cd.getNestedHeatTemplate("1002","1002");
+ public void getNestedHeatTemplate2Test() {
+ cd.getNestedHeatTemplate("1002", "1002");
}
+
@Test(expected = Exception.class)
- public void saveNestedHeatTemplateTest(){
+ public void saveNestedHeatTemplateTest() {
HeatTemplate ar = new HeatTemplate();
- cd.saveNestedHeatTemplate("1001",ar,"test");
+ cd.saveNestedHeatTemplate("1001", ar, "test");
}
+
@Test(expected = Exception.class)
- public void getHeatFiles2Test(){
+ public void getHeatFiles2Test() {
VfModuleCustomization ar = new VfModuleCustomization();
- cd.getHeatFiles(101,"test","1001","v2");
+ cd.getHeatFiles(101, "test", "1001", "v2");
}
+
@Test(expected = Exception.class)
- public void getHeatFiles3Test(){
+ public void getHeatFiles3Test() {
VfModuleCustomization ar = new VfModuleCustomization();
cd.getHeatFiles("200192");
}
+
@Test(expected = Exception.class)
- public void saveHeatFilesTest(){
+ public void saveHeatFilesTest() {
HeatFiles ar = new HeatFiles();
cd.saveHeatFiles(ar);
}
+
@Test(expected = Exception.class)
- public void saveVfModuleToHeatFilesTest(){
+ public void saveVfModuleToHeatFilesTest() {
HeatFiles ar = new HeatFiles();
- cd.saveVfModuleToHeatFiles("3772893",ar);
+ cd.saveVfModuleToHeatFiles("3772893", ar);
}
+
@Test
- public void getNetworkResourceByModelUuidTest(){
+ public void getNetworkResourceByModelUuidTest() {
cd.getNetworkResourceByModelUuid("3899291");
}
+
@Test(expected = Exception.class)
- public void getNetworkRecipeTest(){
+ public void getNetworkRecipeTest() {
- cd.getNetworkRecipe("test","test1","test2");
+ cd.getNetworkRecipe("test", "test1", "test2");
}
+
@Test(expected = Exception.class)
- public void getNetworkRecipe2Test(){
+ public void getNetworkRecipe2Test() {
- cd.getNetworkRecipe("test","test1");
+ cd.getNetworkRecipe("test", "test1");
}
+
@Test
- public void getNetworkResourceByModelCustUuidTest(){
+ public void getNetworkResourceByModelCustUuidTest() {
cd.getNetworkResourceByModelCustUuid("test");
}
+
@Test(expected = Exception.class)
- public void getVnfComponentsRecipe2Test(){
+ public void getVnfComponentsRecipe2Test() {
- cd.getVnfComponentsRecipe("test1","test2","test3","test4");
+ cd.getVnfComponentsRecipe("test1", "test2", "test3", "test4");
}
+
@Test(expected = Exception.class)
- public void getVnfComponentsRecipeByVfModuleModelUUIdTest(){
+ public void getVnfComponentsRecipeByVfModuleModelUUIdTest() {
- cd.getVnfComponentsRecipeByVfModuleModelUUId("test1","test2","test3");
+ cd.getVnfComponentsRecipeByVfModuleModelUUId("test1", "test2", "test3");
}
+
@Test(expected = Exception.class)
- public void getVnfComponentRecipesTest(){
+ public void getVnfComponentRecipesTest() {
cd.getVnfComponentRecipes("test");
}
+
@Test(expected = Exception.class)
- public void saveOrUpdateVnfComponentTest(){
+ public void saveOrUpdateVnfComponentTest() {
VnfComponent ar = new VnfComponent();
cd.saveOrUpdateVnfComponent(ar);
}
@Test(expected = Exception.class)
- public void getVfModule2Test(){
+ public void getVfModule2Test() {
cd.getVfModule("test");
}
+
@Test(expected = Exception.class)
- public void getVfModuleByModelUUIDTest(){
+ public void getVfModuleByModelUUIDTest() {
cd.getVfModuleByModelUUID("test");
}
+
@Test(expected = Exception.class)
- public void getServiceRecipeByModelUUIDTest(){
+ public void getServiceRecipeByModelUUIDTest() {
- cd.getServiceRecipeByModelUUID("test1","test2");
+ cd.getServiceRecipeByModelUUID("test1", "test2");
}
+
@Test(expected = Exception.class)
- public void getModelRecipeTest(){
+ public void getModelRecipeTest() {
- cd.getModelRecipe("test1","test2","test3");
+ cd.getModelRecipe("test1", "test2", "test3");
}
+
@Test(expected = Exception.class)
- public void healthCheck(){
+ public void healthCheck() {
cd.healthCheck();
}
+
@Test(expected = Exception.class)
- public void executeQuerySingleRow(){
+ public void executeQuerySingleRow() {
VnfComponent ar = new VnfComponent();
HashMap<String, String> variables = new HashMap<>();
- cd.executeQuerySingleRow("tets",variables,false);
+ cd.executeQuerySingleRow("tets", variables, false);
}
+
@Test(expected = Exception.class)
- public void executeQueryMultipleRows(){
+ public void executeQueryMultipleRows() {
HashMap<String, String> variables = new HashMap<>();
- cd.executeQueryMultipleRows("select",variables,false);
+ cd.executeQueryMultipleRows("select", variables, false);
}
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java
index da4e87806c..d25daf02f9 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java
@@ -39,49 +39,49 @@ import org.openecomp.mso.db.catalog.beans.HeatFiles;
public class HeatFilesTest {
- @Test
- public final void heatFilesTest() {
-
- HeatFiles heatFiles = new HeatFiles();
- heatFiles.setFileBody("testBody");
- heatFiles.setArtifactUuid(UUID.randomUUID().toString());
- assertTrue(heatFiles.getFileBody().equals("testBody"));
- assertTrue(!heatFiles.toString().contains("8 chars"));
- heatFiles.setFileBody(null);
- assertTrue(!heatFiles.toString().contains("Not defined"));
- heatFiles.setVersion("12");
- assertTrue(heatFiles.getVersion().equals("12"));
-
- heatFiles.setFileName("File");
- assertTrue(heatFiles.getFileName().equalsIgnoreCase("File"));
-
- heatFiles.setCreated(null);
- assertTrue(heatFiles.getCreated() == null);
- heatFiles.setAsdcUuid("asdc");
-
- assertTrue(heatFiles.getAsdcUuid().equalsIgnoreCase("asdc"));
-
- heatFiles.setDescription("desc");
- assertTrue(heatFiles.getDescription().equalsIgnoreCase("desc"));
-
-
- heatFiles.setArtifactChecksum("artifactChecksum");
- assertTrue(heatFiles.getArtifactChecksum().equalsIgnoreCase("artifactChecksum"));
- File tempFile;
- try {
- tempFile = File.createTempFile("heatFiles", "test");
- tempFile.deleteOnExit();
- try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile), "utf-8"))) {
- writer.write("something\n");
- writer.write("something2\n");
- }
- heatFiles.setFileBody(tempFile.getAbsolutePath());
- assertTrue(heatFiles.getFileBody().contains("test"));
- } catch (IOException e) {
- e.printStackTrace();
- fail("Exception caught");
- }
-
- }
+ @Test
+ public final void heatFilesTest() {
+
+ HeatFiles heatFiles = new HeatFiles();
+ heatFiles.setFileBody("testBody");
+ heatFiles.setArtifactUuid(UUID.randomUUID().toString());
+ assertTrue(heatFiles.getFileBody().equals("testBody"));
+ assertTrue(!heatFiles.toString().contains("8 chars"));
+ heatFiles.setFileBody(null);
+ assertTrue(!heatFiles.toString().contains("Not defined"));
+ heatFiles.setVersion("12");
+ assertTrue(heatFiles.getVersion().equals("12"));
+
+ heatFiles.setFileName("File");
+ assertTrue(heatFiles.getFileName().equalsIgnoreCase("File"));
+
+ heatFiles.setCreated(null);
+ assertTrue(heatFiles.getCreated() == null);
+ heatFiles.setAsdcUuid("asdc");
+
+ assertTrue(heatFiles.getAsdcUuid().equalsIgnoreCase("asdc"));
+
+ heatFiles.setDescription("desc");
+ assertTrue(heatFiles.getDescription().equalsIgnoreCase("desc"));
+
+
+ heatFiles.setArtifactChecksum("artifactChecksum");
+ assertTrue(heatFiles.getArtifactChecksum().equalsIgnoreCase("artifactChecksum"));
+ File tempFile;
+ try {
+ tempFile = File.createTempFile("heatFiles", "test");
+ tempFile.deleteOnExit();
+ try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile), "utf-8"))) {
+ writer.write("something\n");
+ writer.write("something2\n");
+ }
+ heatFiles.setFileBody(tempFile.getAbsolutePath());
+ assertTrue(heatFiles.getFileBody().contains("test"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("Exception caught");
+ }
+
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java
index cf79d5b0d1..39ec365f88 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatTemplateTest.java
@@ -41,48 +41,48 @@ import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
*/
public class HeatTemplateTest {
-
+
@Test
- public final void heatTemplateTest () {
- HeatTemplate heatTemplate = new HeatTemplate ();
- heatTemplate.setTemplateBody ("testBody");
+ public final void heatTemplateTest() {
+ HeatTemplate heatTemplate = new HeatTemplate();
+ heatTemplate.setTemplateBody("testBody");
heatTemplate.setArtifactUuid(UUID.randomUUID().toString());
- assertTrue (heatTemplate.getHeatTemplate ().equals ("testBody"));
- assertTrue (heatTemplate.toString ().contains ("8 chars"));
- heatTemplate.setTemplateBody (null);
- assertTrue (heatTemplate.toString ().contains ("Not defined"));
- HashSet<HeatTemplateParam> set = new HashSet<> ();
- HeatTemplateParam param = new HeatTemplateParam ();
- param.setParamName ("param name");
- param.setParamType ("string");
- param.setRequired (false);
+ assertTrue(heatTemplate.getHeatTemplate().equals("testBody"));
+ assertTrue(heatTemplate.toString().contains("8 chars"));
+ heatTemplate.setTemplateBody(null);
+ assertTrue(heatTemplate.toString().contains("Not defined"));
+ HashSet<HeatTemplateParam> set = new HashSet<>();
+ HeatTemplateParam param = new HeatTemplateParam();
+ param.setParamName("param name");
+ param.setParamType("string");
+ param.setRequired(false);
param.setHeatTemplateArtifactUuid(UUID.randomUUID().toString());
- set.add (param);
- HeatTemplateParam param2 = new HeatTemplateParam ();
- param2.setParamName ("param 2");
- param2.setParamType ("string");
- param2.setRequired (true);
+ set.add(param);
+ HeatTemplateParam param2 = new HeatTemplateParam();
+ param2.setParamName("param 2");
+ param2.setParamType("string");
+ param2.setRequired(true);
param2.setHeatTemplateArtifactUuid(UUID.randomUUID().toString());
- set.add (param2);
- heatTemplate.setParameters (set);
- String heatStr = heatTemplate.toString ();
- assertTrue (heatStr.contains ("param name"));
- assertTrue (heatStr.contains ("param 2(reqd)"));
+ set.add(param2);
+ heatTemplate.setParameters(set);
+ String heatStr = heatTemplate.toString();
+ assertTrue(heatStr.contains("param name"));
+ assertTrue(heatStr.contains("param 2(reqd)"));
File tempFile;
try {
- tempFile = File.createTempFile ("heatTemplate", "test");
- tempFile.deleteOnExit ();
- try (Writer writer = new BufferedWriter (new OutputStreamWriter (new FileOutputStream (tempFile),
- "utf-8"))) {
- writer.write ("something\n");
- writer.write ("something2\n");
+ tempFile = File.createTempFile("heatTemplate", "test");
+ tempFile.deleteOnExit();
+ try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile),
+ "utf-8"))) {
+ writer.write("something\n");
+ writer.write("something2\n");
}
- heatTemplate.setTemplateBody(tempFile.getAbsolutePath ());
- assertTrue (heatTemplate.getHeatTemplate ().contains ("test"));
+ heatTemplate.setTemplateBody(tempFile.getAbsolutePath());
+ assertTrue(heatTemplate.getHeatTemplate().contains("test"));
} catch (IOException e) {
- e.printStackTrace ();
- fail ("Exception caught");
+ e.printStackTrace();
+ fail("Exception caught");
}
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java
index c99a714b11..615246b071 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java
@@ -35,153 +35,153 @@ import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
public class MavenVersioningTest {
- @Test
- public final void testVersion () {
- MavenLikeVersioning mavenVersioning = new MavenLikeVersioning ();
- assertFalse(mavenVersioning.isMoreRecentThan("0.0.0"));
- assertFalse(mavenVersioning.isMoreRecentThan(null));
- mavenVersioning.setVersion("0.0.1");
-
- assertFalse(mavenVersioning.isMoreRecentThan(null));
- assertTrue(mavenVersioning.isMoreRecentThan("0.0.0"));
- assertTrue(mavenVersioning.isMoreRecentThan("0.0.0.1"));
-
- assertFalse(mavenVersioning.isMoreRecentThan("0.0.2"));
- assertFalse(mavenVersioning.isMoreRecentThan("0.0.1"));
- assertFalse(mavenVersioning.isMoreRecentThan("00.00.01"));
-
- assertFalse(mavenVersioning.isMoreRecentThan("0.1"));
- assertFalse(mavenVersioning.isMoreRecentThan("1"));
- assertFalse(mavenVersioning.isMoreRecentThan("0.1.0.2"));
-
- assertFalse(mavenVersioning.isMoreRecentThan("0.1.1"));
- assertFalse(mavenVersioning.isMoreRecentThan("2.1.1"));
-
- mavenVersioning.setVersion("1.0.1");
- assertTrue(mavenVersioning.isMoreRecentThan("0.0.0"));
- assertTrue(mavenVersioning.isMoreRecentThan("0.5.2"));
- assertTrue(mavenVersioning.isMoreRecentThan("1.0.0"));
-
- assertFalse(mavenVersioning.isMoreRecentThan("2.1.1"));
- assertFalse(mavenVersioning.isMoreRecentThan("02.001.0001"));
- assertFalse(mavenVersioning.isMoreRecentThan("1.0.1"));
- assertFalse(mavenVersioning.isMoreRecentThan("1.0.2"));
- assertFalse(mavenVersioning.isMoreRecentThan("1.1.1"));
- assertFalse(mavenVersioning.isMoreRecentThan("1.0.10"));
-
-
- mavenVersioning.setVersion("100.0.1");
- assertTrue(mavenVersioning.isMoreRecentThan("0.0.0"));
- assertTrue(mavenVersioning.isMoreRecentThan("0.5.2"));
- assertTrue(mavenVersioning.isMoreRecentThan("1.0.0"));
-
- assertFalse(mavenVersioning.isMoreRecentThan("101.1.1"));
- assertFalse(mavenVersioning.isMoreRecentThan("100.0.1"));
- assertFalse(mavenVersioning.isMoreRecentThan("100.0.2"));
- assertFalse(mavenVersioning.isMoreRecentThan("100.1.1"));
-
- assertFalse(mavenVersioning.isMoreRecentThan("100.0.1.4"));
- }
-
- @Test
- public final void testOneDigitVersion() {
- MavenLikeVersioning oneDigit = new MavenLikeVersioning();
- oneDigit.setVersion("1");
- assertFalse(oneDigit.isMoreRecentThan("2"));
- assertFalse(oneDigit.isMoreRecentThan("2.0"));
- assertFalse(oneDigit.isMoreRecentThan("1.0"));
-
- oneDigit.setVersion("1.0");
- assertTrue(oneDigit.isMoreRecentThan("1"));
-
- oneDigit.setVersion("1");
- assertFalse(oneDigit.isTheSameVersion("1.1"));
- assertFalse(oneDigit.isTheSameVersion("1.0"));
- assertFalse(oneDigit.isTheSameVersion("1.0.0"));
-
- oneDigit.setVersion("2");
- assertTrue(oneDigit.isMoreRecentThan("1"));
- assertTrue(oneDigit.isMoreRecentThan("1.0"));
- assertTrue(oneDigit.isMoreRecentThan("1.1"));
- assertTrue(oneDigit.isMoreRecentThan("0.1"));
- assertFalse(oneDigit.isMoreRecentThan("2.0"));
-
- }
-
- @Test
- public final void testVersionEquals () {
-
- MavenLikeVersioning heatTemplate = new MavenLikeVersioning();
- assertFalse(heatTemplate.isTheSameVersion("100.0"));
- assertTrue(heatTemplate.isTheSameVersion(null));
- heatTemplate.setVersion("100.0.1");
- assertFalse(heatTemplate.isTheSameVersion(null));
- assertFalse(heatTemplate.isTheSameVersion("100.0"));
- assertFalse(heatTemplate.isTheSameVersion("100"));
- assertFalse(heatTemplate.isTheSameVersion("100.0.1.1"));
- assertTrue(heatTemplate.isTheSameVersion("100.0.1"));
- assertTrue(heatTemplate.isTheSameVersion("00100.000.0001"));
- assertFalse(heatTemplate.isTheSameVersion("0.0.1"));
- assertTrue(heatTemplate.isTheSameVersion("100.0.01"));
-
- }
-
- @Test
- public final void testListSort () {
- MavenLikeVersioning test1 = new MavenLikeVersioning();
- test1.setVersion("1.1");
- MavenLikeVersioning test2 = new MavenLikeVersioning();
- test2.setVersion("1.10");
- MavenLikeVersioning test3 = new MavenLikeVersioning();
- test3.setVersion("1.2");
- MavenLikeVersioning test4 = new MavenLikeVersioning();
- test4.setVersion("1.20");
- MavenLikeVersioning test5 = new MavenLikeVersioning();
- test5.setVersion("1.02");
- MavenLikeVersioning test6 = new MavenLikeVersioning();
- test6.setVersion("2.02");
- MavenLikeVersioning test7 = new MavenLikeVersioning();
- test7.setVersion("0.02");
- MavenLikeVersioning test8 = new MavenLikeVersioning();
- test8.setVersion("2.02");
- MavenLikeVersioning test9 = new MavenLikeVersioning();
- test9.setVersion("10.2004");
- MavenLikeVersioning test10 = new MavenLikeVersioning();
- test10.setVersion("2");
- MavenLikeVersioning test11 = new MavenLikeVersioning();
- test11.setVersion("12");
- MavenLikeVersioning test12 = new MavenLikeVersioning();
- test12.setVersion("2.0");
-
- List<MavenLikeVersioning> list= new LinkedList<>();
- list.add(test1);
- list.add(test2);
- list.add(test3);
- list.add(test4);
- list.add(test5);
- list.add(test6);
- list.add(test7);
- list.add(test8);
- list.add(test9);
- list.add(test10);
- list.add(test11);
- list.add(test12);
-
- list.sort(new MavenLikeVersioningComparator());
- //Collections.reverse(list);
- assertTrue(list.get(0).getVersion().equals("0.02"));
- assertTrue(list.get(1).getVersion().equals("1.1"));
- assertTrue(list.get(2).getVersion().equals("1.02") || list.get(3).getVersion().equals("1.02"));
- assertTrue(list.get(3).getVersion().equals("1.2") || list.get(2).getVersion().equals("1.2"));
- assertTrue(list.get(4).getVersion().equals("1.10"));
- assertTrue(list.get(5).getVersion().equals("1.20"));
- assertTrue(list.get(6).getVersion().equals("2"));
- assertTrue(list.get(7).getVersion().equals("2.0"));
- assertTrue(list.get(8).getVersion().equals("2.02"));
- assertTrue(list.get(9).getVersion().equals("2.02"));
- assertTrue(list.get(10).getVersion().equals("10.2004"));
- assertTrue(list.get(11).getVersion().equals("12"));
-
- }
+ @Test
+ public final void testVersion() {
+ MavenLikeVersioning mavenVersioning = new MavenLikeVersioning();
+ assertFalse(mavenVersioning.isMoreRecentThan("0.0.0"));
+ assertFalse(mavenVersioning.isMoreRecentThan(null));
+ mavenVersioning.setVersion("0.0.1");
+
+ assertFalse(mavenVersioning.isMoreRecentThan(null));
+ assertTrue(mavenVersioning.isMoreRecentThan("0.0.0"));
+ assertTrue(mavenVersioning.isMoreRecentThan("0.0.0.1"));
+
+ assertFalse(mavenVersioning.isMoreRecentThan("0.0.2"));
+ assertFalse(mavenVersioning.isMoreRecentThan("0.0.1"));
+ assertFalse(mavenVersioning.isMoreRecentThan("00.00.01"));
+
+ assertFalse(mavenVersioning.isMoreRecentThan("0.1"));
+ assertFalse(mavenVersioning.isMoreRecentThan("1"));
+ assertFalse(mavenVersioning.isMoreRecentThan("0.1.0.2"));
+
+ assertFalse(mavenVersioning.isMoreRecentThan("0.1.1"));
+ assertFalse(mavenVersioning.isMoreRecentThan("2.1.1"));
+
+ mavenVersioning.setVersion("1.0.1");
+ assertTrue(mavenVersioning.isMoreRecentThan("0.0.0"));
+ assertTrue(mavenVersioning.isMoreRecentThan("0.5.2"));
+ assertTrue(mavenVersioning.isMoreRecentThan("1.0.0"));
+
+ assertFalse(mavenVersioning.isMoreRecentThan("2.1.1"));
+ assertFalse(mavenVersioning.isMoreRecentThan("02.001.0001"));
+ assertFalse(mavenVersioning.isMoreRecentThan("1.0.1"));
+ assertFalse(mavenVersioning.isMoreRecentThan("1.0.2"));
+ assertFalse(mavenVersioning.isMoreRecentThan("1.1.1"));
+ assertFalse(mavenVersioning.isMoreRecentThan("1.0.10"));
+
+
+ mavenVersioning.setVersion("100.0.1");
+ assertTrue(mavenVersioning.isMoreRecentThan("0.0.0"));
+ assertTrue(mavenVersioning.isMoreRecentThan("0.5.2"));
+ assertTrue(mavenVersioning.isMoreRecentThan("1.0.0"));
+
+ assertFalse(mavenVersioning.isMoreRecentThan("101.1.1"));
+ assertFalse(mavenVersioning.isMoreRecentThan("100.0.1"));
+ assertFalse(mavenVersioning.isMoreRecentThan("100.0.2"));
+ assertFalse(mavenVersioning.isMoreRecentThan("100.1.1"));
+
+ assertFalse(mavenVersioning.isMoreRecentThan("100.0.1.4"));
+ }
+
+ @Test
+ public final void testOneDigitVersion() {
+ MavenLikeVersioning oneDigit = new MavenLikeVersioning();
+ oneDigit.setVersion("1");
+ assertFalse(oneDigit.isMoreRecentThan("2"));
+ assertFalse(oneDigit.isMoreRecentThan("2.0"));
+ assertFalse(oneDigit.isMoreRecentThan("1.0"));
+
+ oneDigit.setVersion("1.0");
+ assertTrue(oneDigit.isMoreRecentThan("1"));
+
+ oneDigit.setVersion("1");
+ assertFalse(oneDigit.isTheSameVersion("1.1"));
+ assertFalse(oneDigit.isTheSameVersion("1.0"));
+ assertFalse(oneDigit.isTheSameVersion("1.0.0"));
+
+ oneDigit.setVersion("2");
+ assertTrue(oneDigit.isMoreRecentThan("1"));
+ assertTrue(oneDigit.isMoreRecentThan("1.0"));
+ assertTrue(oneDigit.isMoreRecentThan("1.1"));
+ assertTrue(oneDigit.isMoreRecentThan("0.1"));
+ assertFalse(oneDigit.isMoreRecentThan("2.0"));
+
+ }
+
+ @Test
+ public final void testVersionEquals() {
+
+ MavenLikeVersioning heatTemplate = new MavenLikeVersioning();
+ assertFalse(heatTemplate.isTheSameVersion("100.0"));
+ assertTrue(heatTemplate.isTheSameVersion(null));
+ heatTemplate.setVersion("100.0.1");
+ assertFalse(heatTemplate.isTheSameVersion(null));
+ assertFalse(heatTemplate.isTheSameVersion("100.0"));
+ assertFalse(heatTemplate.isTheSameVersion("100"));
+ assertFalse(heatTemplate.isTheSameVersion("100.0.1.1"));
+ assertTrue(heatTemplate.isTheSameVersion("100.0.1"));
+ assertTrue(heatTemplate.isTheSameVersion("00100.000.0001"));
+ assertFalse(heatTemplate.isTheSameVersion("0.0.1"));
+ assertTrue(heatTemplate.isTheSameVersion("100.0.01"));
+
+ }
+
+ @Test
+ public final void testListSort() {
+ MavenLikeVersioning test1 = new MavenLikeVersioning();
+ test1.setVersion("1.1");
+ MavenLikeVersioning test2 = new MavenLikeVersioning();
+ test2.setVersion("1.10");
+ MavenLikeVersioning test3 = new MavenLikeVersioning();
+ test3.setVersion("1.2");
+ MavenLikeVersioning test4 = new MavenLikeVersioning();
+ test4.setVersion("1.20");
+ MavenLikeVersioning test5 = new MavenLikeVersioning();
+ test5.setVersion("1.02");
+ MavenLikeVersioning test6 = new MavenLikeVersioning();
+ test6.setVersion("2.02");
+ MavenLikeVersioning test7 = new MavenLikeVersioning();
+ test7.setVersion("0.02");
+ MavenLikeVersioning test8 = new MavenLikeVersioning();
+ test8.setVersion("2.02");
+ MavenLikeVersioning test9 = new MavenLikeVersioning();
+ test9.setVersion("10.2004");
+ MavenLikeVersioning test10 = new MavenLikeVersioning();
+ test10.setVersion("2");
+ MavenLikeVersioning test11 = new MavenLikeVersioning();
+ test11.setVersion("12");
+ MavenLikeVersioning test12 = new MavenLikeVersioning();
+ test12.setVersion("2.0");
+
+ List<MavenLikeVersioning> list = new LinkedList<>();
+ list.add(test1);
+ list.add(test2);
+ list.add(test3);
+ list.add(test4);
+ list.add(test5);
+ list.add(test6);
+ list.add(test7);
+ list.add(test8);
+ list.add(test9);
+ list.add(test10);
+ list.add(test11);
+ list.add(test12);
+
+ list.sort(new MavenLikeVersioningComparator());
+ //Collections.reverse(list);
+ assertTrue(list.get(0).getVersion().equals("0.02"));
+ assertTrue(list.get(1).getVersion().equals("1.1"));
+ assertTrue(list.get(2).getVersion().equals("1.02") || list.get(3).getVersion().equals("1.02"));
+ assertTrue(list.get(3).getVersion().equals("1.2") || list.get(2).getVersion().equals("1.2"));
+ assertTrue(list.get(4).getVersion().equals("1.10"));
+ assertTrue(list.get(5).getVersion().equals("1.20"));
+ assertTrue(list.get(6).getVersion().equals("2"));
+ assertTrue(list.get(7).getVersion().equals("2.0"));
+ assertTrue(list.get(8).getVersion().equals("2.02"));
+ assertTrue(list.get(9).getVersion().equals("2.02"));
+ assertTrue(list.get(10).getVersion().equals("10.2004"));
+ assertTrue(list.get(11).getVersion().equals("12"));
+
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java
index d70f267cc1..dff06e456c 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java
@@ -32,28 +32,28 @@ import org.openecomp.mso.db.catalog.beans.ModelRecipe;
public class ModelRecipeTest {
- @Test
- public final void modelRecipeDataTest() {
- ModelRecipe modelRecipe = new ModelRecipe();
- modelRecipe.setAction("action");
- assertTrue(modelRecipe.getAction().equalsIgnoreCase("action"));
- modelRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(modelRecipe.getCreated() != null);
- modelRecipe.setDescription("description");
- assertTrue(modelRecipe.getDescription().equalsIgnoreCase("description"));
- modelRecipe.setId(1);
- assertTrue(modelRecipe.getId() == 1);
- modelRecipe.setModelId(1);
- assertTrue(modelRecipe.getModelId() == 1);
- modelRecipe.setModelParamXSD("modelParamXSD");
- assertTrue(modelRecipe.getModelParamXSD().equalsIgnoreCase("modelParamXSD"));
- modelRecipe.setOrchestrationUri("orchestrationUri");
- assertTrue(modelRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
- modelRecipe.setRecipeTimeout(1);
- assertTrue(modelRecipe.getRecipeTimeout() == 1);
- modelRecipe.setSchemaVersion("schemaVersion");
- assertTrue(modelRecipe.getSchemaVersion().equalsIgnoreCase("schemaVersion"));
+ @Test
+ public final void modelRecipeDataTest() {
+ ModelRecipe modelRecipe = new ModelRecipe();
+ modelRecipe.setAction("action");
+ assertTrue(modelRecipe.getAction().equalsIgnoreCase("action"));
+ modelRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(modelRecipe.getCreated() != null);
+ modelRecipe.setDescription("description");
+ assertTrue(modelRecipe.getDescription().equalsIgnoreCase("description"));
+ modelRecipe.setId(1);
+ assertTrue(modelRecipe.getId() == 1);
+ modelRecipe.setModelId(1);
+ assertTrue(modelRecipe.getModelId() == 1);
+ modelRecipe.setModelParamXSD("modelParamXSD");
+ assertTrue(modelRecipe.getModelParamXSD().equalsIgnoreCase("modelParamXSD"));
+ modelRecipe.setOrchestrationUri("orchestrationUri");
+ assertTrue(modelRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
+ modelRecipe.setRecipeTimeout(1);
+ assertTrue(modelRecipe.getRecipeTimeout() == 1);
+ modelRecipe.setSchemaVersion("schemaVersion");
+ assertTrue(modelRecipe.getSchemaVersion().equalsIgnoreCase("schemaVersion"));
// assertTrue(modelRecipe.toString() != null);
- }
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java
index dcc9810042..26b10bd6a6 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java
@@ -32,38 +32,38 @@ import org.openecomp.mso.db.catalog.beans.Model;
public class ModelTest {
- @Test
- public final void modelDataTest() {
- Model model = new Model();
- model.setId(1);
- assertTrue(model.getId() == 1);
+ @Test
+ public final void modelDataTest() {
+ Model model = new Model();
+ model.setId(1);
+ assertTrue(model.getId() == 1);
- model.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(model.getCreated() != null);
- model.setModelCustomizationId("modelCustomizationId");
+ model.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(model.getCreated() != null);
+ model.setModelCustomizationId("modelCustomizationId");
- assertTrue(model.getModelCustomizationId().equalsIgnoreCase("modelCustomizationId"));
- model.setModelCustomizationName("modelCustomizationName");
- assertTrue(model.getModelCustomizationName().equalsIgnoreCase("modelCustomizationName"));
+ assertTrue(model.getModelCustomizationId().equalsIgnoreCase("modelCustomizationId"));
+ model.setModelCustomizationName("modelCustomizationName");
+ assertTrue(model.getModelCustomizationName().equalsIgnoreCase("modelCustomizationName"));
- model.setModelInvariantId("modelInvariantId");
- assertTrue(model.getModelInvariantId().equalsIgnoreCase("modelInvariantId"));
- model.setModelName("modelName");
- assertTrue(model.getModelName().equalsIgnoreCase("modelName"));
+ model.setModelInvariantId("modelInvariantId");
+ assertTrue(model.getModelInvariantId().equalsIgnoreCase("modelInvariantId"));
+ model.setModelName("modelName");
+ assertTrue(model.getModelName().equalsIgnoreCase("modelName"));
- model.setModelType("modelType");
- assertTrue(model.getModelType().equalsIgnoreCase("modelType"));
- model.setModelVersion("modelVersion");
- assertTrue(model.getModelVersion().equalsIgnoreCase("modelVersion"));
- model.setModelVersionId("modelVersionId");
- assertTrue(model.getModelVersionId().equalsIgnoreCase("modelVersionId"));
- model.setVersion("1");
- assertTrue(model.getVersion().equalsIgnoreCase("1"));
- model.setRecipes(null);
+ model.setModelType("modelType");
+ assertTrue(model.getModelType().equalsIgnoreCase("modelType"));
+ model.setModelVersion("modelVersion");
+ assertTrue(model.getModelVersion().equalsIgnoreCase("modelVersion"));
+ model.setModelVersionId("modelVersionId");
+ assertTrue(model.getModelVersionId().equalsIgnoreCase("modelVersionId"));
+ model.setVersion("1");
+ assertTrue(model.getVersion().equalsIgnoreCase("1"));
+ model.setRecipes(null);
- assertTrue(model.getRecipes() == null);
+ assertTrue(model.getRecipes() == null);
// assertTrue(model.toString() != null);
- }
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java
index c17b50e738..69700f9351 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java
@@ -32,32 +32,32 @@ import org.openecomp.mso.db.catalog.beans.NetworkRecipe;
public class NetworkRecipeTest {
- @Test
- public final void networkRecipeDataTest() {
-
- NetworkRecipe networkRecipe = new NetworkRecipe();
- networkRecipe.setAction("action");
- assertTrue(networkRecipe.getAction().equalsIgnoreCase("action"));
- networkRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(networkRecipe.getCreated() != null);
- networkRecipe.setDescription("description");
- assertTrue(networkRecipe.getDescription().equalsIgnoreCase("description"));
- networkRecipe.setId(1);
- assertTrue(networkRecipe.getId() == 1);
- networkRecipe.setModelName("modelName");
- assertTrue(networkRecipe.getModelName().equalsIgnoreCase("modelName"));
- networkRecipe.setParamXSD("networkParamXSD");
- assertTrue(networkRecipe.getParamXSD().equalsIgnoreCase("networkParamXSD"));
- networkRecipe.setOrchestrationUri("orchestrationUri");
- assertTrue(networkRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
- networkRecipe.setRecipeTimeout(1);
- assertTrue(networkRecipe.getRecipeTimeout() == 1);
- networkRecipe.setServiceType("serviceType");
- assertTrue(networkRecipe.getServiceType().equalsIgnoreCase("serviceType"));
- networkRecipe.setVersion("version");
- assertTrue(networkRecipe.getVersion().equalsIgnoreCase("version"));
+ @Test
+ public final void networkRecipeDataTest() {
+
+ NetworkRecipe networkRecipe = new NetworkRecipe();
+ networkRecipe.setAction("action");
+ assertTrue(networkRecipe.getAction().equalsIgnoreCase("action"));
+ networkRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(networkRecipe.getCreated() != null);
+ networkRecipe.setDescription("description");
+ assertTrue(networkRecipe.getDescription().equalsIgnoreCase("description"));
+ networkRecipe.setId(1);
+ assertTrue(networkRecipe.getId() == 1);
+ networkRecipe.setModelName("modelName");
+ assertTrue(networkRecipe.getModelName().equalsIgnoreCase("modelName"));
+ networkRecipe.setParamXSD("networkParamXSD");
+ assertTrue(networkRecipe.getParamXSD().equalsIgnoreCase("networkParamXSD"));
+ networkRecipe.setOrchestrationUri("orchestrationUri");
+ assertTrue(networkRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
+ networkRecipe.setRecipeTimeout(1);
+ assertTrue(networkRecipe.getRecipeTimeout() == 1);
+ networkRecipe.setServiceType("serviceType");
+ assertTrue(networkRecipe.getServiceType().equalsIgnoreCase("serviceType"));
+ networkRecipe.setVersion("version");
+ assertTrue(networkRecipe.getVersion().equalsIgnoreCase("version"));
// assertTrue(networkRecipe.toString() != null);
- }
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java
index 7b54854fd9..5a10de9809 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java
@@ -33,30 +33,30 @@ import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
public class NetworkResourceCustomizationTest {
- @Test
- public final void networkResourceCustomizationDataTest() {
- NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
- networkResourceCustomization.setModelCustomizationUuid("modelCustomizationUuid");
- assertTrue(networkResourceCustomization.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid"));
- networkResourceCustomization.setModelInstanceName("modelInstanceName");
- assertTrue(networkResourceCustomization.getModelInstanceName().equalsIgnoreCase("modelInstanceName"));
- networkResourceCustomization.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(networkResourceCustomization.getCreated() != null);
- networkResourceCustomization.setNetworkResource(new NetworkResource());
- assertTrue(networkResourceCustomization.getNetworkResource() != null);
- networkResourceCustomization.setNetworkResourceModelUuid("networkResourceModelUuid");
- assertTrue(networkResourceCustomization.getNetworkResourceModelUuid()
- .equalsIgnoreCase("networkResourceModelUuid"));
- networkResourceCustomization.setNetworkRole("networkRole");
- assertTrue(networkResourceCustomization.getNetworkRole().equalsIgnoreCase("networkRole"));
- networkResourceCustomization.setNetworkScope("networkScope");
- assertTrue(networkResourceCustomization.getNetworkScope().equalsIgnoreCase("networkScope"));
- networkResourceCustomization.setNetworkTechnology("networkTechnology");
- assertTrue(networkResourceCustomization.getNetworkTechnology().equalsIgnoreCase("networkTechnology"));
- networkResourceCustomization.setNetworkType("networkType");
- assertTrue(networkResourceCustomization.getNetworkType().equalsIgnoreCase("networkType"));
+ @Test
+ public final void networkResourceCustomizationDataTest() {
+ NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
+ networkResourceCustomization.setModelCustomizationUuid("modelCustomizationUuid");
+ assertTrue(networkResourceCustomization.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid"));
+ networkResourceCustomization.setModelInstanceName("modelInstanceName");
+ assertTrue(networkResourceCustomization.getModelInstanceName().equalsIgnoreCase("modelInstanceName"));
+ networkResourceCustomization.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(networkResourceCustomization.getCreated() != null);
+ networkResourceCustomization.setNetworkResource(new NetworkResource());
+ assertTrue(networkResourceCustomization.getNetworkResource() != null);
+ networkResourceCustomization.setNetworkResourceModelUuid("networkResourceModelUuid");
+ assertTrue(networkResourceCustomization.getNetworkResourceModelUuid()
+ .equalsIgnoreCase("networkResourceModelUuid"));
+ networkResourceCustomization.setNetworkRole("networkRole");
+ assertTrue(networkResourceCustomization.getNetworkRole().equalsIgnoreCase("networkRole"));
+ networkResourceCustomization.setNetworkScope("networkScope");
+ assertTrue(networkResourceCustomization.getNetworkScope().equalsIgnoreCase("networkScope"));
+ networkResourceCustomization.setNetworkTechnology("networkTechnology");
+ assertTrue(networkResourceCustomization.getNetworkTechnology().equalsIgnoreCase("networkTechnology"));
+ networkResourceCustomization.setNetworkType("networkType");
+ assertTrue(networkResourceCustomization.getNetworkType().equalsIgnoreCase("networkType"));
// assertTrue(networkResourceCustomization.toString() != null);
- }
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java
index 11ee57b86b..b10f61d77f 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java
@@ -32,37 +32,37 @@ import org.openecomp.mso.db.catalog.beans.NetworkResource;
public class NetworkResourceTest {
- @Test
- public final void networkResourceDataTest() {
- NetworkResource networkResource = new NetworkResource();
- networkResource.setAicVersionMax("aicVersionMax");
- assertTrue(networkResource.getAicVersionMax().equalsIgnoreCase("aicVersionMax"));
- networkResource.setAicVersionMin("aicVersionMin");
- assertTrue(networkResource.getAicVersionMin().equalsIgnoreCase("aicVersionMin"));
- networkResource.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(networkResource.getCreated() != null);
- networkResource.setDescription("description");
- assertTrue(networkResource.getDescription().equalsIgnoreCase("description"));
- networkResource.setHeatTemplateArtifactUUID("heatTemplateArtifactUUID");
- assertTrue(networkResource.getHeatTemplateArtifactUUID().equalsIgnoreCase("heatTemplateArtifactUUID"));
- networkResource.setModelInvariantUUID("modelInvariantUUID");
- assertTrue(networkResource.getModelInvariantUUID().equalsIgnoreCase("modelInvariantUUID"));
- networkResource.setModelName("modelName");
- assertTrue(networkResource.getModelName().equalsIgnoreCase("modelName"));
- networkResource.setModelUUID("modelUUID");
- assertTrue(networkResource.getModelUUID().equalsIgnoreCase("modelUUID"));
- networkResource.setModelVersion("modelVersion");
- assertTrue(networkResource.getModelVersion().equalsIgnoreCase("modelVersion"));
- networkResource.setNeutronNetworkType("neutronNetworkType");
- assertTrue(networkResource.getNeutronNetworkType().equalsIgnoreCase("neutronNetworkType"));
- networkResource.setOrchestrationMode("orchestrationMode");
- assertTrue(networkResource.getOrchestrationMode().equalsIgnoreCase("orchestrationMode"));
- networkResource.setToscaNodeType("toscaNodeType");
- assertTrue(networkResource.getToscaNodeType().equalsIgnoreCase("toscaNodeType"));
- networkResource.setVersion("1");
- assertTrue(networkResource.getVersion().equalsIgnoreCase("1"));
+ @Test
+ public final void networkResourceDataTest() {
+ NetworkResource networkResource = new NetworkResource();
+ networkResource.setAicVersionMax("aicVersionMax");
+ assertTrue(networkResource.getAicVersionMax().equalsIgnoreCase("aicVersionMax"));
+ networkResource.setAicVersionMin("aicVersionMin");
+ assertTrue(networkResource.getAicVersionMin().equalsIgnoreCase("aicVersionMin"));
+ networkResource.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(networkResource.getCreated() != null);
+ networkResource.setDescription("description");
+ assertTrue(networkResource.getDescription().equalsIgnoreCase("description"));
+ networkResource.setHeatTemplateArtifactUUID("heatTemplateArtifactUUID");
+ assertTrue(networkResource.getHeatTemplateArtifactUUID().equalsIgnoreCase("heatTemplateArtifactUUID"));
+ networkResource.setModelInvariantUUID("modelInvariantUUID");
+ assertTrue(networkResource.getModelInvariantUUID().equalsIgnoreCase("modelInvariantUUID"));
+ networkResource.setModelName("modelName");
+ assertTrue(networkResource.getModelName().equalsIgnoreCase("modelName"));
+ networkResource.setModelUUID("modelUUID");
+ assertTrue(networkResource.getModelUUID().equalsIgnoreCase("modelUUID"));
+ networkResource.setModelVersion("modelVersion");
+ assertTrue(networkResource.getModelVersion().equalsIgnoreCase("modelVersion"));
+ networkResource.setNeutronNetworkType("neutronNetworkType");
+ assertTrue(networkResource.getNeutronNetworkType().equalsIgnoreCase("neutronNetworkType"));
+ networkResource.setOrchestrationMode("orchestrationMode");
+ assertTrue(networkResource.getOrchestrationMode().equalsIgnoreCase("orchestrationMode"));
+ networkResource.setToscaNodeType("toscaNodeType");
+ assertTrue(networkResource.getToscaNodeType().equalsIgnoreCase("toscaNodeType"));
+ networkResource.setVersion("1");
+ assertTrue(networkResource.getVersion().equalsIgnoreCase("1"));
// assertTrue(networkResource.toString() != null);
- }
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java
index 49dc9b7079..62f8c274b5 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java
@@ -32,24 +32,24 @@ import org.openecomp.mso.db.catalog.beans.Recipe;
public class RecipeTest {
- @Test
- public final void recipeDataTest() {
- Recipe recipe = new Recipe();
- recipe.setAction("action");
- assertTrue(recipe.getAction().equalsIgnoreCase("action"));
- recipe.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(recipe.getCreated() != null);
- recipe.setDescription("description");
- assertTrue(recipe.getDescription().equalsIgnoreCase("description"));
- recipe.setId(1);
- assertTrue(recipe.getId() == 1);
- recipe.setOrchestrationUri("orchestrationUri");
- assertTrue(recipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
- recipe.setRecipeTimeout(1);
- assertTrue(recipe.getRecipeTimeout() == 1);
- recipe.setServiceType("serviceType");
- assertTrue(recipe.getServiceType().equalsIgnoreCase("serviceType"));
+ @Test
+ public final void recipeDataTest() {
+ Recipe recipe = new Recipe();
+ recipe.setAction("action");
+ assertTrue(recipe.getAction().equalsIgnoreCase("action"));
+ recipe.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(recipe.getCreated() != null);
+ recipe.setDescription("description");
+ assertTrue(recipe.getDescription().equalsIgnoreCase("description"));
+ recipe.setId(1);
+ assertTrue(recipe.getId() == 1);
+ recipe.setOrchestrationUri("orchestrationUri");
+ assertTrue(recipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
+ recipe.setRecipeTimeout(1);
+ assertTrue(recipe.getRecipeTimeout() == 1);
+ recipe.setServiceType("serviceType");
+ assertTrue(recipe.getServiceType().equalsIgnoreCase("serviceType"));
// assertTrue(recipe.toString() != null);
- }
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java
index 0e3492170e..02d35bf0ca 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java
@@ -34,15 +34,15 @@ import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
public class ServiceMacroHolderTest {
- @Test
- public final void serviceMacroHolderDataTest() {
- ServiceMacroHolder serviceMacroHolder = new ServiceMacroHolder();
- assertTrue(serviceMacroHolder.getService() == null);
- serviceMacroHolder.addVnfResource(new VnfResource());
- serviceMacroHolder.addVnfResourceCustomizations(new VnfResourceCustomization());
- serviceMacroHolder.addNetworkResourceCustomization(new NetworkResourceCustomization());
- serviceMacroHolder.addAllottedResourceCustomization(new AllottedResourceCustomization());
- assertTrue(serviceMacroHolder != null);
- }
+ @Test
+ public final void serviceMacroHolderDataTest() {
+ ServiceMacroHolder serviceMacroHolder = new ServiceMacroHolder();
+ assertTrue(serviceMacroHolder.getService() == null);
+ serviceMacroHolder.addVnfResource(new VnfResource());
+ serviceMacroHolder.addVnfResourceCustomizations(new VnfResourceCustomization());
+ serviceMacroHolder.addNetworkResourceCustomization(new NetworkResourceCustomization());
+ serviceMacroHolder.addAllottedResourceCustomization(new AllottedResourceCustomization());
+ assertTrue(serviceMacroHolder != null);
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java
index 4b4a5adf4a..6890b6b508 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java
@@ -33,33 +33,33 @@ import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
public class ServiceRecipeTest {
- @Test
- public final void serviceRecipeDataTest() {
+ @Test
+ public final void serviceRecipeDataTest() {
- ServiceRecipe serviceRecipe = new ServiceRecipe();
- serviceRecipe.setAction("action");
- assertTrue(serviceRecipe.getAction().equalsIgnoreCase("action"));
- serviceRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(serviceRecipe.getCreated() != null);
- serviceRecipe.setDescription("description");
- assertTrue(serviceRecipe.getDescription().equalsIgnoreCase("description"));
- serviceRecipe.setId(1);
- assertTrue(serviceRecipe.getId() == 1);
- serviceRecipe.setOrchestrationUri("orchestrationUri");
- assertTrue(serviceRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
- serviceRecipe.setRecipeTimeout(1);
- assertTrue(serviceRecipe.getRecipeTimeout() == 1);
- serviceRecipe.setVersion("version");
- assertTrue(serviceRecipe.getVersion().equalsIgnoreCase("version"));
- serviceRecipe.setServiceTimeoutInterim(1);
- assertTrue(serviceRecipe.getServiceTimeoutInterim() == 1);
- serviceRecipe.setServiceParamXSD("serviceParamXSD");
- assertTrue(serviceRecipe.getServiceParamXSD().equalsIgnoreCase("serviceParamXSD"));
- assertTrue(serviceRecipe.toString() != null);
- ServiceRecipe serviceRecipeWithValue = new ServiceRecipe(1, "string", "string", "string", "string", "string", 1,
- 1, new Date());
- assertTrue(serviceRecipeWithValue.toString() != null);
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setAction("action");
+ assertTrue(serviceRecipe.getAction().equalsIgnoreCase("action"));
+ serviceRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(serviceRecipe.getCreated() != null);
+ serviceRecipe.setDescription("description");
+ assertTrue(serviceRecipe.getDescription().equalsIgnoreCase("description"));
+ serviceRecipe.setId(1);
+ assertTrue(serviceRecipe.getId() == 1);
+ serviceRecipe.setOrchestrationUri("orchestrationUri");
+ assertTrue(serviceRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
+ serviceRecipe.setRecipeTimeout(1);
+ assertTrue(serviceRecipe.getRecipeTimeout() == 1);
+ serviceRecipe.setVersion("version");
+ assertTrue(serviceRecipe.getVersion().equalsIgnoreCase("version"));
+ serviceRecipe.setServiceTimeoutInterim(1);
+ assertTrue(serviceRecipe.getServiceTimeoutInterim() == 1);
+ serviceRecipe.setServiceParamXSD("serviceParamXSD");
+ assertTrue(serviceRecipe.getServiceParamXSD().equalsIgnoreCase("serviceParamXSD"));
+ assertTrue(serviceRecipe.toString() != null);
+ ServiceRecipe serviceRecipeWithValue = new ServiceRecipe(1, "string", "string", "string", "string", "string", 1,
+ 1, new Date());
+ assertTrue(serviceRecipeWithValue.toString() != null);
- }
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceTest.java
index 12c55e7a48..df7fa405c3 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceTest.java
@@ -32,36 +32,36 @@ import org.openecomp.mso.db.catalog.beans.Service;
public class ServiceTest {
- @Test
- public final void recipeDataTest() {
- Service service = new Service();
- service.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(service.getCreated() != null);
- service.setDescription("description");
- assertTrue(service.getDescription().equalsIgnoreCase("description"));
+ @Test
+ public final void recipeDataTest() {
+ Service service = new Service();
+ service.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(service.getCreated() != null);
+ service.setDescription("description");
+ assertTrue(service.getDescription().equalsIgnoreCase("description"));
- service.setModelInvariantUUID("action");
- assertTrue(service.getModelInvariantUUID().equalsIgnoreCase("action"));
+ service.setModelInvariantUUID("action");
+ assertTrue(service.getModelInvariantUUID().equalsIgnoreCase("action"));
- service.setModelName("modelName");
- assertTrue(service.getModelName().equalsIgnoreCase("modelName"));
+ service.setModelName("modelName");
+ assertTrue(service.getModelName().equalsIgnoreCase("modelName"));
- service.setModelUUID("modelUUID");
- assertTrue(service.getModelUUID().equalsIgnoreCase("modelUUID"));
- service.setModelVersion("modelVersion");
- assertTrue(service.getModelVersion().equalsIgnoreCase("modelVersion"));
- service.setServiceRole("serviceRole");
- assertTrue(service.getServiceRole().equalsIgnoreCase("serviceRole"));
- service.setToscaCsarArtifactUUID("toscaCsarArtifactUUID");
- assertTrue(service.getToscaCsarArtifactUUID().equalsIgnoreCase("toscaCsarArtifactUUID"));
+ service.setModelUUID("modelUUID");
+ assertTrue(service.getModelUUID().equalsIgnoreCase("modelUUID"));
+ service.setModelVersion("modelVersion");
+ assertTrue(service.getModelVersion().equalsIgnoreCase("modelVersion"));
+ service.setServiceRole("serviceRole");
+ assertTrue(service.getServiceRole().equalsIgnoreCase("serviceRole"));
+ service.setToscaCsarArtifactUUID("toscaCsarArtifactUUID");
+ assertTrue(service.getToscaCsarArtifactUUID().equalsIgnoreCase("toscaCsarArtifactUUID"));
- service.setServiceType("serviceType");
- assertTrue(service.getServiceType().equalsIgnoreCase("serviceType"));
- service.setRecipes(null);
- assertTrue(service.getRecipes() == null);
- service.setServiceResourceCustomizations(null);
- assertTrue(service.getServiceResourceCustomizations() == null);
+ service.setServiceType("serviceType");
+ assertTrue(service.getServiceType().equalsIgnoreCase("serviceType"));
+ service.setRecipes(null);
+ assertTrue(service.getRecipes() == null);
+ service.setServiceResourceCustomizations(null);
+ assertTrue(service.getServiceResourceCustomizations() == null);
- }
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToAllottedResourcesTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToAllottedResourcesTest.java
index b2aaeeed4e..86cd746024 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToAllottedResourcesTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToAllottedResourcesTest.java
@@ -32,18 +32,18 @@ import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
public class ServiceToAllottedResourcesTest {
- @Test
- public final void serviceToAllottedResourcesDataTest() {
- ServiceToAllottedResources serviceToAllottedResources = new ServiceToAllottedResources();
- serviceToAllottedResources.setArModelCustomizationUuid("arModelCustomizationUuid");
- assertTrue(
- serviceToAllottedResources.getArModelCustomizationUuid().equalsIgnoreCase("arModelCustomizationUuid"));
- serviceToAllottedResources.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(serviceToAllottedResources.getCreated() != null);
- serviceToAllottedResources.setServiceModelUuid("serviceModelUuid");
- assertTrue(serviceToAllottedResources.getServiceModelUuid().equalsIgnoreCase("serviceModelUuid"));
-// assertTrue(serviceToAllottedResources.toString() != null);
-
- }
+ @Test
+ public final void serviceToAllottedResourcesDataTest() {
+ ServiceToAllottedResources serviceToAllottedResources = new ServiceToAllottedResources();
+ serviceToAllottedResources.setArModelCustomizationUuid("arModelCustomizationUuid");
+ assertTrue(
+ serviceToAllottedResources.getArModelCustomizationUuid().equalsIgnoreCase("arModelCustomizationUuid"));
+ serviceToAllottedResources.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(serviceToAllottedResources.getCreated() != null);
+ serviceToAllottedResources.setServiceModelUuid("serviceModelUuid");
+ assertTrue(serviceToAllottedResources.getServiceModelUuid().equalsIgnoreCase("serviceModelUuid"));
+// assertTrue(serviceToAllottedResources.toString() != null);
+
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToResourceCustomizationTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToResourceCustomizationTest.java
index 337cf4b574..51c4083be5 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToResourceCustomizationTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceToResourceCustomizationTest.java
@@ -32,18 +32,18 @@ import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
public class ServiceToResourceCustomizationTest {
- @Test
- public final void serviceToResourceCustomizationDataTest() {
- ServiceToAllottedResources serviceToResourceCustomization = new ServiceToAllottedResources();
- serviceToResourceCustomization.setArModelCustomizationUuid("arModelCustomizationUuid");
- assertTrue(
- serviceToResourceCustomization.getArModelCustomizationUuid().equalsIgnoreCase("arModelCustomizationUuid"));
- serviceToResourceCustomization.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(serviceToResourceCustomization.getCreated() != null);
- serviceToResourceCustomization.setServiceModelUuid("serviceModelUuid");
- assertTrue(serviceToResourceCustomization.getServiceModelUuid().equalsIgnoreCase("serviceModelUuid"));
-// assertTrue(serviceToResourceCustomization.toString() != null);
-
- }
+ @Test
+ public final void serviceToResourceCustomizationDataTest() {
+ ServiceToAllottedResources serviceToResourceCustomization = new ServiceToAllottedResources();
+ serviceToResourceCustomization.setArModelCustomizationUuid("arModelCustomizationUuid");
+ assertTrue(
+ serviceToResourceCustomization.getArModelCustomizationUuid().equalsIgnoreCase("arModelCustomizationUuid"));
+ serviceToResourceCustomization.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(serviceToResourceCustomization.getCreated() != null);
+ serviceToResourceCustomization.setServiceModelUuid("serviceModelUuid");
+ assertTrue(serviceToResourceCustomization.getServiceModelUuid().equalsIgnoreCase("serviceModelUuid"));
+// assertTrue(serviceToResourceCustomization.toString() != null);
+
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/TempNetworkHeatTemplateLookupTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/TempNetworkHeatTemplateLookupTest.java
index b0ccfdd781..4a8d92ef42 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/TempNetworkHeatTemplateLookupTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/TempNetworkHeatTemplateLookupTest.java
@@ -30,21 +30,21 @@ import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup;
public class TempNetworkHeatTemplateLookupTest {
- @Test
- public final void tempNetworkHeatTemplateLookupDataTest() {
- TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup = new TempNetworkHeatTemplateLookup();
- tempNetworkHeatTemplateLookup.setAicVersionMax("aicVersionMax");
- assertTrue(tempNetworkHeatTemplateLookup.getAicVersionMax().equalsIgnoreCase("aicVersionMax"));
- tempNetworkHeatTemplateLookup.setAicVersionMin("aicVersionMin");
- assertTrue(tempNetworkHeatTemplateLookup.getAicVersionMin().equalsIgnoreCase("aicVersionMin"));
- tempNetworkHeatTemplateLookup.setHeatTemplateArtifactUuid("heatTemplateArtifactUuid");
- assertTrue(tempNetworkHeatTemplateLookup.getHeatTemplateArtifactUuid()
- .equalsIgnoreCase("heatTemplateArtifactUuid"));
- tempNetworkHeatTemplateLookup.setNetworkResourceModelName("networkResourceModelName");
- assertTrue(tempNetworkHeatTemplateLookup.getNetworkResourceModelName()
- .equalsIgnoreCase("networkResourceModelName"));
-// assertTrue(tempNetworkHeatTemplateLookup.toString() != null);
-
- }
+ @Test
+ public final void tempNetworkHeatTemplateLookupDataTest() {
+ TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup = new TempNetworkHeatTemplateLookup();
+ tempNetworkHeatTemplateLookup.setAicVersionMax("aicVersionMax");
+ assertTrue(tempNetworkHeatTemplateLookup.getAicVersionMax().equalsIgnoreCase("aicVersionMax"));
+ tempNetworkHeatTemplateLookup.setAicVersionMin("aicVersionMin");
+ assertTrue(tempNetworkHeatTemplateLookup.getAicVersionMin().equalsIgnoreCase("aicVersionMin"));
+ tempNetworkHeatTemplateLookup.setHeatTemplateArtifactUuid("heatTemplateArtifactUuid");
+ assertTrue(tempNetworkHeatTemplateLookup.getHeatTemplateArtifactUuid()
+ .equalsIgnoreCase("heatTemplateArtifactUuid"));
+ tempNetworkHeatTemplateLookup.setNetworkResourceModelName("networkResourceModelName");
+ assertTrue(tempNetworkHeatTemplateLookup.getNetworkResourceModelName()
+ .equalsIgnoreCase("networkResourceModelName"));
+// assertTrue(tempNetworkHeatTemplateLookup.toString() != null);
+
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java
index 05e857f178..66e422e059 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java
@@ -48,104 +48,104 @@ import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
public class ToStringTest {
- @Test
- public void testTModelRecipeToString(){
- ModelRecipe mr = new ModelRecipe();
- mr.setCreated(new Timestamp(10001));
- mr.setModelId(102);
- mr.setRecipeTimeout(100);
- String str = mr.toString();
- assertTrue(str != null);
- }
-
- @Test
- public void networkResourcetoStringTest(){
- NetworkResource nr = new NetworkResource();
- nr.setCreated(new Timestamp(10000));
- String str = nr.toString();
- assertTrue(str != null);
- }
-
- @Test
- public void modelTestToString(){
- Model m = new Model();
- m.setCreated(new Timestamp(100000));
- m.setId(1001);
- m.setModelCustomizationId("10012");
- String str = m.toString();
- assertTrue(str != null);
- }
-
- @Test
- public void serviceMacroHolderTest(){
- ServiceMacroHolder smh = new ServiceMacroHolder();
- Service service = new Service();
- Map<String,ServiceRecipe> recipes = new HashMap<>();
- recipes.put("test", new ServiceRecipe());
- service.setRecipes(recipes);
-
- Set<ServiceToResourceCustomization> serviceResourceCustomizations = new HashSet<>();
- ServiceToResourceCustomization sr = new ServiceToResourceCustomization();
- serviceResourceCustomizations.add(sr);
- service.setServiceResourceCustomizations(serviceResourceCustomizations);
- smh.setService(service);
-
- ArrayList<VnfResource> vnflist = new ArrayList<>();
- smh.setVnfResources(vnflist);
-
- VnfResource vr = new VnfResource();
- Set<VnfResourceCustomization> vnfResourceCustomization = new HashSet<>();
- vnfResourceCustomization.add(new VnfResourceCustomization());
- vr.setVnfResourceCustomizations(vnfResourceCustomization);
-
- Set<VfModule> vfModules = new HashSet<>();
- vfModules.add(new VfModule());
- vr.setVfModules(vfModules);
- smh.addVnfResource(vr);
-
- ArrayList<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
- smh.setVnfResourceCustomizations(vnfResourceCustomizations);
-
- VnfResourceCustomization vrc = new VnfResourceCustomization();
- smh.addVnfResourceCustomizations(vrc);
-
- ArrayList<NetworkResourceCustomization> networkResourceCustomizations = new ArrayList<>();
- smh.setNetworkResourceCustomization(networkResourceCustomizations);
-
- NetworkResourceCustomization nrc = new NetworkResourceCustomization();
- smh.addNetworkResourceCustomization(nrc);
-
- ArrayList<AllottedResourceCustomization> allottedResourceCustomizations = new ArrayList<>();
- smh.setAllottedResourceCustomization(allottedResourceCustomizations);
-
- AllottedResourceCustomization arc = new AllottedResourceCustomization();
- smh.addAllottedResourceCustomization(arc);
-
- String str = smh.toString();
- assertTrue(str != null);
- }
-
- @Test
- public void heatFilesTest(){
- HeatFiles hf = new HeatFiles();
- String str = hf.toString();
- assertTrue(str != null);
-
- }
-
- @Test
- public void testVnfConponent(){
- VnfComponent vnf = new VnfComponent();
- String str = vnf.toString();
- assertTrue(str != null);
- }
-
- @Test
- public void testTempNetworkHeatTemplateLookup(){
- TempNetworkHeatTemplateLookup tn =new TempNetworkHeatTemplateLookup();
- String str = tn.toString();
- assertTrue(str != null);
- }
-
-
+ @Test
+ public void testTModelRecipeToString() {
+ ModelRecipe mr = new ModelRecipe();
+ mr.setCreated(new Timestamp(10001));
+ mr.setModelId(102);
+ mr.setRecipeTimeout(100);
+ String str = mr.toString();
+ assertTrue(str != null);
+ }
+
+ @Test
+ public void networkResourcetoStringTest() {
+ NetworkResource nr = new NetworkResource();
+ nr.setCreated(new Timestamp(10000));
+ String str = nr.toString();
+ assertTrue(str != null);
+ }
+
+ @Test
+ public void modelTestToString() {
+ Model m = new Model();
+ m.setCreated(new Timestamp(100000));
+ m.setId(1001);
+ m.setModelCustomizationId("10012");
+ String str = m.toString();
+ assertTrue(str != null);
+ }
+
+ @Test
+ public void serviceMacroHolderTest() {
+ ServiceMacroHolder smh = new ServiceMacroHolder();
+ Service service = new Service();
+ Map<String, ServiceRecipe> recipes = new HashMap<>();
+ recipes.put("test", new ServiceRecipe());
+ service.setRecipes(recipes);
+
+ Set<ServiceToResourceCustomization> serviceResourceCustomizations = new HashSet<>();
+ ServiceToResourceCustomization sr = new ServiceToResourceCustomization();
+ serviceResourceCustomizations.add(sr);
+ service.setServiceResourceCustomizations(serviceResourceCustomizations);
+ smh.setService(service);
+
+ ArrayList<VnfResource> vnflist = new ArrayList<>();
+ smh.setVnfResources(vnflist);
+
+ VnfResource vr = new VnfResource();
+ Set<VnfResourceCustomization> vnfResourceCustomization = new HashSet<>();
+ vnfResourceCustomization.add(new VnfResourceCustomization());
+ vr.setVnfResourceCustomizations(vnfResourceCustomization);
+
+ Set<VfModule> vfModules = new HashSet<>();
+ vfModules.add(new VfModule());
+ vr.setVfModules(vfModules);
+ smh.addVnfResource(vr);
+
+ ArrayList<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
+ smh.setVnfResourceCustomizations(vnfResourceCustomizations);
+
+ VnfResourceCustomization vrc = new VnfResourceCustomization();
+ smh.addVnfResourceCustomizations(vrc);
+
+ ArrayList<NetworkResourceCustomization> networkResourceCustomizations = new ArrayList<>();
+ smh.setNetworkResourceCustomization(networkResourceCustomizations);
+
+ NetworkResourceCustomization nrc = new NetworkResourceCustomization();
+ smh.addNetworkResourceCustomization(nrc);
+
+ ArrayList<AllottedResourceCustomization> allottedResourceCustomizations = new ArrayList<>();
+ smh.setAllottedResourceCustomization(allottedResourceCustomizations);
+
+ AllottedResourceCustomization arc = new AllottedResourceCustomization();
+ smh.addAllottedResourceCustomization(arc);
+
+ String str = smh.toString();
+ assertTrue(str != null);
+ }
+
+ @Test
+ public void heatFilesTest() {
+ HeatFiles hf = new HeatFiles();
+ String str = hf.toString();
+ assertTrue(str != null);
+
+ }
+
+ @Test
+ public void testVnfConponent() {
+ VnfComponent vnf = new VnfComponent();
+ String str = vnf.toString();
+ assertTrue(str != null);
+ }
+
+ @Test
+ public void testTempNetworkHeatTemplateLookup() {
+ TempNetworkHeatTemplateLookup tn = new TempNetworkHeatTemplateLookup();
+ String str = tn.toString();
+ assertTrue(str != null);
+ }
+
+
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToscaCsarTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToscaCsarTest.java
index 9cbfaa4d2c..01c5cebe3a 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToscaCsarTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToscaCsarTest.java
@@ -32,26 +32,26 @@ import org.openecomp.mso.db.catalog.beans.ToscaCsar;
public class ToscaCsarTest {
- @Test
- public final void toscaCsarDataTest() {
- ToscaCsar toscaCsar = new ToscaCsar();
- toscaCsar.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(toscaCsar.getCreated() != null);
- toscaCsar.setDescription("description");
- assertTrue(toscaCsar.getDescription().equalsIgnoreCase("description"));
-
- toscaCsar.setArtifactChecksum("artifactChecksum");
- assertTrue(toscaCsar.getArtifactChecksum().equalsIgnoreCase("artifactChecksum"));
-
- toscaCsar.setArtifactUUID("artifactUUID");
- assertTrue(toscaCsar.getArtifactUUID().equalsIgnoreCase("artifactUUID"));
-
- toscaCsar.setName("name");
- assertTrue(toscaCsar.getName().equalsIgnoreCase("name"));
- toscaCsar.setUrl("url");
- assertTrue(toscaCsar.getUrl().equalsIgnoreCase("url"));
-// assertTrue(toscaCsar.toString() != null);
-
- }
+ @Test
+ public final void toscaCsarDataTest() {
+ ToscaCsar toscaCsar = new ToscaCsar();
+ toscaCsar.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(toscaCsar.getCreated() != null);
+ toscaCsar.setDescription("description");
+ assertTrue(toscaCsar.getDescription().equalsIgnoreCase("description"));
+
+ toscaCsar.setArtifactChecksum("artifactChecksum");
+ assertTrue(toscaCsar.getArtifactChecksum().equalsIgnoreCase("artifactChecksum"));
+
+ toscaCsar.setArtifactUUID("artifactUUID");
+ assertTrue(toscaCsar.getArtifactUUID().equalsIgnoreCase("artifactUUID"));
+
+ toscaCsar.setName("name");
+ assertTrue(toscaCsar.getName().equalsIgnoreCase("name"));
+ toscaCsar.setUrl("url");
+ assertTrue(toscaCsar.getUrl().equalsIgnoreCase("url"));
+// assertTrue(toscaCsar.toString() != null);
+
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleCustomizationTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleCustomizationTest.java
index 52d15ee597..cc38becce6 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleCustomizationTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleCustomizationTest.java
@@ -33,38 +33,38 @@ import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
public class VfModuleCustomizationTest {
- @Test
- public final void vfModuleCustomizationDataTest() {
- VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
- vfModuleCustomization.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(vfModuleCustomization.getCreated() != null);
- vfModuleCustomization.setAvailabilityZoneCount(1);
- assertTrue(vfModuleCustomization.getAvailabilityZoneCount() == 1);
- vfModuleCustomization.hashCode();
- vfModuleCustomization.setVolEnvironmentArtifactUuid("volEnvironmentArtifactUuid");
- assertTrue(
- vfModuleCustomization.getVolEnvironmentArtifactUuid().equalsIgnoreCase("volEnvironmentArtifactUuid"));
+ @Test
+ public final void vfModuleCustomizationDataTest() {
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(vfModuleCustomization.getCreated() != null);
+ vfModuleCustomization.setAvailabilityZoneCount(1);
+ assertTrue(vfModuleCustomization.getAvailabilityZoneCount() == 1);
+ vfModuleCustomization.hashCode();
+ vfModuleCustomization.setVolEnvironmentArtifactUuid("volEnvironmentArtifactUuid");
+ assertTrue(
+ vfModuleCustomization.getVolEnvironmentArtifactUuid().equalsIgnoreCase("volEnvironmentArtifactUuid"));
- vfModuleCustomization.setHeatEnvironmentArtifactUuid("heatEnvironmentArtifactUuid");
- assertTrue(
- vfModuleCustomization.getHeatEnvironmentArtifactUuid().equalsIgnoreCase("heatEnvironmentArtifactUuid"));
+ vfModuleCustomization.setHeatEnvironmentArtifactUuid("heatEnvironmentArtifactUuid");
+ assertTrue(
+ vfModuleCustomization.getHeatEnvironmentArtifactUuid().equalsIgnoreCase("heatEnvironmentArtifactUuid"));
- vfModuleCustomization.setInitialCount(1);
- assertTrue(vfModuleCustomization.getInitialCount() == 1);
+ vfModuleCustomization.setInitialCount(1);
+ assertTrue(vfModuleCustomization.getInitialCount() == 1);
- vfModuleCustomization.setLabel("label");
- assertTrue(vfModuleCustomization.getLabel().equalsIgnoreCase("label"));
- vfModuleCustomization.setMaxInstances(2);
- assertTrue(vfModuleCustomization.getMaxInstances() == 2);
- vfModuleCustomization.setMinInstances(1);
- assertTrue(vfModuleCustomization.getMinInstances() == 1);
- vfModuleCustomization.setModelCustomizationUuid("modelCustomizationUuid");
- assertTrue(vfModuleCustomization.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid"));
- vfModuleCustomization.setVfModule(new VfModule());
- assertTrue(vfModuleCustomization.getVfModule() != null);
+ vfModuleCustomization.setLabel("label");
+ assertTrue(vfModuleCustomization.getLabel().equalsIgnoreCase("label"));
+ vfModuleCustomization.setMaxInstances(2);
+ assertTrue(vfModuleCustomization.getMaxInstances() == 2);
+ vfModuleCustomization.setMinInstances(1);
+ assertTrue(vfModuleCustomization.getMinInstances() == 1);
+ vfModuleCustomization.setModelCustomizationUuid("modelCustomizationUuid");
+ assertTrue(vfModuleCustomization.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid"));
+ vfModuleCustomization.setVfModule(new VfModule());
+ assertTrue(vfModuleCustomization.getVfModule() != null);
-// assertTrue(vfModuleCustomization.toString() == null);
+// assertTrue(vfModuleCustomization.toString() == null);
- }
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java
index 9409a642ec..5b76fa183c 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java
@@ -32,32 +32,32 @@ import org.openecomp.mso.db.catalog.beans.VfModule;
public class VfModuleTest {
- @Test
- public final void vfModuleDataTest() {
- VfModule vfModule = new VfModule();
- vfModule.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(vfModule.getCreated() != null);
- vfModule.setDescription("description");
- assertTrue(vfModule.getDescription().equalsIgnoreCase("description"));
-
- vfModule.setModelInvariantUUID("action");
- assertTrue(vfModule.getModelInvariantUUID().equalsIgnoreCase("action"));
-
- vfModule.setModelName("modelName");
- assertTrue(vfModule.getModelName().equalsIgnoreCase("modelName"));
-
- vfModule.setModelUUID("modelUUID");
- assertTrue(vfModule.getModelUUID().equalsIgnoreCase("modelUUID"));
- vfModule.setModelVersion("modelVersion");
- assertTrue(vfModule.getModelVersion().equalsIgnoreCase("modelVersion"));
- vfModule.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId");
- assertTrue(vfModule.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
- vfModule.setVnfResourceModelUUId("vnfResourceModelUUId");
- assertTrue(vfModule.getVnfResourceModelUUId().equalsIgnoreCase("vnfResourceModelUUId"));
- vfModule.setIsBase(1);
- assertTrue(vfModule.isBase());
-// assertTrue(vfModule.toString() == null);
-
- }
+ @Test
+ public final void vfModuleDataTest() {
+ VfModule vfModule = new VfModule();
+ vfModule.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(vfModule.getCreated() != null);
+ vfModule.setDescription("description");
+ assertTrue(vfModule.getDescription().equalsIgnoreCase("description"));
+
+ vfModule.setModelInvariantUUID("action");
+ assertTrue(vfModule.getModelInvariantUUID().equalsIgnoreCase("action"));
+
+ vfModule.setModelName("modelName");
+ assertTrue(vfModule.getModelName().equalsIgnoreCase("modelName"));
+
+ vfModule.setModelUUID("modelUUID");
+ assertTrue(vfModule.getModelUUID().equalsIgnoreCase("modelUUID"));
+ vfModule.setModelVersion("modelVersion");
+ assertTrue(vfModule.getModelVersion().equalsIgnoreCase("modelVersion"));
+ vfModule.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId");
+ assertTrue(vfModule.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
+ vfModule.setVnfResourceModelUUId("vnfResourceModelUUId");
+ assertTrue(vfModule.getVnfResourceModelUUId().equalsIgnoreCase("vnfResourceModelUUId"));
+ vfModule.setIsBase(1);
+ assertTrue(vfModule.isBase());
+// assertTrue(vfModule.toString() == null);
+
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java
index 3f707871a6..6500535a05 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java
@@ -32,32 +32,32 @@ import org.openecomp.mso.db.catalog.beans.VnfRecipe;
public class VnfRecipeTest {
- @Test
- public final void vnfRecipeDataTest() {
- VnfRecipe vnfRecipe = new VnfRecipe();
- vnfRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(vnfRecipe.getCreated() != null);
- vnfRecipe.setDescription("description");
- assertTrue(vnfRecipe.getDescription().equalsIgnoreCase("description"));
-
- vnfRecipe.setOrchestrationUri("orchestrationUri");
- assertTrue(vnfRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
-
- vnfRecipe.setRecipeTimeout(1);
- assertTrue(vnfRecipe.getRecipeTimeout() == 1);
- vnfRecipe.setVnfType("vnfType");
- assertTrue(vnfRecipe.getVnfType().equalsIgnoreCase("vnfType"));
-
- vnfRecipe.setServiceType("serviceType");
- assertTrue(vnfRecipe.getServiceType().equalsIgnoreCase("serviceType"));
- vnfRecipe.setVersion("version");
- assertTrue(vnfRecipe.getVersion().equalsIgnoreCase("version"));
- vnfRecipe.setParamXSD("vnfParamXSD");
- assertTrue(vnfRecipe.getParamXSD().equalsIgnoreCase("vnfParamXSD"));
- vnfRecipe.setVfModuleId("vfModuleId");
- assertTrue(vnfRecipe.getVfModuleId().equalsIgnoreCase("vfModuleId"));
+ @Test
+ public final void vnfRecipeDataTest() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ vnfRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(vnfRecipe.getCreated() != null);
+ vnfRecipe.setDescription("description");
+ assertTrue(vnfRecipe.getDescription().equalsIgnoreCase("description"));
+
+ vnfRecipe.setOrchestrationUri("orchestrationUri");
+ assertTrue(vnfRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
+
+ vnfRecipe.setRecipeTimeout(1);
+ assertTrue(vnfRecipe.getRecipeTimeout() == 1);
+ vnfRecipe.setVnfType("vnfType");
+ assertTrue(vnfRecipe.getVnfType().equalsIgnoreCase("vnfType"));
+
+ vnfRecipe.setServiceType("serviceType");
+ assertTrue(vnfRecipe.getServiceType().equalsIgnoreCase("serviceType"));
+ vnfRecipe.setVersion("version");
+ assertTrue(vnfRecipe.getVersion().equalsIgnoreCase("version"));
+ vnfRecipe.setParamXSD("vnfParamXSD");
+ assertTrue(vnfRecipe.getParamXSD().equalsIgnoreCase("vnfParamXSD"));
+ vnfRecipe.setVfModuleId("vfModuleId");
+ assertTrue(vnfRecipe.getVfModuleId().equalsIgnoreCase("vfModuleId"));
// assertTrue(vnfRecipe.toString() == null);
- }
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java
index 68749e397e..82f0962966 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java
@@ -36,47 +36,47 @@ import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
public class VnfResourceTest {
- @Test
- public final void vnfResourceDataTest() {
+ @Test
+ public final void vnfResourceDataTest() {
- VnfResource vnfResource = new VnfResource();
- vnfResource.setCreated(new Timestamp(System.currentTimeMillis()));
- assertTrue(vnfResource.getCreated() != null);
- vnfResource.setDescription("description");
- assertTrue(vnfResource.getDescription().equalsIgnoreCase("description"));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setCreated(new Timestamp(System.currentTimeMillis()));
+ assertTrue(vnfResource.getCreated() != null);
+ vnfResource.setDescription("description");
+ assertTrue(vnfResource.getDescription().equalsIgnoreCase("description"));
- vnfResource.setAicVersionMax("aicVersionMax");
- assertTrue(vnfResource.getAicVersionMax().equalsIgnoreCase("aicVersionMax"));
+ vnfResource.setAicVersionMax("aicVersionMax");
+ assertTrue(vnfResource.getAicVersionMax().equalsIgnoreCase("aicVersionMax"));
- vnfResource.setAicVersionMin("aicVersionMin");
- assertTrue(vnfResource.getAicVersionMin().equalsIgnoreCase("aicVersionMin"));
- vnfResource.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId");
- assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
+ vnfResource.setAicVersionMin("aicVersionMin");
+ assertTrue(vnfResource.getAicVersionMin().equalsIgnoreCase("aicVersionMin"));
+ vnfResource.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId");
+ assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
- vnfResource.setModelInvariantUuid("modelInvariantUuid");
- assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid"));
- vnfResource.setModelName("modelName");
- assertTrue(vnfResource.getModelName().equalsIgnoreCase("modelName"));
- vnfResource.setModelUuid("modelUuid");
- assertTrue(vnfResource.getModelUuid().equalsIgnoreCase("modelUuid"));
- vnfResource.setModelVersion("modelVersion");
- assertTrue(vnfResource.getModelVersion().equalsIgnoreCase("modelVersion"));
- vnfResource.setOrchestrationMode("orchestrationMode");
- assertTrue(vnfResource.getOrchestrationMode().equalsIgnoreCase("orchestrationMode"));
- vnfResource.setTemplateId("heatTemplateArtifactUUId");
- assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
- vnfResource.setModelInvariantUuid("modelInvariantUuid");
- assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid"));
- Set<VnfResourceCustomization> list = new HashSet<>();
- list.add(new VnfResourceCustomization());
- vnfResource.setVnfResourceCustomizations(list);
- assertTrue(vnfResource.getVfModuleCustomizations() != null);
- Set<VfModule> vfModules = new HashSet<>();
- vfModules.add(new VfModule());
- vnfResource.setVfModules(vfModules);
- assertTrue(vnfResource.getVfModules() != null);
-// assertTrue(vnfResource.toString() != null);
+ vnfResource.setModelInvariantUuid("modelInvariantUuid");
+ assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid"));
+ vnfResource.setModelName("modelName");
+ assertTrue(vnfResource.getModelName().equalsIgnoreCase("modelName"));
+ vnfResource.setModelUuid("modelUuid");
+ assertTrue(vnfResource.getModelUuid().equalsIgnoreCase("modelUuid"));
+ vnfResource.setModelVersion("modelVersion");
+ assertTrue(vnfResource.getModelVersion().equalsIgnoreCase("modelVersion"));
+ vnfResource.setOrchestrationMode("orchestrationMode");
+ assertTrue(vnfResource.getOrchestrationMode().equalsIgnoreCase("orchestrationMode"));
+ vnfResource.setTemplateId("heatTemplateArtifactUUId");
+ assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));
+ vnfResource.setModelInvariantUuid("modelInvariantUuid");
+ assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid"));
+ Set<VnfResourceCustomization> list = new HashSet<>();
+ list.add(new VnfResourceCustomization());
+ vnfResource.setVnfResourceCustomizations(list);
+ assertTrue(vnfResource.getVfModuleCustomizations() != null);
+ Set<VfModule> vfModules = new HashSet<>();
+ vfModules.add(new VfModule());
+ vnfResource.setVfModules(vfModules);
+ assertTrue(vnfResource.getVfModules() != null);
+// assertTrue(vnfResource.toString() != null);
- }
+ }
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/filesearching/LogFileSearching.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/filesearching/LogFileSearching.java
index fba28ac0fd..89a00cdeb2 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/filesearching/LogFileSearching.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/filesearching/LogFileSearching.java
@@ -31,102 +31,102 @@ import java.util.NoSuchElementException;
import java.util.Scanner;
public class LogFileSearching {
-
- private static PrintWriter writer;
-
- public static void initFile(String filePath) {
- if (writer == null) {
- try {
- // This is to reopen an existing file
- writer = new PrintWriter(new FileOutputStream(filePath,true));
- } catch ( IOException e) {
- System.out.println("Exception caught when trying to open the file /tmp/mso-log-checker.log to dump the result");
- e.printStackTrace();
- }
- }
- }
-
- public static void closeFile() {
- if (writer != null) {
- writer.close();
- writer = null;
- }
- }
-
-
- public static boolean searchInFile(final String needle, final File file) throws FileNotFoundException {
- Scanner logScanner = new Scanner(file);
- try {
- writer.println("Searching pattern " + needle + " in " + file.getAbsolutePath());
- //System.out.println("Searching pattern " + needle + " in " + file.getAbsolutePath());
-
- String filedata = logScanner.useDelimiter("\\Z").next();
-
- int occurrences = 0;
- int index = 0;
-
- while (index < filedata.length() && (index = filedata.indexOf(needle, index)) >= 0) {
- occurrences++;
-
- int separatorIndex = filedata.indexOf(System.getProperty("line.separator"), index);
- if (separatorIndex >=0){
- writer.println("FOUND:" + filedata.substring(index, separatorIndex));
- //System.out.println("FOUND:"
- // + filedata.substring(index, separatorIndex));
- } else {
- writer.println("FOUND:" + filedata.substring(index, filedata.length()-1));
- //System.out.println("FOUND:"
- // + filedata.substring(index, filedata.length()-1));
- }
- index += needle.length();
- }
- writer.println("TOTAL:" + occurrences + " FOUND");
- //System.out.println("TOTAL:" + occurrences + " FOUND");
- if (occurrences > 0) {
-
- return true;
- } else {
-
- return false;
- }
- } catch (NoSuchElementException e) {
- writer.println("TOTAL:0 FOUND");
- //System.out.println("TOTAL:0 FOUND");
- return false;
- } finally {
- logScanner.close();
- }
- }
-
- public static boolean searchInDirectory(final String needle, final File directory) throws FileNotFoundException {
-
- boolean res = false;
- String[] dirFiles = directory.list();
-
- if (dirFiles != null) {
-
- for (String dir : dirFiles) {
- res = res || searchInDirectory(needle, new File(directory.getAbsolutePath() + "/" + dir));
- }
-
- } else {
- return LogFileSearching.searchInFile(needle, directory);
- }
- return res;
- }
-
- public static boolean searchInDirectoryForCommonIssues(final String[] needles, final File directory) throws FileNotFoundException {
- String[] defaultPatternsToUse = {"ClassNotFound","NullPointer","RuntimeException","IllegalStateException","FATAL"};
-
- if (needles != null && needles.length>0) {
- defaultPatternsToUse=needles;
- }
-
- boolean returnValue=false;
- for (String needle:defaultPatternsToUse) {
- returnValue |= LogFileSearching.searchInDirectory(needle,directory);
- }
-
- return returnValue;
- }
+
+ private static PrintWriter writer;
+
+ public static void initFile(String filePath) {
+ if (writer == null) {
+ try {
+ // This is to reopen an existing file
+ writer = new PrintWriter(new FileOutputStream(filePath, true));
+ } catch (IOException e) {
+ System.out.println("Exception caught when trying to open the file /tmp/mso-log-checker.log to dump the result");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void closeFile() {
+ if (writer != null) {
+ writer.close();
+ writer = null;
+ }
+ }
+
+
+ public static boolean searchInFile(final String needle, final File file) throws FileNotFoundException {
+ Scanner logScanner = new Scanner(file);
+ try {
+ writer.println("Searching pattern " + needle + " in " + file.getAbsolutePath());
+ //System.out.println("Searching pattern " + needle + " in " + file.getAbsolutePath());
+
+ String filedata = logScanner.useDelimiter("\\Z").next();
+
+ int occurrences = 0;
+ int index = 0;
+
+ while (index < filedata.length() && (index = filedata.indexOf(needle, index)) >= 0) {
+ occurrences++;
+
+ int separatorIndex = filedata.indexOf(System.getProperty("line.separator"), index);
+ if (separatorIndex >= 0) {
+ writer.println("FOUND:" + filedata.substring(index, separatorIndex));
+ //System.out.println("FOUND:"
+ // + filedata.substring(index, separatorIndex));
+ } else {
+ writer.println("FOUND:" + filedata.substring(index, filedata.length() - 1));
+ //System.out.println("FOUND:"
+ // + filedata.substring(index, filedata.length()-1));
+ }
+ index += needle.length();
+ }
+ writer.println("TOTAL:" + occurrences + " FOUND");
+ //System.out.println("TOTAL:" + occurrences + " FOUND");
+ if (occurrences > 0) {
+
+ return true;
+ } else {
+
+ return false;
+ }
+ } catch (NoSuchElementException e) {
+ writer.println("TOTAL:0 FOUND");
+ //System.out.println("TOTAL:0 FOUND");
+ return false;
+ } finally {
+ logScanner.close();
+ }
+ }
+
+ public static boolean searchInDirectory(final String needle, final File directory) throws FileNotFoundException {
+
+ boolean res = false;
+ String[] dirFiles = directory.list();
+
+ if (dirFiles != null) {
+
+ for (String dir : dirFiles) {
+ res = res || searchInDirectory(needle, new File(directory.getAbsolutePath() + "/" + dir));
+ }
+
+ } else {
+ return LogFileSearching.searchInFile(needle, directory);
+ }
+ return res;
+ }
+
+ public static boolean searchInDirectoryForCommonIssues(final String[] needles, final File directory) throws FileNotFoundException {
+ String[] defaultPatternsToUse = {"ClassNotFound", "NullPointer", "RuntimeException", "IllegalStateException", "FATAL"};
+
+ if (needles != null && needles.length > 0) {
+ defaultPatternsToUse = needles;
+ }
+
+ boolean returnValue = false;
+ for (String needle : defaultPatternsToUse) {
+ returnValue |= LogFileSearching.searchInDirectory(needle, directory);
+ }
+
+ return returnValue;
+ }
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/ArquillianPackagerForITCases.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/ArquillianPackagerForITCases.java
index 200e1d2621..4e86f664d6 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/ArquillianPackagerForITCases.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/ArquillianPackagerForITCases.java
@@ -36,42 +36,42 @@ import org.jboss.shrinkwrap.api.spec.WebArchive;
public class ArquillianPackagerForITCases {
- public static Archive<?> createPackageFromExistingOne(String path, String globPattern, String newPackageName) {
- Path dir = Paths.get(path);
+ public static Archive<?> createPackageFromExistingOne(String path, String globPattern, String newPackageName) {
+ Path dir = Paths.get(path);
- try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, globPattern)) {
- Iterator<Path> it = stream.iterator();
- if (it.hasNext()) {
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, globPattern)) {
+ Iterator<Path> it = stream.iterator();
+ if (it.hasNext()) {
- if (newPackageName.endsWith(".war")) {
- File archive = it.next().toFile();
- WebArchive webArchive = ShrinkWrap.create(WebArchive.class, newPackageName);
- webArchive.merge((ShrinkWrap.createFromZipFile(WebArchive.class, archive)));
- return webArchive;
- } else if (newPackageName.endsWith(".jar")) {
- File archive = it.next().toFile();
- JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, newPackageName);
- javaArchive.merge((ShrinkWrap.createFromZipFile(JavaArchive.class, archive)));
- return javaArchive;
- } else if (newPackageName.endsWith(".ear")) {
- File archive = it.next().toFile();
- EnterpriseArchive earArchive = ShrinkWrap.create(EnterpriseArchive.class, newPackageName);
- earArchive.merge((ShrinkWrap.createFromZipFile(EnterpriseArchive.class, archive)));
- return earArchive;
- } else {
- return null;
- }
+ if (newPackageName.endsWith(".war")) {
+ File archive = it.next().toFile();
+ WebArchive webArchive = ShrinkWrap.create(WebArchive.class, newPackageName);
+ webArchive.merge((ShrinkWrap.createFromZipFile(WebArchive.class, archive)));
+ return webArchive;
+ } else if (newPackageName.endsWith(".jar")) {
+ File archive = it.next().toFile();
+ JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, newPackageName);
+ javaArchive.merge((ShrinkWrap.createFromZipFile(JavaArchive.class, archive)));
+ return javaArchive;
+ } else if (newPackageName.endsWith(".ear")) {
+ File archive = it.next().toFile();
+ EnterpriseArchive earArchive = ShrinkWrap.create(EnterpriseArchive.class, newPackageName);
+ earArchive.merge((ShrinkWrap.createFromZipFile(EnterpriseArchive.class, archive)));
+ return earArchive;
+ } else {
+ return null;
+ }
- } else {
- return null;
- }
+ } else {
+ return null;
+ }
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ }
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- }
- }
-
-
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/ASDCITCase.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/ASDCITCase.java
index 27cfe6fa17..3170cd1655 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/ASDCITCase.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/ASDCITCase.java
@@ -73,446 +73,443 @@ import org.openecomp.mso.global_tests.asdc.notif_emulator.JsonNotificationData;
@RunWith(Arquillian.class)
public class ASDCITCase {
- /**
- * Add the resources in the right folder of a jar
- * @param jar The jarArchive
- * @param dir The main dir containing things that must be added
- * @throws Exception In case of issues with the files
- */
- private static void addFiles(JavaArchive jar, File dir,String destFolder) throws Exception {
+ /**
+ * Add the resources in the right folder of a jar
+ *
+ * @param jar The jarArchive
+ * @param dir The main dir containing things that must be added
+ * @throws Exception In case of issues with the files
+ */
+ private static void addFiles(JavaArchive jar, File dir, String destFolder) throws Exception {
- if (!dir.isDirectory()) {
- throw new Exception("not a directory");
- }
- for (File f : dir.listFiles()) {
+ if (!dir.isDirectory()) {
+ throw new Exception("not a directory");
+ }
+ for (File f : dir.listFiles()) {
- if (f.isFile()) {
- jar.addAsResource(f, destFolder + "/" + f.getName());
- } else {
+ if (f.isFile()) {
+ jar.addAsResource(f, destFolder + "/" + f.getName());
+ } else {
- addFiles(jar, f, destFolder+"/"+f.getName());
- }
- }
- }
+ addFiles(jar, f, destFolder + "/" + f.getName());
+ }
+ }
+ }
- @Deployment(name="asdc-controller",testable=true)
- public static Archive<?> createAsdcControllerWarDeployment () throws Exception {
- System.out.println("Deploying ASDC Controller WAR with additional resources on default server");
+ @Deployment(name = "asdc-controller", testable = true)
+ public static Archive<?> createAsdcControllerWarDeployment() throws Exception {
+ System.out.println("Deploying ASDC Controller WAR with additional resources on default server");
- WebArchive warArchive = (WebArchive)ArquillianPackagerForITCases.createPackageFromExistingOne("../../asdc-controller/target/", "asdc-controller*.war", "asdc-controller.war");
+ WebArchive warArchive = (WebArchive) ArquillianPackagerForITCases.createPackageFromExistingOne("../../asdc-controller/target/", "asdc-controller*.war", "asdc-controller.war");
- // Add the current test class
- JavaArchive testclasses = ShrinkWrap.create (JavaArchive.class, "testClasses.jar");
+ // Add the current test class
+ JavaArchive testclasses = ShrinkWrap.create(JavaArchive.class, "testClasses.jar");
- testclasses.addPackage("org.openecomp.mso.global_tests.asdc.notif_emulator");
+ testclasses.addPackage("org.openecomp.mso.global_tests.asdc.notif_emulator");
- addFiles(testclasses,new File(Thread.currentThread().getContextClassLoader().getResource("resource-examples/asdc").getFile()),"resource-examples/asdc");
+ addFiles(testclasses, new File(Thread.currentThread().getContextClassLoader().getResource("resource-examples/asdc").getFile()), "resource-examples/asdc");
- System.out.println(testclasses.toString(true));
- warArchive.addAsLibraries(testclasses);
+ System.out.println(testclasses.toString(true));
+ warArchive.addAsLibraries(testclasses);
+ // BE CAREFUL a settings.xml file must be located in ${home.user}/.m2/settings.xml
+ warArchive.addAsLibraries(Maven.resolver()
+ .resolve("org.mockito:mockito-all:1.10.19")
+ .withoutTransitivity()
+ .asFile());
- // BE CAREFUL a settings.xml file must be located in ${home.user}/.m2/settings.xml
- warArchive.addAsLibraries(Maven.resolver()
- .resolve("org.mockito:mockito-all:1.10.19")
- .withoutTransitivity ()
- .asFile ());
+ //warArchive.addPackage("org.openecomp.mso.global_tests.asdc.notif_emulator");
+ //addFiles(warArchive,new File(ASDCITCase.class.getClassLoader().getResource("resource-examples").getPath()),"resource-examples");
- //warArchive.addPackage("org.openecomp.mso.global_tests.asdc.notif_emulator");
- //addFiles(warArchive,new File(ASDCITCase.class.getClassLoader().getResource("resource-examples").getPath()),"resource-examples");
+ // Take one war randomly to make arquilian happy
+ Testable.archiveToTest(warArchive);
- // Take one war randomly to make arquilian happy
- Testable.archiveToTest(warArchive);
+ System.out.println(warArchive.toString(true));
- System.out.println(warArchive.toString(true));
+ return warArchive;
+ }
- return warArchive;
- }
+ @BeforeClass
+ public static final void waitBeforeStart() throws InterruptedException,
+ IOException,
+ URISyntaxException,
+ NoSuchAlgorithmException {
+ System.out.println("Executing " + ASDCITCase.class.getName());
+ }
- @BeforeClass
- public static final void waitBeforeStart() throws InterruptedException,
- IOException,
- URISyntaxException,
- NoSuchAlgorithmException {
- System.out.println("Executing " + ASDCITCase.class.getName());
- }
+ @AfterClass
+ public static final void waitAfterStart() throws InterruptedException,
+ IOException,
+ URISyntaxException,
+ NoSuchAlgorithmException {
+ System.out.println("Waiting 60000ms " + ASDCITCase.class.getName());
+ Thread.sleep(60000);
+ }
- @AfterClass
- public static final void waitAfterStart() throws InterruptedException,
- IOException,
- URISyntaxException,
- NoSuchAlgorithmException {
- System.out.println("Waiting 60000ms " + ASDCITCase.class.getName());
- Thread.sleep(60000);
- }
+ /**
+ * Be careful when using that notification fake structure, the UUID of notif artifacts MUST be different.
+ * There is a static Map behind the scene.
+ */
+ private JsonNotificationData notifDataWithoutModuleInfo;
+ private DistributionClientEmulator distribClientWithoutModuleInfo;
- /**
- * Be careful when using that notification fake structure, the UUID of notif artifacts MUST be different.
- * There is a static Map behind the scene.
- */
- private JsonNotificationData notifDataWithoutModuleInfo;
- private DistributionClientEmulator distribClientWithoutModuleInfo;
+ private JsonNotificationData notifDataV1, notifDataV2, notifDataV3, notifDataV4, notifDataV5, notifDataDNS, notifDataVFW;
+ private DistributionClientEmulator distribClientV1, distribClientV2, distribClientV3, distribClientV4, distribClientV5, distribClientV1ForSameNotif, distribClientDNS, distribClientVFW;
- private JsonNotificationData notifDataV1, notifDataV2, notifDataV3, notifDataV4, notifDataV5,notifDataDNS,notifDataVFW;
- private DistributionClientEmulator distribClientV1, distribClientV2, distribClientV3, distribClientV4, distribClientV5, distribClientV1ForSameNotif, distribClientDNS,distribClientVFW;
+ @Before
+ public final void beforeEachTest() throws IOException {
- @Before
- public final void beforeEachTest() throws IOException {
+ distribClientV1 = new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V1");
+ distribClientV1ForSameNotif = new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V1");
+ notifDataV1 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V1");
- distribClientV1= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V1");
- distribClientV1ForSameNotif= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V1");
- notifDataV1 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V1");
+ // This is a duplicate in version 2 of the version 1
+ distribClientV2 = new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V2");
+ notifDataV2 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V2");
- // This is a duplicate in version 2 of the version 1
- distribClientV2= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V2");
- notifDataV2 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V2");
+ distribClientV3 = new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V3");
+ notifDataV3 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V3");
- distribClientV3= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V3");
- notifDataV3 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V3");
+ // This is a duplicate in version 4 of the version 3
+ distribClientV4 = new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V4");
+ notifDataV4 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V4");
- // This is a duplicate in version 4 of the version 3
- distribClientV4= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V4");
- notifDataV4 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V4");
+ // This notification is to test the deployment of volume with nested + an artifact not used (should send notification with DEPLOY_ERROR
+ distribClientV5 = new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V5");
+ notifDataV5 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V5");
- // This notification is to test the deployment of volume with nested + an artifact not used (should send notification with DEPLOY_ERROR
- distribClientV5= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V5");
- notifDataV5 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V5");
+ distribClientWithoutModuleInfo = new DistributionClientEmulator("/resource-examples/asdc/notif-without-modules-metadata");
+ notifDataWithoutModuleInfo = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/notif-without-modules-metadata");
- distribClientWithoutModuleInfo= new DistributionClientEmulator("/resource-examples/asdc/notif-without-modules-metadata");
- notifDataWithoutModuleInfo = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/notif-without-modules-metadata");
+ distribClientDNS = new DistributionClientEmulator("/resource-examples/asdc/demo-dns-V1");
+ notifDataDNS = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/demo-dns-V1");
- distribClientDNS= new DistributionClientEmulator("/resource-examples/asdc/demo-dns-V1");
- notifDataDNS = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/demo-dns-V1");
+ distribClientVFW = new DistributionClientEmulator("/resource-examples/asdc/demo-vfw-V1");
+ notifDataVFW = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/demo-vfw-V1");
- distribClientVFW= new DistributionClientEmulator("/resource-examples/asdc/demo-vfw-V1");
- notifDataVFW = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/demo-vfw-V1");
+ }
- }
+ @Test
+ @OperateOnDeployment("asdc-controller")
+ public void testNotifWithoutModuleInfo() throws NoSuchAlgorithmException,
+ IOException,
+ URISyntaxException,
+ ArtifactInstallerException, ASDCControllerException, ASDCParametersException {
- @Test
- @OperateOnDeployment("asdc-controller")
- public void testNotifWithoutModuleInfo () throws NoSuchAlgorithmException,
- IOException,
- URISyntaxException,
- ArtifactInstallerException, ASDCControllerException, ASDCParametersException {
+ ASDCController asdcController = new ASDCController("asdc-controller1", distribClientWithoutModuleInfo);
+ asdcController.initASDC();
+ asdcController.treatNotification(notifDataWithoutModuleInfo);
+ assertTrue(distribClientWithoutModuleInfo.getDistributionMessageReceived().size() > 0);
- ASDCController asdcController = new ASDCController("asdc-controller1", distribClientWithoutModuleInfo);
- asdcController.initASDC();
- asdcController.treatNotification(notifDataWithoutModuleInfo);
+ int badDeployment = 0;
+ for (IDistributionStatusMessage message : distribClientWithoutModuleInfo.getDistributionMessageReceived()) {
+ System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
+ if (message.getStatus().equals(DistributionStatusEnum.DEPLOY_ERROR)) {
+ badDeployment++;
+ }
+ }
+ assertTrue(badDeployment == 3);
- assertTrue(distribClientWithoutModuleInfo.getDistributionMessageReceived().size() > 0);
+ // Check if something has been recorder in DB, as it should not
+ CatalogDatabase catalogDB = CatalogDatabase.getInstance();
- int badDeployment=0;
- for (IDistributionStatusMessage message:distribClientWithoutModuleInfo.getDistributionMessageReceived()) {
- System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
- if(message.getStatus().equals(DistributionStatusEnum.DEPLOY_ERROR)) {
- badDeployment++;
- }
- }
- assertTrue(badDeployment == 3);
+ HeatTemplate heatTemplate = catalogDB.getHeatTemplate("Whot-nimbus-oam_v1.0.yaml", "1.0", "resourceName-1");
+ assertNull(heatTemplate);
+ }
- // Check if something has been recorder in DB, as it should not
- CatalogDatabase catalogDB = CatalogDatabase.getInstance();
+ private void validateVnfResource(JsonNotificationData inputNotification, List<IVfModuleData> moduleList) {
- HeatTemplate heatTemplate = catalogDB.getHeatTemplate("Whot-nimbus-oam_v1.0.yaml", "1.0", "resourceName-1");
- assertNull(heatTemplate);
- }
+ CatalogDatabase catalogDB = CatalogDatabase.getInstance();
- private void validateVnfResource(JsonNotificationData inputNotification, List<IVfModuleData> moduleList) {
- CatalogDatabase catalogDB = CatalogDatabase.getInstance();
+ for (IResourceInstance resource : inputNotification.getResources()) {
+ VnfResource vnfResourceDB = catalogDB.getVnfResource(inputNotification.getServiceName() + "/" + resource.getResourceInstanceName(), inputNotification.getServiceVersion());
+ assertNotNull(vnfResourceDB);
+ //assertTrue(vnfResourceDB.getAsdcUuid().equals(resource.getResourceUUID()));
+ assertTrue(vnfResourceDB.getDescription().equals(inputNotification.getServiceDescription()));
+ assertTrue(vnfResourceDB.getModelInvariantUuid().equals(resource.getResourceInvariantUUID()));
+ assertTrue(vnfResourceDB.getModelVersion().equals(resource.getResourceVersion()));
+ assertTrue(vnfResourceDB.getOrchestrationMode().equals("HEAT"));
+ assertTrue(vnfResourceDB.getVersion().equals(inputNotification.getServiceVersion()));
+ //assertTrue(vnfResourceDB.getVnfType().equals(inputNotification.getServiceName()+"/"+resource.getResourceInstanceName()));
+ //assertTrue(vnfResourceDB.getModelCustomizationName().equals(resource.getResourceInstanceName()));
+ assertTrue(vnfResourceDB.getModelName().equals(resource.getResourceName()));
+ //assertTrue(vnfResourceDB.getServiceModelInvariantUUID().equals(inputNotification.getServiceInvariantUUID()));
- for (IResourceInstance resource:inputNotification.getResources()) {
- VnfResource vnfResourceDB = catalogDB.getVnfResource(inputNotification.getServiceName()+"/"+resource.getResourceInstanceName(), inputNotification.getServiceVersion());
- assertNotNull(vnfResourceDB);
+ for (IVfModuleData module : moduleList) {
- //assertTrue(vnfResourceDB.getAsdcUuid().equals(resource.getResourceUUID()));
- assertTrue(vnfResourceDB.getDescription().equals(inputNotification.getServiceDescription()));
- assertTrue(vnfResourceDB.getModelInvariantUuid().equals(resource.getResourceInvariantUUID()));
- assertTrue(vnfResourceDB.getModelVersion().equals(resource.getResourceVersion()));
- assertTrue(vnfResourceDB.getOrchestrationMode().equals("HEAT"));
- assertTrue(vnfResourceDB.getVersion().equals(inputNotification.getServiceVersion()));
- //assertTrue(vnfResourceDB.getVnfType().equals(inputNotification.getServiceName()+"/"+resource.getResourceInstanceName()));
- //assertTrue(vnfResourceDB.getModelCustomizationName().equals(resource.getResourceInstanceName()));
- assertTrue(vnfResourceDB.getModelName().equals(resource.getResourceName()));
- //assertTrue(vnfResourceDB.getServiceModelInvariantUUID().equals(inputNotification.getServiceInvariantUUID()));
+ VfModule vfModuleDB = catalogDB.getVfModuleModelName(module.getVfModuleModelName(), inputNotification.getServiceVersion());
+ assertNotNull(vfModuleDB);
+ assertTrue(module.getVfModuleModelName().equals(vfModuleDB.getModelName()));
- for (IVfModuleData module:moduleList) {
+ // assertTrue((inputNotification.getServiceName()+"/"+resource.getResourceInstanceName()+"::"+vfModuleDB.getModelName()).equals(vfModuleDB.getType()));
+ // assertTrue(vnfResourceDB.getId()!=0);
+ //assertNotNull(vfModuleDB.getVnfResourceId());
- VfModule vfModuleDB = catalogDB.getVfModuleModelName(module.getVfModuleModelName(),inputNotification.getServiceVersion());
- assertNotNull(vfModuleDB);
- assertTrue(module.getVfModuleModelName().equals(vfModuleDB.getModelName()));
+ // assertTrue(vnfResourceDB.getId()==vfModuleDB.getVnfResourceId().intValue());
- // assertTrue((inputNotification.getServiceName()+"/"+resource.getResourceInstanceName()+"::"+vfModuleDB.getModelName()).equals(vfModuleDB.getType()));
- // assertTrue(vnfResourceDB.getId()!=0);
- //assertNotNull(vfModuleDB.getVnfResourceId());
+ for (String artifactUUID : module.getArtifacts()) {
+ IArtifactInfo artifact = null;
+ for (IArtifactInfo artifactTemp : resource.getArtifacts()) {
+ if (artifactTemp.getArtifactUUID().equals(artifactUUID)) {
+ artifact = artifactTemp;
+ break;
+ }
+ }
+ assertNotNull(artifact);
- // assertTrue(vnfResourceDB.getId()==vfModuleDB.getVnfResourceId().intValue());
+ switch (artifact.getArtifactType()) {
+ case ASDCConfiguration.HEAT:
+ HeatTemplate heatTemplateDB = catalogDB.getHeatTemplate(vfModuleDB.getHeatTemplateArtifactUUId());
+ assertNotNull(heatTemplateDB);
+ //assertTrue(heatTemplateDB.getAsdcResourceName().equals(resource.getResourceName()));
+ assertTrue(heatTemplateDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
+ assertTrue(heatTemplateDB.getDescription().equals(artifact.getArtifactDescription()));
+ assertTrue(heatTemplateDB.getTemplateBody() != null && !heatTemplateDB.getTemplateBody().isEmpty());
+ assertTrue(heatTemplateDB.getParameters().size() > 0);
- for (String artifactUUID:module.getArtifacts()) {
- IArtifactInfo artifact = null;
- for (IArtifactInfo artifactTemp:resource.getArtifacts()) {
- if (artifactTemp.getArtifactUUID().equals(artifactUUID)) {
- artifact = artifactTemp;
- break;
- }
- }
- assertNotNull(artifact);
+ assertTrue(heatTemplateDB.getTemplateName().equals(artifact.getArtifactName()));
- switch (artifact.getArtifactType()) {
- case ASDCConfiguration.HEAT:
- HeatTemplate heatTemplateDB= catalogDB.getHeatTemplate(vfModuleDB.getHeatTemplateArtifactUUId());
- assertNotNull(heatTemplateDB);
- //assertTrue(heatTemplateDB.getAsdcResourceName().equals(resource.getResourceName()));
- assertTrue(heatTemplateDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
- assertTrue(heatTemplateDB.getDescription().equals(artifact.getArtifactDescription()));
- assertTrue(heatTemplateDB.getTemplateBody() != null && !heatTemplateDB.getTemplateBody().isEmpty());
- assertTrue(heatTemplateDB.getParameters().size()>0);
+ if (artifact.getArtifactTimeout() != null) {
+ assertTrue(heatTemplateDB.getTimeoutMinutes() == artifact.getArtifactTimeout().intValue());
+ } else {
+ assertTrue(heatTemplateDB.getTimeoutMinutes() == 240);
+ }
+ assertTrue(heatTemplateDB.getVersion().equals(artifact.getArtifactVersion()));
- assertTrue(heatTemplateDB.getTemplateName().equals(artifact.getArtifactName()));
+ assertFalse(heatTemplateDB.getTemplateBody().contains("file:///"));
+ break;
+ case ASDCConfiguration.HEAT_ENV:
+
+ HeatEnvironment heatEnvironmentDB = catalogDB.getHeatEnvironment(artifact.getArtifactName(), artifact.getArtifactVersion(), inputNotification.getServiceName() + "/" + resource.getResourceInstanceName());
- if (artifact.getArtifactTimeout() != null) {
- assertTrue(heatTemplateDB.getTimeoutMinutes()== artifact.getArtifactTimeout().intValue());
- } else {
- assertTrue(heatTemplateDB.getTimeoutMinutes()== 240);
- }
- assertTrue(heatTemplateDB.getVersion().equals(artifact.getArtifactVersion()));
-
- assertFalse(heatTemplateDB.getTemplateBody().contains("file:///"));
- break;
- case ASDCConfiguration.HEAT_ENV:
-
- HeatEnvironment heatEnvironmentDB = catalogDB.getHeatEnvironment(artifact.getArtifactName(), artifact.getArtifactVersion(), inputNotification.getServiceName()+"/"+resource.getResourceInstanceName());
-
- assertNotNull(heatEnvironmentDB);
+ assertNotNull(heatEnvironmentDB);
// assertTrue((vfModuleDB.getVolEnvironmentId() != null && vfModuleDB.getVolEnvironmentId().intValue() == heatEnvironmentDB.getId())
// || (vfModuleDB.getEnvironmentId() != null && vfModuleDB.getEnvironmentId() == heatEnvironmentDB.getId()));
//
// assertTrue(heatEnvironmentDB.getAsdcResourceName().equals(inputNotification.getServiceName()+"/"+resource.getResourceInstanceName()));
//
// assertTrue(heatEnvironmentDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
- assertTrue(heatEnvironmentDB.getDescription().equals(artifact.getArtifactDescription()));
- assertTrue(heatEnvironmentDB.getVersion().equals(artifact.getArtifactVersion()));
- assertTrue(heatEnvironmentDB.getName().equals(artifact.getArtifactName()));
- assertTrue(heatEnvironmentDB.getEnvironment() != null);
- assertFalse(heatEnvironmentDB.getEnvironment().contains("file:///"));
-
- break;
- case ASDCConfiguration.HEAT_NESTED:
- Map<String,Object> listNestedDBMainHeat=new HashMap<String,Object>();
- Map<String,Object> listNestedDBVolHeat=new HashMap<String,Object>();
-
- if (vfModuleDB.getHeatTemplateArtifactUUId() != null) {
- listNestedDBMainHeat = catalogDB.getNestedTemplates(vfModuleDB.getHeatTemplateArtifactUUId());
- }
- if (vfModuleDB.getVolHeatTemplateArtifactUUId() != null) {
- listNestedDBVolHeat = catalogDB.getNestedTemplates(vfModuleDB.getVolHeatTemplateArtifactUUId());
- }
-
- assertTrue(listNestedDBMainHeat.size() > 0 || listNestedDBVolHeat.size() > 0);
-
-
- assertTrue(listNestedDBMainHeat.get(artifact.getArtifactName()) != null
- || listNestedDBVolHeat.get(artifact.getArtifactName()) != null);
-
- HeatTemplate rightNestedTemplateDB = catalogDB.getHeatTemplate(artifact.getArtifactName(), artifact.getArtifactVersion(), resource.getResourceName());
- assertNotNull(rightNestedTemplateDB);
- //assertTrue(catalogDB.getNestedHeatTemplate(vfModuleDB.getTemplateId(), rightNestedTemplateDB.getId()) != null || catalogDB.getNestedHeatTemplate(vfModuleDB.getVolTemplateId(), rightNestedTemplateDB.getId()) != null);
-
- //assertTrue(rightNestedTemplateDB.getAsdcResourceName().equals(resource.getResourceName()));
- assertTrue(rightNestedTemplateDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
- assertTrue(rightNestedTemplateDB.getDescription().equals(artifact.getArtifactDescription()));
- assertTrue(rightNestedTemplateDB.getTemplateBody() != null && !rightNestedTemplateDB.getTemplateBody().isEmpty());
- assertTrue(rightNestedTemplateDB.getTemplateName().equals(artifact.getArtifactName()));
-
- if (artifact.getArtifactTimeout() != null) {
- assertTrue(rightNestedTemplateDB.getTimeoutMinutes()== artifact.getArtifactTimeout().intValue());
- } else {
- assertTrue(rightNestedTemplateDB.getTimeoutMinutes()== 240);
- }
- assertTrue(rightNestedTemplateDB.getVersion().equals(artifact.getArtifactVersion()));
- assertFalse(rightNestedTemplateDB.getTemplateBody().contains("file:///"));
-
- break;
- case ASDCConfiguration.HEAT_VOL:
- HeatTemplate heatTemplateVolDB = catalogDB.getHeatTemplate(vfModuleDB.getVolHeatTemplateArtifactUUId());
- assertNotNull(heatTemplateVolDB);
-
- //assertTrue(heatTemplateVolDB.getAsdcResourceName().equals(resource.getResourceName()));
- assertTrue(heatTemplateVolDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
- assertTrue(heatTemplateVolDB.getDescription().equals(artifact.getArtifactDescription()));
- assertTrue(heatTemplateVolDB.getTemplateBody() != null && !heatTemplateVolDB.getTemplateBody().isEmpty());
- assertTrue(heatTemplateVolDB.getTemplateName().equals(artifact.getArtifactName()));
-
- if (artifact.getArtifactTimeout() != null) {
- assertTrue(heatTemplateVolDB.getTimeoutMinutes()== artifact.getArtifactTimeout().intValue());
- } else {
- assertTrue(heatTemplateVolDB.getTimeoutMinutes()== 240);
- }
- assertTrue(heatTemplateVolDB.getVersion().equals(artifact.getArtifactVersion()));
- assertFalse(heatTemplateVolDB.getTemplateBody().contains("file:///"));
-
- break;
- case ASDCConfiguration.HEAT_ARTIFACT:
- Map<String,HeatFiles> heatFilesDB= catalogDB.getHeatFilesForVfModule(vfModuleDB.getModelUUID());
- assertTrue(heatFilesDB.size()>0);
- HeatFiles rightHeatFilesDB=heatFilesDB.get( artifact.getArtifactName());
- assertNotNull(rightHeatFilesDB);
-
- //assertTrue(rightHeatFilesDB.getAsdcResourceName().equals(resource.getResourceName()));
- assertTrue(rightHeatFilesDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
- assertTrue(rightHeatFilesDB.getDescription().equals(artifact.getArtifactDescription()));
- assertTrue(rightHeatFilesDB.getFileBody() != null && !rightHeatFilesDB.getFileBody().isEmpty());
- assertTrue(rightHeatFilesDB.getFileName().equals( artifact.getArtifactName()));
- assertTrue(rightHeatFilesDB.getVersion().equals(artifact.getArtifactVersion()));
-
- break;
- default:
- break;
-
- }
- }
-
- }
-
- }
-
- Service service = catalogDB.getServiceByModelUUID(inputNotification.getServiceUUID());
- assertNotNull(service);
- assertTrue(service.getCreated() !=null && service.getCreated().getTime()>0);
- assertTrue(service.getDescription().equals(inputNotification.getServiceDescription()));
- assertTrue(service.getModelInvariantUUID().equals(inputNotification.getServiceInvariantUUID()));
- assertTrue(service.getModelName().equals(inputNotification.getServiceName()));
- assertTrue(service.getModelUUID().equals(inputNotification.getServiceUUID()));
- assertTrue(service.getVersion().equals(inputNotification.getServiceVersion()));
-
- }
-
- @Test
- @OperateOnDeployment("asdc-controller")
- public void testNotifsDeployment () throws NoSuchAlgorithmException,
- IOException,
- URISyntaxException,
- ArtifactInstallerException, ASDCControllerException, ASDCParametersException {
-
-
-
- ASDCController asdcControllerV1 = new ASDCController("asdc-controller1", distribClientV1);
- asdcControllerV1.initASDC();
- asdcControllerV1.treatNotification(notifDataV1);
-
- assertTrue(distribClientV1.getDistributionMessageReceived().size() > 0);
- for (IDistributionStatusMessage message:distribClientV1.getDistributionMessageReceived()) {
- System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
- assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
- }
-
- this.validateVnfResource(notifDataV1,distribClientV1.getListVFModuleMetaData());
-
-
-
- // Try again to load the same notif
- ASDCController asdcControllerNewNotif = new ASDCController("asdc-controller1", distribClientV1ForSameNotif);
- asdcControllerNewNotif.initASDC();
- asdcControllerNewNotif.treatNotification(notifDataV1);
-
- for (IDistributionStatusMessage message:distribClientV1ForSameNotif.getDistributionMessageReceived()) {
- System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
- assertTrue(message.getStatus().equals(DistributionStatusEnum.ALREADY_DEPLOYED) || message.getStatus().equals(DistributionStatusEnum.ALREADY_DOWNLOADED));
- }
-
-
- // Try again to load same notif but in V2
- ASDCController asdcControllerV2 = new ASDCController("asdc-controller1", distribClientV2);
- asdcControllerV2.initASDC();
- asdcControllerV2.treatNotification(notifDataV2);
+ assertTrue(heatEnvironmentDB.getDescription().equals(artifact.getArtifactDescription()));
+ assertTrue(heatEnvironmentDB.getVersion().equals(artifact.getArtifactVersion()));
+ assertTrue(heatEnvironmentDB.getName().equals(artifact.getArtifactName()));
+ assertTrue(heatEnvironmentDB.getEnvironment() != null);
+ assertFalse(heatEnvironmentDB.getEnvironment().contains("file:///"));
+
+ break;
+ case ASDCConfiguration.HEAT_NESTED:
+ Map<String, Object> listNestedDBMainHeat = new HashMap<String, Object>();
+ Map<String, Object> listNestedDBVolHeat = new HashMap<String, Object>();
+
+ if (vfModuleDB.getHeatTemplateArtifactUUId() != null) {
+ listNestedDBMainHeat = catalogDB.getNestedTemplates(vfModuleDB.getHeatTemplateArtifactUUId());
+ }
+ if (vfModuleDB.getVolHeatTemplateArtifactUUId() != null) {
+ listNestedDBVolHeat = catalogDB.getNestedTemplates(vfModuleDB.getVolHeatTemplateArtifactUUId());
+ }
+
+ assertTrue(listNestedDBMainHeat.size() > 0 || listNestedDBVolHeat.size() > 0);
+
+
+ assertTrue(listNestedDBMainHeat.get(artifact.getArtifactName()) != null
+ || listNestedDBVolHeat.get(artifact.getArtifactName()) != null);
+
+ HeatTemplate rightNestedTemplateDB = catalogDB.getHeatTemplate(artifact.getArtifactName(), artifact.getArtifactVersion(), resource.getResourceName());
+ assertNotNull(rightNestedTemplateDB);
+ //assertTrue(catalogDB.getNestedHeatTemplate(vfModuleDB.getTemplateId(), rightNestedTemplateDB.getId()) != null || catalogDB.getNestedHeatTemplate(vfModuleDB.getVolTemplateId(), rightNestedTemplateDB.getId()) != null);
+
+ //assertTrue(rightNestedTemplateDB.getAsdcResourceName().equals(resource.getResourceName()));
+ assertTrue(rightNestedTemplateDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
+ assertTrue(rightNestedTemplateDB.getDescription().equals(artifact.getArtifactDescription()));
+ assertTrue(rightNestedTemplateDB.getTemplateBody() != null && !rightNestedTemplateDB.getTemplateBody().isEmpty());
+ assertTrue(rightNestedTemplateDB.getTemplateName().equals(artifact.getArtifactName()));
+
+ if (artifact.getArtifactTimeout() != null) {
+ assertTrue(rightNestedTemplateDB.getTimeoutMinutes() == artifact.getArtifactTimeout().intValue());
+ } else {
+ assertTrue(rightNestedTemplateDB.getTimeoutMinutes() == 240);
+ }
+ assertTrue(rightNestedTemplateDB.getVersion().equals(artifact.getArtifactVersion()));
+ assertFalse(rightNestedTemplateDB.getTemplateBody().contains("file:///"));
+
+ break;
+ case ASDCConfiguration.HEAT_VOL:
+ HeatTemplate heatTemplateVolDB = catalogDB.getHeatTemplate(vfModuleDB.getVolHeatTemplateArtifactUUId());
+ assertNotNull(heatTemplateVolDB);
+
+ //assertTrue(heatTemplateVolDB.getAsdcResourceName().equals(resource.getResourceName()));
+ assertTrue(heatTemplateVolDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
+ assertTrue(heatTemplateVolDB.getDescription().equals(artifact.getArtifactDescription()));
+ assertTrue(heatTemplateVolDB.getTemplateBody() != null && !heatTemplateVolDB.getTemplateBody().isEmpty());
+ assertTrue(heatTemplateVolDB.getTemplateName().equals(artifact.getArtifactName()));
+
+ if (artifact.getArtifactTimeout() != null) {
+ assertTrue(heatTemplateVolDB.getTimeoutMinutes() == artifact.getArtifactTimeout().intValue());
+ } else {
+ assertTrue(heatTemplateVolDB.getTimeoutMinutes() == 240);
+ }
+ assertTrue(heatTemplateVolDB.getVersion().equals(artifact.getArtifactVersion()));
+ assertFalse(heatTemplateVolDB.getTemplateBody().contains("file:///"));
+
+ break;
+ case ASDCConfiguration.HEAT_ARTIFACT:
+ Map<String, HeatFiles> heatFilesDB = catalogDB.getHeatFilesForVfModule(vfModuleDB.getModelUUID());
+ assertTrue(heatFilesDB.size() > 0);
+ HeatFiles rightHeatFilesDB = heatFilesDB.get(artifact.getArtifactName());
+ assertNotNull(rightHeatFilesDB);
+
+ //assertTrue(rightHeatFilesDB.getAsdcResourceName().equals(resource.getResourceName()));
+ assertTrue(rightHeatFilesDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
+ assertTrue(rightHeatFilesDB.getDescription().equals(artifact.getArtifactDescription()));
+ assertTrue(rightHeatFilesDB.getFileBody() != null && !rightHeatFilesDB.getFileBody().isEmpty());
+ assertTrue(rightHeatFilesDB.getFileName().equals(artifact.getArtifactName()));
+ assertTrue(rightHeatFilesDB.getVersion().equals(artifact.getArtifactVersion()));
+
+ break;
+ default:
+ break;
+
+ }
+ }
+
+ }
+
+ }
+
+ Service service = catalogDB.getServiceByModelUUID(inputNotification.getServiceUUID());
+ assertNotNull(service);
+ assertTrue(service.getCreated() != null && service.getCreated().getTime() > 0);
+ assertTrue(service.getDescription().equals(inputNotification.getServiceDescription()));
+ assertTrue(service.getModelInvariantUUID().equals(inputNotification.getServiceInvariantUUID()));
+ assertTrue(service.getModelName().equals(inputNotification.getServiceName()));
+ assertTrue(service.getModelUUID().equals(inputNotification.getServiceUUID()));
+ assertTrue(service.getVersion().equals(inputNotification.getServiceVersion()));
+
+ }
+
+ @Test
+ @OperateOnDeployment("asdc-controller")
+ public void testNotifsDeployment() throws NoSuchAlgorithmException,
+ IOException,
+ URISyntaxException,
+ ArtifactInstallerException, ASDCControllerException, ASDCParametersException {
+
+
+ ASDCController asdcControllerV1 = new ASDCController("asdc-controller1", distribClientV1);
+ asdcControllerV1.initASDC();
+ asdcControllerV1.treatNotification(notifDataV1);
+
+ assertTrue(distribClientV1.getDistributionMessageReceived().size() > 0);
+ for (IDistributionStatusMessage message : distribClientV1.getDistributionMessageReceived()) {
+ System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
+ assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
+ }
+
+ this.validateVnfResource(notifDataV1, distribClientV1.getListVFModuleMetaData());
- for (IDistributionStatusMessage message:distribClientV2.getDistributionMessageReceived()) {
- System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
- assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
- }
- this.validateVnfResource(notifDataV2,distribClientV2.getListVFModuleMetaData());
+ // Try again to load the same notif
+ ASDCController asdcControllerNewNotif = new ASDCController("asdc-controller1", distribClientV1ForSameNotif);
+ asdcControllerNewNotif.initASDC();
+ asdcControllerNewNotif.treatNotification(notifDataV1);
+
+ for (IDistributionStatusMessage message : distribClientV1ForSameNotif.getDistributionMessageReceived()) {
+ System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
+ assertTrue(message.getStatus().equals(DistributionStatusEnum.ALREADY_DEPLOYED) || message.getStatus().equals(DistributionStatusEnum.ALREADY_DOWNLOADED));
+ }
+
+
+ // Try again to load same notif but in V2
+ ASDCController asdcControllerV2 = new ASDCController("asdc-controller1", distribClientV2);
+ asdcControllerV2.initASDC();
+ asdcControllerV2.treatNotification(notifDataV2);
+
+ for (IDistributionStatusMessage message : distribClientV2.getDistributionMessageReceived()) {
+ System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
+ assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
+ }
+
+ this.validateVnfResource(notifDataV2, distribClientV2.getListVFModuleMetaData());
- // Try again to load same notif + Script + Volume artifacts and in service V3
- ASDCController asdcControllerV3 = new ASDCController("asdc-controller1", distribClientV3);
- asdcControllerV3.initASDC();
- asdcControllerV3.treatNotification(notifDataV3);
+ // Try again to load same notif + Script + Volume artifacts and in service V3
+ ASDCController asdcControllerV3 = new ASDCController("asdc-controller1", distribClientV3);
+ asdcControllerV3.initASDC();
+ asdcControllerV3.treatNotification(notifDataV3);
- for (IDistributionStatusMessage message:distribClientV3.getDistributionMessageReceived()) {
- System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
- assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
- }
+ for (IDistributionStatusMessage message : distribClientV3.getDistributionMessageReceived()) {
+ System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
+ assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
+ }
- this.validateVnfResource(notifDataV3,distribClientV3.getListVFModuleMetaData());
+ this.validateVnfResource(notifDataV3, distribClientV3.getListVFModuleMetaData());
- // Try again to load same notif + Script + Volume artifacts and in service V4
- ASDCController asdcControllerV4 = new ASDCController("asdc-controller1", distribClientV4);
- asdcControllerV4.initASDC();
- asdcControllerV4.treatNotification(notifDataV4);
+ // Try again to load same notif + Script + Volume artifacts and in service V4
+ ASDCController asdcControllerV4 = new ASDCController("asdc-controller1", distribClientV4);
+ asdcControllerV4.initASDC();
+ asdcControllerV4.treatNotification(notifDataV4);
- for (IDistributionStatusMessage message:distribClientV4.getDistributionMessageReceived()) {
- System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
- assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
- }
+ for (IDistributionStatusMessage message : distribClientV4.getDistributionMessageReceived()) {
+ System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
+ assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
+ }
- this.validateVnfResource(notifDataV4,distribClientV4.getListVFModuleMetaData());
+ this.validateVnfResource(notifDataV4, distribClientV4.getListVFModuleMetaData());
- // Try again with service V5 (Nested template attached to Volume + HEat artifact not used by module),
- //this should force the notification DEPLOY_ERROR to be sent for this artifact
- ASDCController asdcControllerV5 = new ASDCController("asdc-controller1", distribClientV5);
- asdcControllerV5.initASDC();
- asdcControllerV5.treatNotification(notifDataV5);
+ // Try again with service V5 (Nested template attached to Volume + HEat artifact not used by module),
+ //this should force the notification DEPLOY_ERROR to be sent for this artifact
+ ASDCController asdcControllerV5 = new ASDCController("asdc-controller1", distribClientV5);
+ asdcControllerV5.initASDC();
+ asdcControllerV5.treatNotification(notifDataV5);
- for (IDistributionStatusMessage message:distribClientV5.getDistributionMessageReceived()) {
- System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
- if ("cloud-nimbus.sh".equals(message.getArtifactURL())) {
- assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_ERROR) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
- } else {
- assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
- }
- }
+ for (IDistributionStatusMessage message : distribClientV5.getDistributionMessageReceived()) {
+ System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
+ if ("cloud-nimbus.sh".equals(message.getArtifactURL())) {
+ assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_ERROR) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
+ } else {
+ assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
+ }
+ }
- this.validateVnfResource(notifDataV5,distribClientV5.getListVFModuleMetaData());
+ this.validateVnfResource(notifDataV5, distribClientV5.getListVFModuleMetaData());
- // Try again with demo DNS
- ASDCController asdcControllerDNS = new ASDCController("asdc-controller1", distribClientDNS);
- asdcControllerDNS.initASDC();
- asdcControllerDNS.treatNotification(notifDataDNS);
+ // Try again with demo DNS
+ ASDCController asdcControllerDNS = new ASDCController("asdc-controller1", distribClientDNS);
+ asdcControllerDNS.initASDC();
+ asdcControllerDNS.treatNotification(notifDataDNS);
- for (IDistributionStatusMessage message:distribClientDNS.getDistributionMessageReceived()) {
- System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
- assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
- }
+ for (IDistributionStatusMessage message : distribClientDNS.getDistributionMessageReceived()) {
+ System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
+ assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
+ }
- this.validateVnfResource(notifDataDNS,distribClientDNS.getListVFModuleMetaData());
+ this.validateVnfResource(notifDataDNS, distribClientDNS.getListVFModuleMetaData());
- // Try again with demo VFW
- ASDCController asdcControllerVFW = new ASDCController("asdc-controller1", distribClientVFW);
- asdcControllerVFW.initASDC();
- asdcControllerVFW.treatNotification(notifDataVFW);
+ // Try again with demo VFW
+ ASDCController asdcControllerVFW = new ASDCController("asdc-controller1", distribClientVFW);
+ asdcControllerVFW.initASDC();
+ asdcControllerVFW.treatNotification(notifDataVFW);
- for (IDistributionStatusMessage message : distribClientVFW.getDistributionMessageReceived()) {
- System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
- assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK)
- || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
- }
+ for (IDistributionStatusMessage message : distribClientVFW.getDistributionMessageReceived()) {
+ System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
+ assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK)
+ || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
+ }
- this.validateVnfResource(notifDataVFW, distribClientVFW.getListVFModuleMetaData());
+ this.validateVnfResource(notifDataVFW, distribClientVFW.getListVFModuleMetaData());
- }
+ }
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java
index 3cb5a97d09..933216e611 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java
@@ -48,28 +48,28 @@ import org.openecomp.mso.asdc.installer.IVfModuleData;
public class DistributionClientEmulator implements IDistributionClient {
- private String resourcePath;
+ private String resourcePath;
- private List<IVfModuleData> listVFModuleMetaData;
+ private List<IVfModuleData> listVFModuleMetaData;
- private List<IDistributionStatusMessage> distributionMessageReceived = new LinkedList<>();
+ private List<IDistributionStatusMessage> distributionMessageReceived = new LinkedList<>();
- public DistributionClientEmulator(String notifFolderInResource) {
+ public DistributionClientEmulator(String notifFolderInResource) {
- resourcePath = notifFolderInResource;
- }
+ resourcePath = notifFolderInResource;
+ }
- public List<IDistributionStatusMessage> getDistributionMessageReceived() {
- return distributionMessageReceived;
- }
-
- @Override
- public List<IVfModuleMetadata> decodeVfModuleArtifact(byte[] arg0) {
- return null;
- }
+ public List<IDistributionStatusMessage> getDistributionMessageReceived() {
+ return distributionMessageReceived;
+ }
+
+ @Override
+ public List<IVfModuleMetadata> decodeVfModuleArtifact(byte[] arg0) {
+ return null;
+ }
/* @Override
- public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) {
+ public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) {
try {
listVFModuleMetaData = new ObjectMapper().readValue(arg0, new TypeReference<List<JsonVfModuleMetaData>>(){});
return listVFModuleMetaData;
@@ -84,91 +84,91 @@ public class DistributionClientEmulator implements IDistributionClient {
return null;
} */
- public List<IVfModuleData> getListVFModuleMetaData() {
- return listVFModuleMetaData;
- }
+ public List<IVfModuleData> getListVFModuleMetaData() {
+ return listVFModuleMetaData;
+ }
@Override
- public IDistributionClientDownloadResult download (IArtifactInfo arg0) {
-
-
- //String filename = resourcePath+"/artifacts/"+arg0.getArtifactURL();
- String filename = arg0.getArtifactURL();
- System.out.println("Emulating the download from resources files:"+filename);
-
- InputStream inputStream = null;
-
- if(arg0.getArtifactName().equals("service_Rg516VmmscSrvc_csar.csar")){
- try{
- inputStream = new FileInputStream(System.getProperty("java.io.tmpdir") + File.separator + "service_Rg516VmmscSrvc_csar.csar");
- }catch(Exception e){
- System.out.println("Error " + e.getMessage());
- }
- }else{
-
- inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath + filename);
- }
+ public IDistributionClientDownloadResult download(IArtifactInfo arg0) {
- if (inputStream == null) {
- System.out.println("InputStream is NULL for:"+filename);
- }
- try {
- return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(),arg0.getArtifactName(),IOUtils.toByteArray(inputStream));
- } catch (IOException e) {
-
- e.printStackTrace();
- }
- return null;
- }
- @Override
- public IConfiguration getConfiguration() {
- return null;
- }
-
- @Override
- public IDistributionClientResult init(IConfiguration arg0, INotificationCallback arg1) {
- return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
- }
-
- @Override
- public IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage arg0) {
- this.distributionMessageReceived.add(arg0);
- return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
- }
-
- @Override
- public IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage arg0, String arg1) {
- this.distributionMessageReceived.add(arg0);
- return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
- }
-
- @Override
- public IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage arg0) {
- this.distributionMessageReceived.add(arg0);
- return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
- }
-
- @Override
- public IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage arg0, String arg1) {
- this.distributionMessageReceived.add(arg0);
- return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
- }
-
- @Override
- public IDistributionClientResult start() {
- return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
- }
-
- @Override
- public IDistributionClientResult stop() {
- return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
-
- }
-
- @Override
- public IDistributionClientResult updateConfiguration(IConfiguration arg0) {
- return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
- }
+ //String filename = resourcePath+"/artifacts/"+arg0.getArtifactURL();
+ String filename = arg0.getArtifactURL();
+ System.out.println("Emulating the download from resources files:" + filename);
+
+ InputStream inputStream = null;
+
+ if (arg0.getArtifactName().equals("service_Rg516VmmscSrvc_csar.csar")) {
+ try {
+ inputStream = new FileInputStream(System.getProperty("java.io.tmpdir") + File.separator + "service_Rg516VmmscSrvc_csar.csar");
+ } catch (Exception e) {
+ System.out.println("Error " + e.getMessage());
+ }
+ } else {
+
+ inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath + filename);
+ }
+
+ if (inputStream == null) {
+ System.out.println("InputStream is NULL for:" + filename);
+ }
+ try {
+ return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(), arg0.getArtifactName(), IOUtils.toByteArray(inputStream));
+ } catch (IOException e) {
+
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public IConfiguration getConfiguration() {
+ return null;
+ }
+
+ @Override
+ public IDistributionClientResult init(IConfiguration arg0, INotificationCallback arg1) {
+ return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
+ }
+
+ @Override
+ public IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage arg0) {
+ this.distributionMessageReceived.add(arg0);
+ return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
+ }
+
+ @Override
+ public IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage arg0, String arg1) {
+ this.distributionMessageReceived.add(arg0);
+ return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
+ }
+
+ @Override
+ public IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage arg0) {
+ this.distributionMessageReceived.add(arg0);
+ return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
+ }
+
+ @Override
+ public IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage arg0, String arg1) {
+ this.distributionMessageReceived.add(arg0);
+ return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
+ }
+
+ @Override
+ public IDistributionClientResult start() {
+ return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
+ }
+
+ @Override
+ public IDistributionClientResult stop() {
+ return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
+
+ }
+
+ @Override
+ public IDistributionClientResult updateConfiguration(IConfiguration arg0) {
+ return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
+ }
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfo.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfo.java
index 90511033dd..e998778a26 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfo.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfo.java
@@ -19,6 +19,7 @@
*/
package org.openecomp.mso.global_tests.asdc.notif_emulator;
+
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -31,92 +32,91 @@ import org.openecomp.sdc.api.notification.IArtifactInfo;
public class JsonArtifactInfo implements IArtifactInfo {
- @JsonIgnore
- private Map<String,IArtifactInfo> artifactsMapByUUID = new HashMap<>();
-
- @JsonIgnore
- private Map<String,Object> attributesMap = new HashMap<>();
-
- public JsonArtifactInfo() {
-
- }
-
- public synchronized void addArtifactToUUIDMap (List<JsonArtifactInfo> artifactList) {
- for (JsonArtifactInfo artifact:artifactList) {
- artifactsMapByUUID.put(artifact.getArtifactUUID(), artifact);
- }
-
- }
-
- @SuppressWarnings("unused")
- @JsonAnySetter
- public final void setAttribute(String attrName, Object attrValue) {
- if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
- this.attributesMap.put(attrName,attrValue);
- }
- }
-
-
-
- public Map<String, IArtifactInfo> getArtifactsMapByUUID() {
- return artifactsMapByUUID;
- }
-
- @Override
- public String getArtifactChecksum() {
- return (String)attributesMap.get("artifactCheckSum");
- }
-
- @Override
- public String getArtifactDescription() {
- return (String)attributesMap.get("artifactDescription");
- }
-
- @Override
- public String getArtifactName() {
- return (String)attributesMap.get("artifactName");
- }
-
- @Override
- public Integer getArtifactTimeout() {
- return (Integer)attributesMap.get("artifactTimeout");
- }
-
- @Override
- public String getArtifactType() {
- return (String)attributesMap.get("artifactType");
- }
-
- @Override
- public String getArtifactURL() {
- return (String)attributesMap.get("artifactURL");
- }
-
- @Override
- public String getArtifactUUID() {
- return (String)attributesMap.get("artifactUUID");
- }
-
- @Override
- public String getArtifactVersion() {
- return (String)attributesMap.get("artifactVersion");
- }
-
- @Override
- public IArtifactInfo getGeneratedArtifact () {
- return artifactsMapByUUID.get(attributesMap.get("generatedArtifact"));
- }
-
- @Override
- public List<IArtifactInfo> getRelatedArtifacts() {
- List<IArtifactInfo> listArtifacts = new LinkedList<>();
- List<String> uuidList = (List<String>)attributesMap.get("relatedArtifact");
- if (uuidList != null) {
- for(String uuid:uuidList) {
- listArtifacts.add(artifactsMapByUUID.get(uuid));
- }
- }
- return listArtifacts;
- }
+ @JsonIgnore
+ private Map<String, IArtifactInfo> artifactsMapByUUID = new HashMap<>();
+
+ @JsonIgnore
+ private Map<String, Object> attributesMap = new HashMap<>();
+
+ public JsonArtifactInfo() {
+
+ }
+
+ public synchronized void addArtifactToUUIDMap(List<JsonArtifactInfo> artifactList) {
+ for (JsonArtifactInfo artifact : artifactList) {
+ artifactsMapByUUID.put(artifact.getArtifactUUID(), artifact);
+ }
+
+ }
+
+ @SuppressWarnings("unused")
+ @JsonAnySetter
+ public final void setAttribute(String attrName, Object attrValue) {
+ if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
+ this.attributesMap.put(attrName, attrValue);
+ }
+ }
+
+
+ public Map<String, IArtifactInfo> getArtifactsMapByUUID() {
+ return artifactsMapByUUID;
+ }
+
+ @Override
+ public String getArtifactChecksum() {
+ return (String) attributesMap.get("artifactCheckSum");
+ }
+
+ @Override
+ public String getArtifactDescription() {
+ return (String) attributesMap.get("artifactDescription");
+ }
+
+ @Override
+ public String getArtifactName() {
+ return (String) attributesMap.get("artifactName");
+ }
+
+ @Override
+ public Integer getArtifactTimeout() {
+ return (Integer) attributesMap.get("artifactTimeout");
+ }
+
+ @Override
+ public String getArtifactType() {
+ return (String) attributesMap.get("artifactType");
+ }
+
+ @Override
+ public String getArtifactURL() {
+ return (String) attributesMap.get("artifactURL");
+ }
+
+ @Override
+ public String getArtifactUUID() {
+ return (String) attributesMap.get("artifactUUID");
+ }
+
+ @Override
+ public String getArtifactVersion() {
+ return (String) attributesMap.get("artifactVersion");
+ }
+
+ @Override
+ public IArtifactInfo getGeneratedArtifact() {
+ return artifactsMapByUUID.get(attributesMap.get("generatedArtifact"));
+ }
+
+ @Override
+ public List<IArtifactInfo> getRelatedArtifacts() {
+ List<IArtifactInfo> listArtifacts = new LinkedList<>();
+ List<String> uuidList = (List<String>) attributesMap.get("relatedArtifact");
+ if (uuidList != null) {
+ for (String uuid : uuidList) {
+ listArtifacts.add(artifactsMapByUUID.get(uuid));
+ }
+ }
+ return listArtifacts;
+ }
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfoDeserializer.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfoDeserializer.java
index 010c9ac2a7..c1213763df 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfoDeserializer.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfoDeserializer.java
@@ -30,19 +30,20 @@ import org.codehaus.jackson.map.JsonDeserializer;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
-public class JsonArtifactInfoDeserializer extends JsonDeserializer<List<JsonArtifactInfo>>{
+public class JsonArtifactInfoDeserializer extends JsonDeserializer<List<JsonArtifactInfo>> {
- @Override
- public List<JsonArtifactInfo> deserialize(JsonParser jp, DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
- List<JsonArtifactInfo> jsonArtifactInfoList = new ObjectMapper().readValue(jp, new TypeReference<List<JsonArtifactInfo>>(){});
+ @Override
+ public List<JsonArtifactInfo> deserialize(JsonParser jp, DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+ List<JsonArtifactInfo> jsonArtifactInfoList = new ObjectMapper().readValue(jp, new TypeReference<List<JsonArtifactInfo>>() {
+ });
- // For each artifact add the list of artifact retrieved
- // This could be used later to index by UUID
- for (JsonArtifactInfo artifactInfo:jsonArtifactInfoList) {
- artifactInfo.addArtifactToUUIDMap(jsonArtifactInfoList);
- }
- return jsonArtifactInfoList;
- }
+ // For each artifact add the list of artifact retrieved
+ // This could be used later to index by UUID
+ for (JsonArtifactInfo artifactInfo : jsonArtifactInfoList) {
+ artifactInfo.addArtifactToUUIDMap(jsonArtifactInfoList);
+ }
+ return jsonArtifactInfoList;
+ }
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonNotificationData.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonNotificationData.java
index cf041afd6c..7622a43a7b 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonNotificationData.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonNotificationData.java
@@ -40,89 +40,89 @@ import org.openecomp.sdc.api.notification.IResourceInstance;
public class JsonNotificationData implements INotificationData {
- @JsonIgnore
- private Map<String,Object> attributesMap = new HashMap<>();
-
- @JsonProperty("serviceArtifacts")
- @JsonDeserialize(using=JsonArtifactInfoDeserializer.class)
- private List<IArtifactInfo> serviceArtifacts;
-
- @JsonProperty("resources")
- @JsonDeserialize(using=JsonResourceInfoDeserializer.class)
- private List<IResourceInstance> resourcesList;
-
- public JsonNotificationData() {
-
- }
-
- /**
- * Method instantiate a INotificationData implementation from a JSON file.
- *
- * @param notifFilePath The file path in String
- * @return A JsonNotificationData instance
- * @throws IOException in case of the file is not readable or not accessible
- */
- public static JsonNotificationData instantiateNotifFromJsonFile(String notifFilePath) throws IOException {
-
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(notifFilePath+"/notif-structure.json");
-
- if (is == null) {
- throw new FileExistsException("Resource Path does not exist: "+notifFilePath);
- }
- ObjectMapper mapper = new ObjectMapper();
- return mapper.readValue(is, JsonNotificationData.class);
- }
-
- @SuppressWarnings("unused")
- @JsonAnySetter
- public final void setAttribute(String attrName, Object attrValue) {
- if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
- this.attributesMap.put(attrName,attrValue);
- }
- }
-
- @Override
- public IArtifactInfo getArtifactMetadataByUUID(String arg0) {
- return null;
- }
-
- @Override
- public String getDistributionID() {
- return (String)this.attributesMap.get("distributionID");
- }
-
- @Override
- public List<IResourceInstance> getResources() {
- return resourcesList;
- }
-
- @Override
- public List<IArtifactInfo> getServiceArtifacts() {
- return this.serviceArtifacts;
- }
-
- @Override
- public String getServiceDescription() {
- return (String)this.attributesMap.get("serviceDescription");
- }
-
- @Override
- public String getServiceInvariantUUID() {
- return (String)this.attributesMap.get("serviceInvariantUUID");
- }
-
- @Override
- public String getServiceName() {
- return (String)this.attributesMap.get("serviceName");
- }
-
- @Override
- public String getServiceUUID() {
- return (String)this.attributesMap.get("serviceUUID");
- }
-
- @Override
- public String getServiceVersion() {
- return (String)this.attributesMap.get("serviceVersion");
- }
+ @JsonIgnore
+ private Map<String, Object> attributesMap = new HashMap<>();
+
+ @JsonProperty("serviceArtifacts")
+ @JsonDeserialize(using = JsonArtifactInfoDeserializer.class)
+ private List<IArtifactInfo> serviceArtifacts;
+
+ @JsonProperty("resources")
+ @JsonDeserialize(using = JsonResourceInfoDeserializer.class)
+ private List<IResourceInstance> resourcesList;
+
+ public JsonNotificationData() {
+
+ }
+
+ /**
+ * Method instantiate a INotificationData implementation from a JSON file.
+ *
+ * @param notifFilePath The file path in String
+ * @return A JsonNotificationData instance
+ * @throws IOException in case of the file is not readable or not accessible
+ */
+ public static JsonNotificationData instantiateNotifFromJsonFile(String notifFilePath) throws IOException {
+
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(notifFilePath + "/notif-structure.json");
+
+ if (is == null) {
+ throw new FileExistsException("Resource Path does not exist: " + notifFilePath);
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ return mapper.readValue(is, JsonNotificationData.class);
+ }
+
+ @SuppressWarnings("unused")
+ @JsonAnySetter
+ public final void setAttribute(String attrName, Object attrValue) {
+ if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
+ this.attributesMap.put(attrName, attrValue);
+ }
+ }
+
+ @Override
+ public IArtifactInfo getArtifactMetadataByUUID(String arg0) {
+ return null;
+ }
+
+ @Override
+ public String getDistributionID() {
+ return (String) this.attributesMap.get("distributionID");
+ }
+
+ @Override
+ public List<IResourceInstance> getResources() {
+ return resourcesList;
+ }
+
+ @Override
+ public List<IArtifactInfo> getServiceArtifacts() {
+ return this.serviceArtifacts;
+ }
+
+ @Override
+ public String getServiceDescription() {
+ return (String) this.attributesMap.get("serviceDescription");
+ }
+
+ @Override
+ public String getServiceInvariantUUID() {
+ return (String) this.attributesMap.get("serviceInvariantUUID");
+ }
+
+ @Override
+ public String getServiceName() {
+ return (String) this.attributesMap.get("serviceName");
+ }
+
+ @Override
+ public String getServiceUUID() {
+ return (String) this.attributesMap.get("serviceUUID");
+ }
+
+ @Override
+ public String getServiceVersion() {
+ return (String) this.attributesMap.get("serviceVersion");
+ }
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java
index af49ee0d37..a717238bb9 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java
@@ -34,72 +34,72 @@ import org.openecomp.sdc.api.notification.IResourceInstance;
public class JsonResourceInfo implements IResourceInstance {
- @JsonIgnore
- private Map<String,Object> attributesMap = new HashMap<>();
-
- @JsonProperty("artifacts")
- @JsonDeserialize(using=JsonArtifactInfoDeserializer.class)
- private List<IArtifactInfo> artifacts;
-
- public JsonResourceInfo() {
-
- }
-
- @Override
- public List<IArtifactInfo> getArtifacts() {
- return artifacts;
- }
-
- @Override
- public String getResourceInstanceName() {
- return (String)attributesMap.get("resourceInstanceName");
- }
-
- @Override
- public String getResourceInvariantUUID() {
- return (String)attributesMap.get("resourceInvariantUUID");
- }
-
- @Override
- public String getResourceName() {
- return (String)attributesMap.get("resourceName");
- }
-
- @Override
- public String getResourceType() {
- return (String)attributesMap.get("resourceType");
- }
-
- @Override
- public String getResourceUUID() {
- return (String)attributesMap.get("resourceUUID");
- }
-
- @Override
- public String getResourceVersion() {
- return (String)attributesMap.get("resourceVersion");
- }
-
- @Override
- public String getResourceCustomizationUUID() {
- return (String)attributesMap.get("resourceCustomizationUUID");
- }
-
- @Override
- public String getSubcategory() {
- return (String)attributesMap.get("subCategory");
- }
-
- @Override
- public String getCategory() {
- return (String)attributesMap.get("category");
- }
-
- @SuppressWarnings("unused")
- @JsonAnySetter
- public final void setAttribute(String attrName, Object attrValue) {
- if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
- this.attributesMap.put(attrName,attrValue);
- }
- }
+ @JsonIgnore
+ private Map<String, Object> attributesMap = new HashMap<>();
+
+ @JsonProperty("artifacts")
+ @JsonDeserialize(using = JsonArtifactInfoDeserializer.class)
+ private List<IArtifactInfo> artifacts;
+
+ public JsonResourceInfo() {
+
+ }
+
+ @Override
+ public List<IArtifactInfo> getArtifacts() {
+ return artifacts;
+ }
+
+ @Override
+ public String getResourceInstanceName() {
+ return (String) attributesMap.get("resourceInstanceName");
+ }
+
+ @Override
+ public String getResourceInvariantUUID() {
+ return (String) attributesMap.get("resourceInvariantUUID");
+ }
+
+ @Override
+ public String getResourceName() {
+ return (String) attributesMap.get("resourceName");
+ }
+
+ @Override
+ public String getResourceType() {
+ return (String) attributesMap.get("resourceType");
+ }
+
+ @Override
+ public String getResourceUUID() {
+ return (String) attributesMap.get("resourceUUID");
+ }
+
+ @Override
+ public String getResourceVersion() {
+ return (String) attributesMap.get("resourceVersion");
+ }
+
+ @Override
+ public String getResourceCustomizationUUID() {
+ return (String) attributesMap.get("resourceCustomizationUUID");
+ }
+
+ @Override
+ public String getSubcategory() {
+ return (String) attributesMap.get("subCategory");
+ }
+
+ @Override
+ public String getCategory() {
+ return (String) attributesMap.get("category");
+ }
+
+ @SuppressWarnings("unused")
+ @JsonAnySetter
+ public final void setAttribute(String attrName, Object attrValue) {
+ if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
+ this.attributesMap.put(attrName, attrValue);
+ }
+ }
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfoDeserializer.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfoDeserializer.java
index 5b18a2cbc9..b1cf82af63 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfoDeserializer.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfoDeserializer.java
@@ -30,14 +30,15 @@ import org.codehaus.jackson.map.JsonDeserializer;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
-public class JsonResourceInfoDeserializer extends JsonDeserializer<List<JsonResourceInfo>>{
+public class JsonResourceInfoDeserializer extends JsonDeserializer<List<JsonResourceInfo>> {
- @Override
- public List<JsonResourceInfo> deserialize(JsonParser jp, DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
- List<JsonResourceInfo> jsonResourceInfoList = new ObjectMapper().readValue(jp, new TypeReference<List<JsonResourceInfo>>(){});
-
- return jsonResourceInfoList;
- }
+ @Override
+ public List<JsonResourceInfo> deserialize(JsonParser jp, DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+ List<JsonResourceInfo> jsonResourceInfoList = new ObjectMapper().readValue(jp, new TypeReference<List<JsonResourceInfo>>() {
+ });
+
+ return jsonResourceInfoList;
+ }
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonVfModuleMetaData.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonVfModuleMetaData.java
index 08d9895a53..08fd140bda 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonVfModuleMetaData.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonVfModuleMetaData.java
@@ -31,53 +31,53 @@ import org.openecomp.sdc.api.notification.IVfModuleMetadata;
public class JsonVfModuleMetaData implements IVfModuleMetadata {
- @JsonProperty("artifacts")
- private List<String> artifacts;
-
- @JsonIgnore
- private Map<String,Object> attributesMap = new HashMap<>();
-
- @Override
- public List<String> getArtifacts() {
- return artifacts;
- }
+ @JsonProperty("artifacts")
+ private List<String> artifacts;
- @Override
- public String getVfModuleModelDescription() {
- return (String)attributesMap.get("vfModuleModelDescription");
- }
+ @JsonIgnore
+ private Map<String, Object> attributesMap = new HashMap<>();
- @Override
- public String getVfModuleModelInvariantUUID() {
- return (String)attributesMap.get("vfModuleModelInvariantUUID");
- }
+ @Override
+ public List<String> getArtifacts() {
+ return artifacts;
+ }
- @Override
- public String getVfModuleModelName() {
- return (String)attributesMap.get("vfModuleModelName");
- }
+ @Override
+ public String getVfModuleModelDescription() {
+ return (String) attributesMap.get("vfModuleModelDescription");
+ }
- @Override
- public String getVfModuleModelUUID() {
- return (String)attributesMap.get("vfModuleModelUUID");
- }
+ @Override
+ public String getVfModuleModelInvariantUUID() {
+ return (String) attributesMap.get("vfModuleModelInvariantUUID");
+ }
- @Override
- public String getVfModuleModelVersion() {
- return (String)attributesMap.get("vfModuleModelVersion");
- }
+ @Override
+ public String getVfModuleModelName() {
+ return (String) attributesMap.get("vfModuleModelName");
+ }
- @Override
- public boolean isBase() {
- return (boolean)attributesMap.get("isBase");
- }
-
- @SuppressWarnings("unused")
- @JsonAnySetter
- public final void setAttribute(String attrName, Object attrValue) {
- if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
- this.attributesMap.put(attrName,attrValue);
- }
- }
+ @Override
+ public String getVfModuleModelUUID() {
+ return (String) attributesMap.get("vfModuleModelUUID");
+ }
+
+ @Override
+ public String getVfModuleModelVersion() {
+ return (String) attributesMap.get("vfModuleModelVersion");
+ }
+
+ @Override
+ public boolean isBase() {
+ return (boolean) attributesMap.get("isBase");
+ }
+
+ @SuppressWarnings("unused")
+ @JsonAnySetter
+ public final void setAttribute(String attrName, Object attrValue) {
+ if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
+ this.attributesMap.put(attrName, attrValue);
+ }
+ }
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/jmeter/JMeterITCase.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/jmeter/JMeterITCase.java
index 0bf9eac915..72a957f45a 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/jmeter/JMeterITCase.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/jmeter/JMeterITCase.java
@@ -50,80 +50,80 @@ import org.openecomp.mso.global_tests.ArquillianPackagerForITCases;
@RunWith(Arquillian.class)
public class JMeterITCase {
-
- @Deployment(name="mso-api-handler-infra",testable=false)
- public static Archive<?> createMsoApiHandlerInfraWarDeployment () {
- System.out.println("Deploying ApiHandler Infra WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../mso-api-handlers/mso-api-handler-infra/target/", "mso-api-handler-infra*.war", "mso-api-handler-infra.war");
- }
-
- @Deployment(name="mso-vnf-adapter",testable=false)
- public static Archive<?> createMsoVnfAdapterWarDeployment () {
- System.out.println("Deploying VNF Adapter WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-vnf-adapter/target/", "mso-vnf-adapter*.war", "mso-vnf-adapter.war");
- }
-
- @Deployment(name="mso-tenant-adapter",testable=false)
- public static Archive<?> createMsoTenantAdapterWarDeployment () {
- System.out.println("Deploying Tenant Adapter WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-tenant-adapter/target/", "mso-tenant-adapter*.war", "mso-tenant-adapter.war");
- }
-
- @Deployment(name="mso-sdnc-adapter",testable=false)
- public static Archive<?> createMsoSdncAdapterWarDeployment () {
- System.out.println("Deploying SDNC Adapter WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-sdnc-adapter/target/", "mso-sdnc-adapter*.war", "mso-sdnc-adapter.war");
- }
-
- @Deployment(name="mso-network-adapter",testable=false)
- public static Archive<?> createMsoNetworkAdapterWarDeployment () {
- System.out.println("Deploying Network Adapter WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-network-adapter/target/", "mso-network-adapter*.war", "mso-network-adapter.war");
- }
-
- @Deployment(name="mso-requests-db-adapter",testable=false)
- public static Archive<?> createMsoRequestsDbAdapterWarDeployment () {
- System.out.println("Deploying Requests DB Adapter WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-requests-db-adapter/target/", "mso-requests-db-adapter*.war", "mso-requests-db-adapter.war");
- }
-
- @Deployment(name="asdc-controller",testable=true)
- public static Archive<?> createAsdcControllerWarDeployment () {
- System.out.println("Deploying ASDC Controller WAR with additional resources on default server");
-
- WebArchive warArchive = (WebArchive)ArquillianPackagerForITCases.createPackageFromExistingOne("../../asdc-controller/target/", "asdc-controller*.war", "asdc-controller.war");
-
- // Add the current test class
- JavaArchive testclasses = ShrinkWrap.create (JavaArchive.class, "testClasses.jar");
- testclasses.addClasses(JMeterITCase.class);
-
- warArchive.addAsLibraries(testclasses);
-
- // BE CAREFUL a settings.xml file must be located in ${home.user}/.m2/settings.xml
- warArchive.addAsLibraries(Maven.resolver()
- .resolve("org.mockito:mockito-all:1.10.19")
- .withoutTransitivity ()
- .asFile ());
-
- // Take one war randomly to make arquilian happy
-
- Testable.archiveToTest(warArchive);
-
-
- return warArchive;
- }
-
-
+
+ @Deployment(name = "mso-api-handler-infra", testable = false)
+ public static Archive<?> createMsoApiHandlerInfraWarDeployment() {
+ System.out.println("Deploying ApiHandler Infra WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../mso-api-handlers/mso-api-handler-infra/target/", "mso-api-handler-infra*.war", "mso-api-handler-infra.war");
+ }
+
+ @Deployment(name = "mso-vnf-adapter", testable = false)
+ public static Archive<?> createMsoVnfAdapterWarDeployment() {
+ System.out.println("Deploying VNF Adapter WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-vnf-adapter/target/", "mso-vnf-adapter*.war", "mso-vnf-adapter.war");
+ }
+
+ @Deployment(name = "mso-tenant-adapter", testable = false)
+ public static Archive<?> createMsoTenantAdapterWarDeployment() {
+ System.out.println("Deploying Tenant Adapter WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-tenant-adapter/target/", "mso-tenant-adapter*.war", "mso-tenant-adapter.war");
+ }
+
+ @Deployment(name = "mso-sdnc-adapter", testable = false)
+ public static Archive<?> createMsoSdncAdapterWarDeployment() {
+ System.out.println("Deploying SDNC Adapter WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-sdnc-adapter/target/", "mso-sdnc-adapter*.war", "mso-sdnc-adapter.war");
+ }
+
+ @Deployment(name = "mso-network-adapter", testable = false)
+ public static Archive<?> createMsoNetworkAdapterWarDeployment() {
+ System.out.println("Deploying Network Adapter WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-network-adapter/target/", "mso-network-adapter*.war", "mso-network-adapter.war");
+ }
+
+ @Deployment(name = "mso-requests-db-adapter", testable = false)
+ public static Archive<?> createMsoRequestsDbAdapterWarDeployment() {
+ System.out.println("Deploying Requests DB Adapter WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-requests-db-adapter/target/", "mso-requests-db-adapter*.war", "mso-requests-db-adapter.war");
+ }
+
+ @Deployment(name = "asdc-controller", testable = true)
+ public static Archive<?> createAsdcControllerWarDeployment() {
+ System.out.println("Deploying ASDC Controller WAR with additional resources on default server");
+
+ WebArchive warArchive = (WebArchive) ArquillianPackagerForITCases.createPackageFromExistingOne("../../asdc-controller/target/", "asdc-controller*.war", "asdc-controller.war");
+
+ // Add the current test class
+ JavaArchive testclasses = ShrinkWrap.create(JavaArchive.class, "testClasses.jar");
+ testclasses.addClasses(JMeterITCase.class);
+
+ warArchive.addAsLibraries(testclasses);
+
+ // BE CAREFUL a settings.xml file must be located in ${home.user}/.m2/settings.xml
+ warArchive.addAsLibraries(Maven.resolver()
+ .resolve("org.mockito:mockito-all:1.10.19")
+ .withoutTransitivity()
+ .asFile());
+
+ // Take one war randomly to make arquilian happy
+
+ Testable.archiveToTest(warArchive);
+
+
+ return warArchive;
+ }
+
+
@BeforeClass
- public static void waitBeforeStart () throws InterruptedException {
- System.out.println ("Executing " + JMeterITCase.class.getName ());
-
+ public static void waitBeforeStart() throws InterruptedException {
+ System.out.println("Executing " + JMeterITCase.class.getName());
+
}
@Test
- @RunAsClient()
- public void testJMeter() throws IOException {
- // JMeter Engine
+ @RunAsClient()
+ public void testJMeter() throws IOException {
+ // JMeter Engine
StandardJMeterEngine jmeter = new StandardJMeterEngine();
@@ -132,12 +132,12 @@ public class JMeterITCase {
JMeterUtils.setJMeterHome("/tmp/apache-jmeter-2.13");
JMeterUtils.initLogging();// you can comment this line out to see extra log messages of i.e. DEBUG level
JMeterUtils.initLocale();
-
+
// Initialize JMeter SaveService
SaveService.loadProperties();
// Load existing .jmx Test Plan
-
+
FileInputStream in = new FileInputStream("./src/test/resources/JMeter/MSO-Perf.jmx");
HashTree testPlanTree = SaveService.loadTree(in);
testPlanTree.getTree("test variables");
@@ -146,21 +146,21 @@ public class JMeterITCase {
// Run JMeter Test
jmeter.configure(testPlanTree);
jmeter.run();
- }
+ }
@AfterClass
public static void afterArquillianTest() {
- try {
- Files.move (Paths.get ("./jmeter.log"),
- Paths.get ("./target/surefire-reports/jmeter.log"),
- StandardCopyOption.REPLACE_EXISTING);
-
+ try {
+ Files.move(Paths.get("./jmeter.log"),
+ Paths.get("./target/surefire-reports/jmeter.log"),
+ StandardCopyOption.REPLACE_EXISTING);
+
/* Files.move (Paths.get ("./mso-perf.jtl"),
Paths.get ("./target/surefire-reports/mso-perf.log"),
StandardCopyOption.REPLACE_EXISTING);*/
- } catch (IOException e) {
- e.printStackTrace();
- }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/logging/LogsCheckerITCase.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/logging/LogsCheckerITCase.java
index bae9af5cc1..56bea0f6b3 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/logging/LogsCheckerITCase.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/logging/LogsCheckerITCase.java
@@ -47,62 +47,60 @@ import org.openecomp.mso.global_tests.ArquillianPackagerForITCases;
@RunWith(Arquillian.class)
public class LogsCheckerITCase {
-
+
@BeforeClass
- public static void waitBeforeStart () throws InterruptedException {
- System.out.println ("Executing " + LogsCheckerITCase.class.getName ());
-
+ public static void waitBeforeStart() throws InterruptedException {
+ System.out.println("Executing " + LogsCheckerITCase.class.getName());
+
+ }
+
+ @Deployment(name = "log-check", testable = true)
+ public static Archive<?> createAsdcControllerWarDeployment() throws Exception {
+ // Any war could be used here, we just take that one randomly
+ // Be careful some WAR does not work when being injected in JBOSS, probably due to Servlet conflict
+ System.out.println("Deploying ASDC Controller WAR for log checker");
+ WebArchive warArchive = (WebArchive) ArquillianPackagerForITCases.createPackageFromExistingOne("../../asdc-controller/target/", "asdc-controller*.war", "asdc-controller.war");
+
+ JavaArchive testclasses = ShrinkWrap.create(JavaArchive.class, "testClasses.jar");
+
+ testclasses.addPackage("org.openecomp.mso.filesearching");
+
+ warArchive.addAsLibraries(testclasses);
+
+ Testable.archiveToTest(warArchive);
+ return warArchive;
+ }
+
+ @Before
+ public void beforeEachTest() {
+ LogFileSearching.initFile("/tmp/mso-log-checker.log");
+ }
+
+ @After
+ public void afterEachTest() {
+ LogFileSearching.closeFile();
}
-
- @Deployment(name="log-check",testable=true)
- public static Archive<?> createAsdcControllerWarDeployment () throws Exception {
- // Any war could be used here, we just take that one randomly
- // Be careful some WAR does not work when being injected in JBOSS, probably due to Servlet conflict
- System.out.println("Deploying ASDC Controller WAR for log checker");
- WebArchive warArchive = (WebArchive)ArquillianPackagerForITCases.createPackageFromExistingOne("../../asdc-controller/target/", "asdc-controller*.war", "asdc-controller.war");
-
- JavaArchive testclasses = ShrinkWrap.create (JavaArchive.class, "testClasses.jar");
-
- testclasses.addPackage("org.openecomp.mso.filesearching");
-
- warArchive.addAsLibraries(testclasses);
-
- Testable.archiveToTest(warArchive);
- return warArchive;
- }
-
- @Before
- public void beforeEachTest() {
- LogFileSearching.initFile("/tmp/mso-log-checker.log");
- }
-
- @After
- public void afterEachTest() {
- LogFileSearching.closeFile();
- }
-
+
@Test
- @OperateOnDeployment("log-check")
- public void testJbossServerLog() throws IOException {
-
- File serverLogs = new File("/opt/jboss/standalone/log");
- //File serverLogs = new File("/tmp/jbosslogs/server.log");
-
- assertFalse(LogFileSearching.searchInDirectoryForCommonIssues(null, serverLogs));
-
+ @OperateOnDeployment("log-check")
+ public void testJbossServerLog() throws IOException {
+
+ File serverLogs = new File("/opt/jboss/standalone/log");
+ //File serverLogs = new File("/tmp/jbosslogs/server.log");
+
+ assertFalse(LogFileSearching.searchInDirectoryForCommonIssues(null, serverLogs));
+
}
-
+
@Test
@OperateOnDeployment("log-check")
- public void testMSOLog() throws IOException {
- //File serverLogs = new File("/opt/app/mso/jboss-eap-6.2/standalone/log/server.log");
- File msoLogs = new File("/var/log/ecomp/MSO");
-
- assertFalse(LogFileSearching.searchInDirectoryForCommonIssues(null, msoLogs));
-
+ public void testMSOLog() throws IOException {
+ //File serverLogs = new File("/opt/app/mso/jboss-eap-6.2/standalone/log/server.log");
+ File msoLogs = new File("/var/log/ecomp/MSO");
+
+ assertFalse(LogFileSearching.searchInDirectoryForCommonIssues(null, msoLogs));
+
}
-
-
-
-
+
+
}
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/soapui/SoapUiITCase.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/soapui/SoapUiITCase.java
index 868de8d089..fe05e4ae3a 100644
--- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/soapui/SoapUiITCase.java
+++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/soapui/SoapUiITCase.java
@@ -54,63 +54,63 @@ import com.eviware.soapui.tools.SoapUITestCaseRunner;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class SoapUiITCase {
- private static String jbossHost=System.getProperty("docker.hostname");
- private static String jbossPort="18080";
-
- @Deployment(name="mso-api-handler-infra",testable=false)
- public static Archive<?> createMsoApiHandlerInfraWarDeployment () {
- System.out.println("Deploying ApiHandler Infra WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../mso-api-handlers/mso-api-handler-infra/target/", "mso-api-handler-infra*.war", "mso-api-handler-infra.war");
- }
-
- @Deployment(name="mso-vnf-adapter",testable=false)
- public static Archive<?> createMsoVnfAdapterWarDeployment () {
- System.out.println("Deploying VNF Adapter WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-vnf-adapter/target/", "mso-vnf-adapter*.war", "mso-vnf-adapter.war");
- }
-
- @Deployment(name="mso-tenant-adapter",testable=false)
- public static Archive<?> createMsoTenantAdapterWarDeployment () {
- System.out.println("Deploying Tenant Adapter WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-tenant-adapter/target/", "mso-tenant-adapter*.war", "mso-tenant-adapter.war");
- }
-
- @Deployment(name="mso-sdnc-adapter",testable=false)
- public static Archive<?> createMsoSdncAdapterWarDeployment () {
- System.out.println("Deploying SDNC Adapter WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-sdnc-adapter/target/", "mso-sdnc-adapter*.war", "mso-sdnc-adapter.war");
- }
-
- @Deployment(name="mso-network-adapter",testable=false)
- public static Archive<?> createMsoNetworkAdapterWarDeployment () {
- System.out.println("Deploying Network Adapter WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-network-adapter/target/", "mso-network-adapter*.war", "mso-network-adapter.war");
- }
-
- @Deployment(name="mso-requests-db-adapter",testable=false)
- public static Archive<?> createMsoRequestsDbAdapterWarDeployment () {
- System.out.println("Deploying Requests DB Adapter WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-requests-db-adapter/target/", "mso-requests-db-adapter*.war", "mso-requests-db-adapter.war");
- }
-
- @Deployment(name="asdc-controller",testable=true)
- public static Archive<?> createAsdcControllerWarDeployment () {
- System.out.println("Deploying ASDC Controller WAR with additional resources on default server");
-
- WebArchive warArchive = (WebArchive)ArquillianPackagerForITCases.createPackageFromExistingOne("../../asdc-controller/target/", "asdc-controller*.war", "asdc-controller.war");
-
- // Take one war randomly to make arquilian happy
-
-
- return warArchive;
- }
-
- @Deployment(name = "infrastructure-bpmn", testable = false)
- public static Archive<?> createInfraBPMNDeployment() {
- System.out.println("Deploying Infrastructure BPMN WAR on default server");
- return ArquillianPackagerForITCases.createPackageFromExistingOne("../../bpmn/MSOInfrastructureBPMN/target/",
- "MSOInfrastructureBPMN*.war", "MSOInfrastructureBPMN.war");
- }
+ private static String jbossHost = System.getProperty("docker.hostname");
+ private static String jbossPort = "18080";
+
+ @Deployment(name = "mso-api-handler-infra", testable = false)
+ public static Archive<?> createMsoApiHandlerInfraWarDeployment() {
+ System.out.println("Deploying ApiHandler Infra WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../mso-api-handlers/mso-api-handler-infra/target/", "mso-api-handler-infra*.war", "mso-api-handler-infra.war");
+ }
+
+ @Deployment(name = "mso-vnf-adapter", testable = false)
+ public static Archive<?> createMsoVnfAdapterWarDeployment() {
+ System.out.println("Deploying VNF Adapter WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-vnf-adapter/target/", "mso-vnf-adapter*.war", "mso-vnf-adapter.war");
+ }
+
+ @Deployment(name = "mso-tenant-adapter", testable = false)
+ public static Archive<?> createMsoTenantAdapterWarDeployment() {
+ System.out.println("Deploying Tenant Adapter WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-tenant-adapter/target/", "mso-tenant-adapter*.war", "mso-tenant-adapter.war");
+ }
+
+ @Deployment(name = "mso-sdnc-adapter", testable = false)
+ public static Archive<?> createMsoSdncAdapterWarDeployment() {
+ System.out.println("Deploying SDNC Adapter WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-sdnc-adapter/target/", "mso-sdnc-adapter*.war", "mso-sdnc-adapter.war");
+ }
+
+ @Deployment(name = "mso-network-adapter", testable = false)
+ public static Archive<?> createMsoNetworkAdapterWarDeployment() {
+ System.out.println("Deploying Network Adapter WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-network-adapter/target/", "mso-network-adapter*.war", "mso-network-adapter.war");
+ }
+
+ @Deployment(name = "mso-requests-db-adapter", testable = false)
+ public static Archive<?> createMsoRequestsDbAdapterWarDeployment() {
+ System.out.println("Deploying Requests DB Adapter WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../adapters/mso-requests-db-adapter/target/", "mso-requests-db-adapter*.war", "mso-requests-db-adapter.war");
+ }
+
+ @Deployment(name = "asdc-controller", testable = true)
+ public static Archive<?> createAsdcControllerWarDeployment() {
+ System.out.println("Deploying ASDC Controller WAR with additional resources on default server");
+
+ WebArchive warArchive = (WebArchive) ArquillianPackagerForITCases.createPackageFromExistingOne("../../asdc-controller/target/", "asdc-controller*.war", "asdc-controller.war");
+
+ // Take one war randomly to make arquilian happy
+
+
+ return warArchive;
+ }
+
+ @Deployment(name = "infrastructure-bpmn", testable = false)
+ public static Archive<?> createInfraBPMNDeployment() {
+ System.out.println("Deploying Infrastructure BPMN WAR on default server");
+ return ArquillianPackagerForITCases.createPackageFromExistingOne("../../bpmn/MSOInfrastructureBPMN/target/",
+ "MSOInfrastructureBPMN*.war", "MSOInfrastructureBPMN.war");
+ }
/*
@Deployment(name = "SoapUIMocks", testable = false)
public static Archive <?> createSoapUIMocksWarDeployment () {
@@ -125,129 +125,129 @@ public class SoapUiITCase {
}*/
@BeforeClass
- public static void waitBeforeStart () throws InterruptedException {
- Thread.currentThread().sleep(10000);
- System.out.println ("Executing " + SoapUiITCase.class.getName ());
-
+ public static void waitBeforeStart() throws InterruptedException {
+ Thread.currentThread().sleep(10000);
+ System.out.println("Executing " + SoapUiITCase.class.getName());
+
}
@Test
@RunAsClient
- public void test01Healthcheck () {
- SoapUITestCaseRunner runner = new SoapUITestCaseRunner ();
+ public void test01Healthcheck() {
+ SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
runner.setSettingsFile("./src/test/resources/SoapUI/soapui-settings.xml");
runner.setJUnitReport(true);
- runner.setProjectFile ("./src/test/resources/SoapUI/Healthcheck-soapui-project.xml");
- runner.setOutputFolder ("./target/surefire-reports");
+ runner.setProjectFile("./src/test/resources/SoapUI/Healthcheck-soapui-project.xml");
+ runner.setOutputFolder("./target/surefire-reports");
String[] properties = new String[7];
- properties[0] = "apihhost="+jbossHost+":"+jbossPort;
- properties[1] = "jrahost="+jbossHost+":"+jbossPort;
+ properties[0] = "apihhost=" + jbossHost + ":" + jbossPort;
+ properties[1] = "jrahost=" + jbossHost + ":" + jbossPort;
properties[2] = "userlogin=sitecontrol";
properties[3] = "userpassword=Domain2.0!";
- properties[4] = "bpmnhost="+jbossHost+":"+jbossPort;
+ properties[4] = "bpmnhost=" + jbossHost + ":" + jbossPort;
properties[5] = "sitename=mso-docker";
properties[6] = "enableBpmn=false";
- runner.setProjectProperties (properties);
+ runner.setProjectProperties(properties);
try {
- runner.setTestSuite ("Healthcheck TestSuite");
- runner.run ();
- Map<TestAssertion,WsdlTestStepResult> mapResult= runner.getAssertionResults();
- for(Map.Entry<TestAssertion,WsdlTestStepResult> entry : mapResult.entrySet()) {
+ runner.setTestSuite("Healthcheck TestSuite");
+ runner.run();
+ Map<TestAssertion, WsdlTestStepResult> mapResult = runner.getAssertionResults();
+ for (Map.Entry<TestAssertion, WsdlTestStepResult> entry : mapResult.entrySet()) {
assertTrue(entry.getValue().getStatus().equals(TestStepStatus.OK));
}
- assertTrue (runner.getFailedTests ().size () == 0);
+ assertTrue(runner.getFailedTests().size() == 0);
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
fail("Failure in SOAPUI Healthcheck");
}
}
@Test
@RunAsClient
- public void test02ApiHandlerInfra () {
- SoapUITestCaseRunner runner = new SoapUITestCaseRunner ();
+ public void test02ApiHandlerInfra() {
+ SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
runner.setSettingsFile("./src/test/resources/SoapUI/soapui-settings.xml");
runner.setJUnitReport(true);
- runner.setProjectFile ("./src/test/resources/SoapUI/Local-API-Handler-soapui-project.xml");
- runner.setOutputFolder ("./target/surefire-reports");
+ runner.setProjectFile("./src/test/resources/SoapUI/Local-API-Handler-soapui-project.xml");
+ runner.setOutputFolder("./target/surefire-reports");
String[] properties = new String[3];
- properties[0] = "host="+jbossHost+":"+jbossPort;
+ properties[0] = "host=" + jbossHost + ":" + jbossPort;
properties[1] = "user-infraportal=InfraPortalClient";
properties[2] = "password-infraportal=password1$";
- runner.setProjectProperties (properties);
+ runner.setProjectProperties(properties);
try {
- runner.setTestSuite ("simple_tests_endpoints");
- runner.run ();
- Map<TestAssertion,WsdlTestStepResult> mapResult= runner.getAssertionResults();
- for(Map.Entry<TestAssertion,WsdlTestStepResult> entry : mapResult.entrySet()) {
+ runner.setTestSuite("simple_tests_endpoints");
+ runner.run();
+ Map<TestAssertion, WsdlTestStepResult> mapResult = runner.getAssertionResults();
+ for (Map.Entry<TestAssertion, WsdlTestStepResult> entry : mapResult.entrySet()) {
assertTrue(entry.getValue().getStatus().equals(TestStepStatus.OK));
}
- assertTrue (runner.getFailedTests ().size () == 0);
+ assertTrue(runner.getFailedTests().size() == 0);
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
fail("Failure in SOAPUI ApiHandler Infra");
}
}
@Test
@RunAsClient
- public void test03StartNetworkAdapter () {
- SoapUITestCaseRunner runner = new SoapUITestCaseRunner ();
+ public void test03StartNetworkAdapter() {
+ SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
runner.setSettingsFile("./src/test/resources/SoapUI/soapui-settings.xml");
runner.setJUnitReport(true);
- runner.setProjectFile ("./src/test/resources/SoapUI/MSONetworkAdapter-soapui-project.xml");
- runner.setOutputFolder ("./target/surefire-reports");
- String[] properties = new String[1];
- properties[0] = "host="+jbossHost+":"+jbossPort;
- runner.setProjectProperties (properties);
-
-
- try {
- runner.setTestSuite ("MsoNetworkAdapter TestSuite");
- runner.run ();
-
- Map<TestAssertion,WsdlTestStepResult> mapResult= runner.getAssertionResults();
- for(Map.Entry<TestAssertion,WsdlTestStepResult> entry : mapResult.entrySet()) {
- assertTrue(entry.getValue().getStatus().equals(TestStepStatus.OK));
- }
- assertTrue (runner.getFailedTests ().size () == 0);
-
- } catch (Exception e) {
- e.printStackTrace ();
- fail("Failure in SOAPUI NetworkAdapter");
- }
+ runner.setProjectFile("./src/test/resources/SoapUI/MSONetworkAdapter-soapui-project.xml");
+ runner.setOutputFolder("./target/surefire-reports");
+ String[] properties = new String[1];
+ properties[0] = "host=" + jbossHost + ":" + jbossPort;
+ runner.setProjectProperties(properties);
+
+
+ try {
+ runner.setTestSuite("MsoNetworkAdapter TestSuite");
+ runner.run();
+
+ Map<TestAssertion, WsdlTestStepResult> mapResult = runner.getAssertionResults();
+ for (Map.Entry<TestAssertion, WsdlTestStepResult> entry : mapResult.entrySet()) {
+ assertTrue(entry.getValue().getStatus().equals(TestStepStatus.OK));
+ }
+ assertTrue(runner.getFailedTests().size() == 0);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Failure in SOAPUI NetworkAdapter");
+ }
}
@Test
@RunAsClient
- public void test04StartVnfAdapter () {
- SoapUITestCaseRunner runner = new SoapUITestCaseRunner ();
+ public void test04StartVnfAdapter() {
+ SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
runner.setSettingsFile("./src/test/resources/SoapUI/soapui-settings.xml");
runner.setJUnitReport(true);
- runner.setProjectFile ("./src/test/resources/SoapUI/MSOVnfAdapter-soapui-project.xml");
- runner.setOutputFolder ("./target/surefire-reports");
+ runner.setProjectFile("./src/test/resources/SoapUI/MSOVnfAdapter-soapui-project.xml");
+ runner.setOutputFolder("./target/surefire-reports");
String[] properties = new String[1];
- properties[0] = "host="+jbossHost+":"+jbossPort;
- runner.setProjectProperties (properties);
+ properties[0] = "host=" + jbossHost + ":" + jbossPort;
+ runner.setProjectProperties(properties);
try {
- runner.setTestSuite ("MsoVnfAdapter TestSuite");
- runner.run ();
+ runner.setTestSuite("MsoVnfAdapter TestSuite");
+ runner.run();
- Map<TestAssertion,WsdlTestStepResult> mapResult= runner.getAssertionResults();
- for(Map.Entry<TestAssertion,WsdlTestStepResult> entry : mapResult.entrySet()) {
+ Map<TestAssertion, WsdlTestStepResult> mapResult = runner.getAssertionResults();
+ for (Map.Entry<TestAssertion, WsdlTestStepResult> entry : mapResult.entrySet()) {
assertTrue(entry.getValue().getStatus().equals(TestStepStatus.OK));
}
- assertTrue (runner.getFailedTests ().size () == 0);
+ assertTrue(runner.getFailedTests().size() == 0);
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
fail("Failure in SOAPUI VnfAdapter");
}
}
@@ -255,30 +255,30 @@ public class SoapUiITCase {
@Test
@RunAsClient
- public void test05StartTenantAdapter () {
- SoapUITestCaseRunner runner = new SoapUITestCaseRunner ();
+ public void test05StartTenantAdapter() {
+ SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
runner.setSettingsFile("./src/test/resources/SoapUI/soapui-settings.xml");
runner.setJUnitReport(true);
- runner.setProjectFile ("./src/test/resources/SoapUI/MSOTenantAdapter-soapui-project.xml");
- runner.setOutputFolder ("./target/surefire-reports");
+ runner.setProjectFile("./src/test/resources/SoapUI/MSOTenantAdapter-soapui-project.xml");
+ runner.setOutputFolder("./target/surefire-reports");
String[] properties = new String[3];
- properties[0] = "host="+jbossHost+":"+jbossPort;
+ properties[0] = "host=" + jbossHost + ":" + jbossPort;
properties[1] = "user-bpel=BPELClient";
properties[2] = "password-bpel=password1$";
- runner.setProjectProperties (properties);
+ runner.setProjectProperties(properties);
try {
- runner.setTestSuite ("MsoTenantAdapter TestSuite");
- runner.run ();
+ runner.setTestSuite("MsoTenantAdapter TestSuite");
+ runner.run();
- Map<TestAssertion,WsdlTestStepResult> mapResult= runner.getAssertionResults();
- for(Map.Entry<TestAssertion,WsdlTestStepResult> entry : mapResult.entrySet()) {
+ Map<TestAssertion, WsdlTestStepResult> mapResult = runner.getAssertionResults();
+ for (Map.Entry<TestAssertion, WsdlTestStepResult> entry : mapResult.entrySet()) {
assertTrue(entry.getValue().getStatus().equals(TestStepStatus.OK));
}
- assertTrue (runner.getFailedTests ().size () == 0);
+ assertTrue(runner.getFailedTests().size() == 0);
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
fail("Failure in SOAPUI TenantAdapter");
}
}
@@ -286,63 +286,63 @@ public class SoapUiITCase {
@Test
@RunAsClient
- public void test06StartRequestDBAdapter () {
- SoapUITestCaseRunner runner = new SoapUITestCaseRunner ();
+ public void test06StartRequestDBAdapter() {
+ SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
runner.setSettingsFile("./src/test/resources/SoapUI/soapui-settings.xml");
runner.setJUnitReport(true);
- runner.setProjectFile ("./src/test/resources/SoapUI/MsoRequestDB-soapui-project.xml");
- runner.setOutputFolder ("./target/surefire-reports");
+ runner.setProjectFile("./src/test/resources/SoapUI/MsoRequestDB-soapui-project.xml");
+ runner.setOutputFolder("./target/surefire-reports");
String[] properties = new String[3];
- properties[0] = "host="+jbossHost+":"+jbossPort;
+ properties[0] = "host=" + jbossHost + ":" + jbossPort;
properties[1] = "user-infraportal=InfraPortalClient";
properties[2] = "password-infraportal=password1$";
- runner.setProjectProperties (properties);
+ runner.setProjectProperties(properties);
try {
- runner.setTestSuite ("MsoRequestsDbAdapterImplPortBinding TestSuite");
- runner.run ();
+ runner.setTestSuite("MsoRequestsDbAdapterImplPortBinding TestSuite");
+ runner.run();
- Map<TestAssertion,WsdlTestStepResult> mapResult= runner.getAssertionResults();
- for(Map.Entry<TestAssertion,WsdlTestStepResult> entry : mapResult.entrySet()) {
+ Map<TestAssertion, WsdlTestStepResult> mapResult = runner.getAssertionResults();
+ for (Map.Entry<TestAssertion, WsdlTestStepResult> entry : mapResult.entrySet()) {
assertTrue(entry.getValue().getStatus().equals(TestStepStatus.OK));
}
- assertTrue (runner.getFailedTests ().size () == 0);
+ assertTrue(runner.getFailedTests().size() == 0);
} catch (Exception e) {
- e.printStackTrace ();
- fail("Failure in SOAPUI RequestDB adapter");
+ e.printStackTrace();
+ fail("Failure in SOAPUI RequestDB adapter");
}
}
@Test
@RunAsClient
- public void test07MsoConfigEndpoints () {
- SoapUITestCaseRunner runner = new SoapUITestCaseRunner ();
- runner.setSettingsFile("./src/test/resources/SoapUI/soapui-settings.xml");
- runner.setJUnitReport(true);
- runner.setProjectFile ("./src/test/resources/SoapUI/MSOConfig-soapui-project.xml");
- runner.setOutputFolder ("./target/surefire-reports");
+ public void test07MsoConfigEndpoints() {
+ SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
+ runner.setSettingsFile("./src/test/resources/SoapUI/soapui-settings.xml");
+ runner.setJUnitReport(true);
+ runner.setProjectFile("./src/test/resources/SoapUI/MSOConfig-soapui-project.xml");
+ runner.setOutputFolder("./target/surefire-reports");
String[] properties = new String[3];
- properties[0] = "host="+jbossHost+":"+jbossPort;
+ properties[0] = "host=" + jbossHost + ":" + jbossPort;
properties[1] = "user-infraportal=InfraPortalClient";
properties[2] = "password-infraportal=password1$";
- runner.setProjectProperties (properties);
+ runner.setProjectProperties(properties);
try {
- runner.setTestSuite ("test_config_endpoints TestSuite");
- runner.run ();
+ runner.setTestSuite("test_config_endpoints TestSuite");
+ runner.run();
- Map<TestAssertion,WsdlTestStepResult> mapResult= runner.getAssertionResults();
- for(Map.Entry<TestAssertion,WsdlTestStepResult> entry : mapResult.entrySet()) {
+ Map<TestAssertion, WsdlTestStepResult> mapResult = runner.getAssertionResults();
+ for (Map.Entry<TestAssertion, WsdlTestStepResult> entry : mapResult.entrySet()) {
assertTrue(entry.getValue().getStatus().equals(TestStepStatus.OK));
}
- assertTrue (runner.getFailedTests ().size () == 0);
+ assertTrue(runner.getFailedTests().size() == 0);
} catch (Exception e) {
- e.printStackTrace ();
- fail("Failure in SOAPUI MSOConfig Endpoints");
+ e.printStackTrace();
+ fail("Failure in SOAPUI MSOConfig Endpoints");
}
}
}
diff --git a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java
index 91016d2475..e3ce9ed068 100644
--- a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java
+++ b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java
@@ -62,18 +62,19 @@ public class HealthCheckUtilsTest {
client = Mockito.mock(CloseableHttpClient.class);
nokRes = Mockito.mock(CloseableHttpResponse.class);
okRes = Mockito.mock(CloseableHttpResponse.class);
- Mockito.when(nokRes.getStatusLine()).thenReturn(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_SERVICE_UNAVAILABLE, "FINE!"));;
+ Mockito.when(nokRes.getStatusLine()).thenReturn(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_SERVICE_UNAVAILABLE, "FINE!"));
+ ;
Mockito.when(okRes.getStatusLine()).thenReturn(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "FINE!"));
properties = new MsoJavaProperties();
properties.setProperty("server-port", port);
properties.setProperty("ssl-enable", sslEnable);
properties.setProperty("apih-load-balancer", ip1);
- properties.setProperty("apih-healthcheck-urn",apihUrl1 + "," + apihUrl2);
- properties.setProperty("camunda-load-balancer",ip1);
- properties.setProperty("camunda-healthcheck-urn",bpmnUrl1);
- properties.setProperty("jra-load-balancer",ip1);
- properties.setProperty("jra-healthcheck-urn",raUrl1 + "," + raUrl2 + "," + raUrl3);
+ properties.setProperty("apih-healthcheck-urn", apihUrl1 + "," + apihUrl2);
+ properties.setProperty("camunda-load-balancer", ip1);
+ properties.setProperty("camunda-healthcheck-urn", bpmnUrl1);
+ properties.setProperty("jra-load-balancer", ip1);
+ properties.setProperty("jra-healthcheck-urn", raUrl1 + "," + raUrl2 + "," + raUrl3);
properties.setProperty("apih-nodehealthcheck-urn", apihUrl1);
properties.setProperty("camunda-nodehealthcheck-urn", bpmnUrl1);
properties.setProperty("jra-nodehealthcheck-urn", raUrl1);
@@ -84,44 +85,44 @@ public class HealthCheckUtilsTest {
Mockito.when(utils.verifyGlobalHealthCheck(true, null)).thenCallRealMethod();
Mockito.when(utils.verifyGlobalHealthCheck(false, null)).thenCallRealMethod();
- Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, sslEnable)).thenCallRealMethod();
- Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, null)).thenCallRealMethod();
- Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, "true")).thenCallRealMethod();
- Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, "otherValue")).thenCallRealMethod();
- Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, "True")).thenCallRealMethod();
- Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, "TRUE")).thenCallRealMethod();
- Mockito.when(utils.getFinalUrl (ip1, null, raUrl1, null)).thenCallRealMethod();
- Mockito.when(utils.getFinalUrl (iptest, null, raUrl1, null)).thenCallRealMethod();
+ Mockito.when(utils.getFinalUrl(ip1, port, raUrl1, sslEnable)).thenCallRealMethod();
+ Mockito.when(utils.getFinalUrl(ip1, port, raUrl1, null)).thenCallRealMethod();
+ Mockito.when(utils.getFinalUrl(ip1, port, raUrl1, "true")).thenCallRealMethod();
+ Mockito.when(utils.getFinalUrl(ip1, port, raUrl1, "otherValue")).thenCallRealMethod();
+ Mockito.when(utils.getFinalUrl(ip1, port, raUrl1, "True")).thenCallRealMethod();
+ Mockito.when(utils.getFinalUrl(ip1, port, raUrl1, "TRUE")).thenCallRealMethod();
+ Mockito.when(utils.getFinalUrl(ip1, null, raUrl1, null)).thenCallRealMethod();
+ Mockito.when(utils.getFinalUrl(iptest, null, raUrl1, null)).thenCallRealMethod();
System.setProperty("jboss.qualified.host.name", ip1);
}
@Test
- public final void testVerifyNodeHealthCheck () {
- Mockito.when (utils.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null)).thenReturn(true);
- Mockito.when (utils.verifyLocalHealth(ip1, port, apihUrl2, sslEnable, null)).thenReturn(true);
- Mockito.when (utils.verifyLocalHealth(ip2, port, apihUrl2, sslEnable, null)).thenReturn(true);
- Mockito.when (utils.verifyLocalHealth(ip2, port, apihUrl1, sslEnable, null)).thenReturn(false);
- Mockito.when (utils.verifyLocalHealth(ip1, port, raUrl1, sslEnable, null)).thenReturn(true);
- Mockito.when (utils.verifyLocalHealth(ip1, port, raUrl2, sslEnable, null)).thenReturn(false);
- Mockito.when (utils.verifyLocalHealth(ip1, port, raUrl3, sslEnable, null)).thenReturn(true);
-
- assertTrue (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.APIH, null));
- assertFalse (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.RA, null));
-
- Mockito.when (utils.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null)).thenReturn(false);
- Mockito.when (utils.verifyLocalHealth(ip1, port, raUrl2, sslEnable, null)).thenReturn(true);
- assertFalse (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.APIH, null));
- assertTrue (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.RA, null));
-
- Mockito.when (utils.verifyLocalHealth(ip2, port, apihUrl1, sslEnable, null)).thenReturn(true);
- assertFalse (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.APIH, null));
- assertTrue (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.RA, null));
+ public final void testVerifyNodeHealthCheck() {
+ Mockito.when(utils.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null)).thenReturn(true);
+ Mockito.when(utils.verifyLocalHealth(ip1, port, apihUrl2, sslEnable, null)).thenReturn(true);
+ Mockito.when(utils.verifyLocalHealth(ip2, port, apihUrl2, sslEnable, null)).thenReturn(true);
+ Mockito.when(utils.verifyLocalHealth(ip2, port, apihUrl1, sslEnable, null)).thenReturn(false);
+ Mockito.when(utils.verifyLocalHealth(ip1, port, raUrl1, sslEnable, null)).thenReturn(true);
+ Mockito.when(utils.verifyLocalHealth(ip1, port, raUrl2, sslEnable, null)).thenReturn(false);
+ Mockito.when(utils.verifyLocalHealth(ip1, port, raUrl3, sslEnable, null)).thenReturn(true);
+
+ assertTrue(utils.verifyNodeHealthCheck(HealthCheckUtils.NodeType.APIH, null));
+ assertFalse(utils.verifyNodeHealthCheck(HealthCheckUtils.NodeType.RA, null));
+
+ Mockito.when(utils.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null)).thenReturn(false);
+ Mockito.when(utils.verifyLocalHealth(ip1, port, raUrl2, sslEnable, null)).thenReturn(true);
+ assertFalse(utils.verifyNodeHealthCheck(HealthCheckUtils.NodeType.APIH, null));
+ assertTrue(utils.verifyNodeHealthCheck(HealthCheckUtils.NodeType.RA, null));
+
+ Mockito.when(utils.verifyLocalHealth(ip2, port, apihUrl1, sslEnable, null)).thenReturn(true);
+ assertFalse(utils.verifyNodeHealthCheck(HealthCheckUtils.NodeType.APIH, null));
+ assertTrue(utils.verifyNodeHealthCheck(HealthCheckUtils.NodeType.RA, null));
}
@Test
- public final void testVerifyGlobalHealthCheckBPMN () {
+ public final void testVerifyGlobalHealthCheckBPMN() {
// healthcheck of bpmn returns false
Mockito.when(utils.verifyLocalHealth(ip1, null, bpmnUrl1, null, null)).thenReturn(false);
@@ -129,123 +130,123 @@ public class HealthCheckUtilsTest {
Mockito.when(utils.verifyLocalHealth(ip1, null, raUrl1, null, null)).thenReturn(true);
// verify BPMN healthcheck
- assertFalse(utils.verifyGlobalHealthCheck (true, null));
+ assertFalse(utils.verifyGlobalHealthCheck(true, null));
// do not verify BPMN healthcheck
- assertTrue(utils.verifyGlobalHealthCheck (false, null));
+ assertTrue(utils.verifyGlobalHealthCheck(false, null));
Mockito.when(utils.verifyLocalHealth(ip1, null, bpmnUrl1, null, null)).thenReturn(true);
- assertTrue(utils.verifyGlobalHealthCheck (true, null));
+ assertTrue(utils.verifyGlobalHealthCheck(true, null));
}
@Test
- public final void testVerifyGlobalHealthCheckAPIH () {
+ public final void testVerifyGlobalHealthCheckAPIH() {
Mockito.when(utils.verifyLocalHealth(ip1, null, apihUrl1, null, null)).thenReturn(true);
Mockito.when(utils.verifyLocalHealth(ip1, null, raUrl1, null, null)).thenReturn(true);
Mockito.when(utils.verifyLocalHealth(ip1, null, bpmnUrl1, null, null)).thenReturn(true);
- assertTrue(utils.verifyGlobalHealthCheck (true, null));
+ assertTrue(utils.verifyGlobalHealthCheck(true, null));
Mockito.when(utils.verifyLocalHealth(ip1, null, apihUrl1, null, null)).thenReturn(false);
- assertFalse(utils.verifyGlobalHealthCheck (true, null));
+ assertFalse(utils.verifyGlobalHealthCheck(true, null));
}
@Test
- public final void testVerifyGlobalHealthCheckRA () {
+ public final void testVerifyGlobalHealthCheckRA() {
// all health check apis returns true
Mockito.when(utils.verifyLocalHealth(ip1, null, apihUrl1, null, null)).thenReturn(true);
Mockito.when(utils.verifyLocalHealth(ip1, null, raUrl1, null, null)).thenReturn(true);
Mockito.when(utils.verifyLocalHealth(ip1, null, bpmnUrl1, null, null)).thenReturn(true);
- assertTrue(utils.verifyGlobalHealthCheck (true, null));
+ assertTrue(utils.verifyGlobalHealthCheck(true, null));
// 3rd ra api return false; others return true
Mockito.when(utils.verifyLocalHealth(ip1, null, raUrl1, null, null)).thenReturn(false);
- assertFalse(utils.verifyGlobalHealthCheck (true, null));
+ assertFalse(utils.verifyGlobalHealthCheck(true, null));
}
@Test
- public final void testGetFinalUrl () {
- String finalUrl1 = utils.getFinalUrl (ip1, port, raUrl1, sslEnable);
- assertTrue (finalUrl1.equals ("http://" + ip1 + ":" + port + raUrl1));
+ public final void testGetFinalUrl() {
+ String finalUrl1 = utils.getFinalUrl(ip1, port, raUrl1, sslEnable);
+ assertTrue(finalUrl1.equals("http://" + ip1 + ":" + port + raUrl1));
- String finalUrl2 = utils.getFinalUrl (ip1, port, raUrl1, "true");
- assertTrue (finalUrl2.equals ("https://" + ip1 + ":" + port + raUrl1));
+ String finalUrl2 = utils.getFinalUrl(ip1, port, raUrl1, "true");
+ assertTrue(finalUrl2.equals("https://" + ip1 + ":" + port + raUrl1));
- String finalUrl3 = utils.getFinalUrl (ip1, port, raUrl1, null);
- assertTrue (finalUrl3.equals ("http://" + ip1 + ":" + port + raUrl1));
+ String finalUrl3 = utils.getFinalUrl(ip1, port, raUrl1, null);
+ assertTrue(finalUrl3.equals("http://" + ip1 + ":" + port + raUrl1));
- String finalUrl4 = utils.getFinalUrl (ip1, port, raUrl1, "otherValue");
- assertTrue (finalUrl4.equals ("http://" + ip1 + ":" + port + raUrl1));
+ String finalUrl4 = utils.getFinalUrl(ip1, port, raUrl1, "otherValue");
+ assertTrue(finalUrl4.equals("http://" + ip1 + ":" + port + raUrl1));
- String finalUrl5 = utils.getFinalUrl (ip1, port, raUrl1, "True");
- assertTrue (finalUrl5.equals ("https://" + ip1 + ":" + port + raUrl1));
+ String finalUrl5 = utils.getFinalUrl(ip1, port, raUrl1, "True");
+ assertTrue(finalUrl5.equals("https://" + ip1 + ":" + port + raUrl1));
- String finalUrl6 = utils.getFinalUrl (ip1, port, raUrl1, "TRUE");
- assertTrue (finalUrl6.equals ("https://" + ip1 + ":" + port + raUrl1));
+ String finalUrl6 = utils.getFinalUrl(ip1, port, raUrl1, "TRUE");
+ assertTrue(finalUrl6.equals("https://" + ip1 + ":" + port + raUrl1));
- String finalUrl7 = utils.getFinalUrl (ip1, null, raUrl1, null);
- assertTrue (finalUrl7.equals (ip1 + raUrl1));
+ String finalUrl7 = utils.getFinalUrl(ip1, null, raUrl1, null);
+ assertTrue(finalUrl7.equals(ip1 + raUrl1));
- String finalUrl8 = utils.getFinalUrl (iptest, null, raUrl1, null);
- assertTrue (finalUrl8.equals ("test" + raUrl1));
+ String finalUrl8 = utils.getFinalUrl(iptest, null, raUrl1, null);
+ assertTrue(finalUrl8.equals("test" + raUrl1));
}
@Test
public final void testVerifyLocalHealth() {
HealthCheckUtils tempUtil = Mockito.mock(HealthCheckUtils.class);
- Mockito.when(tempUtil.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null)).thenCallRealMethod ();
- Mockito.when(tempUtil.getFinalUrl (ip1, port, apihUrl1, sslEnable)).thenCallRealMethod ();
- Mockito.when(tempUtil.getHttpClient()).thenReturn (client);
+ Mockito.when(tempUtil.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null)).thenCallRealMethod();
+ Mockito.when(tempUtil.getFinalUrl(ip1, port, apihUrl1, sslEnable)).thenCallRealMethod();
+ Mockito.when(tempUtil.getHttpClient()).thenReturn(client);
try {
- Mockito.when (client.execute (any(HttpUriRequest.class))).thenReturn (okRes);
+ Mockito.when(client.execute(any(HttpUriRequest.class))).thenReturn(okRes);
boolean res1 = tempUtil.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null);
assertTrue(res1);
- Mockito.when (client.execute (any(HttpUriRequest.class))).thenReturn (nokRes);
+ Mockito.when(client.execute(any(HttpUriRequest.class))).thenReturn(nokRes);
boolean res2 = tempUtil.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null);
assertFalse(res2);
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
}
@Test
- public final void NullityCheck () {
+ public final void NullityCheck() {
Mockito.when(utils.verifyLocalHealth(ip1, null, bpmnUrl1, null, null)).thenReturn(true);
Mockito.when(utils.verifyLocalHealth(ip1, null, apihUrl1, null, null)).thenReturn(true);
Mockito.when(utils.verifyLocalHealth(ip1, null, raUrl1, null, null)).thenReturn(true);
- assertTrue (utils.verifyGlobalHealthCheck (true, null));
+ assertTrue(utils.verifyGlobalHealthCheck(true, null));
// mising server-camunda parameter
MsoJavaProperties newProperties1 = new MsoJavaProperties();
Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties1);
newProperties1.setProperty("apih-load-balancer", ip1);
- newProperties1.setProperty("apih-nodehealthcheck-urn",apihUrl1);
- newProperties1.setProperty("jra-load-balancer",ip1);
- newProperties1.setProperty("jra-nodehealthcheck-urn",raUrl1);
+ newProperties1.setProperty("apih-nodehealthcheck-urn", apihUrl1);
+ newProperties1.setProperty("jra-load-balancer", ip1);
+ newProperties1.setProperty("jra-nodehealthcheck-urn", raUrl1);
- assertFalse (utils.verifyGlobalHealthCheck (true, null));
+ assertFalse(utils.verifyGlobalHealthCheck(true, null));
// mising apih-server-list parameter
MsoJavaProperties newProperties2 = new MsoJavaProperties();
Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties2);
newProperties2.setProperty("server-port", port);
- newProperties2.setProperty("apih-nodehealthcheck-urn",apihUrl1);
- newProperties2.setProperty("camunda-load-balancer",ip1);
- newProperties2.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1);
- newProperties2.setProperty("jra-load-balancer",ip1);
- newProperties2.setProperty("jra-nodehealthcheck-urn",raUrl1);
+ newProperties2.setProperty("apih-nodehealthcheck-urn", apihUrl1);
+ newProperties2.setProperty("camunda-load-balancer", ip1);
+ newProperties2.setProperty("camunda-nodehealthcheck-urn", bpmnUrl1);
+ newProperties2.setProperty("jra-load-balancer", ip1);
+ newProperties2.setProperty("jra-nodehealthcheck-urn", raUrl1);
- assertFalse (utils.verifyGlobalHealthCheck (true, null));
+ assertFalse(utils.verifyGlobalHealthCheck(true, null));
// mising jra-healthcheck-urn parameter
MsoJavaProperties newProperties3 = new MsoJavaProperties();
@@ -253,13 +254,13 @@ public class HealthCheckUtilsTest {
newProperties3.setProperty("server-port", port);
newProperties3.setProperty("apih-load-balancer", ip1);
- newProperties3.setProperty("apih-nodehealthcheck-urn",apihUrl1);
- newProperties3.setProperty("camunda-load-balancer",ip1);
- newProperties3.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1);
- newProperties3.setProperty("jra-load-balancer",ip1);
- newProperties3.setProperty("jra-server-list",ip1);
+ newProperties3.setProperty("apih-nodehealthcheck-urn", apihUrl1);
+ newProperties3.setProperty("camunda-load-balancer", ip1);
+ newProperties3.setProperty("camunda-nodehealthcheck-urn", bpmnUrl1);
+ newProperties3.setProperty("jra-load-balancer", ip1);
+ newProperties3.setProperty("jra-server-list", ip1);
- assertFalse (utils.verifyGlobalHealthCheck (true, null));
+ assertFalse(utils.verifyGlobalHealthCheck(true, null));
Mockito.when(utils.loadTopologyProperties()).thenReturn(properties);
}