diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test')
343 files changed, 21081 insertions, 18357 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy new file mode 100644 index 0000000000..79caf5b9ac --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy @@ -0,0 +1,471 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.onap.so.rest.HttpHeader +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.junit.Rule; +import org.junit.Test +import org.junit.rules.ExpectedException +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.Before; +import org.junit.Test; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class AaiUtilTest extends MsoGroovyTest { + + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Rule + public ExpectedException thrown = ExpectedException.none + + + def aaiPaylod = "<allotted-resource xmlns=\"http://org.openecomp.aai.inventory/v9\">\n" + + "\t\t\t\t<id>allottedResourceId</id>\n" + + "\t\t\t\t<description></description>\n" + + "\t\t\t\t<type>allottedResourceType</type>\n" + + "\t\t\t\t<role>allottedResourceRole</role>\n" + + "\t\t\t\t<selflink></selflink>\n" + + "\t\t\t\t<model-invariant-id></model-invariant-id>\n" + + "\t\t\t\t<model-version-id></model-version-id>\n" + + "\t\t\t\t<model-customization-id></model-customization-id>\n" + + "\t\t\t\t<orchestration-status>PendingCreate</orchestration-status>\n" + + "\t\t\t\t<operation-status></operation-status>\n" + + "\t\t\t\t<relationship-list>\n" + + "\t\t\t\t\t<relationship>\n" + + " \t\t\t<related-to>service-instance</related-to>\n" + + " \t\t\t<related-link>CSI_resourceLink</related-link>\n" + + "\t\t\t\t\t</relationship>\n" + + "\t\t\t\t</relationship-list>\n" + + "\t\t\t</allotted-resource>"; + + @Test + public void testGetVersionDefault() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('8', version) + } + + @Test + public void testGetVersionResourceSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.default.aai.l3-network.version")).thenReturn('7') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('7', version) + } + + @Test + public void testGetVersionFlowSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.custom.CreateAAIVfModule.aai.version")).thenReturn('6') + when(mockExecution.getVariable("mso.workflow.default.aai.l3-network.version")).thenReturn('7') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('6', version) + } + + @Test + public void testGetVersionNotDefined() { + thrown.expect(Exception.class) + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("") + + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + + } + + @Test + public void testGetUriDefaultVersion() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getUri(mockExecution, 'l3-network') + assertEquals('/aai/v8/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetUriFlowAndResourceSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.CreateAAIVfModule.aai.l3-network.uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getUri(mockExecution, 'l3-network') + assertEquals('/aai/v6/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetNetworkGenericVnfEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + + when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') + + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def endpoint = aaiUtil.getNetworkGenericVnfEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/network/generic-vnfs/generic-vnf', endpoint) + } + + @Test + public void testGetNetworkGenericVnfUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkGenericVnfUri(mockExecution) + assertEquals('/aai/v8/network/generic-vnfs/generic-vnf', uri) + } + + @Test + public void testGetNetworkVpnBindingUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn('/aai/v8/network/vpn-bindings/vpn-binding') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkVpnBindingUri(mockExecution) + assertEquals('/aai/v8/network/vpn-bindings/vpn-binding', uri) + } + + @Test + public void testGetNetworkPolicyUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.network-policy.uri")).thenReturn('/aai/v8/network/network-policies/network-policy') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkPolicyUri(mockExecution) + assertEquals('/aai/v8/network/network-policies/network-policy', uri) + } + + @Test + public void testGetNetworkTableReferencesUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.route-table-reference.uri")).thenReturn('/aai/v8/network/route-table-references/route-table-reference') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkTableReferencesUri(mockExecution) + assertEquals('/aai/v8/network/route-table-references/route-table-reference', uri) + } + + @Test + public void testGetNetworkVceUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.vce.uri")).thenReturn('/aai/v8/network/vces/vce') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkVceUri(mockExecution) + assertEquals('/aai/v8/network/vces/vce', uri) + } + + @Test + public void testGetNetworkL3NetworkUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) + assertEquals('/aai/v8/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetBusinessCustomerUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn('/aai/v8/business/customers/customer') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getBusinessCustomerUri(mockExecution) + assertEquals('/aai/v8/business/customers/customer', uri) + } + + @Test + public void testGetCloudInfrastructureCloudRegionEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') + + when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) + } + + @Test + public void testGetCloudInfrastructureCloudRegionUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureCloudRegionUri(mockExecution) + assertEquals('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) + } + + @Test + public void testGetCloudInfrastructureTenantUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.tenant.uri")).thenReturn('/aai/v8/cloud-infrastructure/tenants/tenant') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureTenantUri(mockExecution) + assertEquals('/aai/v8/cloud-infrastructure/tenants/tenant', uri) + } + + @Test + public void testGetSearchNodesQueryUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') + + when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchNodesQueryUri(mockExecution) + assertEquals('/aai/v8/search/nodes-query', uri) + } + + @Test + public void testGetSearchNodesQueryEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') + + when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchNodesQueryEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/search/nodes-query', uri) + } + + @Test + public void testGetSearchGenericQueryUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-query.uri")).thenReturn('/aai/v8/search/generic-query') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchGenericQueryUri(mockExecution) + assertEquals('/aai/v8/search/generic-query', uri) + } + + @Test + public void testGetNamespaceFromUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('6') + when(mockExecution.getVariable("mso.workflow.default.aai.v6.l3-network.uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class + def ns = aaiUtil.getNamespaceFromUri('/aai/v6/search/generic-query') + assertEquals('http://org.openecomp.aai.inventory/v6', ns) + } + + @Test + public void testExecuteAAIGetCall() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.executeAAIGetCall(mockExecution,"http://localhost:8090/aai/v9/business/customers/customer/CUST/service-subscriptions/service-subscription/SVC/service-instances/service-instance/NST/allotted-resources/allotted-resource/allottedResourceId") + } + + + @Test + public void testExecuteAAIPutCall() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.executeAAIPutCall(mockExecution,"http://localhost:8090/aai/v9/business/customers/customer/CUST/service-subscriptions/service-subscription/SVC/service-instances/service-instance/NST/allotted-resources/allotted-resource/allottedResourceId",aaiPaylod) + } + + @Test + public void testGetNamespaceFromUri2() { + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('10') + when(mockExecution.getVariable("mso.workflow.default.aai.v10.l3-network.uri")).thenReturn('/aai/v10/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class + def ns = aaiUtil.getNamespaceFromUri('/aai/v10/search/generic-query') + assertEquals('http://org.openecomp.aai.inventory/v10', ns) + } + + @Test + public void testGetNamespaceFromUri3() { + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('100') + when(mockExecution.getVariable("mso.workflow.default.aai.v100.l3-network.uri")).thenReturn('/aai/v100/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class + def ns = aaiUtil.getNamespaceFromUri('/aai/v100/search/generic-query') + assertEquals('http://org.openecomp.aai.inventory/v100', ns) + } + + @Test + public void testGetNamespaceFromUri_twoArguments() { // (execution, uri) + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('10') + when(mockExecution.getVariable("mso.workflow.default.aai.v10.l3-network.uri")).thenReturn('/aai/v10/network/l3-networks/l3-network') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + // + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def ns = aaiUtil.getNamespaceFromUri(mockExecution, '/aai/v10/search/generic-query') + assertEquals('http://org.openecomp.aai.inventory/v10', ns) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessorTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessorTest.groovy new file mode 100644 index 0000000000..86a175d811 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessorTest.groovy @@ -0,0 +1,182 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.junit.Assert +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.so.bpmn.core.WorkflowException; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.onap.so.rest.HttpHeader +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.Before; +import org.junit.Test; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition + + + +class AbstractServiceTaskProcessorImpl extends AbstractServiceTaskProcessor{ + + @Override + void preProcessRequest(DelegateExecution execution) { + + } +} + +@RunWith(MockitoJUnitRunner.class) +public class AbstractServiceTaskProcessorTest extends MsoGroovyTest { + + @Captor + ArgumentCaptor<ExecutionEntity> captor= ArgumentCaptor.forClass(ExecutionEntity.class); + + @Test + public void testCreateCallbackURL_Success() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn('http://localhost:18080/mso/WorkflowMessage/') + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + def endpoint = serviceTaskProcessor.createCallbackURL(mockExecution, 'testMessageType', 'testCorrelator') + assertEquals('http://localhost:18080/mso/WorkflowMessage/testMessageType/testCorrelator', endpoint) + } + + @Test + public void testCreateCallbackURL_NullEndpoint() { + + ExecutionEntity mockExecution = setupMock() + try { + + when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn("") + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + def endpoint = serviceTaskProcessor.createCallbackURL(mockExecution, 'testMessageType', 'testCorrelator') + } + catch(Exception ex){ + } + Mockito.verify(mockExecution,times(1)).setVariable(captor.capture(),captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals("mso:workflow:message:endpoint URN mapping is not set",workflowException.getErrorMessage()) + Assert.assertEquals(2000,workflowException.getErrorCode()) + } + + @Test + public void testCreateWorkflowMessageAdapterCallbackURL_Success() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("mso.adapters.workflow.message.endpoint")).thenReturn('http://localhost:18080/workflows/messages/message/') + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + def endpoint = serviceTaskProcessor.createWorkflowMessageAdapterCallbackURL(mockExecution, 'testMessageType', 'testCorrelator') + assertEquals('http://localhost:18080/workflows/messages/message/testMessageType/testCorrelator', endpoint) + } + + @Test + public void testCreateWorkflowMessageAdapterCallbackURL_NullEndpoint() { + + ExecutionEntity mockExecution = setupMock() + try { + + when(mockExecution.getVariable("mso.adapters.workflow.message.endpoint")).thenReturn("") + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + def endpoint = serviceTaskProcessor.createWorkflowMessageAdapterCallbackURL(mockExecution, 'testMessageType', 'testCorrelator') + } + catch(Exception ex){ + } + Mockito.verify(mockExecution,times(1)).setVariable(captor.capture(),captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals("mso:adapters:workflow:message:endpoint URN mapping is not set",workflowException.getErrorMessage()) + Assert.assertEquals(2000,workflowException.getErrorCode()) + } + + @Test + public void testSetRollbackEnabledNullOrEmptyDisableRollback() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn('TEST_PREFIX') + when(mockExecution.getVariable("disableRollback")).thenReturn(null) + when(mockExecution.getVariable("mso.rollback")).thenReturn("") + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + serviceTaskProcessor.setRollbackEnabled(mockExecution, "true") + assertEquals(null, mockExecution.getVariable('TEST_PREFIXbackoutOnFailure')) + } + + @Test + public void testSetRollbackEnabledDisableRollback() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn('TEST_PREFIX') + when(mockExecution.getVariable("disableRollback")).thenReturn(true) + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + serviceTaskProcessor.setRollbackEnabled(mockExecution, "true") + verify(mockExecution).setVariable("TEST_PREFIXbackoutOnFailure",false) + } + + @Test + public void testSetRollbackEnabledRollback() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn('TEST_PREFIX') + when(mockExecution.getVariable("disableRollback")).thenReturn(false) + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + serviceTaskProcessor.setRollbackEnabled(mockExecution, "true") + verify(mockExecution).setVariable("TEST_PREFIXbackoutOnFailure",true) + } + + @Test + public void testSetRollbackEnabledDefaultRollback() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn('TEST_PREFIX') + when(mockExecution.getVariable("disableRollback")).thenReturn("test") + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + serviceTaskProcessor.setRollbackEnabled(mockExecution, "true") + verify(mockExecution).setVariable("TEST_PREFIXbackoutOnFailure",true) + } + + @Test + public void testSetBasicDBAuthHeader_Success() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn('9B2278E8B8E95F256A560719055F4DF3') + when(mockExecution.getVariable("mso.msoKey")).thenReturn('aa3871669d893c7fb8abbcda31b88b4f') + + AbstractServiceTaskProcessorImpl serviceTaskProcessor = new AbstractServiceTaskProcessorImpl(); + serviceTaskProcessor.setBasicDBAuthHeader(mockExecution, "true") + verify(mockExecution).setVariable("BasicAuthHeaderValueDB",'Basic dXAyMTE4OnVwMjExOA==') + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy new file mode 100644 index 0000000000..39064caa28 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.get +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when + +@RunWith(MockitoJUnitRunner.class) +class CatalogDbUtilsTest { + + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090) + + @Test + public void testGetResponseFromCatalogDb() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("mso.catalog.db.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn('757A94191D685FD2092AC1490730A4FC') + when(mockExecution.getVariable("mso.msoKey")).thenReturn('07a7159d3bf51a0e53be7a8f89699be7') + + stubFor(get(urlMatching(".*/serviceNetworks[?]serviceModelUuid=12345")) + .willReturn(aResponse() + .withStatus(200) + .withBodyFile("catalogDbFiles/DoCreateServiceInstance_request.json"))) + + CatalogDbUtils obj = new CatalogDbUtils() + String str = obj.getResponseFromCatalogDb(mockExecution, "/serviceNetworks?serviceModelUuid=12345") + String expectedValue = + FileUtil.readResourceFile("__files/catalogDbFiles/DoCreateServiceInstance_request.json"); + Assert.assertEquals(expectedValue, str) + + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("GenericGetService") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("GenericGetService") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("GenericGetService") + when(mockExecution.getProcessInstanceId()).thenReturn("GenericGetService") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy index 5949c3af53..9aa8425a50 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy @@ -16,9 +16,9 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= - */ + */ -package org.openecomp.mso.bpmn.common.scripts +package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity @@ -28,7 +28,7 @@ import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.MockitoAnnotations import org.mockito.runners.MockitoJUnitRunner -import org.openecomp.mso.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.WorkflowException import static org.assertj.core.api.Assertions.assertThat import static org.assertj.core.api.Assertions.assertThatThrownBy @@ -43,7 +43,7 @@ class CompleteMsoProcessTest { } private String completeMsoProcessRequest = """ - <sdncadapterworkflow:MsoCompletionRequest xmlns:ns="http://org.openecomp/mso/request/types/v1" xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> + <sdncadapterworkflow:MsoCompletionRequest xmlns:ns="http://org.onap/so/request/types/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <ns:request-information> <ns:request-id>uCPE1020_STUW105_5002</ns:request-id> <ns:request-action>Layer3ServiceActivateRequest</ns:request-action> @@ -62,8 +62,8 @@ class CompleteMsoProcessTest { ExecutionEntity mockExecution = mock(ExecutionEntity.class) when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoProcessRequest) - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() completeMsoProcess.preProcessRequest(mockExecution) @@ -107,7 +107,7 @@ class CompleteMsoProcessTest { } private String setUpdateDBstatustoSuccessPayload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb"> + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> <soapenv:Header/> <soapenv:Body> <req:updateInfraRequest> @@ -127,21 +127,21 @@ class CompleteMsoProcessTest { ExecutionEntity mockExecution = mock(ExecutionEntity.class) when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId") when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("BPEL") - when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); - when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); - + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() completeMsoProcess.setUpdateDBstatustoSuccessPayload(mockExecution) verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload",setUpdateDBstatustoSuccessPayload) } - private String msoCompletionResponse = """onse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> + private String msoCompletionResponse = """onse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapterworkflow:out>BPEL BPEL-NAME FAILED</sdncadapterworkflow:out> </sdncadapterworkflow:MsoCompletionResponse>""" /* - private String msoCompletionResponse = """<sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> + private String msoCompletionResponse = """<sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapterworkflow:out>BPEL BPEL-NAME FAILED</sdncadapterworkflow:out> </sdncadapterworkflow:MsoCompletionResponse>""" */ diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy new file mode 100644 index 0000000000..9b3b8c2fb0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy @@ -0,0 +1,130 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.onap.so.rest.HttpHeader +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.Before; +import org.junit.Test; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class ConfirmVolumeGroupNameTest extends MsoGroovyTest { + + @Captor + ArgumentCaptor<ExecutionEntity> captor= ArgumentCaptor.forClass(ExecutionEntity.class); + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Test + public void testQueryAAIForVolumeGroupId() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable("CVGN_volumeGroupGetEndpoint")).thenReturn('/aai/test/volume-groups/volume-group/testVolumeGroup') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + + mockData() + + ConfirmVolumeGroupName confirmVolumeGroupName = new ConfirmVolumeGroupName() + confirmVolumeGroupName.queryAAIForVolumeGroupId(mockExecution) + verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponseCode",200) + verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponse","") + } + + @Test + public void testQueryAAIForVolumeGroupId_404() { + + ExecutionEntity mockExecution = setupMock() + try { + when(mockExecution.getVariable("CVGN_volumeGroupGetEndpoint")).thenReturn('/aai/test/volume-groups/volume-group/testVolumeGroup') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + + mockData() + + ConfirmVolumeGroupName confirmVolumeGroupName = new ConfirmVolumeGroupName() + confirmVolumeGroupName.queryAAIForVolumeGroupId(mockExecution) + } + catch(Exception ex){ + + } + Mockito.verify(mockExecution,times(4)).setVariable(captor.capture(),captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals("AAI GET Failed",workflowException.getErrorMessage()) + Assert.assertEquals(500,workflowException.getErrorCode()) + } + private void mockData() { + stubFor(get(urlMatching("/aai/test/volume-groups/volume-group/testVolumeGroup")) + .willReturn(aResponse() + .withStatus(200))) + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("ConfirmVolumeGroupName") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("ConfirmVolumeGroupName") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("ConfirmVolumeGroupName") + when(mockExecution.getProcessInstanceId()).thenReturn("ConfirmVolumeGroupName") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy new file mode 100644 index 0000000000..1b76f5cb3f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.onap.so.rest.HttpHeader +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.onap.so.bpmn.common.scripts.AaiUtil; +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.Before; +import org.junit.Test; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupTenant +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class ConfirmVolumeGroupTenantTest extends MsoGroovyTest { + + @Captor + ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class); + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Test + public void testpreProcessRequest() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('testVolumeGroupId') + when(mockExecution.getVariable("volumeGroupName")).thenReturn('testVolumeGroupName') + when(mockExecution.getVariable("tenantId")).thenReturn('tenantId') + when(mockExecution.getVariable("aicCloudRegion")).thenReturn('aicCloudRegion') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + + mockData() + + + ConfirmVolumeGroupTenant confirmVolumeGroupTenant = new ConfirmVolumeGroupTenant() + confirmVolumeGroupTenant.preProcessRequest(mockExecution) + /* Mockito.verify(mockExecution, times(5)).setVariable(captor.capture(), captor.capture())*/ + verify(mockExecution).setVariable("prefix", "CVGT_") + verify(mockExecution).setVariable("queryVolumeGroupResponseCode", 200) + verify(mockExecution).setVariable("queryAAIVolumeGroupResponse", "<volume-group xmlns=\"http://org.openecomp.aai.inventory/v10\"><volume-group-id>17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c</volume-group-id><volume-group-name>MSOTESTVOL103a-vSAMP12_base_module-0_vol</volume-group-name><heat-stack-id>9d1f53e3-3158-44f8-8032-a6bf40bbc9db</heat-stack-id><vnf-type>pcrf-capacity</vnf-type><orchestration-status>Active</orchestration-status><resource-version>0000020</resource-version><relationship-list><relationship><related-to>tenant</related-to><relationship-data><relationship-key>cloud-region.cloud-owner</relationship-key><relationship-value>att-aic</relationship-value></relationship-data><relationship-data><relationship-key>cloud-region.cloud-region-id</relationship-key><relationship-value>RegionOne</relationship-value></relationship-data><relationship-data><relationship-key>tenant.tenant-id</relationship-key><relationship-value>22eb191dd41a4f3c9be370fc638322f4</relationship-value></relationship-data></relationship></relationship-list></volume-group>") + verify(mockExecution).setVariable("tenantIdsMatch", false) + verify(mockExecution).setVariable("groupNamesMatch", false) + } + + + private void mockData() { + stubFor(get(urlMatching("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/aicCloudRegion/volume-groups/volume-group/testVolumeGroupId")) + .willReturn(aResponse() + .withStatus(200) + .withBody("<volume-group xmlns=\"http://org.openecomp.aai.inventory/v10\"><volume-group-id>17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c</volume-group-id><volume-group-name>MSOTESTVOL103a-vSAMP12_base_module-0_vol</volume-group-name><heat-stack-id>9d1f53e3-3158-44f8-8032-a6bf40bbc9db</heat-stack-id><vnf-type>pcrf-capacity</vnf-type><orchestration-status>Active</orchestration-status><resource-version>0000020</resource-version><relationship-list><relationship><related-to>tenant</related-to><relationship-data><relationship-key>cloud-region.cloud-owner</relationship-key><relationship-value>att-aic</relationship-value></relationship-data><relationship-data><relationship-key>cloud-region.cloud-region-id</relationship-key><relationship-value>RegionOne</relationship-value></relationship-data><relationship-data><relationship-key>tenant.tenant-id</relationship-key><relationship-value>22eb191dd41a4f3c9be370fc638322f4</relationship-value></relationship-data></relationship></relationship-list></volume-group>"))) + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("ConfirmVolumeGroupTenant") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("ConfirmVolumeGroupTenant") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("ConfirmVolumeGroupTenant") + when(mockExecution.getProcessInstanceId()).thenReturn("ConfirmVolumeGroupTenant") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy new file mode 100644 index 0000000000..a8c10b1e81 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner + +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when +import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById +import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName + +/** + * @author sushilma + * @since January 10, 2018 + */ +@RunWith(MockitoJUnitRunner.class) +@Ignore +class CustomE2EGetServiceTest extends MsoGroovyTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + public void testObtainServiceInstanceUrlById (){ + ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') + when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') + when(mockExecution.getVariable("GENGS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") + MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + CustomE2EGetService customE2EGetService = new CustomE2EGetService(); + customE2EGetService.obtainServiceInstanceUrlById(mockExecution) + Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) + Assert.assertEquals(200, captor.getAllValues().get(5)) + } + + @Test + public void testObtainServiceInstanceUrlByName (){ + ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') + when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') + when(mockExecution.getVariable("GENGS_serviceInstanceName")).thenReturn("1604-MVM-26") + MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml"); + CustomE2EGetService customE2EGetService = new CustomE2EGetService(); + customE2EGetService.obtainServiceInstanceUrlByName(mockExecution) + Mockito.verify(mockExecution, times(8)).setVariable(captor.capture(), captor.capture()) + Assert.assertEquals(200, captor.getAllValues().get(5)) + } + + @Test + public void testServiceObject (){ + ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') + when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') + when(mockExecution.getVariable("GENGS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") + when(mockExecution.getVariable("GENGS_resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/1234453") + MockGetServiceInstance("MSO_1610_dev", "MSO-dev-service-type", "1234453", "GenericFlows/getServiceInstance.xml"); + CustomE2EGetService customE2EGetService = new CustomE2EGetService(); + customE2EGetService.getServiceObject(mockExecution) + Mockito.verify(mockExecution, times(7)).setVariable(captor.capture(), captor.capture()) + Assert.assertEquals(200, captor.getAllValues().get(5)) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy new file mode 100644 index 0000000000..879ef7ab4f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner + +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutServiceInstance + +/** + * @author sushilma + * @since January 10, 2018 + */ +@RunWith(MockitoJUnitRunner.class) +@Ignore +class CustomE2EPutServiceTest extends MsoGroovyTest { + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + public void testPutServiceInstance(){ + ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EPutService','GENPS_') + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn('/aai/v8/business/customers/customer') + when(mockExecution.getVariable("GENPS_type")).thenReturn('service-instance') + when(mockExecution.getVariable("GENPS_payload")).thenReturn('') + when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") + when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") + when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn( "1234") + MockPutServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", "GenericFlows/getServiceInstance.xml"); + + CustomE2EPutService customE2EPutService = new CustomE2EPutService() + customE2EPutService.putServiceInstance(mockExecution); + Mockito.verify(mockExecution, times(6)).setVariable(captor.capture(), captor.capture()) + Assert.assertEquals(200, captor.getAllValues().get(7)) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy new file mode 100644 index 0000000000..025bea5325 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy @@ -0,0 +1,218 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mock +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.StubResponseAAI + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class DeleteAAIVfModuleTest { + + def prefix = "DAAIVfMod_" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testQueryAAIForGenericVnf() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "genericVnfEndpoint")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf/skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + StubResponseAAI.MockAAIVfModule() + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.queryAAIForGenericVnf(mockExecution) + + Mockito.verify(mockExecution).setVariable(prefix + "queryGenericVnfResponseCode", 200) + } + + @Test + void testQueryAAIForGenericVnfEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "genericVnfEndpoint")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf/skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + StubResponseAAI.MockAAIVfModule() + try { + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.queryAAIForGenericVnf(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(2)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(5000, workflowException.getErrorCode()) + Assert.assertEquals("Internal Error - Occured during queryAAIForGenericVnf", workflowException.getErrorMessage()) + } + + @Test + void testDeleteGenericVnf() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "genericVnfEndpoint")).thenReturn("/aai/v9/cloud-infrastructure/volume-groups/volume-group/78987") + when(mockExecution.getVariable(prefix + "genVnfRsrcVer")).thenReturn("0000020") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + 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(""))) + + StubResponseAAI.MockAAIVfModule() + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.deleteGenericVnf(mockExecution) + + Mockito.verify(mockExecution).setVariable(prefix + "deleteGenericVnfResponseCode", 200) + } + + @Test + void testDeleteGenericVnfEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "genericVnfEndpoint")).thenReturn("/aai/v9/cloud-infrastructure/volume-groups/volume-group/78987") + when(mockExecution.getVariable(prefix + "genVnfRsrcVer")).thenReturn("0000020") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + StubResponseAAI.MockAAIVfModule() + try { + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.deleteGenericVnf(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(5000, workflowException.getErrorCode()) + Assert.assertEquals("Internal Error - Occured during deleteGenericVnf", workflowException.getErrorMessage()) + } + + @Test + void testDeleteVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vfModuleEndpoint")).thenReturn("/aai/v9/cloud-infrastructure/volume-groups/volume-group/78987") + when(mockExecution.getVariable(prefix + "vfModRsrcVer")).thenReturn("0000020") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + 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(""))) + + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.deleteVfModule(mockExecution) + + Mockito.verify(mockExecution).setVariable(prefix + "deleteVfModuleResponseCode", 200) + } + + @Test + void testDeleteVfModuleEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vfModuleEndpoint")).thenReturn("/aai/v9/cloud-infrastructure/volume-groups/volume-group/78987") + when(mockExecution.getVariable(prefix + "vfModRsrcVer")).thenReturn("0000020") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("aai.auth")).thenReturn("9B2278E8B8E95F256A560719055F4DF3") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("aa3871669d893c7fb8abbcda31b88b4f") + + StubResponseAAI.MockAAIVfModule() + try { + DeleteAAIVfModule obj = new DeleteAAIVfModule() + obj.deleteVfModule(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(5000, workflowException.getErrorCode()) + Assert.assertEquals("Internal Error - Occured during deleteVfModule", workflowException.getErrorMessage()) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DeleteAAIVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DeleteAAIVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DeleteAAIVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("DeleteAAIVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtilTest.groovy index 95272c22af..c7015cda50 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtilTest.groovy @@ -1,66 +1,98 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.scripts
-
-import org.junit.Assert
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-
-
-import org.junit.Ignore;
-
-import static org.mockito.Mockito.*
-
-import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.junit.Before
-import org.junit.runner.RunWith
-import org.mockito.MockitoAnnotations
-import org.mockito.internal.debugging.MockitoDebuggerImpl
-import org.mockito.runners.MockitoJUnitRunner
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
-@RunWith(MockitoJUnitRunner.class)
-import org.junit.Test
-
-
-
-class ExceptionUtilTest {
-
-
- @Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- }
-
- @Test
- public void testMapErrorCode5010(){
- String msg = "Connect to njcdtl20ew2988:8070 failed: Connection refused: connect"
- ExceptionUtil util = new ExceptionUtil()
- Assert.assertEquals("5010",util.MapErrorCode(msg))
- }
-
- @Test
- public void testMapErrorCode5020(){
- String msg = "Connection timed out"
- ExceptionUtil util = new ExceptionUtil()
- Assert.assertEquals("5020",util.MapErrorCode(msg))
- }
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.junit.Assert +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + + +import org.junit.Ignore; + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.core.WorkflowException +@RunWith(MockitoJUnitRunner.class) +import org.junit.Test + + + +class ExceptionUtilTest { + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testMapErrorCode5010(){ + String msg = "Connect to njcdtl20ew2988:8070 failed: Connection refused: connect" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals("5010",util.MapErrorCode(msg)) + } + + @Test + public void testMapErrorCode5020(){ + String msg = "Connection timed out" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals("5020",util.MapErrorCode(msg)) + } + + @Test + public void testGetErrorCode() { + ExceptionUtil eUtil = new ExceptionUtil() + WorkflowException we = new WorkflowException("CreateVCEV2", 400, "SDNC Test Error") + int errCd = eUtil.getErrorCode(we) + Assert.assertEquals(400, errCd) + } + + @Test + public void testGetErrorCodeWithNullWfe() { + ExceptionUtil eUtil = new ExceptionUtil() + int errCd = eUtil.getErrorCode(null) + Assert.assertEquals(2500, errCd) + } + + @Test + public void testGetErrorMessage() { + ExceptionUtil eUtil = new ExceptionUtil() + WorkflowException we = new WorkflowException("CreateVCEV2", 400, "SDNC Test Error") + String errMsg = eUtil.getErrorMessage(we, "CreateVCEV2") + Assert.assertEquals("SDNC Test Error", errMsg) + } + + @Test + public void testGetErrorMessageWithNullWfe() { + ExceptionUtil eUtil = new ExceptionUtil() + String errMsg = eUtil.getErrorMessage(null, "CreateVCEV2") + Assert.assertEquals("Unexpected error encountered in CreateVCEV2", errMsg) + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy index 730b44065d..016d968a12 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy @@ -1,312 +1,312 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.scripts
-
-import org.junit.runner.RunWith;
-import static org.mockito.Mockito.*
-import static org.junit.Assert.*;
-
-import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.mockito.ArgumentCaptor;
-import org.mockito.MockitoAnnotations
-import org.mockito.runners.MockitoJUnitRunner
-import org.openecomp.mso.bpmn.common.scripts.MsoUtils;
-import org.openecomp.mso.bpmn.common.scripts.FalloutHandler;
-
-@RunWith(MockitoJUnitRunner.class)
-class FalloutHandlerTest {
-
- public MsoUtils utils = new MsoUtils()
-
- @Before
- public void init() {
- MockitoAnnotations.initMocks(this)
- }
-
- private String falloutHandlerRequest = """
- <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: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>
- """
-
- private String falloutHandlerResponse = """<workflow:FalloutHandlerResponse xmlns:workflow="http://org.openecomp/mso/workflow/schema/v1">
- <workflow:out>Fallout Handler Failed</workflow:out>
-</workflow:FalloutHandlerResponse>"""
-
- @Test
- public void testPreProcessRequest() {
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-
- when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest)
- when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC");
- when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7");
-
- FalloutHandler falloutHandler = new FalloutHandler()
- falloutHandler.preProcessRequest(mockExecution)
-
- /* Initialize all the process request variables in this block */
- verify(mockExecution).setVariable("prefix","FH_")
- //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","")
-
- //These variables are form the input Message to the BPMN
- verify(mockExecution).setVariable("FH_request_id","")
- verify(mockExecution).setVariable("FH_request_action","")
- verify(mockExecution).setVariable("FH_notification-url","")
- verify(mockExecution).setVariable("FH_mso-bpel-name","")
- verify(mockExecution).setVariable("FH_ErrorCode", "")
- verify(mockExecution).setVariable("FH_ErrorMessage", "")
-
- verify(mockExecution).setVariable("FH_notification-url-Ok", false)
- verify(mockExecution).setVariable("FH_request_id-Ok", false)
-
- //These variables are for Get Mso Aai Password Adapter
- verify(mockExecution).setVariable("FH_deliveryStatus", true)
-
- //update Response Status to pending ...Adapter variables
- verify(mockExecution).setVariable("FH_updateResponseStatusPayload", null)
- verify(mockExecution).setVariable("FH_updateResponseStatusResponse", null)
-
- //update Request Gamma ...Adapter variables
- verify(mockExecution).setVariable("FH_updateRequestGammaPayload", "")
- verify(mockExecution).setVariable("FH_updateRequestGammaResponse", null)
- verify(mockExecution).setVariable("FH_updateRequestGammaResponseCode", null)
-
- //update Request Infra ...Adapter variables
- verify(mockExecution).setVariable("FH_updateRequestInfraPayload", "")
- verify(mockExecution).setVariable("FH_updateRequestInfraResponse", null)
- verify(mockExecution).setVariable("FH_updateRequestInfraResponseCode", null)
-
- //assign False to success variable
- verify(mockExecution).setVariable("FH_success", true)
-
- //Set notify status to Failed variable
- verify(mockExecution).setVariable("FH_NOTIFY_STATUS", "SUCCESS")
-
- //Set DB update variable
- verify(mockExecution).setVariable("FH_updateRequestPayload", "")
- verify(mockExecution).setVariable("FH_updateRequestResponse", null)
- verify(mockExecution).setVariable("FH_updateRequestResponseCode", null)
-
- //Auth variables
- verify(mockExecution).setVariable("BasicAuthHeaderValue","")
-
- //Response variables
- verify(mockExecution).setVariable("FalloutHandlerResponse","")
- verify(mockExecution).setVariable("FH_ErrorResponse", null)
- verify(mockExecution).setVariable("FH_ResponseCode", "")
-
- verify(mockExecution).setVariable("FH_request_id-Ok",true)
- verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002")
- verify(mockExecution).setVariable("FH_request_action","Layer3ServiceActivateRequest")
- verify(mockExecution).setVariable("FH_source","OMX")
- verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler")
- verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler")
-
- }
-
- @Test
- public void testpostProcessResponse(){
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
- when(mockExecution.getVariable("FH_success")).thenReturn(false)
-
- FalloutHandler falloutHandler = new FalloutHandler()
- falloutHandler.postProcessResponse(mockExecution)
-
- // Capture the arguments to setVariable
- ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
- ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
-
- verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture())
- List<String> arg2List = captor2.getAllValues()
- String payloadResponseActual = arg2List.get(1)
-
- assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", ""))
-
- verify(mockExecution).setVariable("FH_ResponseCode","500")
- }
-
- private String updateRequestPayload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateRequest>
- <requestId>testReqId</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <finalErrorMessage>ErrorMessage</finalErrorMessage>
- <finalErrorCode>ErrorCode</finalErrorCode>
- <status>FAILED</status>
- <responseStatus>NotifyStatus</responseStatus>
- </req:updateRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- @Test
- public void testupdateRequestPayload(){
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
- when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage")
- when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode")
- when(mockExecution.getVariable("FH_NOTIFY_STATUS")).thenReturn("NotifyStatus")
-
- FalloutHandler falloutHandler = new FalloutHandler()
- falloutHandler.updateRequestPayload(mockExecution)
-
- // Capture the arguments to setVariable
- ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
- ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
-
- verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
- List<String> arg2List = captor2.getAllValues()
- String payloadRequestActual = arg2List.get(0)
-
- assertEquals(updateRequestPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", ""))
- }
-
- private String updateRequestInfraPayload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateInfraRequest>
- <requestId>testReqId</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <statusMessage>ErrorMessage</statusMessage>
- <requestStatus>FAILED</requestStatus>
- <progress>100</progress>
- </req:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- @Test
- public void testupdateRequestInfraPayload(){
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
- when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage")
-
- FalloutHandler falloutHandler = new FalloutHandler()
- falloutHandler.updateRequestInfraPayload(mockExecution)
-
- // Capture the arguments to setVariable
- ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
- ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
-
- verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
- List<String> arg2List = captor2.getAllValues()
- String payloadRequestActual = arg2List.get(0)
-
- assertEquals(updateRequestInfraPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", ""))
- }
-
- private String updateRequestGammaPayload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateRequest>
- <requestId>testReqId</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <finalErrorMessage>ErrorMessage</finalErrorMessage>
- <finalErrorCode>ErrorCode</finalErrorCode>
- <status>FAILED</status>
- </req:updateRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- @Test
- public void testupdateRequestGammaPayload(){
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
- when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage")
- when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode")
- when(mockExecution.getVariable("URN_mso_default_adapter_namespace")).thenReturn("http://org.openecomp.mso");
-
- FalloutHandler falloutHandler = new FalloutHandler()
- falloutHandler.updateRequestGammaPayload(mockExecution)
-
- // Capture the arguments to setVariable
- ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
- ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
-
- verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
- List<String> arg2List = captor2.getAllValues()
- String payloadRequestActual = arg2List.get(0)
-
- assertEquals(updateRequestGammaPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", ""))
- }
-
-
- String updateResponseStatusPayload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateResponseStatus>
- <requestId>testReqId</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <responseStatus>SENDING_FINAL_NOTIFY</responseStatus>
- </req:updateResponseStatus>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- @Test
- public void testupdateResponseStatusPayload(){
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
-
- FalloutHandler falloutHandler = new FalloutHandler()
- falloutHandler.updateResponseStatusPayload(mockExecution)
-
- // Capture the arguments to setVariable
- ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
- ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
-
- verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
- List<String> arg2List = captor2.getAllValues()
- String payloadResponseActual = arg2List.get(0)
-
- assertEquals(updateResponseStatusPayload.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", ""))
- }
-
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.junit.runner.RunWith; +import static org.mockito.Mockito.* +import static org.junit.Assert.*; + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor; +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.MsoUtils; +import org.onap.so.bpmn.common.scripts.FalloutHandler; + +@RunWith(MockitoJUnitRunner.class) +class FalloutHandlerTest { + + public MsoUtils utils = new MsoUtils() + + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + private String falloutHandlerRequest = """ + <sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" xmlns:ns7="http://org.onap/so/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: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> + """ + + private String falloutHandlerResponse = """<workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1"> + <workflow:out>Fallout Handler Failed</workflow:out> +</workflow:FalloutHandlerResponse>""" + + @Test + public void testPreProcessRequest() { + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest) + when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.preProcessRequest(mockExecution) + + /* Initialize all the process request variables in this block */ + verify(mockExecution).setVariable("prefix","FH_") + //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") + + //These variables are form the input Message to the BPMN + verify(mockExecution).setVariable("FH_request_id","") + verify(mockExecution).setVariable("FH_request_action","") + verify(mockExecution).setVariable("FH_notification-url","") + verify(mockExecution).setVariable("FH_mso-bpel-name","") + verify(mockExecution).setVariable("FH_ErrorCode", "") + verify(mockExecution).setVariable("FH_ErrorMessage", "") + + verify(mockExecution).setVariable("FH_notification-url-Ok", false) + verify(mockExecution).setVariable("FH_request_id-Ok", false) + + //These variables are for Get Mso Aai Password Adapter + verify(mockExecution).setVariable("FH_deliveryStatus", true) + + //update Response Status to pending ...Adapter variables + verify(mockExecution).setVariable("FH_updateResponseStatusPayload", null) + verify(mockExecution).setVariable("FH_updateResponseStatusResponse", null) + + //update Request Gamma ...Adapter variables + verify(mockExecution).setVariable("FH_updateRequestGammaPayload", "") + verify(mockExecution).setVariable("FH_updateRequestGammaResponse", null) + verify(mockExecution).setVariable("FH_updateRequestGammaResponseCode", null) + + //update Request Infra ...Adapter variables + verify(mockExecution).setVariable("FH_updateRequestInfraPayload", "") + verify(mockExecution).setVariable("FH_updateRequestInfraResponse", null) + verify(mockExecution).setVariable("FH_updateRequestInfraResponseCode", null) + + //assign False to success variable + verify(mockExecution).setVariable("FH_success", true) + + //Set notify status to Failed variable + verify(mockExecution).setVariable("FH_NOTIFY_STATUS", "SUCCESS") + + //Set DB update variable + verify(mockExecution).setVariable("FH_updateRequestPayload", "") + verify(mockExecution).setVariable("FH_updateRequestResponse", null) + verify(mockExecution).setVariable("FH_updateRequestResponseCode", null) + + //Auth variables + verify(mockExecution).setVariable("BasicAuthHeaderValue","") + + //Response variables + verify(mockExecution).setVariable("FalloutHandlerResponse","") + verify(mockExecution).setVariable("FH_ErrorResponse", null) + verify(mockExecution).setVariable("FH_ResponseCode", "") + + verify(mockExecution).setVariable("FH_request_id-Ok",true) + verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002") + verify(mockExecution).setVariable("FH_request_action","Layer3ServiceActivateRequest") + verify(mockExecution).setVariable("FH_source","OMX") + verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler") + verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler") + + } + + @Test + public void testpostProcessResponse(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("FH_success")).thenReturn(false) + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.postProcessResponse(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture()) + List<String> arg2List = captor2.getAllValues() + String payloadResponseActual = arg2List.get(1) + + assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) + + verify(mockExecution).setVariable("FH_ResponseCode","500") + } + + private String updateRequestPayload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateRequest> + <requestId>testReqId</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <finalErrorMessage>ErrorMessage</finalErrorMessage> + <finalErrorCode>ErrorCode</finalErrorCode> + <status>FAILED</status> + <responseStatus>NotifyStatus</responseStatus> + </req:updateRequest> + </soapenv:Body> + </soapenv:Envelope> + """ + + @Test + public void testupdateRequestPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") + when(mockExecution.getVariable("FH_NOTIFY_STATUS")).thenReturn("NotifyStatus") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List<String> arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + private String updateRequestInfraPayload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateInfraRequest> + <requestId>testReqId</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <statusMessage>ErrorMessage</statusMessage> + <requestStatus>FAILED</requestStatus> + <progress>100</progress> + </req:updateInfraRequest> + </soapenv:Body> + </soapenv:Envelope> + """ + + @Test + public void testupdateRequestInfraPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestInfraPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List<String> arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestInfraPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + private String updateRequestGammaPayload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateRequest> + <requestId>testReqId</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <finalErrorMessage>ErrorMessage</finalErrorMessage> + <finalErrorCode>ErrorCode</finalErrorCode> + <status>FAILED</status> + </req:updateRequest> + </soapenv:Body> + </soapenv:Envelope> + """ + + @Test + public void testupdateRequestGammaPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") + when(mockExecution.getVariable("mso.default.adapter.namespace")).thenReturn("http://org.onap.so"); + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestGammaPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List<String> arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestGammaPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + + String updateResponseStatusPayload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateResponseStatus> + <requestId>testReqId</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <responseStatus>SENDING_FINAL_NOTIFY</responseStatus> + </req:updateResponseStatus> + </soapenv:Body> + </soapenv:Envelope> + """ + + @Test + public void testupdateResponseStatusPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateResponseStatusPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List<String> arg2List = captor2.getAllValues() + String payloadResponseActual = arg2List.get(0) + + assertEquals(updateResponseStatusPayload.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) + } + }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy new file mode 100644 index 0000000000..c5baf8cc6c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class GenerateVfModuleNameTest { + + @Captor + ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class); + + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Test + public void testQueryAAI() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable("vnfId")).thenReturn('skask') + when(mockExecution.getVariable("personaModelId")).thenReturn('personaModelId_test') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') + + mockData() + GenerateVfModuleName obj = new GenerateVfModuleName() + obj.queryAAI(mockExecution) + + Mockito.verify(mockExecution).setVariable("GVFMN_queryAAIVfModuleResponseCode", 200) + } + + @Test + public void testQueryAAIEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("vnfId")).thenReturn('skask') + when(mockExecution.getVariable("personaModelId")).thenReturn('personaModelId_test') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') + + mockData() + try { + GenerateVfModuleName obj = new GenerateVfModuleName() + obj.queryAAI(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(1002, workflowException.getErrorCode()) + Assert.assertEquals("AAI GET Failed:org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + + private void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf.*")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))) + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("GenerateVfModuleName") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("GenerateVfModuleName") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("GenerateVfModuleName") + when(mockExecution.getProcessInstanceId()).thenReturn("GenerateVfModuleName") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy new file mode 100644 index 0000000000..49edd813f7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy @@ -0,0 +1,124 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class GenericGetServiceTest { + + def prefix = "GENGS_" + @Captor + ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class); + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Test + public void testGetServiceObject() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') + when(mockExecution.getVariable(prefix + "type")).thenReturn('service-instance') + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn('12345') + when(mockExecution.getVariable(prefix + "resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + mockData() + GenericGetService obj = new GenericGetService() + obj.getServiceObject(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix", prefix) + Mockito.verify(mockExecution).setVariable(prefix + "getServiceUrl", "http://localhost:8090/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") + Mockito.verify(mockExecution).setVariable(prefix + "getServiceResponseCode", 200) + } + + @Test + public void testGetServiceObjectEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable(prefix + "type")).thenReturn('service-instance') + when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn('12345') + when(mockExecution.getVariable(prefix + "resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + + mockData() + try { + GenericGetService obj = new GenericGetService() + obj.getServiceObject(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(9999, workflowException.getErrorCode()) + Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + private void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/.*")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile(""))) + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("GenericGetService") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("GenericGetService") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("GenericGetService") + when(mockExecution.getProcessInstanceId()).thenReturn("GenericGetService") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy new file mode 100644 index 0000000000..1aef78f0d5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy @@ -0,0 +1,180 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class GenericGetVnfTest { + + def prefix = "GENGV_" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testGetVnfByName() { + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable(prefix+"vnfName")).thenReturn("genricVnf_test") + when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + GenericGetVnf obj = new GenericGetVnf() + obj.getVnfByName(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix","GENGV_") + Mockito.verify(mockExecution).setVariable(prefix+"getVnfPath","http://localhost:28090/aai/v9/network/generic-vnfs/generic-vnf?vnf-name=genricVnf_test&depth=1") + } + + @Test + public void testGetVnfByNameEndpointNull() { + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable(prefix+"vnfName")).thenReturn("genricVnf_test") + when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + try{ + GenericGetVnf obj = new GenericGetVnf() + obj.getVnfByName(mockExecution) + }catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(9999, workflowException.getErrorCode()) + Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + @Test + public void testGetVnfById() { + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable(prefix+"vnfId")).thenReturn("genricVnf_test") + when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + GenericGetVnf obj = new GenericGetVnf() + obj.getVnfById(mockExecution) + + Mockito.verify(mockExecution).setVariable("prefix","GENGV_") + Mockito.verify(mockExecution).setVariable(prefix+"getVnfPath","http://localhost:28090/aai/v9/network/generic-vnfs/generic-vnf/genricVnf_test?depth=1") + } + + @Test + public void testGetVnfByIdEndpointNull() { + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable(prefix+"vnfId")).thenReturn("genricVnf_test") + when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") + when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + try{ + GenericGetVnf obj = new GenericGetVnf() + obj.getVnfById(mockExecution) + }catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(9999, workflowException.getErrorCode()) + Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + private static void mockData() { + stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf.*")) + .willReturn(aResponse() + .withStatus(200).withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy index 1e7342de68..d4ea8ce71f 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutServiceTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy @@ -1,214 +1,235 @@ -package org.openecomp.mso.bpmn.common.scripts
-
-import static org.mockito.Mockito.*
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutServiceInstance;
-
-import org.camunda.bpm.engine.ProcessEngineServices
-import org.camunda.bpm.engine.RepositoryService
-import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.camunda.bpm.engine.repository.ProcessDefinition
-import org.junit.Before
-import org.junit.Ignore
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.mockito.MockitoAnnotations
-import org.mockito.internal.debugging.MockitoDebuggerImpl
-import org.mockito.runners.MockitoJUnitRunner
-
-import com.github.tomakehurst.wiremock.client.WireMock
-import com.github.tomakehurst.wiremock.junit.WireMockRule
-import org.apache.commons.lang3.*
-
-@RunWith(MockitoJUnitRunner.class)
-class GenericPutServiceTest {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(8090);
-
- @Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
-
- }
-
- @Test
- public void preProcessRequest() {
-
-
- println "************ preProcessRequest ************* "
-
- ExecutionEntity mockExecution = setupMock()
-
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
- when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26")
- when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET")
- when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET")
- when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
- when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance")
-
- GenericPutService putServiceInstance= new GenericPutService()
- putServiceInstance.preProcessRequest(mockExecution)
-
- // check the sequence of variable invocation
- //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl()
- //preDebugger.printInvocations(mockExecution)
-
- verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled")
- verify(mockExecution).setVariable("prefix", "GENPS_")
-
- // execution.getVariable("isDebugLogEnabled")
-
- verify(mockExecution).setVariable("GENPS_SuccessIndicator", false)
- // verify(mockExecution).setVariable("globalSubscriberId", "1604-MVM-26")
- // verify(mockExecution).setVariable("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET")
- // verify(mockExecution).setVariable("serviceType", "SDN-ETHERNET-INTERNET")
- // verify(mockExecution).setVariable("ServiceInstanceData", "f70e927b-6087-4974-9ef8-c5e4d5847ca4")
-
-
- }
-
-
- @Test
- @Ignore
- public void putServiceInstance() {
- println "************ putServiceInstance ************* "
-
- WireMock.reset();
-
- MockPutServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml");
- ExecutionEntity mockExecution = setupMock()
-
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
- when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26")
- when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET")
- when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET")
- when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
- when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090")
- when(mockExecution.getVariable("URN_mso_workflow_PutServiceInstance_aai_business_customer_uri")).thenReturn("/aai/v7/business/customers/customer")
- when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
- when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance")
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("7")
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v7_customer_uri")).thenReturn("/aai/v7/business/customers/customer")
- when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
- when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC")
-
- GenericPutService serviceInstance= new GenericPutService()
- serviceInstance.putServiceInstance(mockExecution)
-
- // check the sequence of variable invocation
- MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl()
- preDebugger.printInvocations(mockExecution)
-
- verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled")
- verify(mockExecution).setVariable("prefix", "GENPS_")
-
- // execution.getVariable("isDebugLogEnabled")
- // verify(mockExecution).setVariable("GENPSI_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4")
-
- String servicePayload = """<service-instance xmlns="http://org.openecomp.aai.inventory/v7">f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance>""" as String
- verify(mockExecution).setVariable("GENPS_serviceInstancePayload",servicePayload)
-
- String serviceAaiPath = "http://localhost:28090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET"
- verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath)
-
- int responseCode = 200
- verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode)
-
- String aaiResponse = """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
- statusCode="200">
- <rest:headers>
- <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/>
- <rest:header name="Content-Length" value="0"/>
- <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
- <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:551-132672"/>
- <rest:header name="Server" value="Apache-Coyote/1.1"/>
- <rest:header name="Cache-Control" value="private"/>
- </rest:headers>
-</rest:RESTResponse>"""
-
- verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse)
-
- verify(mockExecution).setVariable("GENPS_SuccessIndicator", true)
- }
-
- @Test
- @Ignore
- public void putServiceInstance_404() {
-
-
- println "************ putServiceInstance ************* "
-
- WireMock.reset();
-
- ExecutionEntity mockExecution = setupMock()
-
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
- when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26")
- when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET")
- when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET")
- when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
- when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:8090")
- when(mockExecution.getVariable("URN_mso_workflow_PutServiceInstance_aai_business_customer_uri")).thenReturn("/aai/v7/business/customers/customer")
- when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
-
- GenericPutService serviceInstance= new GenericPutService()
- serviceInstance.putServiceInstance(mockExecution)
-
- // check the sequence of variable invocation
- MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl()
- preDebugger.printInvocations(mockExecution)
-
- verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled")
- verify(mockExecution).setVariable("prefix", "GENPS_")
-
- // execution.getVariable("isDebugLogEnabled")
-
-
- verify(mockExecution).setVariable("GENPS_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4")
-
- String serviceInstancepayload = """<service-instance xmlns="http://org.openecomp.mso.aai.inventory/v7">f70e927b-6087-4974-9ef8-c5e4d5847ca4
- </service-instance>""" as String
- verify(mockExecution).setVariable("GENPS_serviceInstancePayload",serviceInstancepayload)
-
- String serviceInstanceAaiPath = "http://localhost:8090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET"
- verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceInstanceAaiPath)
-
- int responseCode = 404
- verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode)
-
- String aaiResponse = ""
- verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse)
-
- verify(mockExecution).setVariable("GENPS_SuccessIndicator", false)
-
-
- }
-
-
- private ExecutionEntity setupMock() {
-
- ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
- when(mockProcessDefinition.getKey()).thenReturn("PutServiceInstance")
- RepositoryService mockRepositoryService = mock(RepositoryService.class)
- when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
- when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("PutServiceInstance")
- when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
- ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
- when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- // Initialize prerequisite variables
-
- when(mockExecution.getId()).thenReturn("100")
- when(mockExecution.getProcessDefinitionId()).thenReturn("PutServiceInstance")
- when(mockExecution.getProcessInstanceId()).thenReturn("PutServiceInstance")
- when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
- when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition)
-
- return mockExecution
- }
-
-}
\ No newline at end of file +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import static org.mockito.Mockito.* +import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutServiceInstance; + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner + +import com.github.tomakehurst.wiremock.client.WireMock +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.apache.commons.lang3.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class GenericPutServiceTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } + + @Test + public void preProcessRequest() { + + + println "************ preProcessRequest ************* " + + ExecutionEntity mockExecution = setupMock() + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") + when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") + when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") + when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance") + + GenericPutService putServiceInstance= new GenericPutService() + putServiceInstance.preProcessRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", "GENPS_") + + // execution.getVariable("isDebugLogEnabled") + + verify(mockExecution).setVariable("GENPS_SuccessIndicator", false) + // verify(mockExecution).setVariable("globalSubscriberId", "1604-MVM-26") + // verify(mockExecution).setVariable("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET") + // verify(mockExecution).setVariable("serviceType", "SDN-ETHERNET-INTERNET") + // verify(mockExecution).setVariable("ServiceInstanceData", "f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + + } + + + @Test + @Ignore + public void putServiceInstance() { + println "************ putServiceInstance ************* " + + WireMock.reset(); + + MockPutServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"); + ExecutionEntity mockExecution = setupMock() + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") + when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") + when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") + when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.PutServiceInstance.aai.business.customer.uri")).thenReturn("/aai/v7/business/customers/customer") + when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("7") + when(mockExecution.getVariable("mso.workflow.default.aai.v7.customer.uri")).thenReturn("/aai/v7/business/customers/customer") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + GenericPutService serviceInstance= new GenericPutService() + serviceInstance.putServiceInstance(mockExecution) + + // check the sequence of variable invocation + MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", "GENPS_") + + // execution.getVariable("isDebugLogEnabled") + // verify(mockExecution).setVariable("GENPSI_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + String servicePayload = """<service-instance xmlns="http://org.openecomp.aai.inventory/v7">f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance>""" as String + verify(mockExecution).setVariable("GENPS_serviceInstancePayload",servicePayload) + + String serviceAaiPath = "http://localhost:28090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET" + verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) + + int responseCode = 200 + verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode) + + String aaiResponse = """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + statusCode="200"> + <rest:headers> + <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> + <rest:header name="Content-Length" value="0"/> + <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> + <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:551-132672"/> + <rest:header name="Server" value="Apache-Coyote/1.1"/> + <rest:header name="Cache-Control" value="private"/> + </rest:headers> +</rest:RESTResponse>""" + + verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse) + + verify(mockExecution).setVariable("GENPS_SuccessIndicator", true) + } + + @Test + @Ignore + public void putServiceInstance_404() { + + + println "************ putServiceInstance ************* " + + WireMock.reset(); + + ExecutionEntity mockExecution = setupMock() + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") + when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") + when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") + when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.PutServiceInstance.aai.business.customer_uri")).thenReturn("/aai/v7/business/customers/customer") + when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + GenericPutService serviceInstance= new GenericPutService() + serviceInstance.putServiceInstance(mockExecution) + + // check the sequence of variable invocation + MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", "GENPS_") + + // execution.getVariable("isDebugLogEnabled") + + + verify(mockExecution).setVariable("GENPS_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + String serviceInstancepayload = """<service-instance xmlns="http://org.onap.so.aai.inventory/v7">f70e927b-6087-4974-9ef8-c5e4d5847ca4 + </service-instance>""" as String + verify(mockExecution).setVariable("GENPS_serviceInstancePayload",serviceInstancepayload) + + String serviceInstanceAaiPath = "http://localhost:8090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET" + verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceInstanceAaiPath) + + int responseCode = 404 + verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode) + + String aaiResponse = "" + verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse) + + verify(mockExecution).setVariable("GENPS_SuccessIndicator", false) + + + } + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("PutServiceInstance") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("PutServiceInstance") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("PutServiceInstance") + when(mockExecution.getProcessInstanceId()).thenReturn("PutServiceInstance") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy index 57055401f3..cd95a3a733 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.scripts +package org.onap.so.bpmn.common.scripts import static org.mockito.Mockito.* diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy index 12e7855808..dfcf69a931 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.scripts +package org.onap.so.bpmn.common.scripts // JUnit 4 import org.junit.Test @@ -27,10 +27,14 @@ import org.junit.Ignore; import org.junit.Rule; import static groovy.test.GroovyAssert.shouldFail + +import groovy.util.slurpersupport.NodeChild + import static groovy.test.GroovyAssert.assertTrue import static groovy.test.GroovyAssert.assertEquals +import static groovy.test.GroovyAssert.assertNotNull; -import org.openecomp.mso.bpmn.common.scripts.MsoUtils; +import org.onap.so.bpmn.common.scripts.MsoUtils; import org.apache.commons.lang3.* @@ -44,7 +48,9 @@ class MsoUtilsTest { def expected_rebuildFirewallLite = "<tns2:firewall-lite><tns2:stateful-firewall-lite-v4-enabled>Y</tns2:stateful-firewall-lite-v4-enabled><tns2:stateful-firewall-lite-v6-enabled>N</tns2:stateful-firewall-lite-v6-enabled><tns2:v4-firewall-packet-filters><tns2:v4-firewall-prefix>0.0.0.1</tns2:v4-firewall-prefix><tns2:v4-firewall-prefix-length>1</tns2:v4-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>1</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>1</tns2:port-number></tns2:tcp-ports></tns2:v4-firewall-packet-filters><tns2:v4-firewall-packet-filters><tns2:v4-firewall-prefix>0.0.0.2</tns2:v4-firewall-prefix><tns2:v4-firewall-prefix-length>2</tns2:v4-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>2</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>2</tns2:port-number></tns2:tcp-ports></tns2:v4-firewall-packet-filters><tns2:v6-firewall-packet-filters><tns2:v6-firewall-prefix>:</tns2:v6-firewall-prefix><tns2:v6-firewall-prefix-length>0</tns2:v6-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>3</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>3</tns2:port-number></tns2:tcp-ports></tns2:v6-firewall-packet-filters><tns2:v6-firewall-packet-filters><tns2:v6-firewall-prefix>:</tns2:v6-firewall-prefix><tns2:v6-firewall-prefix-length>1</tns2:v6-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>4</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>4</tns2:port-number></tns2:tcp-ports></tns2:v6-firewall-packet-filters></tns2:firewall-lite>" def expected_rebuildInternetEvcAccess = "<tns2:internet-evc-access-information><tns2:internet-evc-speed-value>8</tns2:internet-evc-speed-value><tns2:internet-evc-speed-units>Mbps</tns2:internet-evc-speed-units><tns2:ip-version>ds</tns2:ip-version></tns2:internet-evc-access-information>" def expected_rebuildInternetServiceChangeDetails = "<tns:internet-service-change-details><tns2:internet-evc-speed-value>10</tns2:internet-evc-speed-value><tns2:internet-evc-speed-units>Kbps</tns2:internet-evc-speed-units><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.15</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>2</tns2:request-index><tns2:v4-next-hop-address>192.168.1.16</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.16</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes></tns:internet-service-change-details>" + def expected_rebuildInternetServiceChangeDetailsWithVrLanParams = "<tns:internet-service-change-details><tns2:internet-evc-speed-value>10</tns2:internet-evc-speed-value><tns2:internet-evc-speed-units>Kbps</tns2:internet-evc-speed-units><tns2:v4-vr-lan-address>10.10.7.14</tns2:v4-vr-lan-address><tns2:v4-vr-lan-prefix-length>10</tns2:v4-vr-lan-prefix-length><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.15</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>2</tns2:request-index><tns2:v4-next-hop-address>192.168.1.16</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.16</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes></tns:internet-service-change-details>" def expected_rebuildL2Home = "<tns2:l2-homing-information><tns2:evc-name>AS/VLXM/003717//SW</tns2:evc-name><tns2:topology>MultiPoint</tns2:topology><tns2:preferred-aic-clli>MTSNJA4LCP1</tns2:preferred-aic-clli></tns2:l2-homing-information>" + def expected_rebuildL2HomeFor_aic_clli = "<tns2:l2-homing-information><tns2:evc-name>AS/VLXM/003717//SW</tns2:evc-name><tns2:topology>MultiPoint</tns2:topology><tns2:preferred-aic-clli>MTSNJA4LCP1</tns2:preferred-aic-clli><tns2:aic-version>2.5</tns2:aic-version></tns2:l2-homing-information>" def expected_rebuildNat = "<tns2:nat><tns2:v4-nat-enabled>Y</tns2:v4-nat-enabled><tns2:v4-nat-mapping-entries><tns2:v4-nat-internal>0.0.0.0</tns2:v4-nat-internal><tns2:v4-nat-next-hop-address>0.0.0.0</tns2:v4-nat-next-hop-address><tns2:v4-nat-external>0.0.0.0</tns2:v4-nat-external></tns2:v4-nat-mapping-entries><tns2:v4-nat-mapping-entries><tns2:v4-nat-internal>0.0.0.1</tns2:v4-nat-internal><tns2:v4-nat-next-hop-address>0.0.0.1</tns2:v4-nat-next-hop-address><tns2:v4-nat-external>0.0.0.1</tns2:v4-nat-external></tns2:v4-nat-mapping-entries></tns2:nat>" def expected_rebuildPat = "<tns2:pat><tns2:v4-pat-enabled>N</tns2:v4-pat-enabled><tns2:use-v4-default-pool>Y</tns2:use-v4-default-pool><tns2:v4-pat-pools><tns2:v4-pat-pool-prefix>192.168.1.44</tns2:v4-pat-pool-prefix><tns2:v4-pat-pool-prefix-length>0</tns2:v4-pat-pool-prefix-length><tns2:v4-pat-pool-next-hop-address>192.168.1.5</tns2:v4-pat-pool-next-hop-address></tns2:v4-pat-pools><tns2:v4-pat-pools><tns2:v4-pat-pool-prefix>192.168.1.45</tns2:v4-pat-pool-prefix><tns2:v4-pat-pool-prefix-length>28</tns2:v4-pat-pool-prefix-length><tns2:v4-pat-pool-next-hop-address>192.168.1.6</tns2:v4-pat-pool-next-hop-address></tns2:v4-pat-pools></tns2:pat>" def expected_rebuildStaticRoutes = "<tns2:static-routes><tns2:v4-static-routes><tns2:v4-static-route-prefix>255.255.252.1</tns2:v4-static-route-prefix><tns2:v4-static-route-prefix-length>28</tns2:v4-static-route-prefix-length><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address></tns2:v4-static-routes><tns2:v4-static-routes><tns2:v4-static-route-prefix>255.255.252.2</tns2:v4-static-route-prefix><tns2:v4-static-route-prefix-length>28</tns2:v4-static-route-prefix-length><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address></tns2:v4-static-routes><tns2:v4-static-routes><tns2:v4-static-route-prefix>255.255.252.3</tns2:v4-static-route-prefix><tns2:v4-static-route-prefix-length>28</tns2:v4-static-route-prefix-length><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address></tns2:v4-static-routes><tns2:v6-static-routes><tns2:v6-static-route-prefix>2001:1890:12e3:2da::</tns2:v6-static-route-prefix><tns2:v6-static-route-prefix-length>28</tns2:v6-static-route-prefix-length><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address></tns2:v6-static-routes><tns2:v6-static-routes><tns2:v6-static-route-prefix>2001:1890:12e3:2da::</tns2:v6-static-route-prefix><tns2:v6-static-route-prefix-length>28</tns2:v6-static-route-prefix-length><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address></tns2:v6-static-routes></tns2:static-routes>" @@ -53,12 +59,10 @@ class MsoUtilsTest { def expected_rebuildVrLanInterfacePartial = "<tns2:vr-designation>primary</tns2:vr-designation><tns2:v4-vr-lan-prefix>10.192.27.254</tns2:v4-vr-lan-prefix><tns2:v4-vr-lan-prefix-length>24</tns2:v4-vr-lan-prefix-length><tns2:v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</tns2:v6-vr-lan-prefix><tns2:v6-vr-lan-prefix-length>64</tns2:v6-vr-lan-prefix-length><tns2:v4-vce-loopback-address>162.200.3.144</tns2:v4-vce-loopback-address><tns2:v6-vce-wan-address>2001:1890:12e3:2da::</tns2:v6-vce-wan-address><tns2:v4-public-lan-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.2</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.1</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.72</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.71</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.68</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.67</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.15</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>2</tns2:request-index><tns2:v4-next-hop-address>192.168.1.16</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.16</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes></tns2:v4-public-lan-prefixes><tns2:v6-public-lan-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:3da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:4da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes></tns2:v6-public-lan-prefixes>" @Before - public void setUp() { + public void setUp() { def responseAsString = getFile("sdncadaptercallbackrequest.xml") def varrequestData=utils.getNodeText(responseAsString,"RequestData") - //def varResponseListData = StringEscapeUtils.unescapeXml(varrequestData) - def varResponseListData = varrequestData.replace("&", "&") - origXmlResponse = utils.getNodeXml(varResponseListData, "layer3-service-list").drop(38).trim() + origXmlResponse = utils.getNodeXml(varrequestData, "layer3-service-list").drop(38).trim() } @@ -88,6 +92,18 @@ class MsoUtilsTest { println " expected - " + expected_rebuildInternetServiceChangeDetails assertEquals("rebuildInternetServiceChangeDetails - expected vs actual", expected_rebuildInternetServiceChangeDetails, rebuildInternetServiceChangeDetails) } + + @Test + public void testBuildInternetServiceChangeDetailsWithVrLanParams() { + def responseAsString = getFile("sdncadaptercallbackrequest_with_aic_version.xml") + def varrequestData=utils.getNodeText(responseAsString,"RequestData") + def xmlResponse = utils.getNodeXml(varrequestData, "layer3-service-list").drop(38).trim() + def rebuildInternetServiceChangeDetails = utils.buildInternetServiceChangeDetails(xmlResponse) + println " rebuildInternetServiceChangeDetails: " + println " actual - " + rebuildInternetServiceChangeDetails + println " expected - " + expected_rebuildInternetServiceChangeDetails + assertEquals("rebuildInternetServiceChangeDetails - expected vs actual", expected_rebuildInternetServiceChangeDetailsWithVrLanParams, rebuildInternetServiceChangeDetails) + } // Coming v100 @Test @@ -213,7 +229,49 @@ class MsoUtilsTest { println "vlanid: " + myBGF.'vlan-id' +"\n" } } + + @Test + public void testBuildL2HomingInformation_with_aic_clli() { + + def responseAsString = getFile("sdncadaptercallbackrequest_with_aic_version.xml") + def varrequestData=utils.getNodeText(responseAsString,"RequestData") + def xmlResponse = utils.getNodeXml(varrequestData, "layer3-service-list").drop(38).trim() + def rebuildL2Home = utils.buildL2HomingInformation(xmlResponse) + println " rebuildL2Home: " + println " actual - " + rebuildL2Home + println " expected - " + expected_rebuildL2Home + assertEquals("rebuildL2Home - expected vs actual", expected_rebuildL2HomeFor_aic_clli, rebuildL2Home) + } + + @Test + public void testUnescapeNodeContents() { + String output = "<a><b>AT&T</b></a>" + String noChangeInput = "<a><b>AT&T</b></a>" + String decodeWithNamespacesNodeInput = '<top xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"><a xsi:type="xs:string"><b>AT&amp;T</b></a></top>' + String decodeWithNamespacesInput = '<a xsi:type="xs:string"><b>AT&amp;T</b></a>' + String decodeWithNamespacesOutput = '<a xsi:type="xs:string"><b>AT&T</b></a>' + String decodeWithoutNamespacesInput = '<a type="string"><b>AT&amp;T</b></a>' + String decodeWithoutNamespacesOutput = '<a type="string"><b>AT&T</b></a>' + String normalString = "<a>AT&T</a>" + NodeChild noChangeInputNode = new XmlSlurper().parseText(noChangeInput).'**'.find {it.name() == 'a'} + NodeChild decodeWithNamespacesInputNode = new XmlSlurper().parseText(decodeWithNamespacesNodeInput).'**'.find {it.name() == 'a'} + NodeChild decodeWithoutNamespacesInputNode = new XmlSlurper().parseText(decodeWithoutNamespacesInput).'**'.find {it.name() == 'a'} + NodeChild normalStringNode = new XmlSlurper().parseText(normalString).'**'.find {it.name() == 'a'} + + assertEquals("no change", output, utils.unescapeNodeContents(noChangeInputNode, noChangeInput)) + assertEquals("single unescape", decodeWithNamespacesOutput, utils.unescapeNodeContents(decodeWithNamespacesInputNode, decodeWithNamespacesInput)) + assertEquals("single unescape", decodeWithoutNamespacesOutput, utils.unescapeNodeContents(decodeWithoutNamespacesInputNode, decodeWithoutNamespacesInput)) + assertEquals("unescape normal string", "AT&T", utils.unescapeNodeContents(normalStringNode, "AT&T")) + } + @Test + public void testXmlEncode() { + + String expected = "&amp;"; + + assertEquals("is double encoded", expected, MsoUtils.xmlEscape("&")) + + } public String getFile(String fileName) { def SLASH = File.separator def pathBase = ' ' diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy index 63d88f5c3a..510dcf665c 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy @@ -18,7 +18,10 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.scripts +package org.onap.so.bpmn.common.scripts + +import org.junit.Before +import org.mockito.MockitoAnnotations import static org.mockito.Mockito.* import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity @@ -49,13 +52,14 @@ class NetworkUtilsTest { <param name="vnf_name2">US1117MTSNJVBR0246</param> </volume-params> </volume-request>""" - + + @Test public void testIsRollbackEnabled() { ExecutionEntity mockExecution = mock(ExecutionEntity.class) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn(true) + when(mockExecution.getVariable("mso.rollback")).thenReturn(true) NetworkUtils networkUtils = new NetworkUtils() def rollbackEnabled = networkUtils.isRollbackEnabled(mockExecution, volumeRequestXml) @@ -69,7 +73,7 @@ class NetworkUtilsTest { ExecutionEntity mockExecution = mock(ExecutionEntity.class) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("URN_mso_rollback")).thenReturn(false) + when(mockExecution.getVariable("mso.rollback")).thenReturn(false) NetworkUtils networkUtils = new NetworkUtils() def rollbackEnabled = networkUtils.isRollbackEnabled(mockExecution, volumeRequestXml) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy new file mode 100644 index 0000000000..c5b8fab9eb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy @@ -0,0 +1,171 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.mock.StubResponseAAI + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class PrepareUpdateAAIVfModuleTest { + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testGetGenericVnf() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("PUAAIVfMod_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + + PrepareUpdateAAIVfModule obj = new PrepareUpdateAAIVfModule() + obj.getGenericVnf(mockExecution) + + verify(mockExecution).setVariable("PUAAIVfMod_getVnfResponseCode", 200) + } + + @Test + void testGetGenericVnfEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("PUAAIVfMod_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + try { + PrepareUpdateAAIVfModule obj = new PrepareUpdateAAIVfModule() + obj.getGenericVnf(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + verify(mockExecution).setVariable("PUAAIVfMod_getVnfResponseCode", 500) + verify(mockExecution).setVariable("PUAAIVfMod_getVnfResponse", "AAI GET Failed:org.apache.http.client.ClientProtocolException") + } + + @Test + void testUpdateVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("PUAAIVfMod_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("PUAAIVfMod_vfModuleId")).thenReturn("supercool") + + def node = new Node(null, 'vfModule') + new Node(node, 'vf-module-name', "abc") + VfModule vfModule = new VfModule(node, true) + + when(mockExecution.getVariable("PUAAIVfMod_vfModule")).thenReturn(vfModule) + when(mockExecution.getVariable("PUAAIVfMod_orchestrationStatus")).thenReturn("created") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + PrepareUpdateAAIVfModule obj = new PrepareUpdateAAIVfModule() + obj.updateVfModule(mockExecution) + + verify(mockExecution).setVariable("PUAAIVfMod_updateVfModuleResponseCode", 200) + verify(mockExecution).setVariable("PUAAIVfMod_updateVfModuleResponse", "") + } + + @Test + void testUpdateVfModuleEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("PUAAIVfMod_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("PUAAIVfMod_vfModuleId")).thenReturn("supercool") + + def node = new Node(null, 'vfModule') + new Node(node, 'vf-module-name', "abc") + VfModule vfModule = new VfModule(node, true) + + when(mockExecution.getVariable("PUAAIVfMod_vfModule")).thenReturn(vfModule) + when(mockExecution.getVariable("PUAAIVfMod_orchestrationStatus")).thenReturn("created") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + try { + PrepareUpdateAAIVfModule obj = new PrepareUpdateAAIVfModule() + obj.updateVfModule(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + verify(mockExecution).setVariable("PUAAIVfMod_updateVfModuleResponseCode", 500) + verify(mockExecution).setVariable("PUAAIVfMod_updateVfModuleResponse", "AAI PATCH Failed:org.apache.http.client.ClientProtocolException") + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("PrepareUpdateAAIVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("PrepareUpdateAAIVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("PrepareUpdateAAIVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("PrepareUpdateAAIVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1Test.groovy new file mode 100644 index 0000000000..1079bb48b3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1Test.groovy @@ -0,0 +1,151 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Ignore +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.core.json.JsonUtils + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +public class SDNCAdapterRestV1Test { + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testPreProcessRequest() { + // bpTimeout is empty and "mso.adapters.sdnc.timeout" is defined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("mso.adapters.sdnc.timeout")).thenReturn("PT5M") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV1 sdncAdapterRestV1 = new SDNCAdapterRestV1() + sdncAdapterRestV1.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT5M") + } + + @Test + public void testPreProcessRequestGoodTimeout() { + // bpTimeout is valid and "mso.adapters.sdnc.timeout" is undefined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + sdncAdapterWorkflowRequest = JsonUtils.addJsonValue(sdncAdapterWorkflowRequest, "SDNCServiceRequest.bpTimeout", "PT20S") + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV1 sdncAdapterRestV1 = new SDNCAdapterRestV1() + sdncAdapterRestV1.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT20S") + } + + @Test + @Ignore + public void testPreProcessRequestBadTimeout() { + // bpTimeout is invalid and "mso.adapters.sdnc.timeout" is undefined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + sdncAdapterWorkflowRequest = JsonUtils.addJsonValue(sdncAdapterWorkflowRequest, "SDNCServiceRequest.bpTimeout", "badTimeout") + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV1 sdncAdapterRestV1 = new SDNCAdapterRestV1() + sdncAdapterRestV1.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT10S") + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2Test.groovy new file mode 100644 index 0000000000..d7fe0ee208 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2Test.groovy @@ -0,0 +1,151 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Ignore +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.core.json.JsonUtils + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +public class SDNCAdapterRestV2Test { + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testPreProcessRequest() { + // bpTimeout is empty and "mso.adapters.sdnc.timeout" is defined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("mso.adapters.sdnc.timeout")).thenReturn("PT5M") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV2 sdncAdapterRestV2 = new SDNCAdapterRestV2() + sdncAdapterRestV2.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT5M") + } + + @Test + public void testPreProcessRequestGoodTimeout() { + // bpTimeout is valid and "mso.adapters.sdnc.timeout" is undefined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + sdncAdapterWorkflowRequest = JsonUtils.addJsonValue(sdncAdapterWorkflowRequest, "SDNCServiceRequest.bpTimeout", "PT20S") + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV2 sdncAdapterRestV2 = new SDNCAdapterRestV2() + sdncAdapterRestV2.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT20S") + } + + @Ignore + @Test + public void testPreProcessRequestBadTimeout() { + // bpTimeout is invalid and "mso.adapters.sdnc.timeout" is undefined + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json"); + sdncAdapterWorkflowRequest = JsonUtils.addJsonValue(sdncAdapterWorkflowRequest, "SDNCServiceRequest.bpTimeout", "badTimeout") + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("SDNCREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("SDNCREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.sdnc.rest.endpoint")).thenReturn("http://localhost:18080/adapters/rest/v1/sdnc/") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + SDNCAdapterRestV2 sdncAdapterRestV2 = new SDNCAdapterRestV2() + sdncAdapterRestV2.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCREST_") + + verify(mockExecution).setVariable("SDNCREST_SuccessIndicator",false) + verify(mockExecution).setVariable("SDNCREST_requestType","SDNCServiceRequest") + verify(mockExecution).setVariable("SDNCAResponse_CORRELATOR","0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479") + verify(mockExecution).setVariable("SDNCREST_sdncAdapterMethod","POST") + verify(mockExecution).setVariable("SDNCREST_timeout","PT10S") + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy index 2ecb108b4e..18d65d00d8 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy @@ -1,948 +1,951 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.scripts;
-
-import static org.mockito.Mockito.*
-
-import org.camunda.bpm.engine.ProcessEngineServices
-import org.camunda.bpm.engine.RepositoryService
-import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.camunda.bpm.engine.repository.ProcessDefinition
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.mockito.MockitoAnnotations
-import org.mockito.runners.MockitoJUnitRunner
-import org.mockito.internal.debugging.MockitoDebuggerImpl
-import org.openecomp.mso.bpmn.common.scripts.SDNCAdapter;
-
-import org.openecomp.mso.bpmn.mock.FileUtil
-
-@RunWith(MockitoJUnitRunner.class)
-public class SDNCAdapterTest {
-
- @Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- System.setProperty("jboss.qualified.host.name","myhost.com")
- }
-
-
- def workflowResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <sdncadapterworkflow:response-data>
- <tag0:CallbackHeader>
- <tag0:RequestId>testRequestId</tag0:RequestId>
- <tag0:ResponseCode>200</tag0:ResponseCode>
- <tag0:ResponseMessage>OK</tag0:ResponseMessage>
- </tag0:CallbackHeader>
- <tag0:RequestData xsi:type="xs:string"> <layer3-service-list xmlns="com:att:sdnctl:l3api">
- <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
- <service-status>
- <rpc-name>service-configuration-operation</rpc-name>
- <rpc-action>activate</rpc-action>
- <request-status>synccomplete</request-status>
- <final-indicator>N</final-indicator>
- <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action>
- <l3sdn-subaction>SUPP</l3sdn-subaction>
- <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp>
- </service-status>
- <service-data>
- <internet-evc-access-information>
- <ip-version>ds</ip-version>
- <internet-evc-speed-value>8</internet-evc-speed-value>
- <internet-evc-speed-units>Mbps</internet-evc-speed-units>
- </internet-evc-access-information>
- <vr-lan xmlns="com:att:sdnctl:l3api">
- <vr-lan-interface>
- <static-routes>
- <v6-static-routes>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
- <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
- </v6-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- <v6-static-routes>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
- <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
- </v6-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- </static-routes>
- <dhcp>
- <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled>
- <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled>
- <use-v6-default-pool>N</use-v6-default-pool>
- <excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-address>192.168.1.7</excluded-v4-address>
- </excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-address>192.168.1.8</excluded-v4-address>
- </excluded-v4-dhcp-addresses-from-default-pool>
- <v4-dhcp-pools>
- <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address>
- <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.5</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.6</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix>
- </v4-dhcp-pools>
- <v4-dhcp-pools>
- <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address>
- <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.6</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.7</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix>
- </v4-dhcp-pools>
- <use-v4-default-pool>Y</use-v4-default-pool>
- <excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-address>1:5</excluded-v6-address>
- </excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-address>1:6</excluded-v6-address>
- </excluded-v6-dhcp-addresses-from-default-pool>
- <v6-dhcp-pools>
- <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
- <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
- <excluded-v6-addresses>
- <excluded-v6-address>1:1</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
- <excluded-v6-addresses>
- <excluded-v6-address>2:2</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
- </v6-dhcp-pools>
- <v6-dhcp-pools>
- <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
- <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
- <excluded-v6-addresses>
- <excluded-v6-address>1:1</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
- <excluded-v6-addresses>
- <excluded-v6-address>2:2</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
- </v6-dhcp-pools>
- </dhcp>
- <firewall-lite>
- <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled>
- <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled>
- <v4-firewall-packet-filters>
- <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix>
- <v4-firewall-prefix-length>1</v4-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>1</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>1</port-number>
- </tcp-ports>
- </v4-firewall-packet-filters>
- <v4-firewall-packet-filters>
- <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix>
- <v4-firewall-prefix-length>2</v4-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>2</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>2</port-number>
- </tcp-ports>
- </v4-firewall-packet-filters>
- <v6-firewall-packet-filters>
- <v6-firewall-prefix>:</v6-firewall-prefix>
- <v6-firewall-prefix-length>0</v6-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>3</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>3</port-number>
- </tcp-ports>
- </v6-firewall-packet-filters>
- <v6-firewall-packet-filters>
- <v6-firewall-prefix>:</v6-firewall-prefix>
- <v6-firewall-prefix-length>1</v6-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>4</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>4</port-number>
- </tcp-ports>
- </v6-firewall-packet-filters>
- </firewall-lite>
- <pat>
- <v4-pat-pools>
- <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix>
- <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address>
- <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length>
- </v4-pat-pools>
- <use-v4-default-pool>Y</use-v4-default-pool>
- <v4-pat-enabled>N</v4-pat-enabled>
- <v4-pat-pools>
- <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix>
- <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address>
- <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length>
- </v4-pat-pools>
- </pat>
- <nat>
- <v4-nat-enabled>Y</v4-nat-enabled>
- <v4-nat-mapping-entries>
- <v4-nat-internal>0.0.0.0</v4-nat-internal>
- <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address>
- <v4-nat-external>0.0.0.0</v4-nat-external>
- </v4-nat-mapping-entries>
- <v4-nat-mapping-entries>
- <v4-nat-internal>0.0.0.1</v4-nat-internal>
- <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address>
- <v4-nat-external>0.0.0.1</v4-nat-external>
- </v4-nat-mapping-entries>
- </nat>
- <vr-designation>primary</vr-designation>
- <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address>
- <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length>
- <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address>
- <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix>
- <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length>
- <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix>
- <v4-public-lan-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.2</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.72</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.68</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- </v4-public-lan-prefixes>
- <v6-public-lan-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- </v6-public-lan-prefixes>
- </vr-lan-interface>
- <routing-protocol>none</routing-protocol>
- </vr-lan>
-<ucpe-vms-service-information>
- <transport-service-information>
- <transport-service-type>AVPN</transport-service-type>
- <access-circuit-info>
- <access-circuit-id>1</access-circuit-id>
- <dual-mode>Active</dual-mode>
- </access-circuit-info>
- <access-circuit-info>
- <access-circuit-id>2</access-circuit-id>
- <dual-mode>Standby</dual-mode>
- </access-circuit-info>
- </transport-service-information>
- <ucpe-information>
- <ucpe-host-name>hostname</ucpe-host-name>
- <ucpe-activation-code>activecode</ucpe-activation-code>
- <out-of-band-management-modem>OOB</out-of-band-management-modem>
- </ucpe-information>
- <vnf-list>
- <vnf-information>
- <vnf-instance-id>1</vnf-instance-id>
- <vnf-sequence-number>1</vnf-sequence-number>
- <vnf-type>ZZ</vnf-type>
- <vnf-vendor>JUNIPER</vnf-vendor>
- <vnf-model>MODEL1</vnf-model>
- <vnf-id>1</vnf-id>
- <prov-status>1</prov-status>
- <operational-state>1</operational-state>
- <orchestration-status>1</orchestration-status>
- <equipment-role>1</equipment-role>
- </vnf-information>
- <vnf-information>
- <vnf-instance-id>2</vnf-instance-id>
- <vnf-sequence-number>2</vnf-sequence-number>
- <vnf-type>HY</vnf-type>
- <vnf-vendor>JUNIPER</vnf-vendor>
- <vnf-model>MODEL2</vnf-model>
- <vnf-id>2</vnf-id>
- <prov-status>2</prov-status>
- <operational-state>2</operational-state>
- <orchestration-status>2</orchestration-status>
- <equipment-role>2</equipment-role>
- </vnf-information>
- </vnf-list>
- </ucpe-vms-service-information>
- <request-information>
- <request-action>Layer3ServiceActivateRequest</request-action>
- <order-number>4281555</order-number>
- <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id>
- <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url>
- <source>OMX</source>
- <order-version>1</order-version>
- </request-information>
- <sdnc-request-header>
- <svc-action>activate</svc-action>
- <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify</svc-notification-url>
- <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id>
- </sdnc-request-header>
- <l2-homing-information>
- <topology>MultiPoint</topology>
- <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli>
- <evc-name>AS/VLXM/003717//SW</evc-name>
- </l2-homing-information>
- <service-information>
- <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
- <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name>
- <service-type>SDN-ETHERNET-INTERNET</service-type>
- </service-information>
- <internet-service-change-details>
- <internet-evc-speed-value>10</internet-evc-speed-value>
- <internet-evc-speed-units>Kbps</internet-evc-speed-units>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>2</request-index>
- <v4-next-hop-address>192.168.1.16</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- </internet-service-change-details>
- </service-data>
- </layer3-service-list>
-</tag0:RequestData>
- </sdncadapterworkflow:response-data>
-</sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
-
- String sdncAdapterRequest = """
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Body>
- <aetgt:SDNCAdapterRequest xmlns:aetgt="http://org.openecomp/workflow/sdnc/adapter/schema/v1" xmlns:sdncadaptersc="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestId>745b1b50-e39e-4685-9cc8-c71f0bde8bf0</sdncadapter:RequestId>
- <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>http://myhost.com:28080/mso/sdncAdapterCallbackServiceImpl</sdncadapter:CallbackUrl>
- </sdncadapter:RequestHeader>
- <sdncadaptersc:RequestData><rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
- contentType="text/xml">
- <service-request xmlns="http://org.openecomp/mso/request/details/schema/v1">
- <request-information>
- <request-id>12570a36-7388-4c0a-bec4-189ce3kg9956</request-id>
- <request-action>GetLayer3ServiceDetailsRequest</request-action>
- <source>OMX</source>
- </request-information>
- <service-information>
- <service-type>SDN-ETHERNET-INTERNET</service-type>
- <service-instance-id>PD/VLXM/003717//SW_INTERNET</service-instance-id>
- </service-information>
- </service-request>
-</rest:payload></sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"""
-
-def sdncAdapterResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
-<sdncadapterworkflow:response-data>
-<tag0:CallbackHeader xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId>
- <tag0:ResponseCode>404</tag0:ResponseCode>
- <tag0:ResponseMessage>Error processing request to SDNC. Not Found.
- https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout.
- 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.]</tag0:ResponseMessage>
-</tag0:CallbackHeader>
-</sdncadapterworkflow:response-data>
-</sdncadapterworkflow:SDNCAdapterWorkflowResponse>
-"""
-
-def workflowErrorResponse = """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>Received error from SDN-C: Error processing request to SDNC. Not Found.
- https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout.
- 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.]</aetgt:ErrorMessage>
- <aetgt:ErrorCode>5300</aetgt:ErrorCode>
- <aetgt:SourceSystemErrorCode>404</aetgt:SourceSystemErrorCode>
- </aetgt:WorkflowException>"""
-
-def workflowErrorResponse1 = """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>Invalid Callback Response from SDNC Adapter</aetgt:ErrorMessage>
- <aetgt:ErrorCode>5300</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
-
-def enhancedCallbackRequestData =
- """<tag0:RequestData xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="xs:string"> <layer3-service-list xmlns="com:att:sdnctl:l3api">
- <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
- <service-status>
- <rpc-name>service-configuration-operation</rpc-name>
- <rpc-action>activate</rpc-action>
- <request-status>synccomplete</request-status>
- <final-indicator>N</final-indicator>
- <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action>
- <l3sdn-subaction>SUPP</l3sdn-subaction>
- <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp>
- </service-status>
- <service-data>
- <internet-evc-access-information>
- <ip-version>ds</ip-version>
- <internet-evc-speed-value>8</internet-evc-speed-value>
- <internet-evc-speed-units>Mbps</internet-evc-speed-units>
- </internet-evc-access-information>
- <vr-lan xmlns="com:att:sdnctl:l3api">
- <vr-lan-interface>
- <static-routes>
- <v6-static-routes>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
- <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
- </v6-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- <v6-static-routes>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
- <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
- </v6-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- </static-routes>
- <dhcp>
- <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled>
- <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled>
- <use-v6-default-pool>N</use-v6-default-pool>
- <excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-address>192.168.1.7</excluded-v4-address>
- </excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-address>192.168.1.8</excluded-v4-address>
- </excluded-v4-dhcp-addresses-from-default-pool>
- <v4-dhcp-pools>
- <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address>
- <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.5</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.6</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix>
- </v4-dhcp-pools>
- <v4-dhcp-pools>
- <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address>
- <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.6</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.7</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix>
- </v4-dhcp-pools>
- <use-v4-default-pool>Y</use-v4-default-pool>
- <excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-address>1:5</excluded-v6-address>
- </excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-address>1:6</excluded-v6-address>
- </excluded-v6-dhcp-addresses-from-default-pool>
- <v6-dhcp-pools>
- <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
- <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
- <excluded-v6-addresses>
- <excluded-v6-address>1:1</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
- <excluded-v6-addresses>
- <excluded-v6-address>2:2</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
- </v6-dhcp-pools>
- <v6-dhcp-pools>
- <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
- <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
- <excluded-v6-addresses>
- <excluded-v6-address>1:1</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
- <excluded-v6-addresses>
- <excluded-v6-address>2:2</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
- </v6-dhcp-pools>
- </dhcp>
- <firewall-lite>
- <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled>
- <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled>
- <v4-firewall-packet-filters>
- <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix>
- <v4-firewall-prefix-length>1</v4-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>1</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>1</port-number>
- </tcp-ports>
- </v4-firewall-packet-filters>
- <v4-firewall-packet-filters>
- <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix>
- <v4-firewall-prefix-length>2</v4-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>2</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>2</port-number>
- </tcp-ports>
- </v4-firewall-packet-filters>
- <v6-firewall-packet-filters>
- <v6-firewall-prefix>:</v6-firewall-prefix>
- <v6-firewall-prefix-length>0</v6-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>3</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>3</port-number>
- </tcp-ports>
- </v6-firewall-packet-filters>
- <v6-firewall-packet-filters>
- <v6-firewall-prefix>:</v6-firewall-prefix>
- <v6-firewall-prefix-length>1</v6-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>4</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>4</port-number>
- </tcp-ports>
- </v6-firewall-packet-filters>
- </firewall-lite>
- <pat>
- <v4-pat-pools>
- <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix>
- <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address>
- <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length>
- </v4-pat-pools>
- <use-v4-default-pool>Y</use-v4-default-pool>
- <v4-pat-enabled>N</v4-pat-enabled>
- <v4-pat-pools>
- <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix>
- <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address>
- <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length>
- </v4-pat-pools>
- </pat>
- <nat>
- <v4-nat-enabled>Y</v4-nat-enabled>
- <v4-nat-mapping-entries>
- <v4-nat-internal>0.0.0.0</v4-nat-internal>
- <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address>
- <v4-nat-external>0.0.0.0</v4-nat-external>
- </v4-nat-mapping-entries>
- <v4-nat-mapping-entries>
- <v4-nat-internal>0.0.0.1</v4-nat-internal>
- <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address>
- <v4-nat-external>0.0.0.1</v4-nat-external>
- </v4-nat-mapping-entries>
- </nat>
- <vr-designation>primary</vr-designation>
- <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address>
- <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length>
- <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address>
- <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix>
- <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length>
- <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix>
- <v4-public-lan-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.2</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.72</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.68</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- </v4-public-lan-prefixes>
- <v6-public-lan-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- </v6-public-lan-prefixes>
- </vr-lan-interface>
- <routing-protocol>none</routing-protocol>
- </vr-lan>
-<ucpe-vms-service-information>
- <transport-service-information>
- <transport-service-type>AVPN</transport-service-type>
- <access-circuit-info>
- <access-circuit-id>1</access-circuit-id>
- <dual-mode>Active</dual-mode>
- </access-circuit-info>
- <access-circuit-info>
- <access-circuit-id>2</access-circuit-id>
- <dual-mode>Standby</dual-mode>
- </access-circuit-info>
- </transport-service-information>
- <ucpe-information>
- <ucpe-host-name>hostname</ucpe-host-name>
- <ucpe-activation-code>activecode</ucpe-activation-code>
- <out-of-band-management-modem>OOB</out-of-band-management-modem>
- </ucpe-information>
- <vnf-list>
- <vnf-information>
- <vnf-instance-id>1</vnf-instance-id>
- <vnf-sequence-number>1</vnf-sequence-number>
- <vnf-type>ZZ</vnf-type>
- <vnf-vendor>JUNIPER</vnf-vendor>
- <vnf-model>MODEL1</vnf-model>
- <vnf-id>1</vnf-id>
- <prov-status>1</prov-status>
- <operational-state>1</operational-state>
- <orchestration-status>1</orchestration-status>
- <equipment-role>1</equipment-role>
- </vnf-information>
- <vnf-information>
- <vnf-instance-id>2</vnf-instance-id>
- <vnf-sequence-number>2</vnf-sequence-number>
- <vnf-type>HY</vnf-type>
- <vnf-vendor>JUNIPER</vnf-vendor>
- <vnf-model>MODEL2</vnf-model>
- <vnf-id>2</vnf-id>
- <prov-status>2</prov-status>
- <operational-state>2</operational-state>
- <orchestration-status>2</orchestration-status>
- <equipment-role>2</equipment-role>
- </vnf-information>
- </vnf-list>
- </ucpe-vms-service-information>
- <request-information>
- <request-action>Layer3ServiceActivateRequest</request-action>
- <order-number>4281555</order-number>
- <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id>
- <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url>
- <source>OMX</source>
- <order-version>1</order-version>
- </request-information>
- <sdnc-request-header>
- <svc-action>activate</svc-action>
- <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify</svc-notification-url>
- <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id>
- </sdnc-request-header>
- <l2-homing-information>
- <topology>MultiPoint</topology>
- <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli>
- <evc-name>AS/VLXM/003717//SW</evc-name>
- </l2-homing-information>
- <service-information>
- <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
- <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name>
- <service-type>SDN-ETHERNET-INTERNET</service-type>
- </service-information>
- <internet-service-change-details>
- <internet-evc-speed-value>10</internet-evc-speed-value>
- <internet-evc-speed-units>Kbps</internet-evc-speed-units>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>2</request-index>
- <v4-next-hop-address>192.168.1.16</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- </internet-service-change-details>
- </service-data>
- </layer3-service-list>
-</tag0:RequestData>
-"""
-
-def sdncAdapterResponseEmpty =
-"""<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
- <sdncadapterworkflow:response-data/>
-</sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
-
-def sdncAdapterResponseError =
-"""<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <sdncadapterworkflow:response-data>
- <tag0:CallbackHeader>
- <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId>
- <tag0:ResponseCode>404</tag0:ResponseCode>
- <tag0:ResponseMessage>Error processing request to SDNC. Not Found.
- https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout.
- 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.]</tag0:ResponseMessage>
- </tag0:CallbackHeader>
- </sdncadapterworkflow:response-data>
-</sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
-
-
- @Test
- public void testPreProcessRequest() {
-
- String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml");
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B")
- when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
- when(mockExecution.getVariable("sdncAdapterWorkflowRequest")).thenReturn(sdncAdapterWorkflowRequest)
- when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://someurl.someting.com:28080/mso/sdncAdapterCallbackServiceImpl")
- when(mockExecution.getVariable("URN_mso_use_qualified_host")).thenReturn("true")
- when(mockExecution.getProcessInstanceId()).thenReturn("745b1b50-e39e-4685-9cc8-c71f0bde8bf0")
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
-
-
- SDNCAdapter sdncAdapter = new SDNCAdapter()
- sdncAdapter.preProcessRequest(mockExecution)
-
- MockitoDebuggerImpl debugger = new MockitoDebuggerImpl()
- debugger.printInvocations(mockExecution)
-
-
- verify(mockExecution).setVariable("prefix","SDNCA_")
- verify(mockExecution).setVariable("sdncAdapterResponse","")
- verify(mockExecution).setVariable("asynchronousResponseTimeout",false)
- verify(mockExecution).setVariable("continueListening",false)
- verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic cGFzc3dvcmQ=")
- verify(mockExecution).setVariable("serviceConfigActivate",false)
- verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0")
- verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false)
- verify(mockExecution).setVariable("source","")
- verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest)
- }
-
- @Test
- public void testProcessResponse()
- {
- String sdncAdapterCallbackResponse = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml");
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackResponse)
- SDNCAdapter sdncAdapter = new SDNCAdapter()
- sdncAdapter.postProcessResponse(mockExecution)
-
-// MockitoDebuggerImpl debugger = new MockitoDebuggerImpl()
-// debugger.printInvocations(mockExecution)
-
- verify(mockExecution).getVariable("isDebugLogEnabled")
- verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
- verify(mockExecution).setVariable("sdncAdapterResponse",workflowResponse)
- verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData)
- verify(mockExecution).setVariable("continueListening",false)
-
- }
-
- @Test
- public void testProcessResponse_ErrorCase_404()
- {
- String sdncAdapterCallbackErrorResponse = FileUtil.readResourceFile("sdncadaptercallbackrequest_404CallBack.xml");
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackErrorResponse)
- SDNCAdapter sdncAdapter = new SDNCAdapter()
- sdncAdapter.postProcessResponse(mockExecution)
-
- verify(mockExecution, times(1)).getVariable("isDebugLogEnabled")
- verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
- verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseError)
- verify(mockExecution).setVariable("enhancedCallbackRequestData", "")
- verify(mockExecution).setVariable("continueListening",false)
-
- }
-
- @Test
- public void testProcessResponse_ErrorCase_InvalidCallback()
- {
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn("<h1>Service Unavailable</h1>")
- SDNCAdapter sdncAdapter = new SDNCAdapter()
- sdncAdapter.postProcessResponse(mockExecution)
-
- verify(mockExecution).getVariable("isDebugLogEnabled")
- verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
- verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseEmpty)
- verify(mockExecution).setVariable("enhancedCallbackRequestData", "")
- verify(mockExecution).setVariable("continueListening",false)
-
- }
-
- @Test
- public void postProcessResponse()
- {
-
- String SDNCAdapterCallbackRequest =
- """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<SDNCAdapterCallbackRequest
- xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <CallbackHeader>
- <RequestId>3bb02798-b344-4d28-9bca-1f029954d1c9</RequestId>
- <ResponseCode>404</ResponseCode>
- <ResponseMessage>Error processing request to SDNC. Not Found.
- https://sdncodl.us.infra.aic.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693.
- 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 ]</ResponseMessage>
- </CallbackHeader>
-</SDNCAdapterCallbackRequest>"""
-
- String sdncAdapterResponse =
- """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <sdncadapterworkflow:response-data>
- <tag0:CallbackHeader>
- <tag0:RequestId>3bb02798-b344-4d28-9bca-1f029954d1c9</tag0:RequestId>
- <tag0:ResponseCode>404</tag0:ResponseCode>
- <tag0:ResponseMessage>Error processing request to SDNC. Not Found.
- https://sdncodl.us.infra.aic.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693.
- 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 ]</tag0:ResponseMessage>
- </tag0:CallbackHeader>
- </sdncadapterworkflow:response-data>
-</sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(SDNCAdapterCallbackRequest)
- SDNCAdapter sdncAdapter = new SDNCAdapter()
- sdncAdapter.postProcessResponse(mockExecution)
-
- verify(mockExecution).getVariable("isDebugLogEnabled")
- verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
- verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponse)
- verify(mockExecution).setVariable("enhancedCallbackRequestData", "")
- verify(mockExecution).setVariable("continueListening",false)
-
- }
-
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.onap.so.bpmn.common.scripts.SDNCAdapter; + +import org.onap.so.bpmn.mock.FileUtil + +@RunWith(MockitoJUnitRunner.class) +public class SDNCAdapterTest { + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + System.setProperty("jboss.qualified.host.name","myhost.com") + } + + + String workflowResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" + xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="com:att:sdnctl:l3api"> + <sdncadapterworkflow:response-data> + <tag0:CallbackHeader> + <tag0:RequestId>testRequestId</tag0:RequestId> + <tag0:ResponseCode>200</tag0:ResponseCode> + <tag0:ResponseMessage>OK</tag0:ResponseMessage> + </tag0:CallbackHeader> + <tag0:RequestData xsi:type="xs:string"> + <layer3-service-list> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> + <ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> + </tag0:RequestData> + </sdncadapterworkflow:response-data> +</sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" + + String sdncAdapterRequest = """ + <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> + <SOAP-ENV:Body> + <aetgt:SDNCAdapterRequest xmlns:aetgt="http://org.onap/workflow/sdnc/adapter/schema/v1" xmlns:sdncadaptersc="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestHeader xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestId>745b1b50-e39e-4685-9cc8-c71f0bde8bf0</sdncadapter:RequestId> + <sdncadapter:SvcAction>query</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>http://myhost.com:28080/mso/sdncAdapterCallbackServiceImpl</sdncadapter:CallbackUrl> + </sdncadapter:RequestHeader> + <sdncadaptersc:RequestData> + <rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + contentType="text/xml"> + <service-request xmlns="http://org.onap/so/request/details/schema/v1"> + <request-information> + <request-id>12570a36-7388-4c0a-bec4-189ce3kg9956</request-id> + <request-action>GetLayer3ServiceDetailsRequest</request-action> + <source>OMX</source> + </request-information> + <service-information> + <service-type>SDN-ETHERNET-INTERNET</service-type> + <service-instance-id>PD/VLXM/003717//SW_INTERNET</service-instance-id> + </service-information> + </service-request> +</rest:payload> + </sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>""" + +def sdncAdapterResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> +<sdncadapterworkflow:response-data> +<tag0:CallbackHeader xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId> + <tag0:ResponseCode>404</tag0:ResponseCode> + <tag0:ResponseMessage>Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + 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.]</tag0:ResponseMessage> +</tag0:CallbackHeader> +</sdncadapterworkflow:response-data> +</sdncadapterworkflow:SDNCAdapterWorkflowResponse> +""" + +def workflowErrorResponse = """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>Received error from SDN-C: Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + 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.]</aetgt:ErrorMessage> + <aetgt:ErrorCode>5300</aetgt:ErrorCode> + <aetgt:SourceSystemErrorCode>404</aetgt:SourceSystemErrorCode> + </aetgt:WorkflowException>""" + +String workflowErrorResponse1 = """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>Invalid Callback Response from SDNC Adapter</aetgt:ErrorMessage> + <aetgt:ErrorCode>5300</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + +String enhancedCallbackRequestData = + """<tag0:RequestData xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:string"> <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> +</tag0:RequestData> +""" + +def sdncAdapterResponseEmpty = +"""<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapterworkflow:response-data/> +</sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" + +def sdncAdapterResponseError = +"""<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" + xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <sdncadapterworkflow:response-data> + <tag0:CallbackHeader> + <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId> + <tag0:ResponseCode>404</tag0:ResponseCode> + <tag0:ResponseMessage>Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + 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.]</tag0:ResponseMessage> + </tag0:CallbackHeader> + </sdncadapterworkflow:response-data> +</sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" + + + @Test + public void testPreProcessRequest() { + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("sdncAdapterWorkflowRequest")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://someurl.someting.com:28080/mso/sdncAdapterCallbackServiceImpl") + when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") + + when(mockExecution.getProcessInstanceId()).thenReturn("745b1b50-e39e-4685-9cc8-c71f0bde8bf0") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCA_") + verify(mockExecution).setVariable("sdncAdapterResponse","") + verify(mockExecution).setVariable("asynchronousResponseTimeout",false) + verify(mockExecution).setVariable("continueListening",false) + verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("serviceConfigActivate",false) + verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0") + verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false) + verify(mockExecution).setVariable("source","") + verify(mockExecution).setVariable("SDNCA_InterimNotify",false) + verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest) + } + + @Test + public void testProcessResponse() + { + String sdncAdapterCallbackResponse = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackResponse) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + +// MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() +// debugger.printInvocations(mockExecution) + + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData) + verify(mockExecution).setVariable("sdncAdapterResponse",workflowResponse) + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void testProcessResponse_ErrorCase_404() + { + String sdncAdapterCallbackErrorResponse = FileUtil.readResourceFile("sdncadaptercallbackrequest_404CallBack.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackErrorResponse) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseError) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void testProcessResponse_ErrorCase_InvalidCallback() + { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn("<h1>Service Unavailable</h1>") + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseEmpty) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void postProcessResponse() + { + + String SDNCAdapterCallbackRequest = + """<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<SDNCAdapterCallbackRequest + xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <CallbackHeader> + <RequestId>3bb02798-b344-4d28-9bca-1f029954d1c9</RequestId> + <ResponseCode>404</ResponseCode> + <ResponseMessage>Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. + 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 ]</ResponseMessage> + </CallbackHeader> +</SDNCAdapterCallbackRequest>""" + + String sdncAdapterResponse = + """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" + xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <sdncadapterworkflow:response-data> + <tag0:CallbackHeader> + <tag0:RequestId>3bb02798-b344-4d28-9bca-1f029954d1c9</tag0:RequestId> + <tag0:ResponseCode>404</tag0:ResponseCode> + <tag0:ResponseMessage>Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. + 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 ]</tag0:ResponseMessage> + </tag0:CallbackHeader> + </sdncadapterworkflow:response-data> +</sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(SDNCAdapterCallbackRequest) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponse) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy index 161b71cb9c..803e2b03a3 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy @@ -1,213 +1,191 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.scripts;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*
-
-import org.junit.Before
-import org.junit.Ignore
-import org.junit.Test
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
-
-import org.openecomp.mso.bpmn.mock.FileUtil
-
-public class SDNCAdapterUtilsTest {
-
- private def map
- private ExecutionEntity svcex
- private WorkflowException wfex
- private AbstractServiceTaskProcessor tp
- private String resp
- private SDNCAdapterUtils utils
-
- @Before
- public void init()
- {
- map = new HashMap<String,Object>()
- svcex = mock(ExecutionEntity.class)
- wfex = null
- tp = new AbstractServiceTaskProcessor() {
- @Override
- public void preProcessRequest(DelegateExecution execution) {
- }
- };
- utils = new SDNCAdapterUtils(tp)
-
- // svcex gets its variables from "map"
- when(svcex.getVariable(any())).thenAnswer(
- { invocation ->
- return map.get(invocation.getArgumentAt(0, String.class)) })
-
- // svcex puts its variables into "map"
- when(svcex.setVariable(any(), any())).thenAnswer(
- { invocation ->
- return map.put(
- invocation.getArgumentAt(0, String.class),
- invocation.getArgumentAt(1, String.class)) })
-
- map.put("isDebugLogEnabled", "true")
- map.put("prefix", "mypfx-")
- map.put("testProcessKey", "mykey")
- }
-
- @Test
- public void testValidateSDNCResponse_Success_NoCode() {
- resp = """<no-response/>"""
-
- utils.validateSDNCResponse(svcex, resp, wfex, true)
-
- assertEquals(true, map.get("mypfx-sdncResponseSuccess"))
- assertEquals("0", map.get("mypfx-sdncRequestDataResponseCode"))
- assertFalse(map.containsKey("WorkflowException"))
- }
-
- @Test
- public void testValidateSDNCResponse_200() {
- utils.validateSDNCResponse(svcex, makeResp("200", "OK", ""), wfex, true)
-
- assertEquals(true, map.get("mypfx-sdncResponseSuccess"))
- assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode"))
- assertFalse(map.containsKey("WorkflowException"))
- }
-
- @Test
- public void testValidateSDNCResponse_408() {
- try {
- utils.validateSDNCResponse(svcex, makeResp("408", "failed", ""), wfex, true)
-
- // this has been commented out as, currently, the code doesn't
- // throw an exception in this case
-// fail("missing exception")
-
- } catch(BpmnError ex) {
- ex.printStackTrace()
- }
-
- assertEquals(false, map.get("mypfx-sdncResponseSuccess"))
- assertEquals("408", map.get("mypfx-sdncRequestDataResponseCode"))
-
- wfex = map.get("WorkflowException")
- assertNotNull(wfex)
-
- assertEquals(5320, wfex.getErrorCode())
- assertEquals("Received error from SDN-C: failed", wfex.getErrorMessage())
- }
-
- @Test
- public void testValidateSDNCResponse_408_200() {
-
- utils.validateSDNCResponse(svcex, makeResp("408", "failed", makeReq("200", "ok")), wfex, true)
-
- assertEquals(true, map.get("mypfx-sdncResponseSuccess"))
- assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode"))
- assertFalse(map.containsKey("WorkflowException"))
- }
-
- @Ignore // 1802 merge
- @Test
- public void testValidateSDNCResponse_408_200_WithEmbeddedLt() {
-
- utils.validateSDNCResponse(svcex, makeResp("408", "failed", makeReq("200", "<success> message")), wfex, true)
-
- assertEquals(true, map.get("mypfx-sdncResponseSuccess"))
- assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode"))
- assertFalse(map.containsKey("WorkflowException"))
- }
-
- @Test
- public void testUpdateHomingInfo() {
- String actual = utils.updateHomingInfo(null, "AIC3.0")
- println actual
- assertEquals("<l2-homing-information><aic-version>AIC3.0</aic-version></l2-homing-information>", actual)
- }
-
- @Test
- public void testUpdateHomingInfo2() {
- String homingInfo = "<l2-homing-information><preferred-aic-clli>TESTCLLI</preferred-aic-clli></l2-homing-information>"
- String actual = utils.updateHomingInfo(homingInfo, "AIC3.0")
- println actual
- assertEquals("<l2-homing-information><preferred-aic-clli>TESTCLLI</preferred-aic-clli><aic-version>AIC3.0</aic-version></l2-homing-information>", actual)
- }
-
- @Ignore // 1802 merge - testing method that doesn't exist
- @Test
- public void testUpdateServiceInfo() {
- String actual = utils.updateServiceInfo(null, "96688f6f-ab06-4ef6-ae55-9d3af28ae909")
- println actual
- assertEquals("<service-information><infra-service-instance-id>96688f6f-ab06-4ef6-ae55-9d3af28ae909</infra-service-instance-id></service-information>", actual)
- }
-
- @Ignore // 1802 merge - testing method that doesn't exist
- @Test
- public void testUpdateServiceInfo2() {
- String serviceInfo = "<service-information><service-type>SDN-ETHERNET-INTERNET</service-type><service-instance-id>MIS/1602/00029/SB_INTERNET</service-instance-id></service-information>"
- String actual = utils.updateServiceInfo(serviceInfo, "96688f6f-ab06-4ef6-ae55-9d3af28ae909")
- println actual
- assertEquals("<service-information><service-type>SDN-ETHERNET-INTERNET</service-type><service-instance-id>MIS/1602/00029/SB_INTERNET</service-instance-id><infra-service-instance-id>96688f6f-ab06-4ef6-ae55-9d3af28ae909</infra-service-instance-id></service-information>", actual)
- }
-
- private String makeResp(String respcode, String respmsg, String reqdata) {
- def rc = encodeXml(respcode)
- def rm = encodeXml(respmsg)
-
- return """
-<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <sdncadapterworkflow:response-data>
- <tag0:CallbackHeader>
- <tag0:RequestId>myreq</tag0:RequestId>
- <tag0:ResponseCode>${rc}</tag0:ResponseCode>
- <tag0:ResponseMessage>${rm}</tag0:ResponseMessage>
- </tag0:CallbackHeader>
- ${reqdata}
- </sdncadapterworkflow:response-data>
-</sdncadapterworkflow:SDNCAdapterWorkflowResponse>
-"""
-
- }
-
- private String makeReq(String respcode, String respmsg) {
- def rc = encodeXml(respcode)
- def rm = encodeXml(respmsg)
-
- def output = """
-<output xmlns="org:onap:sdnc:northbound:generic-resource">
- <svc-request-id>8b46e36e-b44f-4085-9404-427be1bc8a3</svc-request-id>
- <response-code>${rc}</response-code>
- <response-message>${rm}</response-message>
- <ack-final-indicator>Y</ack-final-indicator>
-</output>
-"""
- output = encodeXml(output)
-
- return """<tag0:RequestData xsi:type="xs:string">${output}</tag0:RequestData>"""
- }
-
- private String encodeXml(String txt) {
- return txt.replace("&", "&").replace("<", "<")
- }
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.junit.Before +import org.junit.Ignore +import org.junit.Test +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils + +import org.onap.so.bpmn.mock.FileUtil + +public class SDNCAdapterUtilsTest { + + private def map + private ExecutionEntity svcex + private WorkflowException wfex + private AbstractServiceTaskProcessor tp + private String resp + private SDNCAdapterUtils utils + + @Before + public void init() + { + map = new HashMap<String,Object>() + svcex = mock(ExecutionEntity.class) + wfex = null + tp = new AbstractServiceTaskProcessor() { + @Override + public void preProcessRequest(DelegateExecution execution) { + } + }; + utils = new SDNCAdapterUtils(tp) + + // svcex gets its variables from "map" + when(svcex.getVariable(any())).thenAnswer( + { invocation -> + return map.get(invocation.getArgumentAt(0, String.class)) }) + + // svcex puts its variables into "map" + when(svcex.setVariable(any(), any())).thenAnswer( + { invocation -> + return map.put( + invocation.getArgumentAt(0, String.class), + invocation.getArgumentAt(1, String.class)) }) + + map.put("isDebugLogEnabled", "true") + map.put("prefix", "mypfx-") + map.put("testProcessKey", "mykey") + } + + @Test + public void testValidateSDNCResponse_Success_NoCode() { + resp = """<no-response/>""" + + utils.validateSDNCResponse(svcex, resp, wfex, true) + + assertEquals(true, map.get("mypfx-sdncResponseSuccess")) + assertEquals("0", map.get("mypfx-sdncRequestDataResponseCode")) + assertFalse(map.containsKey("WorkflowException")) + } + + @Test + public void testValidateSDNCResponse_200() { + utils.validateSDNCResponse(svcex, makeResp("200", "OK", ""), wfex, true) + + assertEquals(true, map.get("mypfx-sdncResponseSuccess")) + assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode")) + assertFalse(map.containsKey("WorkflowException")) + } + + @Test + public void testValidateSDNCResponse_408() { + try { + utils.validateSDNCResponse(svcex, makeResp("408", "failed", ""), wfex, true) + + // this has been commented out as, currently, the code doesn't + // throw an exception in this case +// fail("missing exception") + + } catch(BpmnError ex) { + ex.printStackTrace() + } + + assertEquals(false, map.get("mypfx-sdncResponseSuccess")) + assertEquals("408", map.get("mypfx-sdncRequestDataResponseCode")) + + wfex = map.get("WorkflowException") + assertNotNull(wfex) + + assertEquals(5320, wfex.getErrorCode()) + assertEquals("Received error from SDN-C: failed", wfex.getErrorMessage()) + } + + @Test + public void testValidateSDNCResponse_408_200() { + + utils.validateSDNCResponse(svcex, makeResp("408", "failed", makeReq("200", "ok")), wfex, true) + + assertEquals(true , map.get("mypfx-sdncResponseSuccess")) + assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode")) + assertFalse(map.containsKey("WorkflowException")) + } + + @Test + public void testValidateSDNCResponse_408_200_WithEmbeddedLt() { + + utils.validateSDNCResponse(svcex, makeResp("408", "failed", makeReq("200", "<success> message")), wfex, true) + + assertEquals(true, map.get("mypfx-sdncResponseSuccess")) + assertEquals("200", map.get("mypfx-sdncRequestDataResponseCode")) + assertFalse(map.containsKey("WorkflowException")) + } + + @Test + public void testUpdateHomingInfo() { + String actual = utils.updateHomingInfo(null, "AIC3.0") + println actual + assertEquals("<l2-homing-information><aic-version>AIC3.0</aic-version></l2-homing-information>", actual) + } + + @Test + public void testUpdateHomingInfo2() { + String homingInfo = "<l2-homing-information><preferred-aic-clli>TESTCLLI</preferred-aic-clli></l2-homing-information>" + String actual = utils.updateHomingInfo(homingInfo, "AIC3.0") + println actual + assertEquals("<l2-homing-information><preferred-aic-clli>TESTCLLI</preferred-aic-clli><aic-version>AIC3.0</aic-version></l2-homing-information>", actual) + } + + private String makeResp(String respcode, String respmsg, String reqdata) { + def rc = respcode + def rm = respmsg + + return """ +<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" + xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <sdncadapterworkflow:response-data> + <tag0:CallbackHeader> + <tag0:RequestId>myreq</tag0:RequestId> + <tag0:ResponseCode>${MsoUtils.xmlEscape(rc)}</tag0:ResponseCode> + <tag0:ResponseMessage>${MsoUtils.xmlEscape(rm)}</tag0:ResponseMessage> + </tag0:CallbackHeader> + ${reqdata} + </sdncadapterworkflow:response-data> +</sdncadapterworkflow:SDNCAdapterWorkflowResponse> +""" + + } + + private String makeReq(String respcode, String respmsg) { + def rc = respcode + def rm = respmsg + + def output = """ +<output xmlns="org:onap:sdnc:northbound:generic-resource"> + <svc-request-id>8b46e36e-b44f-4085-9404-427be1bc8a3</svc-request-id> + <response-code>${MsoUtils.xmlEscape(rc)}</response-code> + <response-message>${MsoUtils.xmlEscape(rm)}</response-message> + <ack-final-indicator>Y</ack-final-indicator> +</output> +""" + output = output + + return """<tag0:RequestData xsi:type="xs:string">${MsoUtils.xmlEscape(output)}</tag0:RequestData>""" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy new file mode 100644 index 0000000000..b093aaa491 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy @@ -0,0 +1,196 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class SniroHomingV1Test { + String subsInfo = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}" + ServiceDecomposition serviceDecomp + + { + serviceDecomp = new ServiceDecomposition("{\"serviceResources\":{}}", "123") + ModelInfo modelInfo = new ModelInfo() + serviceDecomp.modelInfo = modelInfo + + AllottedResource allottedResource = new AllottedResource() + allottedResource.setModelInfo(modelInfo) + List allottedResourceList = new ArrayList() + allottedResourceList.add(allottedResource) + + VnfResource vnfResource = new VnfResource() + vnfResource.setModelInfo(modelInfo) + List vnfResourceList = new ArrayList() + vnfResourceList.add(vnfResource) + + serviceDecomp.serviceAllottedResources = allottedResourceList + serviceDecomp.setVnfResources(vnfResourceList) + } + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testCallSniro() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("subscriberInfo")).thenReturn(subsInfo) + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomp) + when(mockExecution.getVariable("mso.sniro.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("mso.adapters.workflow.message.endpoint")).thenReturn('http://localhost:18080/workflows/messages/message/') + when(mockExecution.getVariable("mso.service.agnostic.sniro.endpoint")).thenReturn("/sniro") + when(mockExecution.getVariable("mso.service.agnostic.sniro.host")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.GenericPutVnf.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + + SniroHomingV1 obj = new SniroHomingV1() + obj.callSniro(mockExecution) + + Mockito.verify(mockExecution, times(10)).setVariable(captor.capture(), captor.capture()) + Assert.assertEquals(200, captor.getAllValues().get(17)) + + } + + @Test + public void testCallSniroMissingAuth() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("subscriberInfo")).thenReturn(subsInfo) + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomp) + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("mso.adapters.workflow.message.endpoint")).thenReturn('http://localhost:18080/workflows/messages/message/') + when(mockExecution.getVariable("mso.service.agnostic.sniro.endpoint")).thenReturn("/sniro") + when(mockExecution.getVariable("mso.service.agnostic.sniro.host")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.GenericPutVnf.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + + try { + SniroHomingV1 obj = new SniroHomingV1() + obj.callSniro(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + Mockito.verify(mockExecution, times(4)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(401, workflowException.getErrorCode()) + Assert.assertEquals("Internal Error - BasicAuth value null", workflowException.getErrorMessage()) + } + + @Test + public void testCallSniroHostNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("subscriberInfo")).thenReturn(subsInfo) + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomp) + when(mockExecution.getVariable("mso.sniro.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("mso.adapters.workflow.message.endpoint")).thenReturn('http://localhost:18080/workflows/messages/message/') + when(mockExecution.getVariable("mso.service.agnostic.sniro.endpoint")).thenReturn("/sniro") + when(mockExecution.getVariable("mso.service.agnostic.sniro.host")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.GenericPutVnf.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + + mockData() + try { + SniroHomingV1 obj = new SniroHomingV1() + obj.callSniro(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getValue() + Assert.assertEquals(2500, workflowException.getErrorCode()) + Assert.assertEquals("Internal Error - Occured in Homing CallSniro: org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("Homing") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("Homing") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("Homing") + when(mockExecution.getProcessInstanceId()).thenReturn("Homing") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + private static void mockData() { + stubFor(post(urlMatching(".*/sniro")) + .willReturn(aResponse() + .withStatus(200) + .withBody(""))) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy index 203f11a42e..52f59a3fad 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy @@ -1,201 +1,201 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.scripts
-
-import org.junit.Assert
-import org.junit.Ignore
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-
-
-
-import static org.mockito.Mockito.*
-
-import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.junit.Before
-import org.junit.runner.RunWith
-import org.mockito.MockitoAnnotations
-import org.mockito.internal.debugging.MockitoDebuggerImpl
-import org.mockito.runners.MockitoJUnitRunner
-import org.openecomp.mso.bpmn.common.scripts.TrinityExceptionUtil;
-@RunWith(MockitoJUnitRunner.class)
-import org.junit.Test
-
-class TrinityExceptionUtilTest {
-
- def aotsFault ="""<n1:Fault xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n1="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/SoapFault.xsd" xmlns:cer="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/ErrorResponse.xsd" xsi:schemaLocation="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/SoapFault.xsd SoapFault-CDM.xsd">
- <n1:faultcode>xml:space</n1:faultcode>
- <n1:faultstring>String</n1:faultstring>
- <n1:faultactor>http://test.com</n1:faultactor>
- <n1:detail>
- <n1:CSIApplicationException>
- <cer:Response>
- <cer:code>400</cer:code>
- <cer:description>bad stuff</cer:description>
- </cer:Response>
- <cer:ServiceProviderEntity>
- <cer:reportingServiceEntity>String</cer:reportingServiceEntity>
- <cer:faultDate>*** ERROR ***</cer:faultDate>
- <cer:faultSequenceNumber>String</cer:faultSequenceNumber>
- <cer:faultLevel>String</cer:faultLevel>
- <cer:faultCode>String</cer:faultCode>
- <cer:faultDescription>String</cer:faultDescription>
- <cer:ServiceProviderRawError>
- <cer:code>String</cer:code>
- <cer:description>String</cer:description>
- <cer:BISError>
- <cer:code>String</cer:code>
- <cer:description>String</cer:description>
- <cer:origination>String</cer:origination>
- <cer:severity>String</cer:severity>
- </cer:BISError>
- </cer:ServiceProviderRawError>
- </cer:ServiceProviderEntity>
- </n1:CSIApplicationException>
- <n1:CSIInternalException>
- <cer:reportingServiceEntity>String</cer:reportingServiceEntity>
- <cer:faultDate>*** ERROR ***</cer:faultDate>
- <cer:faultSequenceNumber>String</cer:faultSequenceNumber>
- <cer:faultLevel>String</cer:faultLevel>
- <cer:faultCode>String</cer:faultCode>
- <cer:faultDescription>String</cer:faultDescription>
- <cer:cingularErrorCode>String</cer:cingularErrorCode>
- <cer:cingularErrorDescription>String</cer:cingularErrorDescription>
- <cer:cingularErrorCategory>String</cer:cingularErrorCategory>
- </n1:CSIInternalException>
- </n1:detail>
-</n1:Fault>"""
-
-
- @Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- }
-
- @Test
- @Ignore
- public void testMapAAIExceptionTCommonException() {
-
-
-
- String restFault = """
- <Fault>
-<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>
-</Fault>
- """
- def errorString = """<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>""" as String
-
-
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-
- TrinityExceptionUtil util = new TrinityExceptionUtil()
- Assert.assertEquals(errorString, util.mapAAIExceptionTCommonException(restFault, mockExecution))
- }
-
-
-
-
- @Test
- public void testBuildException() {
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("prefix")).thenReturn("test_")
- when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400")
- ArrayList msgVars = new ArrayList()
- msgVars.add("var1")
- msgVars.add("var2")
- when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars)
-
-
- TrinityExceptionUtil util = new TrinityExceptionUtil()
- String msg = "Bad request"
- String errorString = """<tns:requestError xmlns:tns="http://org.openecomp/mso/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.openecomp/mso/request/types/v1 MsoServiceInstanceTypesV1.xsd">
- <tns:serviceException>
- <tns:messageId>SVC2000</tns:messageId>
- <tns:text>The following service error occurred: %1. Error code is %2.</tns:text>
- <tns:variables>var1</tns:variables>
- <tns:variables>var2</tns:variables>
- </tns:serviceException>
-</tns:requestError>"""
- Assert.assertEquals(errorString, util.buildException(msg, mockExecution))
- }
-
- @Test
- public void testMapAOTSExecptionToCommonException() {
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getVariable("prefix")).thenReturn("test_")
- when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400")
-
- TrinityExceptionUtil util = new TrinityExceptionUtil()
- String errorString = """<tns:requestError xmlns:tns="http://org.openecomp/mso/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.openecomp/mso/request/types/v1 MsoServiceInstanceTypesV1.xsd">
- <tns:serviceException>
- <tns:messageId>SVC2000</tns:messageId>
- <tns:text>The following service error occurred: %1. Error code is %2.</tns:text>
- <tns:variables>Received error from AOTS: bad stuff</tns:variables>
- <tns:variables>400</tns:variables>
- </tns:serviceException>
-</tns:requestError>"""
- Assert.assertEquals(errorString, util.mapAOTSExecptionToCommonException(aotsFault, mockExecution))
- }
-
-
- @Test
- public void testParseError() {
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- String errorString = "The following service error occurred: %1. Error code is %2."
- ArrayList msgVars = new ArrayList()
- msgVars.add("var1")
- msgVars.add("var2")
- when(mockExecution.getVariable("prefix")).thenReturn("test_")
- when(mockExecution.getVariable("test_errTxt")).thenReturn(errorString)
- when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars)
-
- TrinityExceptionUtil util = new TrinityExceptionUtil()
-
- Assert.assertEquals("The following service error occurred: var1. Error code is var2.", util.parseError(mockExecution))
-}
-
-
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.junit.Assert +import org.junit.Ignore +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + + + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.common.scripts.TrinityExceptionUtil; +@RunWith(MockitoJUnitRunner.class) +import org.junit.Test + +class TrinityExceptionUtilTest { + + def aotsFault ="""<n1:Fault xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n1="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/SoapFault.xsd" xmlns:cer="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/ErrorResponse.xsd" xsi:schemaLocation="http://csi.cingular.com/CSI/Namespaces/OneTicketingSystem/InfrastructureCommon/Types/Public/SoapFault.xsd SoapFault-CDM.xsd"> + <n1:faultcode>xml:space</n1:faultcode> + <n1:faultstring>String</n1:faultstring> + <n1:faultactor>http://test.com</n1:faultactor> + <n1:detail> + <n1:CSIApplicationException> + <cer:Response> + <cer:code>400</cer:code> + <cer:description>bad stuff</cer:description> + </cer:Response> + <cer:ServiceProviderEntity> + <cer:reportingServiceEntity>String</cer:reportingServiceEntity> + <cer:faultDate>*** ERROR ***</cer:faultDate> + <cer:faultSequenceNumber>String</cer:faultSequenceNumber> + <cer:faultLevel>String</cer:faultLevel> + <cer:faultCode>String</cer:faultCode> + <cer:faultDescription>String</cer:faultDescription> + <cer:ServiceProviderRawError> + <cer:code>String</cer:code> + <cer:description>String</cer:description> + <cer:BISError> + <cer:code>String</cer:code> + <cer:description>String</cer:description> + <cer:origination>String</cer:origination> + <cer:severity>String</cer:severity> + </cer:BISError> + </cer:ServiceProviderRawError> + </cer:ServiceProviderEntity> + </n1:CSIApplicationException> + <n1:CSIInternalException> + <cer:reportingServiceEntity>String</cer:reportingServiceEntity> + <cer:faultDate>*** ERROR ***</cer:faultDate> + <cer:faultSequenceNumber>String</cer:faultSequenceNumber> + <cer:faultLevel>String</cer:faultLevel> + <cer:faultCode>String</cer:faultCode> + <cer:faultDescription>String</cer:faultDescription> + <cer:cingularErrorCode>String</cer:cingularErrorCode> + <cer:cingularErrorDescription>String</cer:cingularErrorDescription> + <cer:cingularErrorCategory>String</cer:cingularErrorCategory> + </n1:CSIInternalException> + </n1:detail> +</n1:Fault>""" + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + @Ignore + public void testMapAAIExceptionTCommonException() { + + + + String restFault = """ + <Fault> +<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> +</Fault> + """ + def errorString = """<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>""" as String + + + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + TrinityExceptionUtil util = new TrinityExceptionUtil() + Assert.assertEquals(errorString, util.mapAAIExceptionTCommonException(restFault, mockExecution)) + } + + + + + @Test + public void testBuildException() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400") + ArrayList msgVars = new ArrayList() + msgVars.add("var1") + msgVars.add("var2") + when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars) + + + TrinityExceptionUtil util = new TrinityExceptionUtil() + String msg = "Bad request" + String errorString = """<tns:requestError xmlns:tns="http://org.onap/so/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.onap/so/request/types/v1 MsoServiceInstanceTypesV1.xsd"> + <tns:serviceException> + <tns:messageId>SVC2000</tns:messageId> + <tns:text>The following service error occurred: %1. Error code is %2.</tns:text> + <tns:variables>var1</tns:variables> + <tns:variables>var2</tns:variables> + </tns:serviceException> +</tns:requestError>""" + Assert.assertEquals(errorString, util.buildException(msg, mockExecution)) + } + + @Test + public void testMapAOTSExecptionToCommonException() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400") + + TrinityExceptionUtil util = new TrinityExceptionUtil() + String errorString = """<tns:requestError xmlns:tns="http://org.onap/so/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.onap/so/request/types/v1 MsoServiceInstanceTypesV1.xsd"> + <tns:serviceException> + <tns:messageId>SVC2000</tns:messageId> + <tns:text>The following service error occurred: %1. Error code is %2.</tns:text> + <tns:variables>Received error from AOTS: bad stuff</tns:variables> + <tns:variables>400</tns:variables> + </tns:serviceException> +</tns:requestError>""" + Assert.assertEquals(errorString, util.mapAOTSExecptionToCommonException(aotsFault, mockExecution)) + } + + + @Test + public void testParseError() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + String errorString = "The following service error occurred: %1. Error code is %2." + ArrayList msgVars = new ArrayList() + msgVars.add("var1") + msgVars.add("var2") + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_errTxt")).thenReturn(errorString) + when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars) + + TrinityExceptionUtil util = new TrinityExceptionUtil() + + Assert.assertEquals("The following service error occurred: var1. Error code is var2.", util.parseError(mockExecution)) +} + + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy new file mode 100644 index 0000000000..e0166f3602 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy @@ -0,0 +1,172 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.mock.StubResponseAAI + +import static com.github.tomakehurst.wiremock.client.WireMock.* +import static org.mockito.Matchers.any +import static org.mockito.Matchers.refEq +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class UpdateAAIGenericVnfTest { + + String getVfModuleResponse = FileUtil.readResourceFile("__files/VfModularity/GenericVnf.xml") + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testGetGenericVnf() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + UpdateAAIGenericVnf obj = new UpdateAAIGenericVnf() + obj.getGenericVnf(mockExecution) + + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_getGenericVnfResponseCode", 200) + } + + @Test + void testGetGenericVnfEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + try { + UpdateAAIGenericVnf obj = new UpdateAAIGenericVnf() + obj.getGenericVnf(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + WorkflowException exception = new WorkflowException("UpdateAAIGenericVnf", 9999, "org.apache.http.client.ClientProtocolException") + Mockito.verify(mockExecution).setVariable("WorkflowException", refEq(exception, any(WorkflowException.class))) + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_getGenericVnfResponseCode", 500) + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_getGenericVnfResponse", "AAI GET Failed:null") + } + + @Test + void testUpdateGenericVnf() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("UAAIGenVnf_getGenericVnfResponse")).thenReturn(getVfModuleResponse) + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') + + stubFor(patch(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .willReturn(aResponse() + .withStatus(200))) + UpdateAAIGenericVnf obj = new UpdateAAIGenericVnf() + obj.updateGenericVnf(mockExecution) + + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_updateGenericVnfResponseCode", 200) + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_updateGenericVnfResponse", "") + } + + @Test + void testUpdateGenericVnfEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") + when(mockExecution.getVariable("UAAIGenVnf_getGenericVnfResponse")).thenReturn(getVfModuleResponse) + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') + + stubFor(patch(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .willReturn(aResponse() + .withStatus(200))) + + try { + UpdateAAIGenericVnf obj = new UpdateAAIGenericVnf() + obj.updateGenericVnf(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + WorkflowException exception = new WorkflowException("UpdateAAIGenericVnf", 9999, "org.apache.http.client.ClientProtocolException") + Mockito.verify(mockExecution).setVariable("WorkflowException", refEq(exception, any(WorkflowException.class))) + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_updateGenericVnfResponseCode", 500) + Mockito.verify(mockExecution).setVariable("UAAIGenVnf_updateGenericVnfResponse", "AAI PATCH Failed:null") + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("UpdateAAIGenericVnf") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("UpdateAAIGenericVnf") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("UpdateAAIGenericVnf") + when(mockExecution.getProcessInstanceId()).thenReturn("UpdateAAIGenericVnf") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy new file mode 100644 index 0000000000..d2f9095e2d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy @@ -0,0 +1,175 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.bpmn.mock.StubResponseAAI + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +@Ignore +class UpdateAAIVfModuleTest { + def prefix = "UAAIVfMod_" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testGetVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + UpdateAAIVfModule obj = new UpdateAAIVfModule() + obj.getVfModule(mockExecution) + + verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 200) + } + + @Test + void testGetVfModuleEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') + + StubResponseAAI.MockAAIVfModule() + try { + UpdateAAIVfModule obj = new UpdateAAIVfModule() + obj.getVfModule(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getAllValues().get(1) + Assert.assertEquals(9999, workflowException.getErrorCode()) + Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + @Test + void testUpdateVfModule() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') + + String getVfModuleResponse = FileUtil.readResourceFile("__files/VfModularity/GenericVnf.xml") + when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(getVfModuleResponse) + StubResponseAAI.MockAAIVfModule() + UpdateAAIVfModule obj = new UpdateAAIVfModule() + obj.updateVfModule(mockExecution) + + verify(mockExecution).setVariable(prefix + "updateVfModuleResponseCode", 200) + } + + @Test + void testUpdateVfModuleEndpointNull() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") + when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') + + String getVfModuleResponse = FileUtil.readResourceFile("__files/VfModularity/GenericVnf.xml") + when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(getVfModuleResponse) + StubResponseAAI.MockAAIVfModule() + try { + UpdateAAIVfModule obj = new UpdateAAIVfModule() + obj.updateVfModule(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + WorkflowException workflowException = captor.getAllValues().get(1) + Assert.assertEquals(9999, workflowException.getErrorCode()) + Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("UpdateAAIVfModule") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("UpdateAAIVfModule") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("UpdateAAIVfModule") + when(mockExecution.getProcessInstanceId()).thenReturn("UpdateAAIVfModule") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy index ffdaf0653d..1ab049571a 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy @@ -18,12 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts; import static org.mockito.Mockito.* -import org.openecomp.mso.bpmn.common.scripts.VidUtils; -import org.openecomp.mso.bpmn.core.WorkflowException +import org.onap.so.bpmn.common.scripts.VidUtils; +import org.onap.so.bpmn.core.WorkflowException import groovy.json.JsonSlurper @@ -743,7 +743,6 @@ def vidUtilVfModuleRespBackoutOnFailureFalse = """<vnf-request> <request-id>test-request-id-123</request-id> <action>CREATE_VF_MODULE</action> <source>VID</source> - <!-- new 1610 field --> <service-instance-id>test-service-instance-id-123</service-instance-id> </request-info> <vnf-inputs><!-- not in use in 1610 --> @@ -773,7 +772,6 @@ def vidUtilVfModuleRespBackoutOnFailureTrue = """<vnf-request> <request-id>test-request-id-123</request-id> <action>CREATE_VF_MODULE</action> <source>VID</source> - <!-- new 1610 field --> <service-instance-id>test-service-instance-id-123</service-instance-id> </request-info> <vnf-inputs><!-- not in use in 1610 --> @@ -803,7 +801,6 @@ def vidUtilVfModuleRespBackoutOnFailureEmpty = """<vnf-request> <request-id>test-request-id-123</request-id> <action>CREATE_VF_MODULE</action> <source>VID</source> - <!-- new 1610 field --> <service-instance-id>test-service-instance-id-123</service-instance-id> </request-info> <vnf-inputs><!-- not in use in 1610 --> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy new file mode 100644 index 0000000000..22c8e297ca --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy @@ -0,0 +1,118 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.mock.FileUtil + +import static org.mockito.Mockito.* +import static org.junit.Assert.*; + +@RunWith(MockitoJUnitRunner.class) +public class VnfAdapterRestV1Test { + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + + @Test + public void testPreProcessRequest() { + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfadapter_request.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("VNFREST_") + when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") + when(mockExecution.getVariable("VNFREST_Request")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.adapters.vnf.rest.endpoint")).thenReturn("http://localhost:18080/vnfs/rest/v1/vnfs") + + when(mockExecution.getVariable("mso.adapters.sdnc.timeout")).thenReturn("PT5M") + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + + VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() + vnfAdapterRestV1.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","VNFREST_") + + verify(mockExecution).setVariable("VNFREST_SuccessIndicator",false) + verify(mockExecution).setVariable("VNFREST_requestType","createVfModuleRequest") + verify(mockExecution).setVariable("VNFAResponse_CORRELATOR","8892cffa-3514-45d4-b2b0-0fde9a96e323-1511813289000") + verify(mockExecution).setVariable("VNFREST_vnfAdapterMethod","POST") + verify(mockExecution).setVariable("VNFREST_notificationUrl","http://localhost:18080/mso/WorkflowMessage/VNFAResponse/8892cffa-3514-45d4-b2b0-0fde9a96e323-1511813289000") + verify(mockExecution).setVariable("VNFREST_vnfAdapterUrl","http://localhost:18080/vnfs/rest/v1/vnfs/6d2e2469-8708-47c3-a0d4-73fa28a8a50b/vf-modules") + + } + + def rollbackReq = """ +<rollbackVolumeGroupRequest> + <volumeGroupRollback> + <volumeGroupId>8a07b246-155e-4b08-b56e-76e98a3c2d66</volumeGroupId> + <volumeGroupStackId>phmaz401me6-vpevre-VOLUMEGROUP/dbd560b6-b03f-4a17-92e7-8942459a60c1</volumeGroupStackId> + <cloudSiteId>mtrnj1b</cloudSiteId> + <tenantId>cfb5e0a790374c9a98a1c0d2044206a7</tenantId> + <volumeGroupCreated>true</volumeGroupCreated> + <msoRequest> + <requestId>1e1a72ca-7300-4ac4-b718-30351f3b6845</requestId> + <serviceInstanceId>15eb2c68-f771-4030-b185-cff179fdad44</serviceInstanceId> + </msoRequest> + <messageId>683ca1ac-2145-4a00-9484-20d48bd701aa</messageId> + </volumeGroupRollback> + <skipAAI>true</skipAAI> + <notificationUrl>http://localhost:8080/mso/WorkflowMessage/VNFAResponse/683ca1ac-2145-4a00-9484-20d48bd701aa</notificationUrl> +</rollbackVolumeGroupRequest> +""" + + @Test + public void testGetVolumeGroupId() { + Node root = new XmlParser().parseText(rollbackReq) + VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() + def volGrpId = vnfAdapterRestV1.getVolumeGroupIdFromRollbackRequest(root) + assertEquals('8a07b246-155e-4b08-b56e-76e98a3c2d66', volGrpId) + } + + + @Test + public void testGetMessageId() { + Node root = new XmlParser().parseText(rollbackReq) + + VnfAdapterRestV1 p = new VnfAdapterRestV1() + def messageId = p.getMessageIdForVolumeGroupRollback(root) + assertEquals('683ca1ac-2145-4a00-9484-20d48bd701aa', messageId) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/IgnoreNamedElementsDifferenceListener.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/IgnoreNamedElementsDifferenceListener.groovy new file mode 100644 index 0000000000..9c38634885 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/IgnoreNamedElementsDifferenceListener.groovy @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.scripts.utils + +import org.custommonkey.xmlunit.Difference +import org.custommonkey.xmlunit.DifferenceConstants +import org.custommonkey.xmlunit.DifferenceListener +import org.w3c.dom.Node + +class IgnoreNamedElementsDifferenceListener implements DifferenceListener { + private Set<String> blackList = new HashSet<String>(); + + public IgnoreNamedElementsDifferenceListener(String ... ignoreTags) { + for (String name : ignoreTags) { + blackList.add(name); + } + } + + public int differenceFound(Difference difference) { + if (difference.getId() == DifferenceConstants.TEXT_VALUE_ID) { + if (blackList.contains(difference.getControlNodeDetail().getNode().getParentNode().getNodeName())) { + return DifferenceListener.RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL; + } + } + + return DifferenceListener.RETURN_ACCEPT_DIFFERENCE; + } + + + public void skippedComparison(Node node, Node node1) { + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/CommonObjectMapperProviderTest.java b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/XmlComparator.groovy index e1b1770180..e1c86edd90 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/CommonObjectMapperProviderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/XmlComparator.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,27 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.policy; +package org.onap.so.bpmn.common.scripts.utils -import static org.assertj.core.api.Assertions.assertThat; +import org.custommonkey.xmlunit.DetailedDiff +import org.custommonkey.xmlunit.XMLUnit +import org.junit.Assert -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import org.junit.Test; -public class CommonObjectMapperProviderTest { +class XmlComparator { - @Test - public void shouldSetCorrectMapperProperties() throws Exception { - // given - CommonObjectMapperProvider provider = new CommonObjectMapperProvider(); - // when - ObjectMapper context = provider.getContext(Object.class); - // then - assertThat(context.isEnabled(MapperFeature.USE_ANNOTATIONS)).isTrue(); - assertThat(context.isEnabled(SerializationFeature.WRAP_ROOT_VALUE)).isFalse(); - assertThat(context.isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE)).isFalse(); + public static void assertXMLEquals(String expectedXML, String actualXML, String ... ignoreTags ) throws Exception { + XMLUnit.setIgnoreWhitespace(true); + XMLUnit.setIgnoreAttributeOrder(true); + + DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expectedXML, actualXML)); + + diff.overrideDifferenceListener(new IgnoreNamedElementsDifferenceListener(ignoreTags)); + + List<?> allDifferences = diff.getAllDifferences(); + Assert.assertEquals("Differences found: "+ diff.toString(), 0, allDifferences.size()); } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy deleted file mode 100644 index b4b2b951b2..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy +++ /dev/null @@ -1,385 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.scripts;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*
-
-import org.openecomp.mso.rest.HttpHeader
-import org.mockito.MockitoAnnotations
-import org.mockito.runners.MockitoJUnitRunner
-import org.mockito.internal.debugging.MockitoDebuggerImpl
-import org.junit.Before
-import org.openecomp.mso.bpmn.common.scripts.AaiUtil;
-import org.junit.Rule;
-import org.junit.Test
-import org.junit.Ignore
-import org.junit.runner.RunWith
-import org.junit.Before;
-import org.junit.Test;
-import org.camunda.bpm.engine.ProcessEngineServices
-import org.camunda.bpm.engine.RepositoryService
-import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl
-import org.camunda.bpm.engine.repository.ProcessDefinition
-
-@RunWith(MockitoJUnitRunner.class)
-class AaiUtilTest extends MsoGroovyTest {
-
- @Test
- public void testGetVersionDefault() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule')
- assertEquals('8', version)
- }
-
- @Test
- public void testGetVersionResourceSpecific() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule')
- assertEquals('7', version)
- }
-
- @Test
- public void testGetVersionFlowSpecific() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_custom_CreateAAIVfModule_aai_version")).thenReturn('6')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule')
- assertEquals('6', version)
- }
-
- @Test(expected=java.lang.Exception.class)
- public void testGetVersionNotDefined() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule')
- }
-
- @Test
- public void testGetUriDefaultVersion() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getUri(mockExecution, 'l3-network')
- assertEquals('/aai/v8/network/l3-networks/l3-network', uri)
- }
-
- @Test
- public void testGetUriFlowAndResourceSpecific() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_CreateAAIVfModule_aai_l3_network_uri")).thenReturn('/aai/v6/network/l3-networks/l3-network')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getUri(mockExecution, 'l3-network')
- assertEquals('/aai/v6/network/l3-networks/l3-network', uri)
- }
-
- @Test
- public void testGetNetworkGenericVnfEndpoint() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf')
- when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def endpoint = aaiUtil.getNetworkGenericVnfEndpoint(mockExecution)
- assertEquals('http://localhost:28090/aai/v8/network/generic-vnfs/generic-vnf', endpoint)
- }
-
- @Test
- public void testGetNetworkGenericVnfUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getNetworkGenericVnfUri(mockExecution)
- assertEquals('/aai/v8/network/generic-vnfs/generic-vnf', uri)
- }
-
- @Test
- public void testGetNetworkVpnBindingUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn('/aai/v8/network/vpn-bindings/vpn-binding')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getNetworkVpnBindingUri(mockExecution)
- assertEquals('/aai/v8/network/vpn-bindings/vpn-binding', uri)
- }
-
- @Test
- public void testGetNetworkPolicyUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_network_policy_uri")).thenReturn('/aai/v8/network/network-policies/network-policy')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getNetworkPolicyUri(mockExecution)
- assertEquals('/aai/v8/network/network-policies/network-policy', uri)
- }
-
- @Test
- public void testGetNetworkTableReferencesUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_route_table_reference_uri")).thenReturn('/aai/v8/network/route-table-references/route-table-reference')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getNetworkTableReferencesUri(mockExecution)
- assertEquals('/aai/v8/network/route-table-references/route-table-reference', uri)
- }
-
- @Test
- public void testGetNetworkVceUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vce_uri")).thenReturn('/aai/v8/network/vces/vce')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getNetworkVceUri(mockExecution)
- assertEquals('/aai/v8/network/vces/vce', uri)
- }
-
- @Test
- public void testGetNetworkL3NetworkUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution)
- assertEquals('/aai/v8/network/l3-networks/l3-network', uri)
- }
-
- @Test
- public void testGetBusinessCustomerUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_customer_uri")).thenReturn('/aai/v8/business/customers/customer')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getBusinessCustomerUri(mockExecution)
- assertEquals('/aai/v8/business/customers/customer', uri)
- }
-
- @Test
- public void testGetCloudInfrastructureCloudRegionEndpoint() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic')
- when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(mockExecution)
- assertEquals('http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri)
- }
-
- @Test
- public void testGetCloudInfrastructureCloudRegionUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getCloudInfrastructureCloudRegionUri(mockExecution)
- assertEquals('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri)
- }
-
- @Test
- public void testGetCloudInfrastructureTenantUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_tenant_uri")).thenReturn('/aai/v8/cloud-infrastructure/tenants/tenant')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getCloudInfrastructureTenantUri(mockExecution)
- assertEquals('/aai/v8/cloud-infrastructure/tenants/tenant', uri)
- }
-
- @Test
- public void testGetSearchNodesQueryUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query')
- when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getSearchNodesQueryUri(mockExecution)
- assertEquals('/aai/v8/search/nodes-query', uri)
- }
-
- @Test
- public void testGetSearchNodesQueryEndpoint() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query')
- when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getSearchNodesQueryEndpoint(mockExecution)
- assertEquals('http://localhost:28090/aai/v8/search/nodes-query', uri)
- }
-
- @Test
- public void testGetSearchGenericQueryUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_query_uri")).thenReturn('/aai/v8/search/generic-query')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getSearchGenericQueryUri(mockExecution)
- assertEquals('/aai/v8/search/generic-query', uri)
- }
-
- @Test
- public void testGetNamespaceFromUri() {
- ExecutionEntity mockExecution = setupMock('CreateAAIVfModule')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('6')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v6_l3_network_uri")).thenReturn('/aai/v6/network/l3-networks/l3-network')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class
- def ns = aaiUtil.getNamespaceFromUri('/aai/v6/search/generic-query')
- assertEquals('http://org.openecomp.aai.inventory/v6', ns)
- }
-
- @Test
- public void testGetNamespaceFromUri2() {
- ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1')
- //
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('10')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v10_l3_network_uri")).thenReturn('/aai/v10/network/l3-networks/l3-network')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
- //
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class
- def ns = aaiUtil.getNamespaceFromUri('/aai/v10/search/generic-query')
- assertEquals('http://org.openecomp.aai.inventory/v10', ns)
- }
-
- @Test
- public void testGetNamespaceFromUri3() {
- ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1')
- //
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('100')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v100_l3_network_uri")).thenReturn('/aai/v100/network/l3-networks/l3-network')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
- //
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class
- def ns = aaiUtil.getNamespaceFromUri('/aai/v100/search/generic-query')
- assertEquals('http://org.openecomp.aai.inventory/v100', ns)
- }
-
- @Test
- public void testGetNamespaceFromUri_twoArguments() { // (execution, uri)
- ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1')
- //
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('10')
- when(mockExecution.getVariable("URN_mso_workflow_default_aai_v10_l3_network_uri")).thenReturn('/aai/v10/network/l3-networks/l3-network')
- when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn('http://org.openecomp.aai.inventory/')
- //
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true')
- CreateAAIVfModule myproc = new CreateAAIVfModule()
- AaiUtil aaiUtil = new AaiUtil(myproc)
- def ns = aaiUtil.getNamespaceFromUri(mockExecution,'/aai/v10/search/generic-query')
- assertEquals('http://org.openecomp.aai.inventory/v10', ns)
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1Test.groovy deleted file mode 100644 index b37676a044..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1Test.groovy +++ /dev/null @@ -1,44 +0,0 @@ -package org.openecomp.mso.bpmn.common.scripts - -import org.junit.Test -import static org.junit.Assert.*; - -class VnfAdapterRestV1Test { - - - def rollbackReq = """ -<rollbackVolumeGroupRequest> - <volumeGroupRollback> - <volumeGroupId>8a07b246-155e-4b08-b56e-76e98a3c2d66</volumeGroupId> - <volumeGroupStackId>phmaz401me6-vpevre-VOLUMEGROUP/dbd560b6-b03f-4a17-92e7-8942459a60c1</volumeGroupStackId> - <cloudSiteId>mtrnj1b</cloudSiteId> - <tenantId>cfb5e0a790374c9a98a1c0d2044206a7</tenantId> - <volumeGroupCreated>true</volumeGroupCreated> - <msoRequest> - <requestId>1e1a72ca-7300-4ac4-b718-30351f3b6845</requestId> - <serviceInstanceId>15eb2c68-f771-4030-b185-cff179fdad44</serviceInstanceId> - </msoRequest> - <messageId>683ca1ac-2145-4a00-9484-20d48bd701aa</messageId> - </volumeGroupRollback> - <skipAAI>true</skipAAI> - <notificationUrl>http://msobpel-app-e2e.ecomp.cci.att.com:8080/mso/WorkflowMessage/VNFAResponse/683ca1ac-2145-4a00-9484-20d48bd701aa</notificationUrl> -</rollbackVolumeGroupRequest> -""" - - @Test - public void testGetNodeText() { - Node root = new XmlParser().parseText(rollbackReq) - def volGrpId = root.'volumeGroupRollback'.'volumeGroupId'.text() - assertEquals('8a07b246-155e-4b08-b56e-76e98a3c2d66', volGrpId) - } - - @Test - public void testGetMessageId() { - Node root = new XmlParser().parseText(rollbackReq) - //def messageId = root.'volumeGroupRollback'.'messageId'.text() - - VnfAdapterRestV1 p = new VnfAdapterRestV1() - def messageId = p.getMessageIdForVolumeGroupRollback(root) - assertEquals('683ca1ac-2145-4a00-9484-20d48bd701aa', messageId) - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java new file mode 100644 index 0000000000..cd9bdc9532 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllBaseTaskTestSuite.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; + +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/common/aai/tasks/*Test.class", "**/bpmn/sdno/tasks/*Test.class", "**/buildingblock/SniroHomingV2Test.class"}) +public class AllBaseTaskTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/RequestsDbAdapterClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllGroovyTestSuites.java index 2c35151895..696323c4ad 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/RequestsDbAdapterClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllGroovyTestSuites.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,33 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.adapter.requests.db;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class RequestsDbAdapterClientTest {
-
- @BeforeClass
- public static void setUp() {
- System.setProperty("mso.config.path", "src/test/resources");
- }
-
- @Test
- public void updateInfraRequestTest()
- {
-
- }
-
- @Test
- public void getInfraRequestTest()
- {
-
- }
-
- @Test
- public void getSiteStatusTest()
- {
-
- }
-}
+package org.onap.so; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/bpmn/common/scripts/**/*Test.class"}) +public class AllGroovyTestSuites { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllTestSuites.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllTestSuites.java new file mode 100644 index 0000000000..fa70ccf23d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/AllTestSuites.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses({"**/*Test.class", "!**/bpmn/common/scripts/**/*Test.class"}) +public class AllTestSuites { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java new file mode 100644 index 0000000000..d2f1186ad0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java @@ -0,0 +1,163 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.junit.Before; +import org.junit.runner.RunWith; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.MockLoggerDelegate; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupMapperLayer; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; +import org.springframework.http.HttpHeaders; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.client.WireMock; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +@ContextConfiguration +@AutoConfigureWireMock(port = 0) +public abstract class BaseTest extends BuildingBlockTestDataSetup { + + + protected Map<String, Object> variables = new HashMap<>(); + + protected TestRestTemplate restTemplate = new TestRestTemplate(); + + protected HttpHeaders headers = new HttpHeaders(); + + + @Autowired + protected RuntimeService runtimeService; + + @Autowired + private RepositoryService repositoryService; + /* + * Mocked for injection via autowiring + */ + + @Value("${mso.catalog.db.spring.endpoint}") + protected String endpoint; + + @Value("${wiremock.server.port}") + protected String wireMockPort; + + @MockBean + protected CatalogDbClient MOCK_catalogDbClient; + + @SpyBean + protected InjectionHelper MOCK_injectionHelper; + + @SpyBean + protected ExceptionBuilder exceptionUtil; + + /* + * Classes that cannot be simply mocked because they are both + * needed for testing another class, and must be autowired when + * being tested themselves....or classes with private methods that + * must be stubbed during testing + */ + + @SpyBean + protected BBInputSetupMapperLayer SPY_bbInputSetupMapperLayer; + @SpyBean + protected BBInputSetupUtils SPY_bbInputSetupUtils; + @SpyBean + protected BBInputSetup SPY_bbInputSetup; + + /* + * Mocked for injection via the IntectionHelper + */ + + + + @Before + public void baseTestBefore() { + WireMock.reset(); + variables.put("gBuildingBlockExecution", execution); + } + + @LocalServerPort + private int port; + + protected String readFile(String path) throws IOException { + return readFile(path, Charset.defaultCharset()); + } + + protected String readFile(String path, Charset encoding) throws IOException { + byte[] encoded = Files.readAllBytes(Paths.get(path)); + return new String(encoded, encoding); + } + + protected String readJsonFileAsString(String fileLocation) throws IOException{ + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(new File(fileLocation)); + return jsonNode.asText(); + } + + protected String createURLWithPort(String uri) { + return "http://localhost:" + port + uri; + } + /** + * Create and deploy a process model with one logger delegate as service task. + * + * @param origProcessKey + * key to call + * @param mockProcessName + * process name + * @param fileName + * file name without extension + */ + protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName) { + BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(origProcessKey).name(mockProcessName) + .startEvent().name("Start Point").serviceTask().name("Log Something for Test") + .camundaClass(MockLoggerDelegate.class.getName()).endEvent().name("End Point").done(); + repositoryService.createDeployment().addModelInstance(fileName + ".bpmn", modelInstance).deploy(); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java new file mode 100644 index 0000000000..5719ce15e2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseUnitTest.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; + +public abstract class BaseUnitTest extends BuildingBlockTestDataSetup{ + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java new file mode 100644 index 0000000000..a983193ca3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -0,0 +1,668 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.assertj.core.util.Arrays; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; + +public class BuildingBlockTestDataSetup{ + private int collectionCounter; + private int configurationCounter; + private int customerCounter; + private int genericVnfCounter; + private int instanceGroupCounter; + private int l3NetworkCounter; + private int owningEntityCounter; + private int pnfCounter; + private int projectCounter; + private int serviceInstanceCounter; + private int serviceProxyCounter; + private int serviceSubscriptionCounter; + private int vfModuleCounter; + private int volumeGroupCounter; + private int vpnBindingCounter; + private int vpnBondingLinkCounter; + + protected BuildingBlockExecution execution; + + protected GeneralBuildingBlock gBBInput; + + protected HashMap<ResourceKey, String> lookupKeyMap; + + protected ExtractPojosForBB extractPojosForBB = new ExtractPojosForBB(); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + protected DelegateExecution delegateExecution; + + @Before + public void buildingBlockTestDataSetupBefore() { + collectionCounter = 0; + configurationCounter = 0; + customerCounter = 0; + genericVnfCounter = 0; + instanceGroupCounter = 0; + l3NetworkCounter = 0; + owningEntityCounter = 0; + pnfCounter = 0; + projectCounter = 0; + serviceInstanceCounter = 0; + serviceProxyCounter = 0; + serviceSubscriptionCounter = 0; + vfModuleCounter = 0; + volumeGroupCounter = 0; + vpnBindingCounter = 0; + vpnBondingLinkCounter = 0; + + execution = new DelegateExecutionImpl(new ExecutionImpl()); + execution.setVariable("testProcessKey", "testProcessKeyValue"); + + gBBInput = new GeneralBuildingBlock(); + execution.setVariable("gBBInput", gBBInput); + + lookupKeyMap = new HashMap<ResourceKey, String>(); + execution.setVariable("lookupKeyMap", lookupKeyMap); + + ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class); + doReturn("test").when(mockExecutionImpl).getProcessInstanceId(); + + ExecutionImpl executionImpl = new ExecutionImpl(); + executionImpl.setProcessInstance(mockExecutionImpl); + + delegateExecution = (DelegateExecution) executionImpl; + delegateExecution.setVariable("testProcessKey", "testProcessKeyValue"); + } + + public Map<String, String> buildUserInput() { + Map<String, String> userInput = new HashMap<>(); + userInput.put("testUserInputKey", "testUserInputValue"); + + return userInput; + } + + public Map<String, String> setUserInput() { + Map<String, String> userInput = buildUserInput(); + + gBBInput.setUserInput(userInput); + + return userInput; + } + + public RequestContext buildRequestContext() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId(UUID.randomUUID().toString()); + requestContext.setProductFamilyId("testProductFamilyId"); + requestContext.setRequestorId("testRequestorId"); + + requestContext.setUserParams(new HashMap<>()); + + Map<String,Object> dataMap = new HashMap<>(); + dataMap.put("vpnId","testVpnId"); + dataMap.put("vpnRegion","testVpnRegion"); + dataMap.put("vpnRt","testVpnRt"); + dataMap.put("vpnName","vpnName"); + dataMap.put("vpnRegion", Arrays.asList(new String[] {"USA", "EMEA", "APAC"})); + + HashMap<String,Object> userParams = new HashMap<>(); + userParams.put("vpnData",dataMap); + + List<Map<String,Object>> userParamsList = new ArrayList<>(); + userParamsList.add(userParams); + + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(userParamsList); + requestContext.setRequestParameters(requestParameters); + + return requestContext; + } + + public RequestContext setRequestContext() { + RequestContext requestContext = buildRequestContext(); + + gBBInput.setRequestContext(requestContext); + + return requestContext; + } + + public CloudRegion buildCloudRegion() { + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId"); + cloudRegion.setTenantId("testTenantId"); + cloudRegion.setCloudOwner("testCloudOwner"); + + return cloudRegion; + } + + public CloudRegion setCloudRegion() { + CloudRegion cloudRegion = buildCloudRegion(); + + gBBInput.setCloudRegion(cloudRegion); + + return cloudRegion; + } + + public OrchestrationContext buildOrchestrationContext() { + OrchestrationContext orchestrationContext = new OrchestrationContext(); + + return orchestrationContext; + } + + public OrchestrationContext setOrchestrationContext() { + OrchestrationContext orchestrationContext = buildOrchestrationContext(); + + gBBInput.setOrchContext(orchestrationContext); + + return orchestrationContext; + } + + public Collection buildCollection() { + collectionCounter++; + + Collection collection = new Collection(); + collection.setId("testId" + collectionCounter); + collection.setInstanceGroup(buildInstanceGroup()); + + return collection; + } + + public Configuration buildConfiguration() { + configurationCounter++; + + Configuration configuration = new Configuration(); + configuration.setConfigurationId("testConfigurationId" + configurationCounter); + configuration.setConfigurationName("testConfigurationName" + configurationCounter); + + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter); + modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter); + modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter); + + configuration.setModelInfoConfiguration(modelInfoConfiguration); + + return configuration; + } + + public OwningEntity buildOwningEntity() { + owningEntityCounter++; + + OwningEntity owningEntity = new OwningEntity(); + owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter); + owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter); + + return owningEntity; + } + + public Project buildProject() { + projectCounter++; + + Project project = new Project(); + project.setProjectName("testProjectName" + projectCounter); + + return project; + } + + public ServiceSubscription buildServiceSubscription() { + serviceSubscriptionCounter++; + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter); + serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter); + + return serviceSubscription; + } + + public Customer buildCustomer() { + customerCounter++; + + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter); + customer.setSubscriberType("testSubscriberType" + customerCounter); + + customer.setServiceSubscription(buildServiceSubscription()); + + return customer; + } + + public ServiceInstance buildServiceInstance() { + serviceInstanceCounter++; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter); + serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter); + + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter); + modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter); + modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + serviceInstance.setProject(buildProject()); + + serviceInstance.setOwningEntity(buildOwningEntity()); + + serviceInstance.setCollection(buildCollection()); + + serviceInstance.getConfigurations().add(buildConfiguration()); + + return serviceInstance; + } + + public ServiceInstance setServiceInstance() { + ServiceInstance serviceInstance = buildServiceInstance(); + + if(gBBInput.getCustomer() == null) { + gBBInput.setCustomer(buildCustomer()); + } + gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); + + return serviceInstance; + } + + public Customer setCustomer() { + if(gBBInput.getCustomer() != null) return gBBInput.getCustomer(); + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId"); + customer.setSubscriberType("testSubscriberType"); + + customer.setServiceSubscription(buildServiceSubscription()); + + gBBInput.setCustomer(customer); + + return customer; + } + + public Collection setCollection() { + Collection collection = new Collection(); + collection.setId("testId"); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.setCollection(collection); + + return collection; + } + + public InstanceGroup setInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId"); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction"); + + Collection collection = null; + + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + collection = serviceInstance.getCollection(); + + if (collection == null) { + collection = setCollection(); + } + } catch(BBObjectNotFoundException e) { + collection = setCollection(); + } + + collection.setInstanceGroup(instanceGroup); + + return instanceGroup; + } + + public VpnBinding buildVpnBinding() { + vpnBindingCounter++; + + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("testVpnId" + vpnBindingCounter); + vpnBinding.setVpnName("testVpnName" + vpnBindingCounter); + vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter); + + return vpnBinding; + } + + public VpnBinding setVpnBinding() { + VpnBinding vpnBinding = buildVpnBinding(); + + Customer customer = gBBInput.getCustomer(); + + if(customer == null){ + customer = buildCustomer(); + } + + customer.getVpnBindings().add(vpnBinding); + lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId()); + + return vpnBinding; + } + + public InstanceGroup buildInstanceGroup() { + instanceGroupCounter++; + + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId" + instanceGroupCounter); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter); + + return instanceGroup; + } + + public L3Network buildL3Network() { + l3NetworkCounter++; + + L3Network network = new L3Network(); + network.setNetworkId("testNetworkId" + l3NetworkCounter); + network.setNetworkName("testNetworkName" + l3NetworkCounter); + network.setNetworkType("testNetworkType" + l3NetworkCounter); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter); + modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter); + modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter); + modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter); + network.setModelInfoNetwork(modelInfoNetwork); + + return network; + } + + public L3Network setL3Network() { + L3Network network = buildL3Network(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getNetworks().add(network); + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + + return network; + } + + public GenericVnf buildGenericVnf() { + genericVnfCounter++; + + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("testVnfId" + genericVnfCounter); + genericVnf.setVnfName("testVnfName" + genericVnfCounter); + genericVnf.setVnfType("testVnfType" + genericVnfCounter); + + Platform platform = new Platform(); + platform.setPlatformName("testPlatformName"); + genericVnf.setPlatform(platform); + + LineOfBusiness lob = new LineOfBusiness(); + lob.setLineOfBusinessName("testLineOfBusinessName"); + genericVnf.setLineOfBusiness(lob); + + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter); + modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelInvariantUuid("testModelInvariantUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter); + modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelInstanceName("testModelInstanceName" + genericVnfCounter); + genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + return genericVnf; + } + + public GenericVnf setGenericVnf() { + GenericVnf genericVnf = buildGenericVnf(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getVnfs().add(genericVnf); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); + + return genericVnf; + } + + public VfModule buildVfModule() { + vfModuleCounter++; + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter); + vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter); + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter); + modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter); + modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter); + modelInfoVfModule.setModelName("testModelName" + vfModuleCounter); + modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + return vfModule; + } + + public VfModule setVfModule() { + VfModule vfModule = buildVfModule(); + + GenericVnf genericVnf = null; + + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch(BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } + + genericVnf.getVfModules().add(vfModule); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); + + return vfModule; + } + + public VolumeGroup buildVolumeGroup() { + volumeGroupCounter++; + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter); + volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter); + volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter); + + return volumeGroup; + } + + public VolumeGroup setVolumeGroup() { + VolumeGroup volumeGroup = buildVolumeGroup(); + + GenericVnf genericVnf = null; + + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch(BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } + + genericVnf.getVolumeGroups().add(volumeGroup); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + + return volumeGroup; + } + + public Pnf buildPnf() { + pnfCounter++; + + Pnf pnf = new Pnf(); + pnf.setPnfId("testPnfId" + pnfCounter); + pnf.setPnfName("testPnfName" + pnfCounter); + + return pnf; + } + + public ServiceProxy buildServiceProxy() { + serviceProxyCounter++; + + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setServiceInstance(buildServiceInstance()); + serviceProxy.getServiceInstance().getVnfs().add(buildGenericVnf()); + + Pnf primaryPnf = buildPnf(); + primaryPnf.setRole("Primary"); + serviceProxy.getServiceInstance().getPnfs().add(primaryPnf); + + Pnf secondaryPnf = buildPnf(); + secondaryPnf.setRole("Secondary"); + serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf); + + return serviceProxy; + } + + public VpnBondingLink buildVpnBondingLink() { + vpnBondingLinkCounter++; + + VpnBondingLink vpnBondingLink = new VpnBondingLink(); + vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter); + + Configuration vnrConfiguration = buildConfiguration(); + vnrConfiguration.setNetwork(buildL3Network()); + vpnBondingLink.setVnrConfiguration(vnrConfiguration); + + vpnBondingLink.setVrfConfiguration(buildConfiguration()); + + vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy()); + + vpnBondingLink.setTransportServiceProxy(buildServiceProxy()); + + return vpnBondingLink; + } + + public VpnBondingLink setVpnBondingLink() { + VpnBondingLink vpnBondingLink = buildVpnBondingLink(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getVpnBondingLinks().add(vpnBondingLink); + lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId()); + + + return vpnBondingLink; + } + + public Customer setAvpnCustomer() { + Customer customer = buildCustomer(); + + gBBInput.setCustomer(customer); + + return customer; + } + + public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) { + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setId("testProxyId" + uniqueIdentifier); + serviceProxy.setType(type); + + ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy(); + modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); + modelInfo.setModelInstanceName("testProxyInstanceName" + uniqueIdentifier); + + serviceProxy.setModelInfoServiceProxy(modelInfo); + + return serviceProxy; + } + + public AllottedResource setAllottedResource(String uniqueIdentifier) { + AllottedResource ar = new AllottedResource(); + ar.setId("testAllottedResourceId" + uniqueIdentifier); + + ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource(); + modelInfo.setModelInvariantUuid("testAllottedModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testAllottedModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testAllottedModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testAllottedModelVersion" + uniqueIdentifier); + modelInfo.setModelInstanceName("testAllottedInstanceName" + uniqueIdentifier); + + ar.setModelInfoAllottedResource(modelInfo); + + return ar; + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java new file mode 100644 index 0000000000..a29df9cbcf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; +import ch.vorburger.exec.ManagedProcessException; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; +import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import javax.sql.DataSource; + +@Configuration +@Profile({"test"}) +public class EmbeddedMariaDbConfig { + + @Bean + MariaDB4jSpringService mariaDB4jSpringService() { + MariaDB4jSpringService service = new MariaDB4jSpringService(); + + + service.getConfiguration().addArg("--lower_case_table_names=1"); + return service; + } + + @Bean + DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, + @Value("${mariaDB4j.databaseName}") String databaseName, + @Value("${spring.datasource.username}") String datasourceUsername, + @Value("${spring.datasource.password}") String datasourcePassword, + @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { + //Create our database with default root user and no password + mariaDB4jSpringService.getDB().createDB(databaseName); + + DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); + + return DataSourceBuilder + .create() + .username(datasourceUsername) + .password(datasourcePassword) + .url(config.getURL(databaseName)) + .driverClassName(datasourceDriver) + .build(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java new file mode 100644 index 0000000000..97c17d5238 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/SerializableChecker.java @@ -0,0 +1,181 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public final class SerializableChecker +{ + public static class SerializationFailure + { + private final String mContainingClass; + private final String mMemberName; + + public SerializationFailure(String inNonSerializableClass, String inMemberName) + { + mContainingClass = inNonSerializableClass; + mMemberName = inMemberName; + } + + public String getContainingClass() + { + return mContainingClass; + } + + public String getMemberName() + { + return mMemberName; + } + + public String getBadMemberString() + { + if (mMemberName == null) + return mContainingClass; + return mContainingClass + "." + mMemberName; + } + + @Override + public String toString() + { + return "SerializationFailure [mNonSerializableClass=" + mContainingClass + ", mMemberName=" + mMemberName + "]"; + } + } + + private static class SerializationCheckerData + { + private Set<Class<?>> mSerializableClasses; + + SerializationCheckerData() + { + mSerializableClasses = new HashSet<Class<?>>(); + } + + boolean isAlreadyChecked(Class<?> inClass) + { + return mSerializableClasses.contains(inClass); + } + + void addSerializableClass(Class<?> inClass) + { + mSerializableClasses.add(inClass); + } + } + + private SerializableChecker() + { } + + public static SerializationFailure isFullySerializable(Class<?> inClass) + { + if (!isSerializable(inClass)) + return new SerializationFailure(inClass.getName(), null); + + return isFullySerializable(inClass, new SerializationCheckerData()); + } + + private static SerializationFailure isFullySerializable(Class<?> inClass, SerializationCheckerData inSerializationCheckerData) + { + for (Field field : declaredFields(inClass)) + { + Class<?> fieldDeclaringClass = field.getType(); + + if (field.getType() == Object.class) + continue; + + if (Modifier.isStatic(field.getModifiers())) + continue; + + if (field.isSynthetic()) + continue; + + if (fieldDeclaringClass.isInterface() || fieldDeclaringClass.isPrimitive()) + continue; + + if (Modifier.isAbstract(field.getType().getModifiers())) + continue; + + if (inSerializationCheckerData.isAlreadyChecked(fieldDeclaringClass)) + continue; + + if (isSerializable(fieldDeclaringClass)) + { + inSerializationCheckerData.addSerializableClass(inClass); + + SerializationFailure failure = isFullySerializable(field.getType(), inSerializationCheckerData); + if (failure != null) + return failure; + else + continue; + } + + if (Modifier.isTransient(field.getModifiers())) + continue; + + return new SerializationFailure(field.getDeclaringClass().getName(), field.getName()); + } + return null; + } + + private static boolean isSerializable(Class<?> inClass) + { + Set<Class<?>> interfaces = getInterfaces(inClass); + if (interfaces == null) + return false; + boolean isSerializable = interfaces.contains(Serializable.class); + if (isSerializable) + return true; + + for (Class<?> classInterface : interfaces) + { + if (isSerializable(classInterface)) + return true; + } + + if (inClass.getSuperclass() != null && isSerializable(inClass.getSuperclass())) + return true; + + return false; + } + + private static Set<Class<?>> getInterfaces(Class<?> inFieldDeclaringClass) + { + return new HashSet<Class<?>>(Arrays.asList(inFieldDeclaringClass.getInterfaces())); + } + + private static List<Field> declaredFields(Class<?> inClass) + { + List<Field> fields = new ArrayList<Field>(Arrays.asList(inClass.getDeclaredFields())); + + Class<?> parentClasses = inClass.getSuperclass(); + + if (parentClasses == null) + return fields; + fields.addAll(declaredFields(parentClasses)); + + return fields; + } + } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java new file mode 100644 index 0000000000..ba8caee058 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; + +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; +import org.onap.so.requestsdb.RequestsDBHelper; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.Profile; + +@SpringBootApplication +@Profile("test") +@EnableProcessApplication("MSO CommonBPMN Test Application") +@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +public class TestApplication { + public static void main(String... args) { + SpringApplication.run(TestApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplicationConfig.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplicationConfig.java new file mode 100644 index 0000000000..c483f13887 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplicationConfig.java @@ -0,0 +1,96 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.List; + +import org.onap.so.bpmn.common.WorkflowTestTransformer; +import org.springframework.cloud.contract.wiremock.WireMockConfigurationCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; + +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; + +@Configuration +@Profile({"test"}) +public class TestApplicationConfig { + + @Bean + protected ResponseTransformer[] transformerArray() { + // Process WorkflowTestTransformer annotations + List<ResponseTransformer> transformerList = new ArrayList<ResponseTransformer>(); + + for (Field field : getClass().getFields()) { + WorkflowTestTransformer annotation = 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()]); + + optionsCustomizer(transformerArray); + + return transformerArray; + } + + @Bean + WireMockConfigurationCustomizer optionsCustomizer(ResponseTransformer[] transformerArray) { + return new WireMockConfigurationCustomizer() { + @Override + public void customize(WireMockConfiguration options) { + options.extensions(transformerArray); + } + }; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java index 95af260ac6..8d681d721c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java @@ -1,81 +1,81 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.appc.payload;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Optional;
-
-import org.json.JSONObject;
-import org.junit.Test;
-
-public class PayloadClientTest {
-
- @Test
- public void upgradeFormatTest() throws Exception {
- String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing-software-version\":\"existingVersion\",\"new-software-version\":\"newVersion\"}}";
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("existing-software-version", "existingVersion");
- jsonObject.put("new-software-version", "newVersion");
- Optional<String> payload = Optional.of(jsonObject.toString());
- Optional<String> payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1");
- assertEquals(payloadResult, payloadClient.get());
- }
-
- @Test
- public void resumeTrafficFormatTest() throws Exception {
- String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";
- Optional<String> payloadClient = PayloadClient.resumeTrafficFormat("vnfName1");
- assertEquals(payloadResult, payloadClient.get());
- }
-
- @Test
- public void quiesceTrafficFormatTest() throws Exception {
- String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"operations_timeout\":\"operationTimeout\"}}";
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("operations-timeout", "operationTimeout");
- Optional<String> payload = Optional.of(jsonObject.toString());
- Optional<String> payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1");
- assertEquals(payloadResult, payloadClient.get());
- }
-
- @Test
- public void startStopFormatTest() throws Exception {
- String payloadResult = "{\" AICIdentity \":\"aicIdentity1\"}";
- Optional<String> payloadClient = PayloadClient.startStopFormat("aicIdentity1");
- assertEquals(payloadResult, payloadClient.get());
- }
-
- @Test
- public void healthCheckFormatTest() throws Exception {
- String payloadResult = "{\"request-parameters\":{\"vnf-name\":\"vnfName1\"},\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";
- Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "vnfHostIpAddress1");
- assertEquals(payloadResult, payloadClient.get());
- }
-
- @Test
- public void snapshotFormatTest() throws Exception {
- String payloadResult = "{\"vm-id\":\"vmId1\",\"identity-url\":\"identityUrl1\"}";
- Optional<String> payloadClient = PayloadClient.snapshotFormat("vmId1", "identityUrl1");
- assertEquals(payloadResult, payloadClient.get());
- }
-
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.appc.payload; + +import static org.junit.Assert.assertEquals; + +import java.util.Optional; + +import org.json.JSONObject; +import org.junit.Test; + +public class PayloadClientTest { + + @Test + public void upgradeFormatTest() throws Exception { + String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing-software-version\":\"existingVersion\",\"new-software-version\":\"newVersion\"}}"; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("existing-software-version", "existingVersion"); + jsonObject.put("new-software-version", "newVersion"); + Optional<String> payload = Optional.of(jsonObject.toString()); + Optional<String> payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1"); + assertEquals(payloadResult, payloadClient.get()); + } + + @Test + public void resumeTrafficFormatTest() throws Exception { + String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}"; + Optional<String> payloadClient = PayloadClient.resumeTrafficFormat("vnfName1"); + assertEquals(payloadResult, payloadClient.get()); + } + + @Test + public void quiesceTrafficFormatTest() throws Exception { + String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"operations_timeout\":\"operationTimeout\"}}"; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("operations-timeout", "operationTimeout"); + Optional<String> payload = Optional.of(jsonObject.toString()); + Optional<String> payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1"); + assertEquals(payloadResult, payloadClient.get()); + } + + @Test + public void startStopFormatTest() throws Exception { + String payloadResult = "{\" AICIdentity \":\"aicIdentity1\"}"; + Optional<String> payloadClient = PayloadClient.startStopFormat("aicIdentity1"); + assertEquals(payloadResult, payloadClient.get()); + } + + @Test + public void healthCheckFormatTest() throws Exception { + String payloadResult = "{\"request-parameters\":{\"vnf-name\":\"vnfName1\"},\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}"; + Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "vnfHostIpAddress1"); + assertEquals(payloadResult, payloadClient.get()); + } + + @Test + public void snapshotFormatTest() throws Exception { + String payloadResult = "{\"vm-id\":\"vmId1\",\"identity-url\":\"identityUrl1\"}"; + Optional<String> payloadClient = PayloadClient.snapshotFormat("vmId1", "identityUrl1"); + assertEquals(payloadResult, payloadClient.get()); + } + }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BeansTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/BeansTest.java index 358ebfa13c..7949fd26e6 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BeansTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/BeansTest.java @@ -18,23 +18,22 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common; +package org.onap.so.bpmn.common; import org.junit.Test; +import org.onap.so.openpojo.rules.ToStringTester; +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterEnum; +import com.openpojo.reflection.filters.FilterNonConcrete; +import com.openpojo.reflection.filters.FilterPackageInfo; import com.openpojo.validation.Validator; import com.openpojo.validation.ValidatorBuilder; import com.openpojo.validation.rule.impl.GetterMustExistRule; import com.openpojo.validation.rule.impl.SetterMustExistRule; import com.openpojo.validation.test.impl.GetterTester; import com.openpojo.validation.test.impl.SetterTester; -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.PojoClassFilter; -import com.openpojo.reflection.filters.FilterEnum; -import com.openpojo.reflection.filters.FilterNonConcrete; -import com.openpojo.reflection.filters.FilterPackageInfo; -import org.openecomp.mso.openpojo.rules.HasToStringRule; -import org.openecomp.mso.openpojo.rules.ToStringTester; public class BeansTest { @@ -46,8 +45,7 @@ public class BeansTest { @Test public void pojoStructure() { - test("org.openecomp.mso.bpmn.appc.payload.beans"); - test("org.openecomp.mso.client.sdnc.beans"); + test("org.onap.so.bpmn.appc.payload.beans"); } private void test(String pojoPackage) { @@ -68,6 +66,7 @@ public class BeansTest { validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete()); } private static class FilterTestClasses implements PojoClassFilter { + @Override public boolean include(PojoClass pojoClass) { return !pojoClass.getSourcePath().contains("/test-classes/"); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGeneratorTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGeneratorTest.java new file mode 100644 index 0000000000..8a2c8fbfdd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGeneratorTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.HashSet; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.core.type.AnnotationMetadata; + +public class DefaultToShortClassNameBeanNameGeneratorTest { + + + @Mock + private BeanDefinitionRegistry beanDefinitionRegistry; + + private DefaultToShortClassNameBeanNameGenerator customBeanNameGenerator = new DefaultToShortClassNameBeanNameGenerator(); + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void test_generateBeanName_notAnnotatedBeanDefinition() { + String expectedBeanName = "BeanName"; + + AnnotatedBeanDefinition annotatedBeanDefinition = mock(AnnotatedBeanDefinition.class); + AnnotationMetadata metadata = mock(AnnotationMetadata.class); + when(metadata.getAnnotationTypes()).thenReturn(new HashSet<String>()); + when(annotatedBeanDefinition.getBeanClassName()).thenReturn("org.onap.so.BeanName"); + when(annotatedBeanDefinition.getMetadata()).thenReturn(metadata); + String actualBeanName = customBeanNameGenerator.generateBeanName(annotatedBeanDefinition, beanDefinitionRegistry); + + assertEquals(expectedBeanName, actualBeanName); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java new file mode 100644 index 0000000000..cf74356fa2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static org.hamcrest.CoreMatchers.hasItems; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.contains; +import static org.mockito.Mockito.mock; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.hamcrest.collection.IsIterableContainingInOrder; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.common.exceptions.MalformedBuildingBlockInputException; +import org.onap.so.bpmn.common.exceptions.MissingBuildingBlockInputException; +import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; + +public class DelegateExecutionImplTest { + + @Rule + public ExpectedException thrown= ExpectedException.none(); + + + @Test + public void getVariable() throws RequiredExecutionVariableExeception { + Map<String, Serializable> map = new HashMap<>(); + map.put("var1", "value1"); + map.put("var2", "value2"); + map.put("list1", (Serializable)Arrays.asList("value1", "value2")); + DelegateExecutionImpl impl = create(map); + + assertEquals("value1", impl.getVariable("var1")); + assertEquals("value2", impl.getRequiredVariable("var2")); + assertThat(impl.getVariable("list1"), IsIterableContainingInOrder.contains("value1", "value2")); + + } + + + @Test + public void getRequiredVariableNotFound() throws RequiredExecutionVariableExeception { + DelegateExecutionImpl impl = create(); + + thrown.expect(RequiredExecutionVariableExeception.class); + impl.getRequiredVariable("var1"); + } + + + @Test + public void setVariable() { + DelegateExecutionImpl impl = create(); + impl.setVariable("var1", "value1"); + + assertEquals("value1", impl.get("var1")); + } + + @Test + public void getGeneralBuildingBlock() { + GeneralBuildingBlock gBB = mock(GeneralBuildingBlock.class); + Map<String, Serializable> map = new HashMap<>(); + map.put("gBBInput", gBB); + DelegateExecutionImpl impl = create(map); + + assertEquals(gBB, impl.getGeneralBuildingBlock()); + } + + @Test + public void getGeneralBuildingBlockNotFound() { + + DelegateExecutionImpl impl = create(); + + thrown.expect(MissingBuildingBlockInputException.class); + impl.getGeneralBuildingBlock(); + } + + @Test + public void getGeneralBuildingBlockCastException() { + Map<String, Serializable> map = new HashMap<>(); + map.put("gBBInput", new DelegateExecutionFake()); + DelegateExecutionImpl impl = create(map); + + thrown.expect(MalformedBuildingBlockInputException.class); + impl.getGeneralBuildingBlock(); + } + + @Test + public void getDelegateExecution() { + DelegateExecutionImpl impl = create(); + + assertNotNull(impl.getDelegateExecution()); + } + + @Test + public void getLookupMap() { + Map<String, Serializable> lookup = new HashMap<>(); + Map<String, Serializable> map = new HashMap<>(); + map.put("lookupKeyMap", (Serializable) lookup); + DelegateExecutionImpl impl = create(map); + + assertEquals(lookup, impl.getLookupMap()); + } + + private DelegateExecutionImpl create() { + return create(new HashMap<String, Serializable>()); + } + + private DelegateExecutionImpl create(Map<String, Serializable> map) { + DelegateExecutionFake fake = new DelegateExecutionFake(); + + for (Entry<String, Serializable> entry : map.entrySet()) { + fake.setVariable(entry.getKey(), entry.getValue()); + } + return new DelegateExecutionImpl(fake); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java new file mode 100644 index 0000000000..514d93bdf8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import java.util.List; +import java.util.concurrent.Executor; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.PreUndeploy; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; +import org.onap.so.logger.MsoLogger; +import org.onap.so.requestsdb.RequestsDBHelper; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +/** + * @since Version 1.0 + * + */ + +@SpringBootApplication +@EnableProcessApplication("MSO Common Application") +@EnableAsync +@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +public class MSOCommonApplication { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + MSOCommonApplication.class); + + @Value("${mso.async.core-pool-size}") + private int corePoolSize; + + @Value("${mso.async.max-pool-size}") + private int maxPoolSize; + + @Value("${mso.async.queue-capacity}") + private int queueCapacity; + + private static final String LOGS_DIR = "logs_dir"; + + + private static void setLogsDir() { + if (System.getProperty(LOGS_DIR) == null) { + System.getProperties().setProperty(LOGS_DIR, "./logs/bpmn/"); + } + } + + public static void main(String... args) { + SpringApplication.run(MSOCommonApplication.class, args); + System.getProperties().setProperty("mso.config.path", "."); + setLogsDir(); + } + + @PostDeploy + public void postDeploy(ProcessEngine processEngineInstance) { + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Post deployment complete..."); + } + + @PreUndeploy + public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, + List<ProcessEngine> processEngines) { + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Pre Undeploy complete..."); + + } + + @Bean + public Executor asyncExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + + executor.setCorePoolSize(corePoolSize); + executor.setMaxPoolSize(maxPoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setThreadNamePrefix("Camunda-"); + executor.initialize(); + return executor; + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java new file mode 100644 index 0000000000..819962f16c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +public class MockAAIDeleteGenericVnf { + public 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"))); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java new file mode 100644 index 0000000000..9cb10a0494 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +public class MockAAIDeleteVfModule { + + public 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/onap/so/bpmn/common/MockAAIGenericVnfSearch.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java new file mode 100644 index 0000000000..b46d528cc5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java @@ -0,0 +1,340 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +public class MockAAIGenericVnfSearch { + + private static final String EOL = "\n"; + + public 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))); + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java new file mode 100644 index 0000000000..6a9ff2a4a8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +public class MockLoggerDelegate implements JavaDelegate { + @Override + public void execute(DelegateExecution execution) throws Exception { + System.out.println("\n\n ..." + MockLoggerDelegate.class.getName() + " invoked by " + "processDefinitionId=" + + execution.getProcessDefinitionId() + ", activtyId=" + execution.getCurrentActivityId() + + ", activtyName='" + execution.getCurrentActivityName() + "'" + ", processInstanceId=" + + execution.getProcessInstanceId() + ", businessKey=" + execution.getProcessBusinessKey() + + ", executionId=" + execution.getId() + " \n\n"); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SPIPropertiesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java index e9a5492b6f..9239889f28 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SPIPropertiesTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common; +package org.onap.so.bpmn.common; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; @@ -28,11 +28,11 @@ import java.io.IOException; import org.junit.BeforeClass; import org.junit.Test; -import org.openecomp.mso.client.RestPropertiesLoader; -import org.openecomp.mso.client.aai.AAIProperties; -import org.openecomp.mso.client.dmaap.DmaapProperties; -import org.openecomp.mso.client.dmaap.DmaapPropertiesLoader; -import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer; +import org.onap.so.client.RestPropertiesLoader; +import org.onap.so.client.aai.AAIProperties; +import org.onap.so.client.dmaap.DmaapProperties; +import org.onap.so.client.dmaap.DmaapPropertiesLoader; +import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer; public class SPIPropertiesTest { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java new file mode 100644 index 0000000000..4a51d34c3e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + + + +import java.util.UUID; +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse; +import org.onap.so.bpmn.common.workflow.context.WorkflowContext; +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; + + +public class WorkflowContextHolderTest { + + + @Test + public void testProcessCallback() throws Exception { + String requestId = UUID.randomUUID().toString(); + String message = "TEST MESSATGE"; + String responseMessage = "Successfully processed request"; + int testCode = 200; + + + WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); + callbackResponse.setMessage(message); + callbackResponse.setResponse(responseMessage); + callbackResponse.setStatusCode(testCode); + + contextHolder.processCallback("testAsyncProcess","process-instance-id",requestId,callbackResponse); + + //same object returned + WorkflowContext contextFound = contextHolder.getWorkflowContext(requestId); + if(contextFound == null) + throw new Exception("Expected to find Context Object"); + + WorkflowResponse testResponse = contextFound.getWorkflowResponse(); + Assert.assertEquals(200,testResponse.getMessageCode()); + Assert.assertEquals(message, testResponse.getMessage()); + Assert.assertEquals(responseMessage, testResponse.getResponse()); + + + + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java index ea338c21bf..dbad35a6a4 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java @@ -1,41 +1,41 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Allows a subclass of WorkflowTest to specify one or more WireMock
- * response transformers. A transformer must be declared as a public
- * static field in the subclass. For example:
- * <pre>
- * @WorkflowTestTransformer
- * public static final ResponseTransformer sdncAdapterMockTransformer =
- * new SDNCAdapterMockTransformer();
- * </pre>
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface WorkflowTestTransformer {
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Allows a subclass of WorkflowTest to specify one or more WireMock + * response transformers. A transformer must be declared as a public + * static field in the subclass. For example: + * <pre> + * @WorkflowTestTransformer + * public static final ResponseTransformer sdncAdapterMockTransformer = + * new SDNCAdapterMockTransformer(); + * </pre> + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface WorkflowTestTransformer { }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnParamTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnParamTest.java new file mode 100644 index 0000000000..5510e21b31 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnParamTest.java @@ -0,0 +1,41 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + +package org.onap.so.bpmn.common.recipe; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class BpmnParamTest { + + BpmnParam bp=new BpmnParam(); + + @Test + public void test() { + bp.setValue("testdata"); + assertEquals(bp.getValue(),"testdata"); + } + @Test + public void testToString(){ + assert(bp.toString()!=null); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceInputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java index 466f4a1f3f..70191311b2 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceInputTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java @@ -1,30 +1,31 @@ /* * ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.recipe; +package org.onap.so.bpmn.common.recipe; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.core.domain.ModelInfo; -public class ResourceInputTest { +public class ResourceInputTest extends BaseTest{ ResourceInput ri=new ResourceInput(); @Test diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequestTest.java new file mode 100644 index 0000000000..f0f6fa79e0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequestTest.java @@ -0,0 +1,52 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ +package org.onap.so.bpmn.common.recipe; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.so.BaseTest; + +public class ResourceRecipeRequestTest extends BaseTest{ + + ResourceRecipeRequest rr=new ResourceRecipeRequest(); + BpmnParam bp=new BpmnParam(); + @Test + public void test() { + rr.setResourceInput(bp); + rr.setHost(bp); + rr.setRequestId(bp); + rr.setRequestAction(bp); + rr.setServiceInstanceId(bp); + rr.setServiceType(bp); + rr.setRecipeParams(bp); + assertEquals(rr.getResourceInput(),bp); + assertEquals(rr.getHost(),bp); + assertEquals(rr.getRequestId(),bp); + assertEquals(rr.getRequestAction(),bp); + assertEquals(rr.getServiceInstanceId(),bp); + assertEquals(rr.getServiceType(),bp); + assertEquals(rr.getRecipeParams(),bp); + } + @Test + public void testToString(){ + assert(rr.toString()!=null); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java index 5170e9d5d9..5598e3d2e4 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.resource; +package org.onap.so.bpmn.common.resource; import org.junit.Test; @@ -28,7 +28,7 @@ public class ResourceRequestBuilderTest { @Test public void buildResouceRequestTest() throws Exception { - ResourceRequestBuilder.buildResouceRequest("aa4535", + ResourceRequestBuilder.buildResouceRequest("xxxxxx", "a1074969-944f-4ddc-b687-9550b0c8cd57", new HashMap<>()); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java index 724d3edf4d..cbde63e933 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java @@ -1,42 +1,55 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.util;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class CryptoHandlerTest {
-
- @Test
- public void test() throws Exception {
- String plainPswd = "mso0206";
- String encryptPwd = "C1FC4A39E16419DD41DFC1212843F440";
- CryptoHandler cryptoHandler = new CryptoHandler();
- String aaiPassword = cryptoHandler.getMsoAaiPassword();
- assertEquals(plainPswd, aaiPassword);
- String encryptPassword = cryptoHandler.encryptMsoPassword(plainPswd);
- assertEquals(encryptPwd, encryptPassword);
- String decryptPassword = cryptoHandler.decryptMsoPassword(encryptPwd);
- assertEquals(plainPswd, decryptPassword);
- }
-
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.util; + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.so.BaseTest; + +public class CryptoHandlerTest { + private static final String plainPswd = "mso0206"; + private static final String encryptPwd = "C1FC4A39E16419DD41DFC1212843F440"; + private CryptoHandler cryptoHandler; + + @Before + public void setup() { + cryptoHandler = new CryptoHandler(); + } + + @Test + @Ignore // ignored until we can mock the properties file. + public void getMsoAaiPasswordTest() { + assertEquals(plainPswd, cryptoHandler.getMsoAaiPassword()); + } + + @Test + public void encryptMsoPasswordTest() { + assertEquals(encryptPwd, cryptoHandler.encryptMsoPassword(plainPswd)); + } + + @Test + public void decryptMsoPasswordTest() { + assertEquals(plainPswd, cryptoHandler.decryptMsoPassword(encryptPwd)); + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java index 38d0584d0d..b6acdf7adb 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java @@ -1,26 +1,28 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import java.io.IOException; import java.io.InputStream; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.logger.MsoLogger; /** * @@ -33,7 +35,7 @@ import org.openecomp.mso.logger.MsoLogger; */ public class FileUtil { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class); /** * Read the specified resource file and return the contents as a String. @@ -48,9 +50,13 @@ public class FileUtil { stream = getResourceAsStream(fileName); byte[] bytes; bytes = new byte[stream.available()]; - stream.read(bytes); - stream.close(); - return new String(bytes); + if(stream.read(bytes) > 0) { + stream.close(); + return new String(bytes); + } else { + stream.close(); + return ""; + } } catch (IOException e) { LOGGER.debug("Exception:", e); return ""; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java index 9ead882b07..b9a413fc96 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java @@ -1,22 +1,24 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; @@ -52,16 +54,16 @@ public class MockResource { } private synchronized void initMockServer(int portNumber) { - String path = FileUtil.class.getClassLoader().getResource("__files/sdncSimResponse.xml").getFile(); + String path = "src/test/resources/" + "__files/sdncSimResponse.xml"; 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")); + wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.onap.so.bpmn.mock.SDNCAdapterMockTransformer") + .extensions("org.onap.so.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer") + .extensions("org.onap.so.bpmn.mock.VnfAdapterCreateMockTransformer") + .extensions("org.onap.so.bpmn.mock.VnfAdapterDeleteMockTransformer") + .extensions("org.onap.so.bpmn.mock.VnfAdapterUpdateMockTransformer") + .extensions("org.onap.so.bpmn.mock.VnfAdapterRollbackMockTransformer") + .extensions("org.onap.so.bpmn.mock.VnfAdapterQueryMockTransformer")); //.withRootDirectory(path)); //Mocks were failing - commenting out for now, both mock and transformers seem to work fine WireMock.configureFor("localhost", portNumber); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java index ba48bffca0..6c62920781 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java @@ -1,22 +1,24 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import java.util.HashSet; import java.util.Set; @@ -24,11 +26,14 @@ import java.util.Set; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; +import org.junit.Ignore; + /** * * JAX RS Application wiring for Mock Resource */ @ApplicationPath("/console") +@Ignore public class MockResourceApplication extends Application { private Set<Object> singletons = new HashSet<>(); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java index 93cf0bddef..9b5bb33bf8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterAsyncTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java @@ -18,15 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.BinaryFile; import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; @@ -35,7 +38,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; * Simulates SDNC Adapter Callback response * */ -public class SDNCAdapterAsyncTransformer extends ResponseTransformer { +public class SDNCAdapterAsyncTransformer extends ResponseDefinitionTransformer { private String syncResponse; private String callbackResponseWrapper; @@ -44,8 +47,9 @@ public class SDNCAdapterAsyncTransformer extends ResponseTransformer { syncResponse = FileUtil.readResourceFile("__files/StandardSDNCSynchResponse.xml"); callbackResponseWrapper = FileUtil.readResourceFile("__files/sdncCallbackSoapWrapper.xml"); } - - public String name() { + + @Override + public String getName() { return "sdnc-adapter-vf-module-assign"; } @@ -58,7 +62,7 @@ public class SDNCAdapterAsyncTransformer extends ResponseTransformer { */ @Override public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { + FileSource fileSource, Parameters parameters) { String requestBody = request.getBodyAsString(); @@ -84,10 +88,6 @@ public class SDNCAdapterAsyncTransformer extends ResponseTransformer { } } - // Transform the SDNC response to escape < and > - sdncResponse = sdncResponse.replaceAll ("<", "<"); - sdncResponse = sdncResponse.replaceAll (">", ">"); - // Next substitute the SDNC response into the callbackResponse (SOAP wrapper). // Also, replace the request ID wherever it appears String callbackResponse = callbackResponseWrapper.replace("SDNC_RESPONSE_DATA", sdncResponse).replaceAll("SDNC_REQUEST_ID", requestId); @@ -140,13 +140,9 @@ public class SDNCAdapterAsyncTransformer extends ResponseTransformer { // TODO Auto-generated catch block e1.printStackTrace(); } - System.out.println("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()); + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java index 9c4e7936b1..8c34b65c00 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java @@ -1,42 +1,46 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; -package org.openecomp.mso.bpmn.mock; +import javax.ws.rs.core.UriBuilder; -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; 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 { +public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterMockTransformer.class); private String callbackResponse; private String requestId; @@ -48,7 +52,8 @@ public class SDNCAdapterMockTransformer extends ResponseTransformer { this.requestId = requestId; } - public String name() { + @Override + public String getName() { return "sdnc-adapter-transformer"; } @@ -61,7 +66,7 @@ public class SDNCAdapterMockTransformer extends ResponseTransformer { */ @Override public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { + FileSource fileSource, Parameters parameters) { String requestBody = request.getBodyAsString(); String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>")); @@ -125,12 +130,9 @@ public class SDNCAdapterMockTransformer extends ResponseTransformer { 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()); + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + client.post(payLoad); } 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/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java index e59e3b67d2..f53fd6f424 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java @@ -1,37 +1,42 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; -import org.openecomp.mso.logger.MsoLogger; - -public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransformer { +public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterNetworkTopologyMockTransformer.class); private String callbackResponse; private String requestId; @@ -44,12 +49,13 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransform this.requestId = requestId; } - public String name() { + @Override + public String getName() { return "network-topology-operation-transformer"; } @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource) { + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource, Parameters parameters) { String requestBody = request.getBodyAsString(); String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>")); @@ -115,12 +121,10 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransform 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()); + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + Response response = client.post(payLoad); + LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); } catch (Exception e) { // TODO Auto-generated catch block LOGGER.debug("catch error in - request.post() "); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java index 6efd992566..c7d1a7c81f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java @@ -1,24 +1,26 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.github.tomakehurst.wiremock.client.WireMock.containing; import static com.github.tomakehurst.wiremock.client.WireMock.delete; import static com.github.tomakehurst.wiremock.client.WireMock.get; @@ -98,6 +100,16 @@ public class StubResponseAAI { /** * Service Instance Mock StubResponses below */ + public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId) { + 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"))); + } + + /** + * 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() @@ -178,8 +190,8 @@ public class StubResponseAAI { .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)) + public static void MockGetServiceInstance(String customer, String serviceSubscription, int statusCode){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml"))); @@ -341,7 +353,8 @@ public class StubResponseAAI { } public static void MockGetGenericVnfById_500(String vnfId){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + stubFor(get(urlMatching("/aai/v9/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) + .withQueryParam("depth", equalTo("1")) .willReturn(aResponse() .withStatus(500))); } @@ -765,9 +778,13 @@ public class StubResponseAAI { * Volume Group StubResponse below */ public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) { + MockGetVolumeGroupById(cloudRegionId, volumeGroupId, responseFile, 200); + } + + public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int responseCode) { 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) + .withStatus(responseCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAPPC.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java index e94f0142d2..58e7dcdaad 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAPPC.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.containing; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java index ffa6701a89..6227b05d07 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java @@ -1,22 +1,24 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; @@ -36,7 +38,7 @@ public class StubResponseDatabase { } public static void MockUpdateRequestDB(String fileName){ - stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + stubFor(post(urlEqualTo("/services/RequestsDbAdapter")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") @@ -44,7 +46,7 @@ public class StubResponseDatabase { } public static void mockUpdateRequestDB(int statusCode, String reponseFile) { - stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + stubFor(post(urlEqualTo("/services/RequestsDbAdapter")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") @@ -82,7 +84,8 @@ public class StubResponseDatabase { } public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String serviceModelVersion, String responseFile){ - stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid + + stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" + + serviceModelInvariantUuid + "&serviceModelVersion=" + serviceModelVersion)) .willReturn(aResponse() .withStatus(200) @@ -91,7 +94,7 @@ public class StubResponseDatabase { } public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String responseFile){ - stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid)) + stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") @@ -106,5 +109,10 @@ public class StubResponseDatabase { .withBodyFile(responseFile))); } - + public static void MockPostRequestDB(){ + stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml"))); + } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java index 8baeb1b137..d88509cb57 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java @@ -1,22 +1,24 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.containing; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseOof.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java index b969b382c0..335fd94f5b 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseOof.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java @@ -1,13 +1,15 @@ -/* +/*- * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,10 +18,7 @@ * ============LICENSE_END========================================================= */ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java index fd13084613..809616dff0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java @@ -1,22 +1,24 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.containing; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java index f41d6d7dba..e0c51b794c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java @@ -1,28 +1,31 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.containing; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; /** * Please describe the StubResponseSDNC.java class @@ -47,7 +50,7 @@ public class StubResponseSDNCAdapter { } public static void mockSDNCAdapter(int statusCode) { - stubFor(post(urlEqualTo("/SDNCAdapter")) + stubFor(post(urlMatching(".*/SDNCAdapter")) .willReturn(aResponse() .withStatus(statusCode))); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java index c16ac43d41..22d3191821 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java @@ -1,13 +1,15 @@ -/* +/*- * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,10 +18,7 @@ * ============LICENSE_END========================================================= */ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; @@ -29,7 +28,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; /** * Please describe the StubResponseSNIRO.java class * - * @author cb645j */ public class StubResponseSNIRO { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java index d518ab0b1c..91ecbd23b4 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java @@ -1,22 +1,24 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.containing; @@ -76,55 +78,55 @@ public class StubResponseVNFAdapter { } public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) { - stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + stubFor(post(urlEqualTo("/services/rest/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)) + stubFor(put(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/vnfs/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId)) + stubFor(put(urlEqualTo("/services/rest/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)) + stubFor(put(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + stubFor(put(urlEqualTo("/services/rest/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)) + stubFor(delete(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + stubFor(delete(urlEqualTo("/services/rest/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")) + stubFor(delete(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId + "/rollback")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlEqualTo("/vnfs/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback")) + stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); @@ -163,19 +165,19 @@ public class StubResponseVNFAdapter { } public static void mockVNFAdapterRest(String vnfId) { - stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules")) + stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules")) .willReturn(aResponse() .withStatus(200))); - stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules")) + stubFor(post(urlEqualTo("/services/rest/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")) + stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules")) .willReturn(aResponse() .withStatus(500))); - stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules")) + stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules")) .willReturn(aResponse() .withStatus(500))); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java index 2eebe94f2b..63abf4d064 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterAsyncTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java @@ -18,15 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.HttpClient; +import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.BinaryFile; import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; @@ -39,12 +42,13 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; * By definition, the async API sends a 202 (with no body) in the sync response. * */ -public class VnfAdapterAsyncTransformer extends ResponseTransformer { +public class VnfAdapterAsyncTransformer extends ResponseDefinitionTransformer { public VnfAdapterAsyncTransformer() { } - - public String name() { + + @Override + public String getName() { return "vnf-adapter-async"; } @@ -61,7 +65,7 @@ public class VnfAdapterAsyncTransformer extends ResponseTransformer { */ @Override public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { + FileSource fileSource, Parameters parameters) { String requestBody = request.getBodyAsString(); @@ -146,13 +150,10 @@ public class VnfAdapterAsyncTransformer extends ResponseTransformer { // TODO Auto-generated catch block e1.printStackTrace(); } - System.out.println("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()); + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java index 23921da8d8..de21d64863 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java @@ -1,43 +1,46 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; -import javax.xml.ws.Endpoint; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; 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 { +public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateMockTransformer.class); private String notifyCallbackResponse; private String ackResponse; @@ -47,13 +50,13 @@ public class VnfAdapterCreateMockTransformer extends ResponseTransformer { } @Override - public String name() { + public String getName() { return "vnf-adapter-create-transformer"; } @Override public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { + FileSource fileSource, Parameters parameters) { String requestBody = request.getBodyAsString(); @@ -127,13 +130,10 @@ public class VnfAdapterCreateMockTransformer extends ResponseTransformer { 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()); + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + Response response = client.post(payLoad); + LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); //System.err.println("Successfully posted callback:" + result.getStatus()); } catch (Exception e) { // TODO Auto-generated catch block diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java index ee6972e46e..99ad84dad4 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java @@ -1,39 +1,45 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; -package org.openecomp.mso.bpmn.mock; +import javax.ws.rs.core.UriBuilder; -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; 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 { +public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterDeleteMockTransformer.class); private String notifyCallbackResponse; private String ackResponse; @@ -43,13 +49,13 @@ public class VnfAdapterDeleteMockTransformer extends ResponseTransformer { } @Override - public String name() { + public String getName() { return "vnf-adapter-delete-transformer"; } @Override public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { + FileSource fileSource, Parameters parameters) { // System.err.println("notifyCallbackResponse:" + notifyCallbackResponse); @@ -124,14 +130,10 @@ public class VnfAdapterDeleteMockTransformer extends ResponseTransformer { // 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()); + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block System.out.println("catch error in - request.post() "); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java index 1582071d3a..7ad687a2b3 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java @@ -1,46 +1,48 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ -package org.openecomp.mso.bpmn.mock; +package org.onap.so.bpmn.mock; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import javax.ws.rs.core.UriBuilder; -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; 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{ +public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransformer{ - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterQueryMockTransformer.class); private String notifyCallbackResponse; private String ackResponse; @@ -55,13 +57,13 @@ public class VnfAdapterQueryMockTransformer extends ResponseTransformer{ } @Override - public String name() { + public String getName() { return "vnf-adapter-query-transformer"; } @Override public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { + FileSource fileSource, Parameters parameters) { String requestBody = request.getBodyAsString(); @@ -144,12 +146,10 @@ public class VnfAdapterQueryMockTransformer extends ResponseTransformer{ } 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()); + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + client.post(payLoad); } 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/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java index 186fd35b6f..560915d1f1 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java @@ -1,40 +1,45 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; -package org.openecomp.mso.bpmn.mock; +import javax.ws.rs.core.UriBuilder; -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; 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 { +public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterRollbackMockTransformer.class); private String notifyCallbackResponse; private String ackResponse; @@ -49,13 +54,13 @@ public class VnfAdapterRollbackMockTransformer extends ResponseTransformer { } @Override - public String name() { + public String getName() { return "vnf-adapter-rollback-transformer"; } @Override public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { + FileSource fileSource, Parameters parameters) { String requestBody = request.getBodyAsString(); @@ -126,14 +131,10 @@ public class VnfAdapterRollbackMockTransformer extends ResponseTransformer { } 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()); + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + client.post(payLoad); } 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/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java index 7808b47d24..9e8927102a 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java @@ -1,44 +1,45 @@ -/* - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.mock; -package org.openecomp.mso.bpmn.mock; +import javax.ws.rs.core.UriBuilder; -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; 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 { +public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterUpdateMockTransformer.class); private String notifyCallbackResponse; private String requestId; @@ -51,15 +52,15 @@ public class VnfAdapterUpdateMockTransformer extends ResponseTransformer { public VnfAdapterUpdateMockTransformer(String requestId) { this.requestId = requestId; } - - - public String name() { + + @Override + public String getName() { return "vnf-adapter-update-transformer"; } @Override public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource) { + FileSource fileSource, Parameters parameters) { String requestBody = request.getBodyAsString(); @@ -130,14 +131,10 @@ public class VnfAdapterUpdateMockTransformer extends ResponseTransformer { } 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()); + HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + client.post(payLoad); } catch (Exception e) { System.out.println("catch error in - request.post() "); LOGGER.debug("Exception :",e); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java new file mode 100644 index 0000000000..a72db062aa --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBDecompPojoTest.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterNonConcrete; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import org.junit.Test; +import org.onap.so.openpojo.rules.EqualsAndHashCodeTester; +import org.onap.so.openpojo.rules.HasEqualsAndHashCodeRule; + +public class BBDecompPojoTest { + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.onap.so.bpmn.servicedecomposition.bbobjects"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new EqualsAndHashCodeTester()) + .with(new HasEqualsAndHashCodeRule()) + .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterNonConcrete()); + } + + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java new file mode 100644 index 0000000000..801314b2ae --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition; + +import org.junit.Test; +import org.onap.so.BaseTest; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterNonConcrete; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SerializableMustHaveSerialVersionUIDRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + + +public class BBPojoTest extends BaseTest{ + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.onap.so.bpmn.servicedecomposition.bbobjects"); + test("org.onap.so.bpmn.servicedecomposition.modelinfo"); + test("org.onap.so.bpmn.servicedecomposition.entities"); + test("org.onap.so.bpmn.servicedecomposition.homingobjects"); + test("org.onap.so.bpmn.servicedecomposition.generalobjects"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .with(new SerializableMustHaveSerialVersionUIDRule()) + .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterNonConcrete()); + } + + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java new file mode 100644 index 0000000000..5f90f1e827 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java @@ -0,0 +1,221 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition; + +import static org.junit.Assert.assertEquals; + +import java.util.HashMap; +import java.util.List; + +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.*; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; + +public class ExtractPojosForBBTest extends BaseTest{ + ExtractPojosForBB extractPojos = new ExtractPojosForBB(); + private BuildingBlockExecution execution; + private GeneralBuildingBlock gBBInput; + private HashMap<ResourceKey, String> lookupKeyMap; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void before() { + execution = new DelegateExecutionImpl(new ExecutionImpl()); + execution.setVariable("testProcessKey", "AAICreateTasksTests"); + gBBInput = new GeneralBuildingBlock(); + execution.setVariable("gBBInput", gBBInput); + lookupKeyMap = new HashMap<>(); + execution.setVariable("lookupKeyMap", lookupKeyMap); + } + + @Test + public void get() throws BBObjectNotFoundException { + ServiceInstance serviceInstancePend = new ServiceInstance(); + serviceInstancePend.setServiceInstanceId("abc"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstancePend.getServiceInstanceId()); + + VpnBondingLink vpnBondingLinkPend = new VpnBondingLink(); + vpnBondingLinkPend.setVpnBondingLinkId("testVpnBondingLink"); + serviceInstancePend.getVpnBondingLinks().add(vpnBondingLinkPend); + lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLinkPend.getVpnBondingLinkId()); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("abc"); + customer.getVpnBindings().add(vpnBinding); + lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId()); + + List<GenericVnf> vnfsPend = serviceInstancePend.getVnfs(); + GenericVnf vnfPend = new GenericVnf(); + vnfPend.setVnfId("abc"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfPend.getVnfId()); + + List<VfModule> vfModulesPend = vnfPend.getVfModules(); + VfModule vfModulePend = new VfModule(); + vfModulePend.setVfModuleId("abc"); + vfModulesPend.add(vfModulePend); + vnfsPend.add(vnfPend); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModulePend.getVfModuleId()); + + List<L3Network> networksPend = serviceInstancePend.getNetworks(); + L3Network networkPend = new L3Network(); + networkPend.setNetworkId("abc"); + networksPend.add(networkPend); + lookupKeyMap.put(ResourceKey.NETWORK_ID, networkPend.getNetworkId()); + + List<VolumeGroup> volumeGroupsPend = serviceInstancePend.getVnfs().get(0).getVolumeGroups(); + VolumeGroup volumeGroupPend = new VolumeGroup(); + volumeGroupPend.setVolumeGroupId("abc"); + volumeGroupsPend.add(volumeGroupPend); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupPend.getVolumeGroupId()); + + List<AllottedResource> allotedResourcesPend = serviceInstancePend.getAllottedResources(); + AllottedResource allotedResourcePend = new AllottedResource(); + allotedResourcePend.setId("abc"); + allotedResourcesPend.add(allotedResourcePend); + lookupKeyMap.put(ResourceKey.ALLOTTED_RESOURCE_ID, allotedResourcePend.getId()); + + Configuration configurationPend = new Configuration(); + configurationPend.setConfigurationId("abc"); + serviceInstancePend.getConfigurations().add(configurationPend); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configurationPend.getConfigurationId()); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstancePend); + gBBInput.setCustomer(customer); + + ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, "abc"); + assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId()); + GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "abc"); + assertEquals(extractVnfPend.getVnfId(), vnfPend.getVnfId()); + L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID, "abc"); + assertEquals(extractNetworkPend.getNetworkId(), networkPend.getNetworkId()); + VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, "abc"); + assertEquals(extractVolumeGroupPend.getVolumeGroupId(), volumeGroupPend.getVolumeGroupId()); + AllottedResource extractallotedResourcePend = extractPojos.extractByKey(execution, + ResourceKey.ALLOTTED_RESOURCE_ID, "abc"); + assertEquals(extractallotedResourcePend.getId(), allotedResourcePend.getId()); + Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID, + "abc"); + assertEquals(extractConfigurationPend.getConfigurationId(), configurationPend.getConfigurationId()); + VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "abc"); + assertEquals(extractVpnBinding.getVpnId(), vpnBinding.getVpnId()); + + VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "abc"); + assertEquals(extractVfModulePend.getVfModuleId(), vfModulePend.getVfModuleId()); + + VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "testVpnBondingLink"); + assertEquals(extractVpnBondingLinkPend.getVpnBondingLinkId(), vpnBondingLinkPend.getVpnBondingLinkId()); + } + + @Test + public void siError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + + extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, "abc"); + } + + @Test + public void vnfError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "bbb"); + } + + @Test + public void vfModuleError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "bbb"); + } + + @Test + public void configurationError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID, "bbb"); + } + @Test + public void allotedError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID, "bbb"); + } + @Test + public void vpnBindingError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "bbb"); + } + + @Test + public void vpnBondingLinkError() throws BBObjectNotFoundException { + expectedException.expect(BBObjectNotFoundException.class); + Customer customer = new Customer(); + customer.setServiceSubscription(new ServiceSubscription()); + ServiceInstance serviceInstance = new ServiceInstance(); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setCustomer(customer); + extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "bbb"); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/SerializationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/SerializationTest.java new file mode 100644 index 0000000000..cfafe1622b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/SerializationTest.java @@ -0,0 +1,130 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition; + +import static org.junit.Assert.assertEquals; + +import java.io.ByteArrayOutputStream; +import java.io.Externalizable; +import java.io.File; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +import org.junit.Test; +import org.onap.so.SerializableChecker; +import org.onap.so.SerializableChecker.SerializationFailure; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class SerializationTest { + + private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; + private static final String FLOW_VAR_NAME = "flowToBeCalled"; + private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap"; + private static final String GBB_INPUT_VAR_NAME = "gBBInput"; + protected ObjectMapper mapper = new ObjectMapper(); + + @Test + public void testSerializationOfAllPojos() throws IOException { + GeneralBuildingBlock gbb = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + DelegateExecution execution = new ExecutionImpl(); + execution.setVariable(FLOW_VAR_NAME, "AssignServiceInstanceBB"); + execution.setVariable(GBB_INPUT_VAR_NAME, gbb); + execution.setVariable(LOOKUP_KEY_MAP_VAR_NAME, lookupKeyMap); + System.out.println(execution.getVariables()); + BuildingBlockExecution gBuildingBlockExecution = new DelegateExecutionImpl(execution); + boolean isSerializable = SerializationTest.isSerializable(gBuildingBlockExecution); + assertEquals(true, isSerializable); + } + + public static boolean isSerializable(final Object o) + { + final boolean retVal; + + if(implementsInterface(o)) + { + retVal = attemptToSerialize(o); + } + else + { + retVal = false; + } + + return (retVal); + } + + private static boolean implementsInterface(final Object o) + { + final boolean retVal; + + retVal = ((o instanceof Serializable) || (o instanceof Externalizable)); + + return (retVal); + } + + private static boolean attemptToSerialize(final Object o) + { + final OutputStream sink; + ObjectOutputStream stream; + + stream = null; + + try + { + sink = new ByteArrayOutputStream(); + stream = new ObjectOutputStream(sink); + stream.writeObject(o); + // could also re-serilalize at this point too + } + catch(final IOException ex) + { + return (false); + } + finally + { + if(stream != null) + { + try + { + stream.close(); + } + catch(final IOException ex) + { + // should not be able to happen + } + } + } + + return (true); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputExceptionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputExceptionTest.java new file mode 100644 index 0000000000..9d34a95e79 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputExceptionTest.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.entities.exceptions; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class InvalidBuildingBlockInputExceptionTest { + private static final String MESSAGE = "message"; + private static final Throwable CAUSE = new Throwable(); + private InvalidBuildingBlockInputException invalidBuildingBlockInputException; + + @Test + public void defaultConstructorTest() { + invalidBuildingBlockInputException = new InvalidBuildingBlockInputException(); + assertEquals(null, invalidBuildingBlockInputException.getMessage()); + assertEquals(null, invalidBuildingBlockInputException.getCause()); + } + + @Test + public void messageConstructorTest() { + invalidBuildingBlockInputException = new InvalidBuildingBlockInputException(MESSAGE); + assertEquals(MESSAGE, invalidBuildingBlockInputException.getMessage()); + assertEquals(null, invalidBuildingBlockInputException.getCause()); + } + + @Test + public void causeConstructorTest() { + invalidBuildingBlockInputException = new InvalidBuildingBlockInputException(CAUSE); + assertEquals(CAUSE.toString(), invalidBuildingBlockInputException.getMessage()); // CAUSE.toString because of the implementation of Exception(Throwable cause) + assertEquals(CAUSE, invalidBuildingBlockInputException.getCause()); + } + + @Test + public void messageAndCauseConstructorTest() { + invalidBuildingBlockInputException = new InvalidBuildingBlockInputException(MESSAGE, CAUSE); + assertEquals(MESSAGE, invalidBuildingBlockInputException.getMessage()); + assertEquals(CAUSE, invalidBuildingBlockInputException.getCause()); + } + + @Test + public void messageAndCauseAndFlagsConstructorTest() { + invalidBuildingBlockInputException = new InvalidBuildingBlockInputException(MESSAGE, CAUSE, true, true); + assertEquals(MESSAGE, invalidBuildingBlockInputException.getMessage()); + assertEquals(CAUSE, invalidBuildingBlockInputException.getCause()); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java new file mode 100644 index 0000000000..0abbb2dbe2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -0,0 +1,630 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.hamcrest.CoreMatchers.equalTo; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.mockito.InjectMocks; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResource; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.RequestDetails; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class BBInputSetupMapperLayerTest { + @InjectMocks + BBInputSetupMapperLayer bbInputSetupMapperLayer = new BBInputSetupMapperLayer(); + + ObjectMapper mapper = new ObjectMapper(); + + private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; + + @Test + public void testMapOrchestrationStatusFromAAI() { + OrchestrationStatus expected = OrchestrationStatus.INVENTORIED; + String orchStatusInput = "Inventoried"; + OrchestrationStatus actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.ASSIGNED; + orchStatusInput = "Assigned"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.ACTIVE; + orchStatusInput = "Active"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.CREATED; + orchStatusInput = "Created"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.PRECREATED; + orchStatusInput = "PreCreated"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.PENDING_CREATE; + orchStatusInput = "PendingCreate"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.PENDING_DELETE; + orchStatusInput = "PendingDelete"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.PENDING; + orchStatusInput = "Pending"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + + expected = OrchestrationStatus.PENDING_ACTIVATION; + orchStatusInput = "PendingActivation"; + actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapOrchestrationFuzzyCases() { + List<String> values = Arrays.asList("pending-create", "pending_Create", "pendinggcreate", "PendingCreate"); + values.forEach(value -> { + assertThat(bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(value), equalTo(OrchestrationStatus.PENDING_CREATE)); + }); + } + + @Test + public void testMapAAICustomer() throws IOException { + Customer expected = mapper.readValue( + new File(RESOURCE_PATH+"Customer.json"), + Customer.class); + + org.onap.aai.domain.yang.Customer customerAAI = mapper.readValue( + new File(RESOURCE_PATH+"Customer_AAI.json"), org.onap.aai.domain.yang.Customer.class); + + Customer actual = bbInputSetupMapperLayer.mapAAICustomer(customerAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIServiceSubscription() throws IOException { + ServiceSubscription expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceSubscriptionExpected.json"), ServiceSubscription.class); + + org.onap.aai.domain.yang.ServiceSubscription svcSubscriptionAAI = mapper.readValue( + new File(RESOURCE_PATH + "ServiceSubscription_AAI.json"), org.onap.aai.domain.yang.ServiceSubscription.class); + + ServiceSubscription actual = bbInputSetupMapperLayer.mapAAIServiceSubscription(svcSubscriptionAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIProject() throws IOException { + Project expected = mapper.readValue(new File(RESOURCE_PATH+"Project.json"),Project.class); + + org.onap.aai.domain.yang.Project projectAAI = new org.onap.aai.domain.yang.Project(); + projectAAI.setProjectName("projectName"); + + Project actual = bbInputSetupMapperLayer.mapAAIProject(projectAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapRequestProject() throws IOException { + Project expected = mapper.readValue(new File(RESOURCE_PATH+"Project.json"),Project.class); + + org.onap.so.serviceinstancebeans.Project requestProject = new org.onap.so.serviceinstancebeans.Project(); + requestProject.setProjectName("projectName"); + + Project actual = bbInputSetupMapperLayer.mapRequestProject(requestProject); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIOwningEntity() throws IOException { + OwningEntity expected = mapper.readValue(new File(RESOURCE_PATH+"OwningEntity.json"),OwningEntity.class); + + org.onap.aai.domain.yang.OwningEntity entityAAI = new org.onap.aai.domain.yang.OwningEntity(); + entityAAI.setOwningEntityId("owningEntityId"); + entityAAI.setOwningEntityName("owningEntityName"); + + OwningEntity actual = bbInputSetupMapperLayer.mapAAIOwningEntity(entityAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapRequestOwningEntity() throws IOException { + OwningEntity expected = mapper.readValue(new File(RESOURCE_PATH+"OwningEntity.json"),OwningEntity.class); + + org.onap.so.serviceinstancebeans.OwningEntity requestOwningEntity = new org.onap.so.serviceinstancebeans.OwningEntity(); + requestOwningEntity.setOwningEntityId("owningEntityId"); + requestOwningEntity.setOwningEntityName("owningEntityName"); + + OwningEntity actual = bbInputSetupMapperLayer.mapRequestOwningEntity(requestOwningEntity); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIPlatform() throws IOException { + Platform expected = mapper.readValue(new File(RESOURCE_PATH+"Platform.json"),Platform.class); + + org.onap.aai.domain.yang.Platform platformAAI = new org.onap.aai.domain.yang.Platform(); + platformAAI.setPlatformName("platformName"); + + Platform actual = bbInputSetupMapperLayer.mapAAIPlatform(platformAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAILineOfBusiness() throws IOException { + LineOfBusiness expected = mapper.readValue(new File(RESOURCE_PATH+"LineOfBusiness.json"),LineOfBusiness.class); + + org.onap.aai.domain.yang.LineOfBusiness lobAAI = new org.onap.aai.domain.yang.LineOfBusiness(); + lobAAI.setLineOfBusinessName("lineOfBusinessName"); + + LineOfBusiness actual = bbInputSetupMapperLayer.mapAAILineOfBusiness(lobAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAINetworkPolicy() throws JsonParseException, JsonMappingException, IOException { + NetworkPolicy expectedNetworkPolicy = mapper.readValue(new File(RESOURCE_PATH + "NetworkPolicy.json"), NetworkPolicy.class); + + org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy = new org.onap.aai.domain.yang.NetworkPolicy(); + aaiNetworkPolicy.setNetworkPolicyId("networkPolicyId"); + aaiNetworkPolicy.setNetworkPolicyFqdn("networkPolicyFqdn"); + aaiNetworkPolicy.setHeatStackId("heatStackId"); + aaiNetworkPolicy.setResourceVersion("resourceVersion"); + + NetworkPolicy actualNetworkPolicy = bbInputSetupMapperLayer.mapAAINetworkPolicy(aaiNetworkPolicy); + + assertThat(actualNetworkPolicy, sameBeanAs(expectedNetworkPolicy)); + } + + @Test + public void testMapAAIVolumeGroup() throws JsonParseException, JsonMappingException, IOException { + VolumeGroup expectedVolumeGroup = mapper.readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class); + + org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = mapper.readValue( + new File(RESOURCE_PATH + "VolumeGroup_AAI.json"), org.onap.aai.domain.yang.VolumeGroup.class); + + VolumeGroup actualVolumeGroup = bbInputSetupMapperLayer.mapAAIVolumeGroup(aaiVolumeGroup); + + assertThat(actualVolumeGroup, sameBeanAs(expectedVolumeGroup)); + } + + @Test + public void testMapCatalogServiceIntoServiceInstance() throws IOException { + ModelInfoServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ModelInfoServiceInstance.json"), + ModelInfoServiceInstance.class); + + Service catalogService = mapper.readValue( + new File(RESOURCE_PATH + "CatalogServiceInput.json"), Service.class); + + ModelInfoServiceInstance actual = bbInputSetupMapperLayer.mapCatalogServiceIntoServiceInstance(catalogService); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCatalogInstanceGroupToInstanceGroup() throws IOException { + ModelInfoInstanceGroup expected = mapper.readValue( + new File(RESOURCE_PATH + "ModelInfoInstanceGroup.json"), + ModelInfoInstanceGroup.class); + + InstanceGroup instanceGroup = mapper.readValue( + new File(RESOURCE_PATH + "InstanceGroup.json"), InstanceGroup.class); + instanceGroup.setCollectionInstanceGroupCustomizations(new ArrayList<>()); + CollectionResourceInstanceGroupCustomization collectionInstanceGroupCust = new CollectionResourceInstanceGroupCustomization(); + collectionInstanceGroupCust.setModelCustomizationUUID("modelCustomizationUUID"); + collectionInstanceGroupCust.setFunction("function"); + collectionInstanceGroupCust.setDescription("description"); + instanceGroup.getCollectionInstanceGroupCustomizations().add(collectionInstanceGroupCust); + CollectionResourceCustomization collectionResourceCust = new CollectionResourceCustomization(); + collectionResourceCust.setModelCustomizationUUID("modelCustomizationUUID"); + ModelInfoInstanceGroup actual = bbInputSetupMapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionResourceCust, instanceGroup); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCollectionNetworkResourceCustToNetworkResourceCust() { + String modelCustomizationUUID = "modelCustomizationUUID"; + String modelInstanceName = "modelInstanceName"; + String networkRole = "networkRole"; + String networkScope = "networkScope"; + String networkTechnology = "networkTechnology"; + String networkType = "networkType"; + + NetworkResourceCustomization expected = new NetworkResourceCustomization(); + expected.setModelCustomizationUUID(modelCustomizationUUID); + expected.setModelInstanceName(modelInstanceName); + expected.setNetworkRole(networkRole); + expected.setNetworkScope(networkScope); + expected.setNetworkTechnology(networkTechnology); + expected.setNetworkType(networkType); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = new CollectionNetworkResourceCustomization(); + collectionNetworkResourceCust.setModelCustomizationUUID(modelCustomizationUUID); + collectionNetworkResourceCust.setModelInstanceName(modelInstanceName); + collectionNetworkResourceCust.setNetworkRole(networkRole); + collectionNetworkResourceCust.setNetworkScope(networkScope); + collectionNetworkResourceCust.setNetworkTechnology(networkTechnology); + collectionNetworkResourceCust.setNetworkType(networkType); + NetworkResourceCustomization actual = bbInputSetupMapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCatalogCollectionToCollection() throws IOException { + ModelInfoCollection expected = mapper.readValue( + new File(RESOURCE_PATH + "ModelInfoCollection.json"), + ModelInfoCollection.class); + + CollectionResourceCustomization collectionCust = mapper.readValue( + new File(RESOURCE_PATH + "CollectionResourceCustomization.json"), + CollectionResourceCustomization.class); + + CollectionResource collectionResource = mapper.readValue( + new File(RESOURCE_PATH + "CollectionResource.json"), + CollectionResource.class); + + ModelInfoCollection actual = bbInputSetupMapperLayer.mapCatalogCollectionToCollection(collectionCust, collectionResource); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIServiceInstanceIntoServiceInstance() throws IOException { + ServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_aaiServiceInstanceToSI.json"), + ServiceInstance.class); + + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstanceAAIInput.json"), + org.onap.aai.domain.yang.ServiceInstance.class); + + ServiceInstance actual = bbInputSetupMapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testSetPlatformAndLOB() throws IOException { + ServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_aaiPlatformAndLOBToSI.json"), + ServiceInstance.class); + + Map<ResourceKey, String> resourcesToBeOrchestrated = new HashMap<>(); + resourcesToBeOrchestrated.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + Platform platformMSO = new Platform(); + platformMSO.setPlatformName("platformName"); + LineOfBusiness lineOfBusinessMSO = new LineOfBusiness(); + lineOfBusinessMSO.setLineOfBusinessName("lineOfBusinessName"); + + ServiceInstance actual = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstanceAAIPlatformAndLOBInput.json"), + ServiceInstance.class); + + bbInputSetupMapperLayer.setPlatformAndLOBIntoServiceInstance(platformMSO, lineOfBusinessMSO, actual, + resourcesToBeOrchestrated); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIL3NetworkIntoL3Network() throws IOException { + L3Network expected = mapper.readValue( + new File(RESOURCE_PATH + "l3NetworkExpected.json"), L3Network.class); + + org.onap.aai.domain.yang.L3Network aaiL3Network = mapper.readValue( + new File(RESOURCE_PATH + "aaiL3NetworkInput.json"), + org.onap.aai.domain.yang.L3Network.class); + + L3Network actual = bbInputSetupMapperLayer.mapAAIL3Network(aaiL3Network); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAIGenericVnfIntoGenericVnf() throws IOException { + GenericVnf expected = mapper.readValue(new File(RESOURCE_PATH + "GenericVnfExpected.json"), GenericVnf.class); + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = mapper.readValue( + new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), org.onap.aai.domain.yang.GenericVnf.class); + + GenericVnf actual = bbInputSetupMapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapAAICollectionIntoCollection() throws JsonParseException, JsonMappingException, IOException { + org.onap.aai.domain.yang.Collection aaiCollection = mapper.readValue( + new File(RESOURCE_PATH + "CollectionInput.json"), org.onap.aai.domain.yang.Collection.class); + + Collection expectedCollection = mapper.readValue(new File(RESOURCE_PATH + "CollectionExpected.json"), Collection.class); + + Collection actualCollection = bbInputSetupMapperLayer.mapAAICollectionIntoCollection(aaiCollection); + + assertThat(actualCollection, sameBeanAs(expectedCollection)); + } + + @Test + public void testMapAAIInstanceGroupIntoInstanceGroup() throws JsonParseException, JsonMappingException, IOException { + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = mapper.readValue( + new File(RESOURCE_PATH + "InstanceGroupInput.json"), org.onap.aai.domain.yang.InstanceGroup.class); + + org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup expectedInstanceGroup = mapper.readValue( + new File(RESOURCE_PATH + "InstanceGroupExpected.json"), org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class); + + org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup actualInstanceGroup = + bbInputSetupMapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); + + assertThat(actualInstanceGroup, sameBeanAs(expectedInstanceGroup)); + } + + @Test + public void testMapAAIRouteTableReferenceIntoRouteTableReference() throws JsonParseException, JsonMappingException, IOException { + org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference = mapper.readValue( + new File(RESOURCE_PATH + "RouteTableReferenceInput.json"), org.onap.aai.domain.yang.RouteTableReference.class); + + RouteTableReference expectedRouteTableReference = mapper.readValue( + new File(RESOURCE_PATH + "RouteTableReferenceExpected.json"), RouteTableReference.class); + + RouteTableReference actualRouteTableReference = bbInputSetupMapperLayer.mapAAIRouteTableReferenceIntoRouteTableReference(aaiRouteTableReference); + + assertThat(actualRouteTableReference, sameBeanAs(expectedRouteTableReference)); + } + + @Test + public void testMapCatalogNetworkToNetwork() throws JsonParseException, JsonMappingException, IOException { + NetworkResourceCustomization networkResourceCustomization = mapper.readValue( + new File(RESOURCE_PATH + "NetworkResourceCustomizationInput.json"), NetworkResourceCustomization.class); + + ModelInfoNetwork expectedModelInfoNetwork = mapper.readValue( + new File(RESOURCE_PATH + "ModelInfoNetworkExpected.json"), ModelInfoNetwork.class); + + ModelInfoNetwork actualModelInfoNetwork = bbInputSetupMapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization); + + assertThat(actualModelInfoNetwork, sameBeanAs(expectedModelInfoNetwork)); + } + + @Test + public void testMapCatalogVnfToVnf() throws IOException { + VnfResourceCustomization vnfResourceCustomization = mapper.readValue( + new File(RESOURCE_PATH + "VnfResourceCustomizationInput.json"), VnfResourceCustomization.class); + + ModelInfoGenericVnf expectedModelInfoGenericVnf = mapper.readValue( + new File(RESOURCE_PATH + "ModelInfoGenericVnfExpected.json"), ModelInfoGenericVnf.class); + + ModelInfoGenericVnf actualModelInfoGenericVnf = bbInputSetupMapperLayer.mapCatalogVnfToVnf(vnfResourceCustomization); + + assertThat(actualModelInfoGenericVnf, sameBeanAs(expectedModelInfoGenericVnf)); + } + + @Test + public void testMapCatalogVfModuleToVfModule() throws JsonParseException, JsonMappingException, IOException { + VfModuleCustomization vfResourceCustomization = mapper.readValue( + new File(RESOURCE_PATH + "VfModuleCustomizationInput.json"), VfModuleCustomization.class); + + ModelInfoVfModule expectedModelInfoVfModule = mapper.readValue(new File(RESOURCE_PATH + "ModelInfoVfModuleExpected.json"), ModelInfoVfModule.class); + + ModelInfoVfModule actualModelInfoVfModule = bbInputSetupMapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization); + + assertThat(actualModelInfoVfModule, sameBeanAs(expectedModelInfoVfModule)); + } + + @Test + public void testMapRequestPlatform() throws JsonParseException, JsonMappingException, IOException { + org.onap.so.serviceinstancebeans.Platform platform = mapper.readValue( + new File(RESOURCE_PATH + "RequestPlatformInput.json"), org.onap.so.serviceinstancebeans.Platform.class); + + Platform expectedPlatform = mapper.readValue(new File(RESOURCE_PATH + "PlatformExpected.json"), Platform.class); + + Platform actualPlatform = bbInputSetupMapperLayer.mapRequestPlatform(platform); + + assertThat(actualPlatform, sameBeanAs(expectedPlatform)); + } + + @Test + public void testMapRequestLineOfBusiness() throws JsonParseException, JsonMappingException, IOException { + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = mapper.readValue( + new File(RESOURCE_PATH + "RequestLineOfBusinessInput.json"), org.onap.so.serviceinstancebeans.LineOfBusiness.class); + + LineOfBusiness expectedLineOfBusiness = mapper.readValue(new File(RESOURCE_PATH + "LineOfBusinessExpected.json"), LineOfBusiness.class); + + LineOfBusiness actualLineOfBusiness = bbInputSetupMapperLayer.mapRequestLineOfBusiness(lineOfBusiness); + + assertThat(actualLineOfBusiness, sameBeanAs(expectedLineOfBusiness)); + } + + @Test + public void testMapAAIConfiguration() throws JsonParseException, JsonMappingException, IOException { + org.onap.aai.domain.yang.Configuration configurationAAI = mapper.readValue( + new File(RESOURCE_PATH + "ConfigurationInput.json"), org.onap.aai.domain.yang.Configuration.class); + + Configuration expectedConfiguration = mapper.readValue( + new File(RESOURCE_PATH + "ConfigurationExpected.json"), Configuration.class); + + Configuration actualConfiguration = bbInputSetupMapperLayer.mapAAIConfiguration(configurationAAI); + + assertThat(actualConfiguration, sameBeanAs(expectedConfiguration)); + } + + @Test + public void testMapRequestContext() throws IOException { + RequestContext expected = mapper.readValue( + new File(RESOURCE_PATH + "RequestContextExpected.json"), + RequestContext.class); + + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), + RequestDetails.class); + RequestContext actual = bbInputSetupMapperLayer.mapRequestContext(requestDetails); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapOrchestrationContext() throws IOException { + OrchestrationContext expected = new OrchestrationContext(); + expected.setIsRollbackEnabled(false); + + RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class); + + OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapLocationContext() { + CloudRegion expected = new CloudRegion(); + expected.setCloudOwner("att-aic"); + expected.setLcpCloudRegionId("cloudRegionId"); + expected.setComplex("complexName"); + expected.setTenantId("tenantId"); + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setTenantId("tenantId"); + cloudConfig.setLcpCloudRegionId("cloudRegionId"); + cloudConfig.setAicNodeClli("aicNodeClli"); + org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion(); + cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setCloudRegionId("cloudRegionId"); + cloudRegion.setComplexName("complexName"); + + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion, "att-aic"); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCloudRegion() { + CloudRegion expected = new CloudRegion(); + expected.setCloudOwner("att-aic"); + expected.setLcpCloudRegionId("cloudRegionId"); + expected.setTenantId("tenantId"); + expected.setCloudRegionVersion("cloudRegionVersion"); + + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setTenantId("tenantId"); + cloudConfig.setLcpCloudRegionId("cloudRegionId"); + cloudConfig.setAicNodeClli("aicNodeClli"); + + org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion(); + cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setCloudRegionId("cloudRegionId"); + cloudRegion.setCloudRegionVersion("cloudRegionVersion"); + + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion, "att-aic"); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCloudRegionWithNullCheck() { + CloudRegion expected = new CloudRegion(); + + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null, null); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testmapCatalogConfigurationToConfiguration() { + String modelCustUUID = "modelCustomizationUUID"; + String modelInvariantUUID = "modelInvariantUUID"; + String modelVersionUUID = "modelUUID"; + ModelInfoConfiguration expected = new ModelInfoConfiguration(); + expected.setModelCustomizationId(modelCustUUID); + expected.setModelInvariantId(modelInvariantUUID); + expected.setModelVersionId(modelVersionUUID); + ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization(); + configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID); + configurationResourceCustomization.setConfigurationResource(new ConfigurationResource()); + configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID); + configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID); + + ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization ); + + assertThat(actual, sameBeanAs(expected)); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java new file mode 100644 index 0000000000..355dc15bbf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -0,0 +1,2433 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.InstanceGroupType; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.ModelType; +import org.onap.so.serviceinstancebeans.RelatedInstance; +import org.onap.so.serviceinstancebeans.RelatedInstanceList; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.RequestInfo; +import org.onap.so.serviceinstancebeans.RequestParameters; +import org.onap.so.serviceinstancebeans.Resources; +import org.onap.so.serviceinstancebeans.SubscriberInfo; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +@RunWith(MockitoJUnitRunner.class) +public class BBInputSetupTest { + private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; + + protected ObjectMapper mapper = new ObjectMapper(); + private static final String CLOUD_OWNER = "att-aic"; + + @Spy + private BBInputSetup SPY_bbInputSetup = new BBInputSetup(); + + @Mock + private BBInputSetupUtils SPY_bbInputSetupUtils; + + @Spy + private BBInputSetupMapperLayer bbInputSetupMapperLayer; + + @Before + public void setup(){ + SPY_bbInputSetup.setBbInputSetupUtils(SPY_bbInputSetupUtils); + SPY_bbInputSetup.setMapperLayer(bbInputSetupMapperLayer); + } + + @Test + public void testGetAlaCarteServiceInstance() throws Exception { + ServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setInstanceName("SharansInstanceName"); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelUuid("modelUUID"); + expected.setModelInfoServiceInstance(modelInfoServiceInstance); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUIDDifferent"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + Service differentService = new Service(); + differentService.setModelUUID("modelUUIDDifferent"); + + doReturn(expected).when(SPY_bbInputSetup).getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId); + doReturn(differentService).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId()); + doReturn(expected.getModelInfoServiceInstance()).when(bbInputSetupMapperLayer) + .mapCatalogServiceIntoServiceInstance(differentService); + + ServiceInstance actual = SPY_bbInputSetup.getALaCarteServiceInstance(service, requestDetails, customer, null, + null, lookupKeyMap, serviceInstanceId, aLaCarte, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test(expected = Exception.class) + public void testGetAlaCarteServiceInstanceException() throws Exception { + ServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setInstanceName("SharansInstanceName"); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelUuid("modelUUID"); + expected.setModelInfoServiceInstance(modelInfoServiceInstance); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUIDDifferent"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + Service differentService = new Service(); + differentService.setModelUUID("modelUUIDDifferent"); + + doReturn(expected).when(SPY_bbInputSetup).getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId); + doReturn(null).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId()); + + ServiceInstance actual = SPY_bbInputSetup.getALaCarteServiceInstance(service, requestDetails, customer, null, + null, lookupKeyMap, serviceInstanceId, aLaCarte, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetCustomerAndServiceSubscription() throws JsonParseException, JsonMappingException, IOException { + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + SubscriberInfo subscriberInfo = new SubscriberInfo(); + subscriberInfo.setGlobalSubscriberId("globalSubscriberId"); + RequestParameters requestParams = new RequestParameters(); + requestParams.setSubscriptionServiceType("subscriptionServiceType"); + requestDetails.setRequestParameters(requestParams); + requestDetails.setSubscriberInfo(subscriberInfo); + String resourceId = "resourceId"; + Customer expected = new Customer(); + expected.setGlobalCustomerId("globalCustomerId"); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("subscriptionServiceType"); + + doReturn(expected).when(this.SPY_bbInputSetup).getCustomerFromRequest(requestDetails); + doReturn(serviceSubscription).when(this.SPY_bbInputSetup).getServiceSubscription(requestDetails, expected); + + Customer actual = this.SPY_bbInputSetup.getCustomerAndServiceSubscription(requestDetails, resourceId); + + assertThat(actual, sameBeanAs(expected)); + + requestDetails.setSubscriberInfo(null); + + doReturn(null).when(this.SPY_bbInputSetup).getServiceSubscription(requestDetails, expected); + doReturn(expected).when(this.SPY_bbInputSetup).getCustomerFromURI(resourceId); + doReturn(serviceSubscription).when(this.SPY_bbInputSetup).getServiceSubscriptionFromURI(resourceId, expected); + + assertThat(actual, sameBeanAs(expected)); + + } + + @Test + public void testSetHomingFlag() throws JsonParseException, JsonMappingException, IOException { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + GenericVnf genericVnfExpected = new GenericVnf(); + genericVnfExpected.setVnfId("vnfId"); + genericVnfExpected.setCallHoming(true); + expected.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs().add(genericVnfExpected); + boolean homing = true; + GenericVnf genericVnfActual = new GenericVnf(); + genericVnfActual.setVnfId("vnfId"); + genericVnfActual.setCallHoming(false); + GeneralBuildingBlock actual = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + actual.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs().add(genericVnfActual); + + SPY_bbInputSetup.setHomingFlag(actual, homing, lookupKeyMap); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetExecuteBBFromExecution() throws IOException { + ExecuteBuildingBlock expected = new ExecuteBuildingBlock(); + BuildingBlock bb = new BuildingBlock(); + bb.setBpmnFlowName("AssignServiceInstanceBB"); + expected.setBuildingBlock(bb); + expected.setRequestId("00032ab7-3fb3-42e5-965d-8ea592502017"); + DelegateExecution execution = Mockito.mock(DelegateExecution.class); + doReturn(expected).when(execution).getVariable(any(String.class)); + ExecuteBuildingBlock actual = SPY_bbInputSetup.getExecuteBBFromExecution(execution); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetGBB() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + executeBB.setRequestId("requestId"); + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.service); + requestDetails.setModelInfo(modelInfo); + RequestParameters requestParams = new RequestParameters(); + requestParams.setaLaCarte(true); + requestDetails.setRequestParameters(requestParams); + doReturn(requestDetails).when(SPY_bbInputSetupUtils).getRequestDetails(executeBB.getRequestId()); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String resourceId = "123"; + String requestAction = "createInstance"; + doReturn(expected).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doNothing().when(SPY_bbInputSetup).populateLookupKeyMapWithIds(any(WorkflowResourceIds.class), any()); + boolean aLaCarte = true; + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, + resourceId, null); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetGBBALaCarteNonService() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String requestAction = "createInstance"; + Service service = Mockito.mock(Service.class); + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + String resourceId = "123"; + String vnfType = "vnfType"; + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + aaiServiceInstance.setModelVersionId("modelVersionId"); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "instanceId"); + doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + + doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName", + serviceInstance, lookupKeyMap, resourceId, vnfType); + doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); + doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction, null); + + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId, vnfType); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test(expected = Exception.class) + public void testGetGBBALaCarteNonServiceWithoutServiceModelInfo() throws Exception { + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String requestAction = "createInstance"; + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + aaiServiceInstance.setModelVersionId("modelVersionId"); + String resourceId = "123"; + String vnfType = "vnfType"; + doReturn(null).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); + + SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, + vnfType); + } + + @Test + public void testGetGBBALaCarteNonServiceWithoutRelatedInstances() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withoutRelatedInstanceList.json"), RequestDetails.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String requestAction = "createInstance"; + Service service = Mockito.mock(Service.class); + String resourceId = "123"; + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + aaiServiceInstance.setModelVersionId("modelVersionId"); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + String vnfType = "vnfType"; + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "instanceId"); + doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + + doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName", + serviceInstance, lookupKeyMap, resourceId, vnfType); + + doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); + doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction,null); + + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId, vnfType); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetGBBALaCarteService() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + + org.onap.so.serviceinstancebeans.Project requestProject = new org.onap.so.serviceinstancebeans.Project(); + org.onap.so.serviceinstancebeans.OwningEntity requestOwningEntity = new org.onap.so.serviceinstancebeans.OwningEntity(); + requestDetails.setProject(requestProject); + requestDetails.setOwningEntity(requestOwningEntity); + + Service service = Mockito.mock(Service.class); + Customer customer = Mockito.mock(Customer.class); + ServiceSubscription serviceSubscription = Mockito.mock(ServiceSubscription.class); + Project project = Mockito.mock(Project.class); + OwningEntity owningEntity = Mockito.mock(OwningEntity.class); + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + String resourceId = "123"; + String requestAction = "createInstance"; + executeBB.setaLaCarte(true); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(project).when(bbInputSetupMapperLayer).mapRequestProject(requestDetails.getProject()); + doReturn(owningEntity).when(bbInputSetupMapperLayer) + .mapRequestOwningEntity(requestDetails.getOwningEntity()); + + doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId); + doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer, + project, owningEntity, lookupKeyMap, resourceId, executeBB.isaLaCarte(), + executeBB.getBuildingBlock().getBpmnFlowName()); + doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction, customer); + + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetGBBALaCarteServiceFindServiceByModelVersionId() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + + org.onap.so.serviceinstancebeans.Project requestProject = new org.onap.so.serviceinstancebeans.Project(); + org.onap.so.serviceinstancebeans.OwningEntity requestOwningEntity = new org.onap.so.serviceinstancebeans.OwningEntity(); + requestDetails.setProject(requestProject); + requestDetails.setOwningEntity(requestOwningEntity); + + Service service = Mockito.mock(Service.class); + Customer customer = Mockito.mock(Customer.class); + ServiceSubscription serviceSubscription = Mockito.mock(ServiceSubscription.class); + Project project = Mockito.mock(Project.class); + OwningEntity owningEntity = Mockito.mock(OwningEntity.class); + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + String resourceId = "123"; + String requestAction = "createInstance"; + executeBB.setaLaCarte(true); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + + doReturn(null).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelVersionAndModelInvariantUUID( + requestDetails.getModelInfo().getModelVersion(), requestDetails.getModelInfo().getModelInvariantId()); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(project).when(bbInputSetupMapperLayer).mapRequestProject(requestDetails.getProject()); + doReturn(owningEntity).when(bbInputSetupMapperLayer) + .mapRequestOwningEntity(requestDetails.getOwningEntity()); + + doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId); + doReturn(serviceSubscription).when(SPY_bbInputSetup).getServiceSubscription(requestDetails, customer); + doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer, + project, owningEntity, lookupKeyMap, resourceId, executeBB.isaLaCarte(), + executeBB.getBuildingBlock().getBpmnFlowName()); + doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction,customer); + + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetGBBALaCarteServiceNoProjectNoOE() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + + Service service = Mockito.mock(Service.class); + Customer customer = Mockito.mock(Customer.class); + ServiceSubscription serviceSubscription = Mockito.mock(ServiceSubscription.class); + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + String resourceId = "123"; + String requestAction = "createInstance"; + executeBB.setaLaCarte(true); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + + Map<String, String> uriKeys = new HashMap<>(); + uriKeys.put("global-customer-id", "globalCustomerId"); + uriKeys.put("service-type", "serviceType"); + doReturn(uriKeys).when(SPY_bbInputSetupUtils) + .getURIKeysFromServiceInstance(resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + + doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId); + doReturn(serviceSubscription).when(SPY_bbInputSetup).getServiceSubscription(requestDetails, customer); + doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer, + null, null, lookupKeyMap, resourceId, executeBB.isaLaCarte(), + executeBB.getBuildingBlock().getBpmnFlowName()); + doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, + executeBB, requestAction,customer); + + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceInstanceHelperCreateScenario() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setInstanceName("SharansInstanceName"); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + ServiceInstance expected = new ServiceInstance(); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + Service service = new Service(); + service.setModelUUID("modelUUID"); + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + + doReturn(null).when(SPY_bbInputSetupUtils).getAAIServiceInstanceByName(requestInfo.getInstanceName(), customer); + doReturn(null).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId); + + + doReturn(expected).when(SPY_bbInputSetup).createServiceInstance(requestDetails, null, null, + lookupKeyMap, serviceInstanceId); + + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceInstanceHelperCreateScenarioExisting() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setInstanceName("SharansInstanceName"); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + ServiceInstance expected = new ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUID"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils) + .getAAIServiceInstanceByName(requestInfo.getInstanceName(), customer); + doReturn(expected).when(SPY_bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceInstanceHelperCreateScenarioExistingNoNameButWithId() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setInstanceName("SharansInstanceName"); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + ServiceInstance expected = new ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUID"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String bbName = "ActivateServiceInstanceBB"; + + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId); + doReturn(expected).when(SPY_bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceInstanceHelperCreateScenarioExistingNoNameButWithIdDifferentModel() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + ServiceInstance expected = new ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUIDDifferent"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String bbName = "ActivateServiceInstanceBB"; + Service differentService = new Service(); + differentService.setModelUUID("modelUUIDDifferent"); + + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId); + doReturn(differentService).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId()); + doReturn(expected).when(SPY_bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + assertThat(actual, sameBeanAs(expected)); + } + + @Test(expected = Exception.class) + public void testGetServiceInstanceHelperCreateScenarioExistingNoNameButWithIdExceptionThrown() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestDetails.setRequestInfo(requestInfo); + Customer customer = new Customer(); + String serviceInstanceId = "SharansInstanceId"; + boolean aLaCarte = true; + Service service = new Service(); + service.setModelUUID("modelUUID"); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setModelVersionId("modelUUIDDifferent"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + } + + @Test + public void testPopulateObjectsOnAssignAndCreateFlows() throws Exception { + String bbName = AssignFlows.SERVICE_INSTANCE.toString(); + String instanceName = "instanceName"; + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); + RequestDetails requestDetails = Mockito.mock(RequestDetails.class); + ModelInfo modelInfo = Mockito.mock(ModelInfo.class); + RequestInfo requestInfo = Mockito.mock(RequestInfo.class); + RelatedInstanceList[] relatedInstanceList = new RelatedInstanceList[] {}; + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + org.onap.so.serviceinstancebeans.Platform platform = Mockito + .mock(org.onap.so.serviceinstancebeans.Platform.class); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = Mockito + .mock(org.onap.so.serviceinstancebeans.LineOfBusiness.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + + doNothing().when(SPY_bbInputSetup).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, null); + doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, + service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); + doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); + doReturn(modelInfo).when(requestDetails).getModelInfo(); + doReturn(requestInfo).when(requestDetails).getRequestInfo(); + doReturn(instanceName).when(requestInfo).getInstanceName(); + doReturn(platform).when(requestDetails).getPlatform(); + doReturn(lineOfBusiness).when(requestDetails).getLineOfBusiness(); + doReturn(relatedInstanceList).when(requestDetails).getRelatedInstanceList(); + doReturn(cloudConfiguration).when(requestDetails).getCloudConfiguration(); + + doReturn(ModelType.network).when(modelInfo).getModelType(); + + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, + lookupKeyMap, resourceId, vnfType); + + verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, null); + + doReturn(ModelType.vnf).when(modelInfo).getModelType(); + + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, + lookupKeyMap, resourceId, vnfType); + + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, + service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + + doReturn(ModelType.volumeGroup).when(modelInfo).getModelType(); + + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, + lookupKeyMap, resourceId, vnfType); + + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); + + doReturn(ModelType.vfModule).when(modelInfo).getModelType(); + + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, + lookupKeyMap, resourceId, vnfType); + + verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); + } + + @Test + public void testPopulateGBBWithSIAndAdditionalInfo() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class); + RequestContext requestContext = mapper.readValue(new File(RESOURCE_PATH + "RequestContextExpected.json"), + RequestContext.class); + ServiceInstance serviceInstance = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); + cloudRegion.setComplex("complexName"); + cloudRegion.setTenantId("tenantId"); + + Map<String, String> uriKeys = new HashMap<>(); + uriKeys.put("global-customer-id","global-customer-id"); + uriKeys.put("service-type","service-type"); + + Customer customer = new Customer(); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("subscriptionServiceType"); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setSubscriberName("subscriberName"); + customer.setSubscriberType("subscriberType"); + customer.setServiceSubscription(serviceSubscription); + + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + + String requestAction = "createInstance"; + + doReturn(uriKeys).when(SPY_bbInputSetupUtils).getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId()); + doReturn(customer).when(SPY_bbInputSetup).mapCustomer(uriKeys.get("global-customer-id"),uriKeys.get("service-type")); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(orchestrationContext).when(bbInputSetupMapperLayer).mapOrchestrationContext(requestDetails); + doReturn(requestContext).when(bbInputSetupMapperLayer).mapRequestContext(requestDetails); + doReturn(cloudRegion).when(bbInputSetupMapperLayer).mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion, + "att-aic"); + + GeneralBuildingBlock actual = SPY_bbInputSetup.populateGBBWithSIAndAdditionalInfo(requestDetails, + serviceInstance, executeBB, requestAction, null); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceInstanceNOAAI() throws Exception { + ServiceInstance expected = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Customer customer = mapper.readValue(new File(RESOURCE_PATH + "Customer.json"), Customer.class); + Project project = mapper.readValue(new File(RESOURCE_PATH + "Project.json"), Project.class); + OwningEntity owningEntity = mapper.readValue(new File(RESOURCE_PATH + "OwningEntity.json"), OwningEntity.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + executeBB.setaLaCarte(true); + BuildingBlock buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); + executeBB.setBuildingBlock(buildingBlock); + RequestDetails requestDetails = new RequestDetails(); + RequestInfo reqInfo = new RequestInfo(); + reqInfo.setInstanceName("serviceInstanceName"); + requestDetails.setRequestInfo(reqInfo); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.service); + requestDetails.setModelInfo(modelInfo); + doReturn(null).when(SPY_bbInputSetupUtils) + .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer); + doReturn(expected.getModelInfoServiceInstance()).when(bbInputSetupMapperLayer) + .mapCatalogServiceIntoServiceInstance(service); + doReturn(null).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(any(String.class)); + String serviceInstanceId = "3655a595-05d1-433c-93c0-3afd6b572545"; + boolean aLaCarte = true; + + ServiceInstance actual = SPY_bbInputSetup.getALaCarteServiceInstance(service, requestDetails, customer, project, + owningEntity, lookupKeyMap, serviceInstanceId, aLaCarte, + executeBB.getBuildingBlock().getBpmnFlowName()); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetServiceSubscription() throws IOException { + ServiceSubscription expected = new ServiceSubscription(); + RequestDetails requestDetails = new RequestDetails(); + RequestParameters params = new RequestParameters(); + params.setSubscriptionServiceType("subscriptionServiceType"); + requestDetails.setRequestParameters(params); + org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = new org.onap.aai.domain.yang.ServiceSubscription(); + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + doReturn(aaiServiceSubscription).when(SPY_bbInputSetupUtils).getAAIServiceSubscription( + customer.getGlobalCustomerId(), requestDetails.getRequestParameters().getSubscriptionServiceType()); + doReturn(expected).when(bbInputSetupMapperLayer).mapAAIServiceSubscription(aaiServiceSubscription); + + ServiceSubscription actual = SPY_bbInputSetup.getServiceSubscription(requestDetails, customer); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetCustomer() throws IOException { + Customer expected = new Customer(); + RequestDetails requestDetails = new RequestDetails(); + SubscriberInfo subscriberInfo = new SubscriberInfo(); + subscriberInfo.setGlobalSubscriberId("globalSubscriberId"); + requestDetails.setSubscriberInfo(subscriberInfo); + org.onap.aai.domain.yang.Customer aaiCustomer = new org.onap.aai.domain.yang.Customer(); + doReturn(aaiCustomer).when(SPY_bbInputSetupUtils) + .getAAICustomer(requestDetails.getSubscriberInfo().getGlobalSubscriberId()); + doReturn(expected).when(bbInputSetupMapperLayer).mapAAICustomer(aaiCustomer); + + Customer actual = SPY_bbInputSetup.getCustomerFromRequest(requestDetails); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetExistingServiceInstance() throws Exception { + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + ServiceInstance expected = new ServiceInstance(); + + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI); + + doNothing().when(SPY_bbInputSetup).addRelationshipsToSI(serviceInstanceAAI, expected); + + ServiceInstance actual = SPY_bbInputSetup.getExistingServiceInstance(serviceInstanceAAI); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testPopulateNetworkCollectionAndInstanceGroupAssign() throws Exception { + Service service = Mockito.mock(Service.class); + String key = "collectionCustId"; + ServiceInstance serviceInstance = mapper.readValue( + new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), + ServiceInstance.class); + String resourceId = "123"; + Collection collection = SPY_bbInputSetup.createCollection(resourceId); + InstanceGroup instanceGroup = SPY_bbInputSetup.createInstanceGroup(); + assertNull(serviceInstance.getCollection()); + doReturn(true).when(SPY_bbInputSetup).isVlanTagging(service, key); + doReturn(collection).when(SPY_bbInputSetup).createCollection(resourceId); + doReturn(instanceGroup).when(SPY_bbInputSetup).createInstanceGroup(); + doNothing().when(SPY_bbInputSetup).mapCatalogCollection(service, collection, key); + doNothing().when(SPY_bbInputSetup).mapCatalogNetworkCollectionInstanceGroup(service, + collection.getInstanceGroup(), key); + NetworkCollectionResourceCustomization networkCollection = new NetworkCollectionResourceCustomization(); + networkCollection.setModelCustomizationUUID(key); + networkCollection.setCollectionResource(new CollectionResource()); + networkCollection.getCollectionResource().setInstanceGroup(new org.onap.so.db.catalog.beans.InstanceGroup()); + networkCollection.getCollectionResource().getInstanceGroup().setToscaNodeType("NetworkCollectionResource"); + networkCollection.getCollectionResource().getInstanceGroup().setType(InstanceGroupType.L3_NETWORK); + networkCollection.getCollectionResource().getInstanceGroup().setCollectionInstanceGroupCustomizations(new ArrayList<>()); + List<CollectionResourceCustomization> customizations = new ArrayList<>(); + customizations.add(networkCollection); + doReturn(customizations).when(service).getCollectionResourceCustomizations(); + + SPY_bbInputSetup.populateNetworkCollectionAndInstanceGroupAssign(service, + AssignFlows.NETWORK_COLLECTION.toString(), serviceInstance, resourceId, key); + + assertNotNull(serviceInstance.getCollection()); + assertNotNull(serviceInstance.getCollection().getInstanceGroup()); + + verify(SPY_bbInputSetup, times(1)).mapCatalogCollection(service, serviceInstance.getCollection(), key); + verify(SPY_bbInputSetup, times(1)).mapCatalogNetworkCollectionInstanceGroup(service, + serviceInstance.getCollection().getInstanceGroup(), key); + } + + @Test + public void testIsVlanTagging() throws Exception { + boolean expected = true; + Service service = Mockito.mock(Service.class); + String key = "collectionCustId"; + NetworkCollectionResourceCustomization networkCollection = new NetworkCollectionResourceCustomization(); + networkCollection.setModelCustomizationUUID(key); + networkCollection.setCollectionResource(new CollectionResource()); + networkCollection.getCollectionResource().setInstanceGroup(new org.onap.so.db.catalog.beans.InstanceGroup()); + networkCollection.getCollectionResource().getInstanceGroup().setToscaNodeType("org.openecomp.resource.cr.NetworkCollectionResource1806"); + List<CollectionResourceCustomization> customizations = new ArrayList<>(); + customizations.add(networkCollection); + doReturn(customizations).when(service).getCollectionResourceCustomizations(); + boolean actual = SPY_bbInputSetup.isVlanTagging(service, key); + assertEquals("Is Vlan Tagging check.", expected, actual); + } + + @Test + public void testPopulateVolumeGroup() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RelatedInstanceList ril = new RelatedInstanceList(); + RelatedInstance ri = new RelatedInstance(); + ModelInfo mi = new ModelInfo(); + mi.setModelType(ModelType.vnf); + mi.setModelCustomizationUuid("vnfModelCustomizationUUID"); + ri.setModelInfo(mi); + ril.setRelatedInstance(ri); + requestDetails.setRelatedInstanceList(new RelatedInstanceList[] { ril }); + + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.volumeGroup); + + RequestInfo reqInfo = new RequestInfo(); + reqInfo.setInstanceName("volumeGroupName"); + requestDetails.setModelInfo(modelInfo); + requestDetails.setRequestInfo(reqInfo); + + ServiceInstance serviceInstance = new ServiceInstance(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("genericVnfId"); + + VolumeGroup vg = new VolumeGroup(); + vg.setVolumeGroupName("volumeGroupName"); + vg.setVolumeGroupId("volumeGroupId"); + vnf.getVolumeGroups().add(vg); + vnf.getVolumeGroups().add(vg); + serviceInstance.getVnfs().add(vnf); + + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId"); + + String bbName = AssignFlows.VOLUME_GROUP.toString(); + String resourceId = "123"; + doNothing().when(SPY_bbInputSetup).mapCatalogVolumeGroup(isA(VolumeGroup.class), eq(modelInfo), + eq(service), eq("vnfModelCustomizationUUID")); + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiGenericVnf.setModelCustomizationId("vnfModelCustomizationUUID"); + doReturn(aaiGenericVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + + SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); + verify(SPY_bbInputSetup, times(2)).mapCatalogVolumeGroup(vg, modelInfo, service, "vnfModelCustomizationUUID"); + vnf.getVolumeGroups().clear(); + SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); + verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vnf.getVolumeGroups().get(0), modelInfo, service, + "vnfModelCustomizationUUID"); + } + + @Test + public void testMapCatalogVolumeGroup() { + VolumeGroup volumeGroup = new VolumeGroup(); + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid("modelCustomizationUUID"); + requestDetails.setModelInfo(modelInfo); + Service service = new Service(); + VnfResourceCustomization resourceCust = new VnfResourceCustomization(); + resourceCust.setModelCustomizationUUID("vnfModelCustomizationUUID"); + service.getVnfCustomizations().add(resourceCust); + VfModuleCustomization vfResourceCust = new VfModuleCustomization(); + vfResourceCust.setModelCustomizationUUID("modelCustomizationUUID"); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + resourceCust.getVfModuleCustomizations().add(vfResourceCust); + + doReturn(modelInfoVfModule).when(bbInputSetupMapperLayer).mapCatalogVfModuleToVfModule(vfResourceCust); + + SPY_bbInputSetup.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, "vnfModelCustomizationUUID"); + + assertEquals(modelInfoVfModule, volumeGroup.getModelInfoVfModule()); + } + + @Test + public void testPopulateL3Network() throws JsonParseException, JsonMappingException, IOException { + String instanceName = "networkName"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.network); + + ServiceInstance serviceInstance = new ServiceInstance(); + L3Network network = new L3Network(); + network.setNetworkId("networkId"); + network.setNetworkName("networkName"); + serviceInstance.getNetworks().add(network); + String resourceId = "123"; + // Mock service + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + String bbName = AssignFlows.NETWORK_A_LA_CARTE.toString(); + + doNothing().when(SPY_bbInputSetup).mapCatalogNetwork(network, modelInfo, service); + + SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, null); + + lookupKeyMap.put(ResourceKey.NETWORK_ID, null); + + SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, null); + verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network, modelInfo, service); + + instanceName = "networkName2"; + L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null); + doReturn(network2).when(SPY_bbInputSetup).createNetwork(lookupKeyMap, instanceName, resourceId, null); + SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, null); + verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network2, modelInfo, service); + } + + @Test + public void testMapCatalogNetwork() { + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + L3Network network = new L3Network(); + + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid("modelCustomizationUUID"); + requestDetails.setModelInfo(modelInfo); + Service service = new Service(); + NetworkResourceCustomization resourceCust = new NetworkResourceCustomization(); + resourceCust.setModelCustomizationUUID("modelCustomizationUUID"); + service.setNetworkCustomizations(Arrays.asList(new NetworkResourceCustomization[] { resourceCust })); + + doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(resourceCust); + + SPY_bbInputSetup.mapCatalogNetwork(network, modelInfo, service); + + assertEquals(modelInfoNetwork, network.getModelInfoNetwork()); + } + + @Test + public void testPopulateConfiguration() throws JsonParseException, JsonMappingException, IOException { + String instanceName = "configurationName"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); + + ServiceInstance serviceInstance = new ServiceInstance(); + Configuration configuration = new Configuration(); + configuration.setConfigurationId("configurationId"); + configuration.setConfigurationName("configurationName"); + serviceInstance.getConfigurations().add(configuration); + String resourceId = "configurationId"; + // Mock service + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization(); + configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); + service.getConfigurationCustomizations().add(configurationCust); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + String bbName = AssignFlows.FABRIC_CONFIGURATION.toString(); + + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service); + + SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + instanceName); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service); + + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null); + + SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + instanceName); + verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service); + + instanceName = "configurationName2"; + resourceId = "resourceId2"; + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId2"); + Configuration configuration2 = SPY_bbInputSetup.createConfiguration(lookupKeyMap, instanceName, resourceId); + doReturn(configuration2).when(SPY_bbInputSetup).createConfiguration(lookupKeyMap, instanceName, resourceId); + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service); + SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + instanceName); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service); + } + + @Test + public void testMapCatalogConfiguration() { + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + L3Network network = new L3Network(); + + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid("modelCustomizationUUID"); + requestDetails.setModelInfo(modelInfo); + Service service = new Service(); + NetworkResourceCustomization resourceCust = new NetworkResourceCustomization(); + resourceCust.setModelCustomizationUUID("modelCustomizationUUID"); + service.setNetworkCustomizations(Arrays.asList(new NetworkResourceCustomization[] { resourceCust })); + + doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(resourceCust); + + SPY_bbInputSetup.mapCatalogNetwork(network, modelInfo, service); + + assertEquals(modelInfoNetwork, network.getModelInfoNetwork()); + } + + @Test + public void testPopulateGenericVnf() throws JsonParseException, JsonMappingException, IOException { + org.onap.so.serviceinstancebeans.Platform platform = new org.onap.so.serviceinstancebeans.Platform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = new org.onap.so.serviceinstancebeans.LineOfBusiness(); + String instanceName = "vnfName"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.vnf); + + ServiceInstance serviceInstance = new ServiceInstance(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("genericVnfId"); + vnf.setVnfName("vnfName"); + serviceInstance.getVnfs().add(vnf); + String vnfType = "vnfType"; + RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetails_CreateVnf.json"), + RequestDetails.class); + + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId"); + String bbName = AssignFlows.VNF.toString(); + + Platform expectedPlatform = new Platform(); + LineOfBusiness expectedLineOfBusiness = new LineOfBusiness(); + String resourceId = "123"; + doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform); + doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service); + doReturn(null).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf, modelInfo, service); + + instanceName = "vnfName2"; + GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, null); + doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, null); + doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); + doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf2, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); + verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + } + + @Test + public void testPopulateGenericVnfWhereVnfTypeIsNull() + throws JsonParseException, JsonMappingException, IOException { + org.onap.so.serviceinstancebeans.Platform platform = new org.onap.so.serviceinstancebeans.Platform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = new org.onap.so.serviceinstancebeans.LineOfBusiness(); + String instanceName = "vnfName"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.vnf); + + ServiceInstance serviceInstance = new ServiceInstance(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("genericVnfId"); + vnf.setVnfName("vnfName"); + serviceInstance.getVnfs().add(vnf); + String vnfType = null; + RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetails_CreateVnf.json"), + RequestDetails.class); + + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId"); + String bbName = AssignFlows.VNF.toString(); + + Platform expectedPlatform = new Platform(); + LineOfBusiness expectedLineOfBusiness = new LineOfBusiness(); + String resourceId = "123"; + doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform); + doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service); + + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf, modelInfo, service); + + instanceName = "vnfName2"; + GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, null); + doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, null); + doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); + doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf2, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); + verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + } + + @Test + public void testMapCatalogVnf() { + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + GenericVnf genericVnf = new GenericVnf(); + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid("modelCustomizationUUID"); + requestDetails.setModelInfo(modelInfo); + Service service = new Service(); + VnfResourceCustomization resourceCust = new VnfResourceCustomization(); + resourceCust.setModelCustomizationUUID("vnfModelCustomizationUUID"); + service.getVnfCustomizations().add(resourceCust); + resourceCust.setModelCustomizationUUID("modelCustomizationUUID"); + + doReturn(modelInfoGenericVnf).when(bbInputSetupMapperLayer).mapCatalogVnfToVnf(resourceCust); + + SPY_bbInputSetup.mapCatalogVnf(genericVnf, modelInfo, service); + + assertEquals(modelInfoGenericVnf, genericVnf.getModelInfoGenericVnf()); + } + + @Test + public void testMapCatalogCollectionAndInstanceGroup() { + ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); + modelInfoCollection.setCollectionFunction("collectionFunction"); + modelInfoCollection.setCollectionRole("collectionRole"); + modelInfoCollection.setCollectionType("collectionType"); + modelInfoCollection.setDescription("description"); + modelInfoCollection.setModelInvariantUUID("modelInvariantUUID"); + modelInfoCollection.setQuantity(0); + + ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup(); + modelInfoInstanceGroup.setFunction("function"); + modelInfoInstanceGroup.setInstanceGroupRole("instanceGroupRole"); + modelInfoInstanceGroup.setModelInvariantUUID("modelInvariantUUID"); + modelInfoInstanceGroup.setModelUUID("modelUUID"); + modelInfoInstanceGroup.setType("VNFC"); + modelInfoInstanceGroup.setDescription("description"); + + InstanceGroup instanceGroup = new InstanceGroup(); + Collection collection = new Collection(); + collection.setInstanceGroup(instanceGroup); + + CollectionResource collectionResource = new CollectionResource(); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup(); + collectionResource.setToscaNodeType("NetworkCollection"); + collectionResource.setInstanceGroup(catalogInstanceGroup); + + CollectionResourceCustomization collectionCust = new NetworkCollectionResourceCustomization(); + collectionCust.setModelCustomizationUUID("modelCustomizationUUID"); + collectionCust.setCollectionResource(collectionResource); + + Service service = new Service(); + service.getCollectionResourceCustomizations().add(collectionCust); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setCollection(collection); + + List<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = new ArrayList<>(); + CollectionResourceInstanceGroupCustomization instanceGroupCust = new CollectionResourceInstanceGroupCustomization(); + instanceGroupCust.setFunction("function"); + instanceGroupCust.setDescription("description"); + + doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(collectionCust, + collectionResource); + doReturn(instanceGroupCustList).when(SPY_bbInputSetupUtils) + .getCollectionResourceInstanceGroupCustomization(collectionCust.getModelCustomizationUUID()); + doReturn(modelInfoInstanceGroup).when(bbInputSetupMapperLayer).mapCatalogInstanceGroupToInstanceGroup(collectionCust, + catalogInstanceGroup); + + SPY_bbInputSetup.mapCatalogCollection(service, serviceInstance.getCollection(), "modelCustomizationUUID"); + SPY_bbInputSetup.mapCatalogNetworkCollectionInstanceGroup(service, + serviceInstance.getCollection().getInstanceGroup(), collectionCust.getModelCustomizationUUID()); + + assertThat(collection.getModelInfoCollection(), sameBeanAs(modelInfoCollection)); + assertThat(instanceGroup.getModelInfoInstanceGroup(), sameBeanAs(modelInfoInstanceGroup)); + } + + @Test + public void testAddRelationshipsToSI() throws Exception { + ServiceInstance serviceInstance = new ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("serviceInstanceId"); + + org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship(); + relationshipList.getRelationship().add(relationship); + serviceInstanceAAI.setRelationshipList(relationshipList); + + Map<String, String> uriKeys = new HashMap<>(); + uriKeys.put("global-customer-id", "globalCustomerId"); + uriKeys.put("service-type", "serviceType"); + + doReturn(uriKeys).when(SPY_bbInputSetupUtils) + .getURIKeysFromServiceInstance(serviceInstanceAAI.getServiceInstanceId()); + doNothing().when(SPY_bbInputSetup).mapProject(any(), eq(serviceInstance)); + doNothing().when(SPY_bbInputSetup).mapOwningEntity(any(), eq(serviceInstance)); + doNothing().when(SPY_bbInputSetup).mapL3Networks(any(), eq(serviceInstance.getNetworks())); + doNothing().when(SPY_bbInputSetup).mapGenericVnfs(any(), eq(serviceInstance.getVnfs())); + doNothing().when(SPY_bbInputSetup).mapCollection(any(), eq(serviceInstance)); + + SPY_bbInputSetup.addRelationshipsToSI(serviceInstanceAAI, serviceInstance); + + verify(SPY_bbInputSetup, times(1)).mapProject(any(), eq(serviceInstance)); + verify(SPY_bbInputSetup, times(1)).mapOwningEntity(any(), eq(serviceInstance)); + verify(SPY_bbInputSetup, times(1)).mapL3Networks(any(), eq(serviceInstance.getNetworks())); + verify(SPY_bbInputSetup, times(1)).mapGenericVnfs(any(), eq(serviceInstance.getVnfs())); + verify(SPY_bbInputSetup, times(1)).mapCollection(any(), eq(serviceInstance)); + verify(SPY_bbInputSetup, times(1)).mapConfigurations(any(), eq(serviceInstance.getConfigurations())); + } + + @Test + public void testMapConfigurations() throws JsonProcessingException { + org.onap.aai.domain.yang.Configuration expectedAAI = new org.onap.aai.domain.yang.Configuration(); + org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship(); + relationshipList.getRelationship().add(relationship); + expectedAAI.setRelationshipList(relationshipList); + + Configuration expected = new Configuration(); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId"); + AAIResultWrapper configurationWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(configurationWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri); + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIConfiguration(isA(org.onap.aai.domain.yang.Configuration.class)); + + List<Configuration> configurations = new ArrayList<>(); + + SPY_bbInputSetup.mapConfigurations(Arrays.asList(new AAIResourceUri[] { aaiResourceUri }), configurations); + + assertEquals(expected, configurations.get(0)); + } + + @Test + public void testMapGenericVnfs() throws JsonProcessingException { + org.onap.aai.domain.yang.GenericVnf expectedAAI = new org.onap.aai.domain.yang.GenericVnf(); + org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship(); + relationshipList.getRelationship().add(relationship); + expectedAAI.setRelationshipList(relationshipList); + + GenericVnf expected = new GenericVnf(); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(vnfWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri); + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIGenericVnfIntoGenericVnf(isA(org.onap.aai.domain.yang.GenericVnf.class)); + doNothing().when(SPY_bbInputSetup).mapPlatform(any(), eq(expected)); + doNothing().when(SPY_bbInputSetup).mapLineOfBusiness(any(), eq(expected)); + doReturn(new ArrayList<>()).when(SPY_bbInputSetup).mapVolumeGroups(any()); + + List<GenericVnf> genericVnfs = new ArrayList<>(); + + SPY_bbInputSetup.mapGenericVnfs(Arrays.asList(new AAIResourceUri[] { aaiResourceUri }), genericVnfs); + + assertEquals(expected, genericVnfs.get(0)); + verify(SPY_bbInputSetup, times(1)).mapPlatform(any(), eq(expected)); + verify(SPY_bbInputSetup, times(1)).mapLineOfBusiness(any(), eq(expected)); + verify(SPY_bbInputSetup, times(1)).mapVolumeGroups(any()); + } + + @Test + public void testMapVolumeGroups() throws JsonProcessingException { + org.onap.aai.domain.yang.VolumeGroup expectedAAI = new org.onap.aai.domain.yang.VolumeGroup(); + + VolumeGroup expected = new VolumeGroup(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIVolumeGroup(isA(org.onap.aai.domain.yang.VolumeGroup.class)); + + List<VolumeGroup> volumeGroupsList = + SPY_bbInputSetup.mapVolumeGroups(Arrays.asList(new AAIResultWrapper[] { vnfWrapper })); + + assertEquals(expected, volumeGroupsList.get(0)); + } + + @Test + public void testMapLineOfBusiness() throws JsonProcessingException { + org.onap.aai.domain.yang.LineOfBusiness expectedAAI = new org.onap.aai.domain.yang.LineOfBusiness(); + + LineOfBusiness expected = new LineOfBusiness(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAILineOfBusiness(isA(org.onap.aai.domain.yang.LineOfBusiness.class)); + + GenericVnf vnf = new GenericVnf(); + + SPY_bbInputSetup.mapLineOfBusiness(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), vnf); + + assertEquals(expected, vnf.getLineOfBusiness()); + } + + @Test + public void testMapPlatform() throws JsonProcessingException { + org.onap.aai.domain.yang.Platform expectedAAI = new org.onap.aai.domain.yang.Platform(); + + Platform expected = new Platform(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIPlatform(isA(org.onap.aai.domain.yang.Platform.class)); + + GenericVnf vnf = new GenericVnf(); + + SPY_bbInputSetup.mapPlatform(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), vnf); + + assertEquals(expected, vnf.getPlatform()); + } + + @Test + public void testMapCollection() throws JsonProcessingException { + List<AAIResultWrapper> collections = new ArrayList<>(); + ServiceInstance serviceInstance = new ServiceInstance(); + + org.onap.aai.domain.yang.Collection aaiCollection = new org.onap.aai.domain.yang.Collection(); + org.onap.aai.domain.yang.RelationshipList collectionRelationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship collectionInstanceGroupRelationship = new org.onap.aai.domain.yang.Relationship(); + collectionRelationshipList.getRelationship().add(collectionInstanceGroupRelationship); + aaiCollection.setRelationshipList(collectionRelationshipList); + + collections.add(new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiCollection))); + + Collection collection = new Collection(); + List<InstanceGroup> instanceGroupsList = new ArrayList<>(); + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroupsList.add(instanceGroup); + + doReturn(collection).when(bbInputSetupMapperLayer) + .mapAAICollectionIntoCollection(isA(org.onap.aai.domain.yang.Collection.class)); + doReturn(instanceGroup).when(SPY_bbInputSetup).mapInstanceGroup(isA(AAIResultWrapper.class)); + doReturn(instanceGroupsList).when(SPY_bbInputSetup).mapInstanceGroups(any()); + SPY_bbInputSetup.mapCollection(collections, serviceInstance); + + assertEquals(collection, serviceInstance.getCollection()); + assertEquals(instanceGroup, collection.getInstanceGroup()); + + instanceGroupsList.clear(); + collection = new Collection(); + + SPY_bbInputSetup.mapCollection(collections, serviceInstance); + assertEquals(collection, serviceInstance.getCollection()); + assertNull(collection.getInstanceGroup()); + } + + @Test + public void testMapL3Networks() throws JsonProcessingException { + org.onap.aai.domain.yang.L3Network expectedAAI = new org.onap.aai.domain.yang.L3Network(); + org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship(); + relationshipList.getRelationship().add(relationship); + expectedAAI.setRelationshipList(relationshipList); + + L3Network expected = new L3Network(); + List<L3Network> l3Networks = new ArrayList<>(); + AAIResultWrapper l3NetworksWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, "networkId"); + + doReturn(l3NetworksWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthTwo(aaiResourceUri); + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIL3Network(isA(org.onap.aai.domain.yang.L3Network.class)); + doNothing().when(SPY_bbInputSetup).mapNetworkPolicies(any(), eq(expected.getNetworkPolicies())); + doNothing().when(SPY_bbInputSetup).mapRouteTableReferences(any(), + eq(expected.getContrailNetworkRouteTableReferences())); + + SPY_bbInputSetup.mapL3Networks(Arrays.asList(new AAIResourceUri[] { aaiResourceUri }), l3Networks); + + assertEquals(expected, l3Networks.get(0)); + verify(SPY_bbInputSetup, times(1)).mapNetworkPolicies(any(), eq(expected.getNetworkPolicies())); + verify(SPY_bbInputSetup, times(1)).mapRouteTableReferences(any(), + eq(expected.getContrailNetworkRouteTableReferences())); + } + + @Test + public void testMapRouteTableReferences() throws JsonProcessingException { + org.onap.aai.domain.yang.RouteTableReference expectedAAI = new org.onap.aai.domain.yang.RouteTableReference(); + + RouteTableReference expected = new RouteTableReference(); + List<RouteTableReference> contrailNetworkRouteTableReferences = new ArrayList<>(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer).mapAAIRouteTableReferenceIntoRouteTableReference( + isA(org.onap.aai.domain.yang.RouteTableReference.class)); + + SPY_bbInputSetup.mapRouteTableReferences(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), + contrailNetworkRouteTableReferences); + + assertEquals(expected, contrailNetworkRouteTableReferences.get(0)); + } + + @Test + public void testMapOwningEntity() throws JsonProcessingException { + org.onap.aai.domain.yang.OwningEntity expectedAAI = new org.onap.aai.domain.yang.OwningEntity(); + + OwningEntity expected = new OwningEntity(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAIOwningEntity(isA(org.onap.aai.domain.yang.OwningEntity.class)); + + ServiceInstance serviceInstance = new ServiceInstance(); + + SPY_bbInputSetup.mapOwningEntity(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), serviceInstance); + + assertEquals(expected, serviceInstance.getOwningEntity()); + } + + @Test + public void testMapProject() throws JsonProcessingException { + org.onap.aai.domain.yang.Project expectedAAI = new org.onap.aai.domain.yang.Project(); + + Project expected = new Project(); + AAIResultWrapper vnfWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(expected).when(bbInputSetupMapperLayer).mapAAIProject(isA(org.onap.aai.domain.yang.Project.class)); + + ServiceInstance serviceInstance = new ServiceInstance(); + + SPY_bbInputSetup.mapProject(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), serviceInstance); + + assertEquals(expected, serviceInstance.getProject()); + } + + @Test + public void testMapCustomer() throws Exception { + org.onap.aai.domain.yang.Customer customerAAI = new org.onap.aai.domain.yang.Customer(); + org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI = new org.onap.aai.domain.yang.ServiceSubscription(); + + Customer expected = new Customer(); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + + String globalCustomerId = "globalCustomerId"; + String subscriptionServiceType = "subscriptionServiceType"; + + doReturn(customerAAI).when(SPY_bbInputSetupUtils).getAAICustomer(globalCustomerId); + doReturn(serviceSubscriptionAAI).when(SPY_bbInputSetupUtils).getAAIServiceSubscription(globalCustomerId, + subscriptionServiceType); + doReturn(expected).when(bbInputSetupMapperLayer) + .mapAAICustomer(isA(org.onap.aai.domain.yang.Customer.class)); + doReturn(serviceSubscription).when(bbInputSetupMapperLayer) + .mapAAIServiceSubscription(isA(org.onap.aai.domain.yang.ServiceSubscription.class)); + + Customer actual = SPY_bbInputSetup.mapCustomer(globalCustomerId, subscriptionServiceType); + + assertEquals(expected, actual); + assertEquals(serviceSubscription, expected.getServiceSubscription()); + } + + @Test + public void testPopulateLookupKeyMapWithIds() { + Map<ResourceKey, String> expected = new HashMap<>(); + Map<ResourceKey, String> actual = new HashMap<>(); + String serviceInstanceId = "serviceInstanceId"; + String networkId = "networkId"; + String vnfId = "vnfId"; + String vfModuleId = "vfModuleId"; + String volumeGroupId = "volumeGroupId"; + String configurationId = "configurationId"; + + expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); + expected.put(ResourceKey.NETWORK_ID, networkId); + expected.put(ResourceKey.GENERIC_VNF_ID, vnfId); + expected.put(ResourceKey.VF_MODULE_ID, vfModuleId); + expected.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId); + expected.put(ResourceKey.CONFIGURATION_ID, configurationId); + + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId(serviceInstanceId); + workflowResourceIds.setNetworkId(networkId); + workflowResourceIds.setVnfId(vnfId); + workflowResourceIds.setVfModuleId(vfModuleId); + workflowResourceIds.setVolumeGroupId(volumeGroupId); + workflowResourceIds.setConfigurationId(configurationId); + + SPY_bbInputSetup.populateLookupKeyMapWithIds(workflowResourceIds, actual); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testgetGBBMacro() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + doNothing().when(SPY_bbInputSetupUtils).updateInfraActiveRequestVnfId(request, + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + doReturn("vnfId").when(SPY_bbInputSetup).getVnfId(executeBB, lookupKeyMap); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); + + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString()); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), + isA(org.onap.so.serviceinstancebeans.Platform.class), + isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any()); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); + executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVfModule(isA(ModelInfo.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), any(), isA(CloudConfiguration.class)); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), + any(String.class), any()); + + Configuration configuration = new Configuration(); + configuration.setConfigurationId("configurationId"); + gBB.getServiceInstance().getConfigurations().add(configuration); + List<ConfigurationResourceCustomization> configurationCustList = new ArrayList<>(); + ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization(); + configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); + doReturn(configurationCustList).when(service).getConfigurationCustomizations(); + configurationCustList.add(configurationCust); + doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB"); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class)); + } + + @Test + public void testgetGBBMacroCloudConfiguration() throws Exception { + org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue( + new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class); + CloudConfiguration cloudConfig = null; + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = new org.onap.aai.domain.yang.CloudRegion(); + Resources resources = serviceMacro.getResources(); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class), eq("att-aic")); + CloudRegion expected = new CloudRegion(); + expected.setLcpCloudRegionId("mdt1"); + expected.setCloudOwner("att-aic"); + expected.setTenantId("88a6ca3ee0394ade9403f075db23167e"); + + CloudRegion actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); + assertThat(actual, sameBeanAs(expected)); + + serviceMacro = mapper.readValue( + new File(RESOURCE_PATH + "ServiceMacroVnfs.json"), org.onap.so.serviceinstancebeans.Service.class); + resources = serviceMacro.getResources(); + + actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); + assertThat(actual, sameBeanAs(expected)); + + serviceMacro = mapper.readValue( + new File(RESOURCE_PATH + "ServiceMacroNetworks.json"), org.onap.so.serviceinstancebeans.Service.class); + resources = serviceMacro.getResources(); + + actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); + assertThat(actual, sameBeanAs(expected)); + + serviceMacro = mapper.readValue( + new File(RESOURCE_PATH + "ServiceMacroNoCloudConfig.json"), org.onap.so.serviceinstancebeans.Service.class); + resources = serviceMacro.getResources(); + + actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); + assertNull(actual); + } + + @Test + public void testgetGBBMacroWithEmptyUserParams() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().getUserParams().clear(); + InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + doNothing().when(SPY_bbInputSetupUtils).updateInfraActiveRequestVnfId(request, + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + doReturn("vnfId").when(SPY_bbInputSetup).getVnfId(executeBB, lookupKeyMap); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(any(ExecuteBuildingBlock.class), any(), + any(String.class), any(String.class), any(GeneralBuildingBlock.class), any(Service.class)); + } + + @Test(expected = Exception.class) + public void testgetGBBMacroException() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(null).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + + executeBB.getBuildingBlock().setBpmnFlowName("Network"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + } + + @Test + public void testgetGBBMacroWithVnfTypeNull() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class); + String resourceId = "123"; + String vnfType = null; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + doNothing().when(SPY_bbInputSetupUtils).updateInfraActiveRequestVnfId(request, + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + doReturn("vnfId").when(SPY_bbInputSetup).getVnfId(executeBB, lookupKeyMap); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), + isA(org.onap.so.serviceinstancebeans.Platform.class), + isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any()); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); + executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVfModule(isA(ModelInfo.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), any(), isA(CloudConfiguration.class)); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), + any(String.class), any()); + } + + @Test + public void testgetGBBMacroGetServiceWithInvariantId() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + doNothing().when(SPY_bbInputSetupUtils).updateInfraActiveRequestVnfId(request, + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + doReturn("vnfId").when(SPY_bbInputSetup).getVnfId(executeBB, lookupKeyMap); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), + isA(org.onap.so.serviceinstancebeans.Platform.class), + isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any()); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); + executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVfModule(isA(ModelInfo.class), isA(Service.class), any(String.class), + isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), any(), isA(CloudConfiguration.class)); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), + any(String.class), any()); + } + + @Test + public void testgetGBBMacroNoUserParamsDeactivateInstnace() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().setUserParams(null); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "deactivateInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + String generatedId = "12131"; + doReturn(generatedId).when(SPY_bbInputSetup).generateRandomUUID(); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName("DeactivateServiceInstanceBB"); + executeBB.getBuildingBlock().setKey("3c40d244-808e-42ca-b09a-256d83d19d0a"); + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId, vnfType); + assertThat(actual, sameBeanAs(gBB)); + } + + @Test + public void testgetGBBMacroNoUserParamsCreateInstance() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class); + requestDetails.getRequestParameters().setUserParams(null); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "createInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(null).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + List<NetworkResourceCustomization> networkCustList = new ArrayList<>(); + NetworkResourceCustomization networkCust = Mockito.mock(NetworkResourceCustomization.class); + doReturn("ab153b6e-c364-44c0-bef6-1f2982117f04").when(networkCust).getModelCustomizationUUID(); + networkCustList.add(networkCust); + doReturn(networkCustList).when(service).getNetworkCustomizations(); + doNothing().when(SPY_bbInputSetup).populateL3Network(any(), isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + executeBB.getBuildingBlock().setIsVirtualLink(false); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service); + + CollectionNetworkResourceCustomization collectionNetworkResourceCust = Mockito.mock(CollectionNetworkResourceCustomization.class); + doReturn(collectionNetworkResourceCust).when(SPY_bbInputSetupUtils).getCatalogCollectionNetworkResourceCustByID(any(String.class)); + NetworkResourceCustomization networkResourceCustomization = Mockito.mock(NetworkResourceCustomization.class); + doReturn(networkResourceCustomization).when(bbInputSetupMapperLayer).mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + ModelInfoNetwork modelInfoNetwork = Mockito.mock(ModelInfoNetwork.class); + doReturn(modelInfoNetwork ).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(networkResourceCustomization); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + executeBB.getBuildingBlock().setIsVirtualLink(true); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(2)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.FABRIC_CONFIGURATION.toString()); + executeBB.getBuildingBlock().setKey("modelCustId"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), "modelCustId", gBB, service); + } + + @Test + public void testgetGBBMacroNoUserParamsOther() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().setUserParams(null); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "deleteInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); + requestDetails.setCloudConfiguration(cloudConfig); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), + "att-aic"); + executeBB.getBuildingBlock().setBpmnFlowName("DeleteNetworkBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(1)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), + any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + isA(CloudConfiguration.class)); + + requestAction = "activateInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + executeBB.getBuildingBlock().setBpmnFlowName("ActivateNetworkBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(2)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), + any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + isA(CloudConfiguration.class)); + + requestAction = "unassignInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + executeBB.getBuildingBlock().setBpmnFlowName("UnassignNetworkBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(3)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), + any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + isA(CloudConfiguration.class)); + + requestAction = "activateFabricConfiguration"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-134534656234"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + verify(SPY_bbInputSetup, times(4)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(), + any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class), + isA(CloudConfiguration.class)); + } + + @Test(expected = IllegalArgumentException.class) + public void testgetGBBMacroNoUserParamsOtherException() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().setUserParams(null); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + String resourceId = "123"; + String vnfType = "vnfType"; + Service service = Mockito.mock(Service.class); + String requestAction = "assignInstance"; + doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + String generatedId = "12131"; + doReturn(generatedId).when(SPY_bbInputSetup).generateRandomUUID(); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); + executeBB.getBuildingBlock().setKey("3c40d244-808e-42ca-b09a-256d83d19d0a"); + SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + } + @Test + public void testgetGBBMacroNoUserParamsExistingService() throws Exception { + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().setUserParams(null); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.NETWORK_ID, "networkId"); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnfId"); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, "vfModuleId"); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + Service service = Mockito.mock(Service.class); + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + cloudConfiguration.setLcpCloudRegionId("cloudRegionId"); + String requestAction = "unassignInstance"; + + L3Network network = new L3Network(); + network.setNetworkId("networkId"); + gBB.getServiceInstance().getNetworks().add(network); + org.onap.aai.domain.yang.L3Network aaiNetwork = new org.onap.aai.domain.yang.L3Network(); + aaiNetwork.setModelCustomizationId("modelCustId"); + doReturn(aaiNetwork).when(SPY_bbInputSetupUtils).getAAIL3Network(network.getNetworkId()); + doNothing().when(SPY_bbInputSetup).mapCatalogNetwork(any(L3Network.class), any(ModelInfo.class), + any(Service.class)); + + executeBB.getBuildingBlock().setBpmnFlowName("DeleteNetworkBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(any(L3Network.class), any(ModelInfo.class), + any(Service.class)); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + gBB.getServiceInstance().getVnfs().add(vnf); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + + executeBB.getBuildingBlock().setBpmnFlowName("ActivateVnfBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + gBB.getServiceInstance().getVnfs().get(0).getVfModules().add(vfModule); + org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule(); + aaiVfModule.setModelCustomizationId("modelCustId"); + doReturn(aaiVfModule).when(SPY_bbInputSetupUtils).getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()); + + executeBB.getBuildingBlock().setBpmnFlowName("UnassignVfModuleBB"); + executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(any(VfModule.class), any(ModelInfo.class), + any(Service.class), any(String.class)); + + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), + "att-aic"); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + gBB.getServiceInstance().getVnfs().get(0).getVolumeGroups().add(volumeGroup); + org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup(); + aaiVolumeGroup.setModelCustomizationId("modelCustId"); + doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup("att-aic", + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + + executeBB.getBuildingBlock().setBpmnFlowName("UnassignVolumeGroupBB"); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + verify(SPY_bbInputSetup, times(3)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(isA(VolumeGroup.class), isA(ModelInfo.class), + isA(Service.class), isA(String.class)); + + Configuration configuration = new Configuration(); + configuration.setConfigurationId("configurationId"); + gBB.getServiceInstance().getConfigurations().add(configuration); + org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration(); + aaiConfiguration.setModelCustomizationId("modelCustId"); + doReturn(aaiConfiguration).when(SPY_bbInputSetupUtils).getAAIConfiguration(configuration.getConfigurationId()); + + executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB"); + executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(any(Configuration.class), any(ModelInfo.class), + any(Service.class)); + } + + @Test + public void testGetVnfId() { + String expected = "vnfId"; + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + executeBB.setRequestId("requestId"); + InfraActiveRequests request = new InfraActiveRequests(); + request.setVnfId(expected); + doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); + + String actual = SPY_bbInputSetup.getVnfId(executeBB, lookupKeyMap); + + assertEquals("VnfId is set correctly", expected, actual); + } + + @Test + public void testCreateVfModule() { + String vfModuleId = "vfModuleId"; + String instanceName = "vfModuleName"; + Map<String, String> cloudParams = new HashMap<>(); + cloudParams.put("param1", "param1Value"); + VfModule expected = new VfModule(); + expected.setVfModuleId(vfModuleId); + expected.setVfModuleName(instanceName); + expected.setCloudParams(cloudParams); + expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + List<Map<String, String>> instanceParams = new ArrayList<>(); + instanceParams.add(cloudParams); + + VfModule actual = SPY_bbInputSetup.createVfModule(lookupKeyMap, vfModuleId, instanceName, instanceParams); + + assertThat(actual, sameBeanAs(expected)); + assertEquals("LookupKeyMap is populated", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID)); + + expected.getCloudParams().clear(); + actual = SPY_bbInputSetup.createVfModule(lookupKeyMap, vfModuleId, instanceName, null); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testCreateVolumeGroup() { + String volumeGroupId = "volumeGroupId"; + String instanceName = "vfModuleName"; + String vnfType = "vnfType"; + Map<String, String> cloudParams = new HashMap<>(); + cloudParams.put("param1", "param1Value"); + VolumeGroup expected = new VolumeGroup(); + expected.setVolumeGroupId(volumeGroupId); + expected.setVolumeGroupName(instanceName); + expected.setCloudParams(cloudParams); + expected.setVnfType(vnfType); + expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + List<Map<String, String>> instanceParams = new ArrayList<>(); + instanceParams.add(cloudParams); + + VolumeGroup actual = SPY_bbInputSetup.createVolumeGroup(lookupKeyMap, volumeGroupId, instanceName, vnfType, instanceParams); + + assertThat(actual, sameBeanAs(expected)); + assertEquals("LookupKeyMap is populated", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID)); + + expected.getCloudParams().clear(); + actual = SPY_bbInputSetup.createVolumeGroup(lookupKeyMap, volumeGroupId, instanceName, vnfType, null); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testCreateNetwork() { + String networkId = "networkId"; + String instanceName = "networkName"; + Map<String, String> cloudParams = new HashMap<>(); + cloudParams.put("param1", "param1Value"); + L3Network expected = new L3Network(); + expected.setNetworkId(networkId); + expected.setNetworkName(instanceName); + expected.setCloudParams(cloudParams); + expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + List<Map<String, String>> instanceParams = new ArrayList<>(); + instanceParams.add(cloudParams); + L3Network actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, instanceParams); + + assertThat(actual, sameBeanAs(expected)); + assertEquals("LookupKeyMap is populated", networkId, lookupKeyMap.get(ResourceKey.NETWORK_ID)); + + expected.getCloudParams().clear(); + actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, null); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testCreateGenericVnf() { + String vnfId = "vnfId"; + String instanceName = "vnfName"; + String vnfType = "vnfType"; + String platformName = "platformName"; + String lineOfBusinessName = "lineOfBusinessName"; + Platform platform = new Platform(); + platform.setPlatformName(platformName); + LineOfBusiness lineOfBusiness = new LineOfBusiness(); + lineOfBusiness.setLineOfBusinessName(lineOfBusinessName); + Map<String, String> cloudParams = new HashMap<>(); + cloudParams.put("param1", "param1Value"); + GenericVnf expected = new GenericVnf(); + expected.setVnfId(vnfId); + expected.setVnfName(instanceName); + expected.setVnfType(vnfType); + expected.setCloudParams(cloudParams); + expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + expected.setPlatform(platform); + expected.setLineOfBusiness(lineOfBusiness); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + List<Map<String, String>> instanceParams = new ArrayList<>(); + instanceParams.add(cloudParams); + org.onap.so.serviceinstancebeans.Platform requestPlatform = new org.onap.so.serviceinstancebeans.Platform(); + platform.setPlatformName(platformName); + org.onap.so.serviceinstancebeans.LineOfBusiness requestLineOfBusiness = new org.onap.so.serviceinstancebeans.LineOfBusiness(); + lineOfBusiness.setLineOfBusinessName(lineOfBusinessName); + + doReturn(platform).when(bbInputSetupMapperLayer).mapRequestPlatform(requestPlatform); + doReturn(lineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(requestLineOfBusiness); + + GenericVnf actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness, vnfId, vnfType, instanceParams); + + assertThat(actual, sameBeanAs(expected)); + assertEquals("LookupKeyMap is populated", vnfId, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + + expected.getCloudParams().clear(); + actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness, vnfId, vnfType, null); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testMapCatalogVfModule() { + String vnfModelCustomizationUUID = "vnfResourceCustUUID"; + String vfModuleCustomizationUUID = "vfModelCustomizationUUID"; + VfModule vfModule = new VfModule(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(vfModuleCustomizationUUID); + Service service = new Service(); + VnfResourceCustomization vnfResourceCust = new VnfResourceCustomization(); + vnfResourceCust.setModelCustomizationUUID(vnfModelCustomizationUUID); + VfModuleCustomization vfModuleCust = new VfModuleCustomization(); + vfModuleCust.setModelCustomizationUUID(vfModuleCustomizationUUID); + vnfResourceCust.getVfModuleCustomizations().add(vfModuleCust); + service.getVnfCustomizations().add(vnfResourceCust); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + + doReturn(modelInfoVfModule).when(bbInputSetupMapperLayer).mapCatalogVfModuleToVfModule(vfModuleCust); + + SPY_bbInputSetup.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + + assertThat(vfModule.getModelInfoVfModule(), sameBeanAs(modelInfoVfModule)); + + modelInfo.setModelCustomizationUuid(null); + modelInfo.setModelCustomizationId(vfModuleCustomizationUUID); + + SPY_bbInputSetup.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + + assertThat(vfModule.getModelInfoVfModule(), sameBeanAs(modelInfoVfModule)); + } + + @Test + public void testPopulateVfModule() throws Exception { + String vnfId = "vnfId"; + String vfModuleId = "vfModuleId"; + String volumeGroupId = "volumeGroupId"; + String vfModuleCustomizationId = "vfModuleCustomizationId"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationId(vfModuleCustomizationId); + Service service = new Service(); + String bbName = AssignFlows.VF_MODULE.toString(); + ServiceInstance serviceInstance = new ServiceInstance(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId(vnfId); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId(volumeGroupId); + vnf.getVolumeGroups().add(volumeGroup); + serviceInstance.getVnfs().add(vnf); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); + String resourceId = vfModuleId; + RelatedInstanceList[] relatedInstanceList = null; + String instanceName = "vfModuleName"; + List<Map<String, String>> instanceParams = null; + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + + org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf(); + vnfAAI.setModelCustomizationId("vnfModelCustId"); + org.onap.aai.domain.yang.VolumeGroup volumeGroupAAI = new org.onap.aai.domain.yang.VolumeGroup(); + volumeGroupAAI.setModelCustomizationId(vfModuleCustomizationId); + + doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + doReturn(volumeGroupAAI).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(CLOUD_OWNER, + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(isA(GenericVnf.class), isA(ModelInfo.class), isA(Service.class)); + doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class)); + + SPY_bbInputSetup.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration); + + assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID)); + assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID)); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java new file mode 100644 index 0000000000..d576242318 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -0,0 +1,774 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aai.domain.yang.CloudRegion; +import org.onap.aai.domain.yang.Configuration; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.L3Networks; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aai.domain.yang.VolumeGroups; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.client.aai.AAIObjectPlurals; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.so.client.db.request.RequestsDbClient; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.RequestDetails; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(MockitoJUnitRunner.class) +public class BBInputSetupUtilsTest { + protected ObjectMapper mapper = new ObjectMapper(); + private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/"; + + @InjectMocks + BBInputSetupUtils bbInputSetupUtils = new BBInputSetupUtils(); + + @Mock + protected CatalogDbClient MOCK_catalogDbClient; + + @Mock + protected RequestsDbClient MOCK_requestsDbClient; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void setup(){ + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void testGetCatalogServiceByModelUUID() throws JsonParseException, JsonMappingException, IOException { + Service expected = mapper.readValue( + new File(RESOURCE_PATH + "CatalogServiceExpected.json"), Service.class); + + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelVersionId("modelUUID"); + requestDetails.setModelInfo(modelInfo); + doReturn(expected).when(MOCK_catalogDbClient).getServiceByID("modelUUID"); + Service actual = bbInputSetupUtils.getCatalogServiceByModelUUID(modelInfo.getModelVersionId()); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testGetCatalogServiceByModelVersionAndModelInvariantUUID() throws JsonParseException, JsonMappingException, IOException { + String modelVersion = "modelVersion"; + String modelInvariantUUID = "modelInvariantUUID"; + Service expectedService = mapper.readValue( + new File(RESOURCE_PATH + "CatalogServiceExpected.json"), Service.class); + + doReturn(expectedService).when(MOCK_catalogDbClient).getServiceByModelVersionAndModelInvariantUUID(isA(String.class), isA(String.class)); + + Service actualService = bbInputSetupUtils.getCatalogServiceByModelVersionAndModelInvariantUUID(modelVersion, modelInvariantUUID); + + assertThat(actualService, sameBeanAs(expectedService)); + } + + @Test + public void testGetVnfcInstanceGroups() throws JsonParseException, JsonMappingException, IOException { + VnfcInstanceGroupCustomization vnfc = mapper.readValue( + new File(RESOURCE_PATH + "VnfcInstanceGroupCustomization.json"), VnfcInstanceGroupCustomization.class); + String modelCustomizationUUID = "modelCustomizationUUID"; + + doReturn(Arrays.asList(vnfc)).when(MOCK_catalogDbClient).getVnfcInstanceGroupsByVnfResourceCust(isA(String.class)); + + List<VnfcInstanceGroupCustomization> actualVnfcList = bbInputSetupUtils.getVnfcInstanceGroups(modelCustomizationUUID); + + assertThat(actualVnfcList, sameBeanAs(Arrays.asList(vnfc))); + } + + @Test + public void testGetRequestDetails() throws JsonParseException, JsonMappingException, IOException { + InfraActiveRequests infraActiveRequest = mapper.readValue( + new File(RESOURCE_PATH + "InfraActiveRequestExpected.json"), + InfraActiveRequests.class); + + RequestDetails expected = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsExpected.json"), + RequestDetails.class); + String requestId = "requestId"; + doReturn(infraActiveRequest).when(MOCK_requestsDbClient).getInfraActiveRequestbyRequestId(requestId); + RequestDetails actual = bbInputSetupUtils.getRequestDetails(requestId); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void getRequestDetailsNullTest() throws IOException { + RequestDetails requestDetails = bbInputSetupUtils.getRequestDetails(""); + + assertNull(requestDetails); + } + + @Test + public void testGetCloudRegion() { + String cloudOwner = "cloudOwnerId"; + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); + Optional<org.onap.aai.domain.yang.CloudRegion> expected = Optional.of(new org.onap.aai.domain.yang.CloudRegion()); + expected.get().setCloudOwner(cloudOwner); + expected.get().setCloudRegionId("lcpCloudRegionId"); + doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.CloudRegion.class, + AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + cloudConfig.getLcpCloudRegionId())); + + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + cloudConfig.getLcpCloudRegionId()); + bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + + verify(MOCK_aaiResourcesClient, times(1)).get(CloudRegion.class, expectedUri); + } + + @Test + public void testGetCloudRegionExceptionTest() { + String cloudOwner = "cloudOwnerId"; + + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); + + RequestDetails requestDetails = new RequestDetails(); + requestDetails.setCloudConfiguration(cloudConfig); + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + + assertNull(cloudRegion); + } + + @Test + public void testGetCloudRegionEmptyId() { + String cloudOwner = "cloudOwnerId"; + + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId(""); + + RequestDetails requestDetails = new RequestDetails(); + requestDetails.setCloudConfiguration(cloudConfig); + + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + + assertNull(cloudRegion); + } + + @Test + public void testGetCloudRegionEmptyConfiguration() { + String cloudOwner = "cloudOwnerId"; + + RequestDetails requestDetails = new RequestDetails(); + + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration(), cloudOwner); + + assertNull(cloudRegion); + } + + @Test + public void testGetAAIInstanceGroup() { + Optional<org.onap.aai.domain.yang.InstanceGroup> expected = Optional.of(new org.onap.aai.domain.yang.InstanceGroup()); + String instanceGroupId = "instanceGroupId"; + expected.get().setId(instanceGroupId); + doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.InstanceGroup.class, + AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId); + + bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId); + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.InstanceGroup.class, expectedUri); + } + + @Test + public void testGetAAIInstanceGroupThrowNotFound() { + String instanceGroupId = "instanceGroupId"; + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.InstanceGroup.class, + AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)); + + org.onap.aai.domain.yang.InstanceGroup actual = bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId); + + assertNull(actual); + } + + @Test + public void testGetAAICustomer() { + Optional<org.onap.aai.domain.yang.Customer> expected = Optional.of(new org.onap.aai.domain.yang.Customer()); + String globalSubscriberId = "globalSubscriberId"; + expected.get().setGlobalCustomerId(globalSubscriberId); + doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Customer.class, + AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId); + + bbInputSetupUtils.getAAICustomer(globalSubscriberId); + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.Customer.class, expectedUri); + } + + @Test + public void testGetAAICustomerThrowNotFound() { + String globalSubscriberId = "globalSubscriberId"; + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Customer.class, + AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)); + + org.onap.aai.domain.yang.Customer actual = bbInputSetupUtils.getAAICustomer(globalSubscriberId); + + assertNull(actual); + } + + @Test + public void testGetAAIServiceSubscription() { + Optional<org.onap.aai.domain.yang.ServiceSubscription> expected = Optional.of(new org.onap.aai.domain.yang.ServiceSubscription()); + String globalSubscriberId = "globalSubscriberId"; + String subscriptionServiceType = "subscriptionServiceType"; + expected.get().setServiceType(subscriptionServiceType); + doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.ServiceSubscription.class, + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, + subscriptionServiceType)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, + subscriptionServiceType); + + bbInputSetupUtils.getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType); + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.ServiceSubscription.class, expectedUri); + } + + @Test + public void testGetAAIServiceSubscriptionErrors() { + String globalSubId = null; + String subServiceType = null; + org.onap.aai.domain.yang.ServiceSubscription actual = bbInputSetupUtils.getAAIServiceSubscription(globalSubId, subServiceType); + assertNull(actual); + + String globalSubId2 = ""; + String subServiceType2 = ""; + org.onap.aai.domain.yang.ServiceSubscription actual2 = bbInputSetupUtils.getAAIServiceSubscription(globalSubId2, subServiceType2); + assertNull(actual2); + + String globalSubId3 = ""; + String subServiceType3 = null; + org.onap.aai.domain.yang.ServiceSubscription actual3 = bbInputSetupUtils.getAAIServiceSubscription(globalSubId3, subServiceType3); + assertNull(actual3); + + String globalSubId4 = null; + String subServiceType4 = ""; + org.onap.aai.domain.yang.ServiceSubscription actual4 = bbInputSetupUtils.getAAIServiceSubscription(globalSubId4, subServiceType4); + assertNull(actual4); + } + + @Test + public void testGetAAIServiceSubscriptionThrowNotFound() { + String globalSubscriberId = "globalSubscriberId"; + String subscriptionServiceType = "subscriptionServiceType"; + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient) + .get(org.onap.aai.domain.yang.ServiceSubscription.class, AAIUriFactory.createResourceUri( + AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, subscriptionServiceType)); + org.onap.aai.domain.yang.ServiceSubscription actual = bbInputSetupUtils + .getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType); + assertNull(actual); + } + + @Test + public void testGetAAIServiceInstanceById() { + String serviceInstanceId = "serviceInstanceId"; + + ServiceInstance expectedServiceInstance = new ServiceInstance(); + + doReturn(Optional.of(expectedServiceInstance)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + ServiceInstance actualServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + + assertThat(actualServiceInstance, sameBeanAs(expectedServiceInstance)); + } + + @Test + public void testGetAAIServiceInstanceByIdThrowNotFound() { + String serviceInstanceId = "serviceInstanceId"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + ServiceInstance actualServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + + assertNull(actualServiceInstance); + } + + @Test + public void testGetAAIServiceInstanceByIdAndCustomer() { + String globalCustomerId = "globalCustomerId"; + String serviceType = "serviceType"; + String serviceInstanceId = "serviceInstanceId"; + ServiceInstance expected = new ServiceInstance(); + expected.setServiceInstanceId(serviceInstanceId); + doReturn(Optional.of(expected)).when(MOCK_aaiResourcesClient).get(isA(Class.class), + isA(AAIResourceUri.class)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri( + AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId).depth(Depth.TWO); + this.bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(globalCustomerId, serviceType, serviceInstanceId); + + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.ServiceInstance.class, expectedUri); + + } + + @Test + public void testGetAAIServiceInstanceByIdAndCustomerThrowNotFound() { + String globalCustomerId = "globalCustomerId"; + String serviceType = "serviceType"; + String serviceInstanceId = "serviceInstanceId"; + + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), + isA(AAIResourceUri.class)); + ServiceInstance actual = this.bbInputSetupUtils + .getAAIServiceInstanceByIdAndCustomer(globalCustomerId, serviceType, serviceInstanceId); + + assertNull(actual); + } + + @Test + public void testGetAAIServiceInstanceByName() throws Exception { + String serviceInstanceName = "serviceInstanceName"; + + ServiceInstance expectedServiceInstance = new ServiceInstance(); + expectedServiceInstance.setServiceInstanceId("serviceInstanceId"); + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("serviceType"); + + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(serviceSubscription); + + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(expectedServiceInstance); + + doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(), + customer.getServiceSubscription().getServiceType()) + .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO); + bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer); + + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.ServiceInstances.class, expectedUri); + } + + @Test + public void testGetAAIServiceInstanceByNameException() throws Exception { + expectedException.expect(Exception.class); + + String serviceInstanceName = "serviceInstanceName"; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("serviceType"); + + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(serviceSubscription); + + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(serviceInstance); + serviceInstances.getServiceInstance().add(serviceInstance); + + doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer); + } + + @Test + public void testGetAAIServiceInstanceByNameNull() throws Exception { + String serviceInstanceName = "serviceInstanceName"; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("serviceType"); + + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(serviceSubscription); + + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(serviceInstance); + serviceInstances.getServiceInstance().add(serviceInstance); + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + ServiceInstance actualServiceInstance = bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer); + + assertNull(actualServiceInstance); + } + + @Test + public void testGetOptionalAAIServiceInstanceByNameException() throws Exception { + expectedException.expect(Exception.class); + + String globalCustomerId = "globalCustomerId"; + String serviceType = "serviceType"; + String serviceInstanceId = "serviceInstanceId"; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + serviceInstance.setServiceType(serviceType); + serviceInstance.setServiceInstanceName("serviceInstanceName"); + + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(serviceInstance); + serviceInstances.getServiceInstance().add(serviceInstance); + + doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + bbInputSetupUtils.getAAIServiceInstanceByName(globalCustomerId, serviceType, serviceInstanceId); + } + + @Test + public void testGetOptionalAAIServiceInstanceByNameNull() throws Exception { + String globalCustomerId = "globalCustomerId"; + String serviceType = "serviceType"; + String serviceInstanceId = "serviceInstanceId"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + Optional<ServiceInstance> actual = this.bbInputSetupUtils + .getAAIServiceInstanceByName(globalCustomerId, serviceType, serviceInstanceId); + + assertThat(actual, sameBeanAs(Optional.empty())); + } + + @Test + public void testGetCatalogInstanceGroup() throws JsonParseException, JsonMappingException, IOException { + String modelUUID = "modelUUID"; + + org.onap.so.db.catalog.beans.InstanceGroup expectedInstanceGroup = mapper.readValue( + new File(RESOURCE_PATH + "InstanceGroup.json"), org.onap.so.db.catalog.beans.InstanceGroup.class); + + doReturn(expectedInstanceGroup).when(MOCK_catalogDbClient).getInstanceGroupByModelUUID(isA(String.class)); + + org.onap.so.db.catalog.beans.InstanceGroup actualInstanceGroup = bbInputSetupUtils.getCatalogInstanceGroup(modelUUID); + + assertThat(actualInstanceGroup, sameBeanAs(expectedInstanceGroup)); + } + + @Test + public void testGetCollectionResourceInstanceGroupCustomization() { + String modelCustomizationUUID = "modelCustomizationUUID"; + + CollectionResourceInstanceGroupCustomization expectedCollection = new CollectionResourceInstanceGroupCustomization(); + + doReturn(Arrays.asList(expectedCollection)).when(MOCK_catalogDbClient) + .getCollectionResourceInstanceGroupCustomizationByModelCustUUID(modelCustomizationUUID); + + List<CollectionResourceInstanceGroupCustomization> actualCollection = bbInputSetupUtils + .getCollectionResourceInstanceGroupCustomization(modelCustomizationUUID); + + assertThat(actualCollection, sameBeanAs(Arrays.asList(expectedCollection))); + } + + @Test + public void testGetAAIGenericVnf() throws JsonParseException, JsonMappingException, IOException { + String vnfId = "vnfId"; + + GenericVnf expectedAaiVnf = mapper.readValue( + new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), GenericVnf.class); + + doReturn(Optional.of(expectedAaiVnf)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE); + GenericVnf actualAaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + + assertThat(actualAaiVnf, sameBeanAs(expectedAaiVnf)); + + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.GenericVnf.class, expectedUri); + } + + @Test + public void testGetAAIConfiguration() throws JsonParseException, JsonMappingException, IOException { + String configurationId = "configurationId"; + + Configuration expectedAaiConfiguration = mapper.readValue( + new File(RESOURCE_PATH + "ConfigurationInput.json"), Configuration.class); + + doReturn(Optional.of(expectedAaiConfiguration)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE); + bbInputSetupUtils.getAAIConfiguration(configurationId); + + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.Configuration.class, expectedUri); + } + + @Test + public void testGetAAIGenericVnfThrowNotFound() throws JsonParseException, JsonMappingException, IOException { + String vnfId = "vnfId"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + + GenericVnf actualAaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + + assertNull(actualAaiVnf); + } + + @Test + public void testGetAAIResourceDepthOne() { + String vnfId = "vnfId"; + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.ONE); + AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone(); + bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); + + verify(MOCK_aaiResourcesClient, times(1)).get(expectedUri); + assertEquals("Uri should not have changed", aaiResourceUriClone.build(), aaiResourceUri.build()); + } + + @Test + public void testGetAAIResourceDepthTwo() { + String vnfId = "vnfId"; + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.TWO); + AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone(); + bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri); + + verify(MOCK_aaiResourcesClient, times(1)).get(expectedUri); + assertEquals("Uri should not have changed", aaiResourceUriClone.build(), aaiResourceUri.build()); + } + + @Test + public void getRelatedNetworkByNameFromServiceInstanceTest() throws Exception { + Optional<L3Networks> expected = Optional.of(new L3Networks()); + L3Network network = new L3Network(); + network.setNetworkId("id123"); + network.setNetworkName("name123"); + expected.get().getL3Network().add(network); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class)); + Optional<L3Network> actual = this.bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance("id123", "name123"); + assertEquals(actual.get().getNetworkId(), expected.get().getL3Network().get(0).getNetworkId()); + } + + @Test + public void getRelatedNetworkByNameFromServiceInstanceMultipleNetworksExceptionTest() throws Exception { + expectedException.expect(Exception.class); + + String serviceInstanceId = "serviceInstanceId"; + String networkName = "networkName"; + + L3Network network = new L3Network(); + network.setNetworkId("id123"); + network.setNetworkName("name123"); + + L3Networks expected = new L3Networks(); + expected.getL3Network().add(network); + expected.getL3Network().add(network); + + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class)); + + bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName); + } + + @Test + public void getRelatedNetworkByNameFromServiceInstanceNotFoundTest() throws Exception { + String serviceInstanceId = "serviceInstanceId"; + String networkName = "networkName"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class)); + + Optional<L3Network> actualNetwork = bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName); + + assertEquals(Optional.empty(), actualNetwork); + } + + @Test + public void getRelatedVnfByNameFromServiceInstanceTest() throws Exception { + Optional<GenericVnfs> expected = Optional.of(new GenericVnfs()); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + vnf.setVnfName("name123"); + expected.get().getGenericVnf().add(vnf); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class)); + Optional<GenericVnf> actual = this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance("id123", "name123"); + assertEquals(actual.get().getVnfId(), expected.get().getGenericVnf().get(0).getVnfId()); + } + + @Test + public void getRelatedVnfByNameFromServiceInstanceMultipleVnfsExceptionTest() throws Exception { + expectedException.expect(Exception.class); + + String serviceInstanceId = "serviceInstanceId"; + String vnfName = "vnfName"; + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + vnf.setVnfName("name123"); + + GenericVnfs expectedVnf = new GenericVnfs(); + expectedVnf.getGenericVnf().add(vnf); + expectedVnf.getGenericVnf().add(vnf); + + doReturn(expectedVnf).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class)); + + bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName); + } + + @Test + public void getRelatedVnfByNameFromServiceInstanceNotFoundTest() throws Exception { + String serviceInstanceId = "serviceInstanceId"; + String vnfName = "vnfName"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class)); + + Optional<GenericVnf> actualVnf = this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName); + + assertEquals(actualVnf, Optional.empty()); + } + + @Test + public void getRelatedVolumeGroupByNameFromVnfTest() throws Exception { + Optional<VolumeGroups> expected = Optional.of(new VolumeGroups()); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + expected.get().getVolumeGroup().add(volumeGroup); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "name123"); + assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId()); + } + + @Test + public void getRelatedVolumeGroupByNameFromVnfMultipleVolumeGroupsExceptionTest() throws Exception { + expectedException.expect(Exception.class); + + String vnfId = "vnfId"; + String volumeGroupName = "volumeGroupName"; + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + + VolumeGroups expectedVolumeGroup = new VolumeGroups(); + expectedVolumeGroup.getVolumeGroup().add(volumeGroup); + expectedVolumeGroup.getVolumeGroup().add(volumeGroup); + + doReturn(expectedVolumeGroup).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + + bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName); + } + + @Test + public void getRelatedVolumeGroupByNameFromVnfNotFoundTest() throws Exception { + String vnfId = "vnfId"; + String volumeGroupName = "volumeGroupName"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + + Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName); + + assertEquals(actualVolumeGroup, Optional.empty()); + } + + @Test + public void getRelatedVolumeGroupByNameFromVfModuleTest() throws Exception { + Optional<VolumeGroups> expected = Optional.of(new VolumeGroups()); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + expected.get().getVolumeGroup().add(volumeGroup); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "name123"); + assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId()); + } + + @Test + public void getRelatedVolumeGroupByNameFromVfModuleMultipleVolumeGroupsExceptionTest() throws Exception { + expectedException.expect(Exception.class); + + String vnfId = "vnfId"; + String volumeGroupName = "volumeGroupName"; + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + + VolumeGroups expectedVolumeGroup = new VolumeGroups(); + expectedVolumeGroup.getVolumeGroup().add(volumeGroup); + expectedVolumeGroup.getVolumeGroup().add(volumeGroup); + + doReturn(expectedVolumeGroup).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + + bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupName); + } + + @Test + public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception { + String vnfId = "vnfId"; + String volumeGroupName = "volumeGroupName"; + + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); + + Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupName); + + assertEquals(actualVolumeGroup, Optional.empty()); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java new file mode 100644 index 0000000000..5e2275015b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; +import org.springframework.beans.factory.annotation.Autowired; + +public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { + @Autowired + private ExecuteBuildingBlockRainyDay executeBuildingBlockRainyDay; + + private ServiceInstance serviceInstance; + private Customer customer; //will build service sub + private GenericVnf vnf; + private BuildingBlock buildingBlock; + private ExecuteBuildingBlock executeBuildingBlock; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + customer = setCustomer(); + vnf = setGenericVnf(); + + buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName("AssignServiceInstanceBB"); + + executeBuildingBlock = new ExecuteBuildingBlock(); + executeBuildingBlock.setBuildingBlock(buildingBlock); + + delegateExecution.setVariable("gBBInput", gBBInput); + delegateExecution.setVariable("WorkflowException", new WorkflowException("", 7000, "")); + delegateExecution.setVariable("buildingBlock", executeBuildingBlock); + delegateExecution.setVariable("lookupKeyMap", lookupKeyMap); + } + + @Test + public void setRetryTimerTest() throws Exception{ + delegateExecution.setVariable("retryCount", 2); + executeBuildingBlockRainyDay.setRetryTimer(delegateExecution); + assertEquals("PT25M",delegateExecution.getVariable("RetryDuration")); + } + + @Test + public void setRetryTimerExceptionTest() { + expectedException.expect(BpmnError.class); + + executeBuildingBlockRainyDay.setRetryTimer(null); + } + + @Test + public void queryRainyDayTableExists() throws Exception{ + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); + vnf.setVnfType("vnft1"); + + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); + rainyDayHandlerStatus.setErrorCode("7000"); + rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); + rainyDayHandlerStatus.setServiceType("st1"); + rainyDayHandlerStatus.setVnfType("vnft1"); + rainyDayHandlerStatus.setPolicy("Rollback"); + rainyDayHandlerStatus.setWorkStep("ASTERISK"); + + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "st1", "vnft1", "7000", "*"); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution); + + assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); + } + + @Test + public void queryRainyDayTableDefault() throws Exception{ + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); + vnf.setVnfType("vnft1"); + + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); + rainyDayHandlerStatus.setErrorCode("ASTERISK"); + rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); + rainyDayHandlerStatus.setServiceType("ASTERISK"); + rainyDayHandlerStatus.setVnfType("ASTERISK"); + rainyDayHandlerStatus.setPolicy("Rollback"); + rainyDayHandlerStatus.setWorkStep("ASTERISK"); + + doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "st1", "vnft1", "7000", "ASTERISK"); + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "ASTERISK", "ASTERISK", "ASTERISK", "ASTERISK"); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution); + + assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); + } + + @Test + public void queryRainyDayTableDoesNotExist() throws Exception{ + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); + vnf.setVnfType("vnft1"); + + doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution); + + assertEquals("Abort", delegateExecution.getVariable("handlingCode")); + } + + @Test + public void queryRainyDayTableExceptionTest() { + doThrow(Exception.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution); + + assertEquals("Abort", delegateExecution.getVariable("handlingCode")); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java index 8943014ad0..3a4d6a0cc9 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/ResponseExceptionMapperImplTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,14 +18,17 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client; +package org.onap.so.client; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import com.google.common.base.Charsets; +import java.io.ByteArrayInputStream; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; + import javax.ws.rs.BadRequestException; import javax.ws.rs.ForbiddenException; import javax.ws.rs.InternalServerErrorException; @@ -35,16 +38,18 @@ import javax.ws.rs.NotAuthorizedException; import javax.ws.rs.NotFoundException; import javax.ws.rs.NotSupportedException; import javax.ws.rs.WebApplicationException; -import javax.ws.rs.client.ClientResponseContext; +import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; -import junitparams.JUnitParamsRunner; -import junitparams.Parameters; -import org.apache.commons.io.IOUtils; + import org.junit.Test; import org.junit.runner.RunWith; +import org.onap.so.BaseTest; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; @RunWith(JUnitParamsRunner.class) -public class ResponseExceptionMapperImplTest { +public class ResponseExceptionMapperImplTest{ private static final ResponseExceptionMapperImpl mapper = new ResponseExceptionMapperImpl(); @@ -68,42 +73,42 @@ public class ResponseExceptionMapperImplTest { @Parameters(method = "statusesAndCorrespondingExceptions") public void shouldThrowExceptionWhenStatusIsNotOk(Status status, Class<Exception> expectedException) { // given - ClientResponseContext responseContext = createMockResponseContext(status); + Response response = createMockResponse(status); // when, then - assertThatThrownBy(() -> mapper.filter(null, responseContext)).isInstanceOf(expectedException); + assertThatThrownBy(() -> mapper.map(response)).isInstanceOf(expectedException); } @Test public void shouldNotThrowExceptionWhenStatusIsOk() { // given - ClientResponseContext responseContext = createMockResponseContext(Status.OK); + Response response = createMockResponse(Status.OK); // when, then - assertThatCode(() -> mapper.filter(null, responseContext)).doesNotThrowAnyException(); + assertThatCode(() -> mapper.map(response)).doesNotThrowAnyException(); } @Test - public void shouldThrowExceptionWithCustomMessageWhenResponseHasEntity() { + public void shouldThrowExceptionWithCustomMessageWhenResponseHasEntity() throws UnsupportedEncodingException { // given - ClientResponseContext responseContext = createMockResponseContext(Status.BAD_REQUEST); - when(responseContext.hasEntity()).thenReturn(true); - when(responseContext.getEntityStream()).thenReturn(IOUtils.toInputStream("test message", Charsets.UTF_8)); + Response response = createMockResponse(Status.BAD_REQUEST); + when(response.hasEntity()).thenReturn(true); + when(response.getEntity()).thenReturn(new ByteArrayInputStream("test message".getBytes(StandardCharsets.UTF_8))); // when, then - assertThatThrownBy(() -> mapper.filter(null, responseContext)).isInstanceOf(BadRequestException.class) + assertThatThrownBy(() -> mapper.map(response)).isInstanceOf(BadRequestException.class) .hasMessage("test message"); } @Test public void shouldThrowExceptionWithDefaultMessageWhenResponseHasNoEntity() { // given - ClientResponseContext responseContext = createMockResponseContext(Status.BAD_REQUEST); - when(responseContext.hasEntity()).thenReturn(false); + Response response = createMockResponse(Status.BAD_REQUEST); + when(response.hasEntity()).thenReturn(false); // when, then - assertThatThrownBy(() -> mapper.filter(null, responseContext)).isInstanceOf(BadRequestException.class) + assertThatThrownBy(() -> mapper.map(response)).isInstanceOf(BadRequestException.class) .hasMessage("empty message"); } - private static ClientResponseContext createMockResponseContext(Status status) { - ClientResponseContext responseContext = mock(ClientResponseContext.class); + private static Response createMockResponse(Status status) { + Response responseContext = mock(Response.class); when(responseContext.getStatusInfo()).thenReturn(status); when(responseContext.getStatus()).thenReturn(status.getStatusCode()); return responseContext; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java new file mode 100644 index 0000000000..8d33a08c7a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java @@ -0,0 +1,463 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Optional; + +import org.json.JSONObject; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.Status; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.appc.payload.PayloadClient; + +import com.fasterxml.jackson.core.JsonProcessingException; + + +public class ApplicationControllerActionTest extends BaseTest{ + + private ApplicationControllerAction appCAction; + + @Mock + private ApplicationControllerOrchestrator client; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + + appCAction = new ApplicationControllerAction(); + appCAction.client = client; + } + + @Test + public void runAppCCommand_ResumeTraffic_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.ResumeTraffic; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + Optional<String> vserverId = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional<String> otherPayload = PayloadClient.resumeTrafficFormat(payloadInfo.get("vnfName")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + } + + @Test + public void runAppCCommand_Start_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_StartStop_Test(Action.Start); + } + + @Test + public void runAppCCommand_Stop_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_StartStop_Test(Action.Stop); + } + + private void runAppCCommand_StartStop_Test(Action action) throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + Optional<String> vserverId = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional<String> otherPayload = PayloadClient.startStopFormat(payloadInfo.get("vnfName")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + } + + @Test + public void runAppCCommand_Unlock_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_LockUnlock_Test(Action.Unlock); + } + + @Test + public void runAppCCommand_Lock_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_LockUnlock_Test(Action.Lock); + } + + private void runAppCCommand_LockUnlock_Test(Action action) throws ApplicationControllerOrchestratorException { + //Prepare method + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + Optional<String> vserverId = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional<String> otherPayload = Optional.empty(); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + } + + @Test + public void runAppCCommand_QuiesceTraffic_PayloadPresent_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.QuiesceTraffic; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.of("testPayload"); + Optional<String> vserverId = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional<String> modifiedPayload = PayloadClient.quiesceTrafficFormat(payload, payloadInfo.get("vnfName")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, modifiedPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, modifiedPayload, controllerType); + } + + @Test + public void runAppCCommand_QuiesceTraffic_NoPayload_Test() throws ApplicationControllerOrchestratorException { + //Prepare method + Action action = Action.QuiesceTraffic; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + String controllerType = "testControllerType"; + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify non call + verify(client, times(0)).vnfCommand(any(), any(), any(), any(), any(), any()); + assertEquals("Payload is not present for " + action.toString(), appCAction.getErrorMessage()); + } + + @Test + public void runAppCCommand_HealthCheck_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.HealthCheck; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + Optional<String> vserverId = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + payloadInfo.put("vnfHostIpAddress", "testVnfHostIpAddress"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional<String> otherPayload = PayloadClient.healthCheckFormat(payloadInfo.get("vnfName"), payloadInfo.get("vnfHostIpAddress")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + } + + @Test + public void runAppCCommand_Snapshot_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.Snapshot; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("identityUrl", "testIdentityUrl"); + ArrayList<String> vmIdList = new ArrayList<String>(); + String vmId1 = "testlink:testVmId1"; + vmIdList.add(vmId1); + String vmId2 = "testlink:testVmId2"; + vmIdList.add(vmId2); + JSONObject vmIdListJson = new JSONObject(); + vmIdListJson.put("vmIds", vmIdList); + payloadInfo.put("vmIdList", vmIdListJson.toString()); + ArrayList<String> vserverIdList = new ArrayList<String>(); + String vserverId1 = "testVserverId1"; + Optional<String> vserverIdString1 = Optional.of(vserverId1); + vserverIdList.add(vserverId1); + String vserverId2 = "testVserverId2"; + Optional<String> vserverIdString2 = Optional.of(vserverId2); + vserverIdList.add(vserverId2); + + JSONObject vserverIdListJson = new JSONObject(); + vserverIdListJson.put("vserverIds", vserverIdList); + payloadInfo.put("vserverIdList", vserverIdListJson.toString()); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional<String> otherPayloadVm1 = PayloadClient.snapshotFormat(vmId1, payloadInfo.get("identityUrl")); + Optional<String> otherPayloadVm2 = PayloadClient.snapshotFormat(vmId2, payloadInfo.get("identityUrl")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverIdString1, otherPayloadVm1, controllerType); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverIdString2, otherPayloadVm2, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverIdString1, otherPayloadVm1, controllerType); + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverIdString2, otherPayloadVm2, controllerType); + } + + @Test + public void runAppCCommand_ConfigModify__PayloadPresent_Test() throws ApplicationControllerOrchestratorException { + //Prepare method + Action action = Action.ConfigModify; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.of("testPayload"); + Optional<String> vserverId = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, payload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, payload, controllerType); + } + + @Test + public void runAppCCommand_ConfigModify__NoPayload_Test() throws ApplicationControllerOrchestratorException { + //Prepare method + Action action = Action.ConfigModify; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + String controllerType = "testControllerType"; + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify non call + verify(client, times(0)).vnfCommand(any(), any(), any(), any(), any(), any()); + assertEquals("Payload is not present for " + action.toString(), appCAction.getErrorMessage()); + } + + @Test + public void runAppCCommand_UpgradePreCheck_PayloadPresent_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_Upgrade_PayloadPresent_Test(Action.UpgradePreCheck); + } + + @Test + public void runAppCCommand_UpgradePostCheck_PayloadPresent_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_Upgrade_PayloadPresent_Test(Action.UpgradePostCheck); + } + + @Test + public void runAppCCommand_UpgradeSoftware_PayloadPresent_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_Upgrade_PayloadPresent_Test(Action.UpgradeSoftware); + } + + @Test + public void runAppCCommand_UpgradeBackup_PayloadPresent_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + runAppCCommand_Upgrade_PayloadPresent_Test(Action.UpgradeBackup); + } + + private void runAppCCommand_Upgrade_PayloadPresent_Test(Action action) throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.of("testPayload"); + Optional<String> vserverId = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + Optional<String> modifiedPayload = PayloadClient.upgradeFormat(payload, payloadInfo.get("vnfName")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, modifiedPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, modifiedPayload, controllerType); + } + + @Test + public void runAppCCommand_UpgradePreCheck_NoPayload_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_Upgrade_NoPayload_Test(Action.UpgradePreCheck); + } + + @Test + public void runAppCCommand_UpgradePostCheck_NoPayload_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_Upgrade_NoPayload_Test(Action.UpgradePostCheck); + } + + @Test + public void runAppCCommand_UpgradeSoftware_NoPayload_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_Upgrade_NoPayload_Test(Action.UpgradeSoftware); + } + + @Test + public void runAppCCommand_UpgradeBackup_NoPayload_Test() throws ApplicationControllerOrchestratorException { + runAppCCommand_Upgrade_NoPayload_Test(Action.UpgradeBackup); + } + + private void runAppCCommand_Upgrade_NoPayload_Test(Action action) throws ApplicationControllerOrchestratorException { + //Prepare method + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + String controllerType = "testControllerType"; + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify non call + verify(client, times(0)).vnfCommand(any(), any(), any(), any(), any(), any()); + assertEquals("Payload is not present for " + action.toString(), appCAction.getErrorMessage()); + } + + @Test + public void runAppCCommand_InvalidAppCAction_Test() throws ApplicationControllerOrchestratorException { + //Prepare method + Action action = Action.ActionStatus; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + String controllerType = "testControllerType"; + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify non call + verify(client, times(0)).vnfCommand(any(), any(), any(), any(), any(), any()); + //TODO For original author/architect: it appears that whoever coded this wanted the error message to be "Unable to idenify Action request for AppCClient" and this is not the case because of the ApplicationControllerSupport.getCategoryOf(appCStatus) call with a null appCStatus, so this may be something worth looking into + } + + @Test + public void runAppCCommand_NormalAppCStatusGetErrorCode_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.Start; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + Optional<String> vserverId = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Status status = new Status(); + status.setCode(100); + Optional<String> otherPayload = PayloadClient.startStopFormat(payloadInfo.get("vnfName")); + doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify call + String expectedErrorCode = "0"; + assertEquals(expectedErrorCode, appCAction.getErrorCode()); + } + + @Test + public void getErrorCode_Test() { + String defaultErrorCode = "1002"; + //Verify default error code + assertEquals(defaultErrorCode, appCAction.getErrorCode()); + } + + @Test + public void getErrorMessage_Test() { + String defaultErrorMessage = "Unable to reach App C Servers"; + //Verify default error message + assertEquals(defaultErrorMessage, appCAction.getErrorMessage()); + } + + @Test + public void applicationControllerOrchestratorExceptionCaught_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException { + //Prepare method + Action action = Action.Start; + String msoRequestId = "testMsoRequestId"; + String vnfId = "testVnfId"; + Optional<String> payload = Optional.empty(); + Optional<String> vserverId = Optional.empty(); + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + String controllerType = "testControllerType"; + + //Prepare mocks + Optional<String> otherPayload = PayloadClient.startStopFormat(payloadInfo.get("vnfName")); + String expectedErrorMessage = "Test appc orchestrator error message"; + doThrow(new ApplicationControllerOrchestratorException(expectedErrorMessage, 0)).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType); + + //Run method + appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + + //Verify error + assertEquals(expectedErrorMessage, appCAction.getErrorMessage()); + String expectedErrorCode = "1002"; + assertEquals(expectedErrorCode, appCAction.getErrorCode()); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java index 59be8235fe..7fabb2ac0e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java @@ -1,113 +1,131 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.client.appc;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.Properties;
-import java.util.UUID;
-
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.onap.appc.client.lcm.model.Action;
-import org.onap.appc.client.lcm.model.ActionIdentifiers;
-import org.onap.appc.client.lcm.model.CheckLockInput;
-import org.onap.appc.client.lcm.model.Status;
-
-public class ApplicationControllerClientTest {
-
- @BeforeClass
- public static void beforeClass() {
- System.setProperty("mso.config.path", "src/test/resources");
- }
-
- @Test
- public void testClientCreation() {
- ApplicationControllerClient client = new ApplicationControllerClient("appc");
- assertEquals(client.getControllerType(), "APPC");
- assertNotNull(client.getAppCClient());
- }
-
- @Test
- public void createRequest_CheckLock_RequestBuilt() {
- ApplicationControllerClient client = new ApplicationControllerClient("APPC");
- ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
- actionIdentifiers.setVnfId("vnfId");
- CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers, null,
- "requestId");
- assertEquals(checkLockInput.getAction().name(), "CheckLock");
- }
-
- @Test
- @Ignore // 1802 merge
- public void runCommand_liveAppc() {
- ApplicationControllerClient client = new ApplicationControllerClient("appc");
- ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
- //actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f");
- actionIdentifiers.setVnfId("2d2bf10e-81a5-");
- Status status;
- try {
- status = client.runCommand(Action.Lock, actionIdentifiers, null, UUID.randomUUID().toString());
- } catch (ApplicationControllerOrchestratorException e) {
- status = new Status();
- status.setCode(e.getAppcCode());
- status.setMessage(e.getMessage());
- }
- assertEquals("Status of run command is correct", status.getCode(), 306);
- }
-
- @Test
- @Ignore // 1802 merge
- public void runCommand_CheckLock_RequestBuilt() {
- ApplicationControllerClient client = new ApplicationControllerClient("appc");
- ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
- actionIdentifiers.setVnfId("fusion-vpp-vnf-001");
- Status status;
- try {
- status = client.runCommand(Action.Unlock, actionIdentifiers, null, "requestId");
- } catch (ApplicationControllerOrchestratorException e) {
- status = new Status();
- status.setCode(e.getAppcCode());
- status.setMessage(e.getMessage());
- }
- assertEquals("Status of run command is correct", status.getCode(), 309);
- }
-
- @Test
- public void test_getLCMPropertiesHelper() {
- ApplicationControllerClient client = new ApplicationControllerClient();
- Properties properties = client.getLCMProperties();
- assertEquals(properties.get("topic.read"), "APPC-TEST-AMDOCS2");
- assertEquals(properties.get("topic.write"), "APPC-TEST-AMDOCS1-DEV3");
- assertEquals(properties.get("SDNC-topic.read"), "SDNC-LCM-READ");
- assertEquals(properties.get("SDNC-topic.write"), "SDNC-LCM-WRITE");
- assertEquals(properties.get("topic.read.timeout"), "120000");
- assertEquals(properties.get("client.response.timeout"), "120000");
- assertEquals(properties.get("poolMembers"),
- "uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904");
- assertEquals(properties.get("client.key"), "iaEMAfjsVsZnraBP");
- assertEquals(properties.get("client.secret"), "wcivUjsjXzmGFBfxMmyJu9dz");
- assertEquals(properties.get("controllerType"), "appc");
- }
-
-}
\ No newline at end of file +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.ActionIdentifiers; +import org.onap.appc.client.lcm.model.CheckLockInput; +import org.onap.appc.client.lcm.model.Status; +import org.onap.so.BaseTest; + +import java.util.Properties; +import java.util.UUID; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class ApplicationControllerClientV2Test { + + @Mock + ApplicationControllerSupport applicationControllerSupport; + + @Mock + ApplicationControllerConfiguration applicationControllerConfiguration; + + @InjectMocks + ApplicationControllerClientV2 client; + + + @Before + public void setup(){ + when(applicationControllerConfiguration.getReadTopic()).thenReturn("APPC-TEST-AMDOCS2"); + when(applicationControllerConfiguration.getReadTimeout()).thenReturn("120000"); + when(applicationControllerConfiguration.getResponseTimeout()).thenReturn("120000"); + when(applicationControllerConfiguration.getWrite()).thenReturn("APPC-TEST-AMDOCS1-DEV3"); + when(applicationControllerConfiguration.getService()).thenReturn("ueb"); + when(applicationControllerConfiguration.getPoolMembers()).thenReturn("localhost:3904,localhost:3904,localhost:3904"); + when(applicationControllerConfiguration.getClientKey()).thenReturn("iaEMAfjsVsZnraBP"); + when(applicationControllerConfiguration.getClientSecret()).thenReturn("wcivUjsjXzmGFBfxMmyJu9dz"); + //client.buildClient(); + } + @BeforeClass + public static void beforeClass() { + System.setProperty("mso.config.path", "src/test/resources"); + } + @Ignore + @Test + public void createRequest_CheckLock_RequestBuilt() { + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + actionIdentifiers.setVnfId("vnfId"); + // when(applicationControllerSupport.getInput(eq(Action.CheckLock.name()))).thenReturn(new CheckLockInput()); + CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers, null, + "requestId"); + assertEquals(checkLockInput.getAction().name(), "CheckLock"); + } + @Ignore + @Test + public void runCommand_liveAppc() { + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + //actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f"); + actionIdentifiers.setVnfId("2d2bf10e-81a5-"); + Status status; + //when(applicationControllerSupport.getInput(eq(Action.Lock.name()))).thenReturn(new LockInput()); + //when(applicationControllerSupport.getAPIMethod(anyString(),any(),anyBoolean())).thenCallRealMethod(); + try { + status = client.runCommand(Action.Lock, actionIdentifiers, null, UUID.randomUUID().toString()); + } catch (ApplicationControllerOrchestratorException e) { + status = new Status(); + status.setCode(e.getAppcCode()); + status.setMessage(e.getMessage()); + } + assertEquals("Status of run command is correct", status.getCode(), 306); + } + + @Ignore + @Test + public void runCommand_CheckLock_RequestBuilt() { + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + actionIdentifiers.setVnfId("fusion-vpp-vnf-001"); + Status status; + try { + status = client.runCommand(Action.Unlock, actionIdentifiers, null, "requestId"); + } catch (ApplicationControllerOrchestratorException e) { + status = new Status(); + status.setCode(e.getAppcCode()); + status.setMessage(e.getMessage()); + } + assertEquals("Status of run command is correct", status.getCode(), 309); + } + + @Ignore + @Test + public void test_getLCMPropertiesHelper() { + Properties properties = client.getLCMProperties(""); + assertEquals(properties.get("topic.write"), "APPC-TEST-AMDOCS1-DEV3"); + assertEquals(properties.get("topic.read.timeout"), "120000"); + assertEquals(properties.get("client.response.timeout"), "120000"); + assertEquals(properties.get("topic.read"), "APPC-TEST-AMDOCS2"); + assertEquals(properties.get("poolMembers"), + "localhost:3904,localhost:3904,localhost:3904"); + assertEquals(properties.get("client.key"), "iaEMAfjsVsZnraBP"); + assertEquals(properties.get("client.secret"), "wcivUjsjXzmGFBfxMmyJu9dz"); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java index d2d4f5002a..5ef26b34ee 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,20 +18,21 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.appc.client.lcm.model.Status; -import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory; +import org.onap.so.BaseTest; +import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; import junitparams.JUnitParamsRunner; import junitparams.Parameters; @RunWith(JUnitParamsRunner.class) -public class ApplicationControllerSupportTest { +public class ApplicationControllerSupportTest{ public static Object[][] statusesAndCategories() { return new Object[][]{ @@ -81,4 +82,4 @@ public class ApplicationControllerSupportTest { status.setCode(code); return status; } -} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBeansTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBeansTest.java new file mode 100644 index 0000000000..30ab21b2dd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBeansTest.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.avpn.dmaap.beans; + +import static org.junit.Assert.assertNotNull; + +import java.util.List; + +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.openpojo.rules.ToStringTester; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.affirm.Affirm; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class AVPNDmaapBeansTest extends BaseTest{ + + private static final int EXPECTED_CLASS_COUNT = 5; + private static final String POJO_PACKAGE = "org.onap.so.client.avpn.dmaap.beans"; + + @Test + public void ensureExpectedPojoCount() { + List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses( POJO_PACKAGE, + new FilterPackageInfo()); + Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size()); + } + + @Test + public void testPojoStructureAndBehavior() { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .with(new ToStringTester()) + .build(); + + validator.validate(POJO_PACKAGE, new FilterPackageInfo()); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java new file mode 100644 index 0000000000..35586cc29e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.dmaapproperties; + +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.urlEqualTo; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +import java.io.File; +import java.io.IOException; + +import org.apache.http.HttpStatus; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.client.avpn.dmaap.beans.AVPNDmaapBean; +import org.onap.so.client.exception.MapperException; +import org.springframework.beans.factory.annotation.Autowired; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import static com.github.tomakehurst.wiremock.client.WireMock.*; + +public class DmaapPropertiesClientTest extends BaseTest{ + + @Autowired + private DmaapPropertiesClient dmaapPropertiesClient; + + private final String file = "src/test/resources/org/onap/so/client/avpn/dmaap/avpnDmaapAsyncRequestStatus.json"; + private String requestId = "rq1234d1-5a33-55df-13ab-12abad84e331"; + private String clientSource = "SPP"; + private String correlator = "myClientId123"; + private String serviceInstanceId = "bc305d54-75b4-431b-adb2-eb6b9e546014"; + private String startTime = "2017-11-17T09:30:47Z"; + private String finishTime = "2017-11-17T09:30:47Z"; + private String requestScope = "service"; + private String requestType = "createInstance"; + private String timestamp = "2017-11-17T09:30:47Z"; + private String requestState = "COMPLETE"; + private String statusMessage = "Success"; + private String percentProgress = "100"; + + @Test + public void testBuildRequestJson() throws MapperException, IOException { + AVPNDmaapBean actualBean = dmaapPropertiesClient.buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope, + requestType, timestamp, requestState, statusMessage, percentProgress, true); + + AVPNDmaapBean expected = new ObjectMapper().readValue(new File(file), AVPNDmaapBean.class); + + assertNotNull(actualBean); + assertThat(actualBean, sameBeanAs(expected)); + } + + @Test + public void testDmaapPublishRequest() throws JsonProcessingException, MapperException { + stubFor(post(urlEqualTo("/events/com.att.mso.asyncStatusUpdate?timeout=20000")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); + + dmaapPropertiesClient.dmaapPublishRequest(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope, + requestType, timestamp, requestState, statusMessage, percentProgress, false); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java new file mode 100644 index 0000000000..0992b59267 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.dmaapproperties; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.BaseTest; +import org.springframework.beans.factory.annotation.Autowired; + +public class GlobalDmaapPublisherTest extends BaseTest{ + + @Autowired + private GlobalDmaapPublisher globalDmaapPublisher; + + @Test + public void testGetters() { + assertEquals("dmaapUsername", globalDmaapPublisher.getUserName()); + assertEquals("dmaapPassword", globalDmaapPublisher.getPassword()); + assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic()); + assertEquals("http://localhost:" + wireMockPort, globalDmaapPublisher.getHost().get()); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java new file mode 100644 index 0000000000..9ada85fa38 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.exception; + +import static org.junit.Assert.assertEquals; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.mock.FileUtil; + +public class ExceptionBuilderTest extends BaseTest { + + private static final String RESOURCE_PATH = "__files/"; + private static final String VALID_ERROR_MESSAGE = "{test error message}"; + + @Test + public void buildAndThrowWorkflowExceptionTest() { + try { + ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, new NullPointerException(VALID_ERROR_MESSAGE)); + } catch (BpmnError bpmnException){ + assertEquals("MSOWorkflowException", bpmnException.getErrorCode()); + } + } + + @Test + public void buildAndThrowWorkflowExceptionInvalidMessageTest() { + try{ + ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + String invalidErrorMessage = FileUtil.readResourceFile(RESOURCE_PATH + "invalidErrorMessage.txt"); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, new NullPointerException(invalidErrorMessage)); + } catch (BpmnError bpmnException){ + assertEquals("MSOWorkflowException", bpmnException.getErrorCode()); + } + } + + @Test + public void buildAndThrowWorkflowExceptionInvalidMessageFlagTest() { + try{ + ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + String invalidErrorMessage = FileUtil.readResourceFile(RESOURCE_PATH + "invalidErrorMessageFlag.txt"); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, new NullPointerException(invalidErrorMessage)); + } catch (BpmnError bpmnException){ + assertEquals("MSOWorkflowException", bpmnException.getErrorCode()); + } + } + + @Test + public void buildAndThrowWorkflowExceptionNullMessageTest() { + try{ + ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, new NullPointerException()); + } catch (BpmnError bpmnException){ + assertEquals("MSOWorkflowException", bpmnException.getErrorCode()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java index c6602d33f9..2e74d443bd 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java @@ -1,43 +1,50 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class RollbackVnfNotificationTest {
- private RollbackVnfNotification rvn = new RollbackVnfNotification();
- MsoExceptionCategory mso= MsoExceptionCategory.OPENSTACK;
- @Test
- public void testRollbackVnfNotification() {
- rvn.setMessageId("messageId");
- rvn.setCompleted(true);
- rvn.setException(mso);
- rvn.setErrorMessage("errorMessage");
- assertEquals(rvn.getMessageId(), "messageId");
- assertEquals(rvn.isCompleted(), true);
- assertEquals(rvn.getException(), mso);
- assertEquals(rvn.getErrorMessage(), "errorMessage");
- }
- @Test
- public void testtoString() {
- assert(rvn.toString()!=null);
- }
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.restproperties; + +import static org.junit.Assert.assertEquals; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.junit.Test; +import org.onap.so.client.aai.AAIVersion; + +public class AAIPropertiesImplTest{ + + private AAIPropertiesImpl aaiPropertiesImpl = new AAIPropertiesImpl(); + + @Test + public void getEndpointTest() throws MalformedURLException { + assertEquals("aai.endpoint", AAIPropertiesImpl.AAI_ENDPOINT); + } + + @Test + public void getAuthTest() { + String expectedAuth = "aai.auth"; + assertEquals(expectedAuth, AAIPropertiesImpl.AAI_AUTH); + } + + @Test + public void getKeyTest() { + assertEquals("mso.msoKey", AAIPropertiesImpl.MSO_MSO_KEY); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/PolicyRestPropertiesImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/PolicyRestPropertiesImplTest.java new file mode 100644 index 0000000000..d1de702a81 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/PolicyRestPropertiesImplTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.restproperties; + +import static org.junit.Assert.assertEquals; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.junit.Test; + +public class PolicyRestPropertiesImplTest { + + + @Test + public void getEndpointTest() throws MalformedURLException { + assertEquals("policy.endpoint", PolicyRestPropertiesImpl.POLICY_ENDPOINT); + } + + @Test + public void getEnvironmentTest() { + assertEquals("policy.environment", PolicyRestPropertiesImpl.POLICY_ENVIRONMENT); + } + + @Test + public void getClientAuthTest() { + assertEquals("policy.auth", PolicyRestPropertiesImpl.POLICY_AUTH); + } + + @Test + public void getAuthTest() { + assertEquals("policy.client.auth", PolicyRestPropertiesImpl.POLICY_CLIENT_AUTH); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java new file mode 100644 index 0000000000..863338548e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/RestPropertiesPojoTest.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.restproperties; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.NoPrimitivesRule; +import com.openpojo.validation.rule.impl.NoPublicFieldsRule; +import com.openpojo.validation.test.impl.GetterTester; + +public class RestPropertiesPojoTest { + @Test + public void pojoStructure() { + test(PojoClassFactory.getPojoClass(AaiPropertiesConfiguration.class)); + } + + private void test(PojoClass pojoClass) { + Validator validator = ValidatorBuilder.create() + .with(new NoPrimitivesRule()) + .with(new NoPublicFieldsRule()) + .with(new GetterTester()) + .build(); + validator.validate(pojoClass); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java new file mode 100644 index 0000000000..8231c2f529 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.restproperties; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.client.RestPropertiesLoader; +import org.onap.so.client.aai.AAIProperties; + +public class ThreadedReadTest { + @Test + public void allAtOnce() throws InterruptedException { + ExecutorService executorService = Executors.newFixedThreadPool(10); + + Callable<AAIProperties> callableTask = () -> { + return RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class); + }; + List<Callable<AAIProperties>> callableTasks = new ArrayList<>(); + + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + + List<Future<AAIProperties>> futures = executorService.invokeAll(callableTasks); + + Set<AAIProperties> results = new HashSet<>(); + futures.forEach(item -> { + try { + results.add(item.get()); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }); + + assertThat("expect all unique results", results.size(), equalTo(callableTasks.size())); + + } + + @Test + public void executeOverTime() { + ScheduledExecutorService executorService = Executors.newScheduledThreadPool(10); + + Callable<AAIProperties> callableTask = () -> { + TimeUnit.MILLISECONDS.sleep(500); + return RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class); + }; + List<Callable<AAIProperties>> callableTasks = new ArrayList<>(); + + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + + Set<AAIProperties> results = new HashSet<>(); + callableTasks.forEach(callable -> { + try { + TimeUnit.MILLISECONDS.sleep(300); + Future<AAIProperties> result = executorService.submit(callable); + results.add(result.get()); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }); + + assertThat("expect all unique results", results.size(), equalTo(callableTasks.size())); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/AppCClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/AppCClientTest.java deleted file mode 100644 index 8561b030eb..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/AppCClientTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetPserverByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicySkip; -import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; - -//import static org.junit.Assert.assertEquals; -//import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -//import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -//import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.onap.appc.client.lcm.model.Action; - -//import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; - -public class AppCClientTest extends WorkflowTest{ - - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/AppCClient.bpmn"}) - public void test() 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"); - - Map<String, Object> variables = new HashMap<String, Object>(); - variables = setVariablesInstance(); - String businessKey = UUID.randomUUID().toString(); - invokeSubProcess("AppCClient", businessKey, variables); - waitForProcessEnd(businessKey, 10000); - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, "AppCClient", "WorkflowException"); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - logEnd(); - } - - - private Map<String, Object> setVariablesInstance(){ - Map<String,Object> variables = new HashMap<String, Object>(); - variables.put("isDebugLogEnabled", "true"); - variables.put("mso-request-id", "RaaACCTest1"); - variables.put("msoRequestId", "RaaACCTestRequestId-1"); - variables.put("requestId", "testRequestId"); - variables.put("vnfId", "skask"); - variables.put("action", Action.Stop); - variables.put("healthCheckIndex", 0); - variables.put("payload", "{\"existing-software-version\":\"3.1\",\"new-software-version\":\"3.2\"}"); - //variables.put("payload", "{\"vm-id\": \"<VM-ID>\", \"identy-url\":\"<IDENTITY-URL>\", \"tenant-id\": \"<TENANT-ID>\"}, \"Hello\":\"Whats up\"" ); - return variables; - } -} 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 deleted file mode 100644 index 0bb5186a17..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java +++ /dev/null @@ -1,248 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.spy;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.core.Response;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.history.HistoricProcessInstance;
-import org.camunda.bpm.engine.history.HistoricVariableInstance;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.jboss.resteasy.spi.AsynchronousResponse;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource;
-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);
- }
- }
-}
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 deleted file mode 100644 index bf69223b52..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java +++ /dev/null @@ -1,217 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-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;
- }
-}
-
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 deleted file mode 100644 index 845f06045a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; -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(); - } -} 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 deleted file mode 100644 index 13c400e71e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -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"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables); - - 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"); - - 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"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables); - - 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"); - - 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"); - } -} 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 deleted file mode 100644 index b2b7760327..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java +++ /dev/null @@ -1,277 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Test;
-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 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 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 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 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());
- }
-
- 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 deleted file mode 100644 index 5cc26459e8..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Test;
-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();
- }
-}
-
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 deleted file mode 100644 index 873e87cc49..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DecomposeServiceTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; - -/** - * Unit Test for the DecomposeService Flow - * - */ -public class DecomposeServiceTest extends WorkflowTest { - - - public DecomposeServiceTest() throws IOException { - - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/DecomposeService.bpmn"}) - public void testDecomposeService_success() throws Exception{ - MockGetServiceResourcesCatalogData("cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataWithConfig.json"); - - 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); - - 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"); - - - 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); - - 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); - - 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 deleted file mode 100644 index 564927a854..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java +++ /dev/null @@ -1,643 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Test;
-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)));
- }
-}
-
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 deleted file mode 100644 index c3259a0de5..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java +++ /dev/null @@ -1,235 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-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.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Test;
-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;
- }
-
-}
-
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenerateVfModuleNameTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenerateVfModuleNameTest.java deleted file mode 100644 index 051d935527..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenerateVfModuleNameTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common;
-
-import static org.junit.Assert.assertNotNull;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Test;
-
-/**
- * Unit test for GenerateVfModuleName.bpmn.
- */
-public class GenerateVfModuleNameTest extends WorkflowTest {
- private static final String EOL = "\n";
-
- @Test
- @Deployment(resources = {
- "subprocess/GenerateVfModuleName.bpmn"
- })
- public void TestGenerateVfModuleNameSuvvess() {
- //
- String request =
- "<vnf-request xmlns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>CREATE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
- " <vf-module-name>STMTN5MMSC22-MMSC::module-0-0</vf-module-name>" + EOL +
- " <vf-module-model-name>MMSC::module-0</vf-module-model-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <aic-node-clli>MDTWNJ21</aic-node-clli>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- MockGetGenericVnfById(".*", "GenericFlows/getGenericVnfByNameResponse.xml");
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put("isDebugLogEnabled","true");
- variables.put("vnfName", "STMTN5MMSC20");
- variables.put("vfModuleLabel", "ModuleLabel1");
- variables.put("personaModelId", "extrovert");
- variables.put("vnfId", "12345678-f41f-4822-9323-b75962763d74");
-
- runtimeService.startProcessInstanceByKey("GenerateVfModuleName", variables);
- String response = BPMNUtil.getVariable(processEngineRule, "GenerateVfModuleName", "vfModuleName");
-
- assertNotNull(response);
- }
-}
\ No newline at end of file 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 deleted file mode 100644 index 67ac34c1d0..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceSubscription; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -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"); - - 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("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); - - Map<String, String> variables = new HashMap<>(); - setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", ""); - - 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("false", foundIndicator); - assertEquals("true", successIndicator); - assertEquals("false", resourceVersionProvidedFlag); - assertEquals(null, workflowException); - - } - - @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"); - - 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("false", foundIndicator); - assertEquals("true", successIndicator); - assertEquals("true", resourceVersionProvidedFlag); - assertEquals(null, workflowException); - } - - @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"); - - 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=Incoming Required Variable is Missing or Null!]"; - - 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{ - - 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); - - 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); - } - - - 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"); - } - - -} 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 deleted file mode 100644 index a318be5b10..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf_500; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVce; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVceById; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -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"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "true", "true", null); - - } - - @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"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "true", "true", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_success_genericVnfNoResourceVersion() throws Exception{ - - MockGetGenericVnfById("/testVnfId123", "GenericFlows/getGenericVnfByNameResponse.xml", 200); - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "generic-vnf", ""); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - 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"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "vce", null); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "true", "false", null); - - } - - @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"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "false", "true", null); - - } - - @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"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "false", "true", null); - - } - - @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", ""); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId()); - - assertVariables("true", "false", "false", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) - public void testGenericDeleteVnf_error_missingVariables() throws Exception{ - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, "testVnfId123", "", "testReVer123"); - - 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!]"); - - } - - @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"); - - 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]"); - - } - - @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"); - - 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]"); - - } - - 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"); - - 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); - } - -} 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 deleted file mode 100644 index 6da6924d11..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java +++ /dev/null @@ -1,560 +0,0 @@ -/*
- * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceSubscription;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_500;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_500;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-
-
-/**
- * Unit Test for the GenericGetService Sub Flow
- */
-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());
-
- 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");
-
- Map<String, String> variables = new HashMap<>();
- setVariablesInstance(variables, null, "1604-MVM-26", "XyCorporation", 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("true", found);
- 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");
- }
-
-
-}
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 deleted file mode 100644 index 7de493a621..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_500; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByNameWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVceByNameWithDepth; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVceById; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -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); - } -} 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 deleted file mode 100644 index 7c003c986a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; -import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVce; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -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>"; - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_success_genericVnf() throws Exception{ - - MockPutGenericVnf("testVnfId123"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); - - 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"); - - assertEquals("true", successIndicator); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_success_vce() throws Exception{ - - MockPutVce("testVnfId123"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, "testVnfId123", vcePayload, "vce"); - - 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"); - - assertEquals("true", successIndicator); - assertEquals(null, workflowException); - - } - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_error_missingType() throws Exception{ - - MockPutGenericVnf("testVnfId123"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, "testVnfId123", genericVnfPayload, ""); - - 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 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); - - } - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_error_missingPayload() throws Exception{ - - MockPutGenericVnf("testVnfId123"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, "testVnfId123", genericVnfPayload, ""); - - 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 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); - - } - - @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"); - - 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 expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=404,errorMessage=Received a bad response from AAI]"; - - assertEquals("false", successIndicator); - assertEquals(expectedWFEX, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) - public void testGenericPutVnf_error_400() throws Exception{ - - MockPutGenericVnf("/testVnfId123", 400); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); - - 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 expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=400,errorMessage=Received a bad response from AAI]"; - - 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); - } - - -} 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 deleted file mode 100644 index 85a0bb789d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ManualHandlingTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; - -import org.camunda.bpm.engine.TaskService; -import org.camunda.bpm.ProcessEngineService; -import org.camunda.bpm.engine.task.TaskQuery; -import org.camunda.bpm.engine.task.Task; -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateTask; -import org.camunda.bpm.engine.runtime.Execution; - -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; -import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; -import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicyAbort; - -import java.io.DataOutputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import java.util.List; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; -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", "AAI"); - variables.put("vnfName", "vSAMP12"); - variables.put("errorCode", "123"); - variables.put("errorText", "update failed"); - variables.put("validResponses", "Rollback"); - variables.put("vnfName", "vSAMP1"); - - - 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/OofHomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java deleted file mode 100644 index 1f64fb55f8..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java +++ /dev/null @@ -1,781 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -package org.openecomp.mso.bpmn.common; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.core.domain.AllottedResource; -import org.openecomp.mso.bpmn.core.domain.CloudFlavor; -import org.openecomp.mso.bpmn.core.domain.HomingSolution; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.bpmn.core.domain.NetworkResource; -import org.openecomp.mso.bpmn.core.domain.Resource; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.domain.ServiceInstance; -import org.openecomp.mso.bpmn.core.domain.VnfResource; -import org.openecomp.mso.bpmn.mock.FileUtil; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid; -import static org.openecomp.mso.bpmn.mock.StubResponseOof.mockOof; -import static org.openecomp.mso.bpmn.mock.StubResponseOof.mockOof_500; - - -/** - * Test the OOF Homing subflow building block. - */ -public class OofHomingTest extends WorkflowTest { - - ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); - String subscriber = ""; - String subscriber2 = ""; - - private final CallbackSet callbacks = new CallbackSet(); - - public OofHomingTest() throws IOException { - String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf"); - String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf"); - String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net"); - - String oofCallbackNoSolution = FileUtil. - readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound"); - String oofCallbackPolicyException = FileUtil. - readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException"); - String oofCallbackServiceException = FileUtil. - readResourceFile("__files/BuildingBlocks/oofCallbackServiceException"); - - callbacks.put("oof", JSON, "oofResponse", oofCallback); - callbacks.put("oof2", JSON, "oofResponse", oofCallback2); - callbacks.put("oof3", JSON, "oofResponse", oofCallback3); - callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution); - callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException); - callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException); - - // Service Model - ModelInfo sModel = new ModelInfo(); - sModel.setModelCustomizationName("testModelCustomizationName"); - 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.setNfFunction("testARFunctionName"); - 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.setNfFunction("testAR2FunctionName"); - 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.setNfFunction("testVnfFunctionName"); - ArrayList<CloudFlavor> flavors = new ArrayList<>(); - CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx"); - CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx"); - flavors.add(flavor1); - flavors.add(flavor2); - vnf.getHomingSolution().setFlavors(flavors); - 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 { - - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "oof2"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, - "serviceDecomposition"); - String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); - - 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+", " "); - expectedOofRequest = expectedOofRequest.replaceAll("\\s+", ""); - - assertNull(workflowException); - assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", - resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx", - "\"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", - resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2", - null, null), resourceARHoming2String); - assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3", - true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", - "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), - resourceVNFHomingString); - assertEquals(verifyOofRequest(), expectedOofRequest); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_2AR1Vnf2Net() throws Exception { - - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables2(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "oof3"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, - "serviceDecomposition"); - String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); - - 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+", " "); - expectedOofRequest = expectedOofRequest.replaceAll("\\s+", ""); - - - assertNull(workflowException); - assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", - resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx", - "\"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", - resourceARHoming2.getVnf().getResourceId(), - "aic", "testCloudRegionId2", - null, null), resourceARHoming2String); - assertEquals(homingSolutionCloud("cloud","aic", - "testCloudRegionId3", - true, "\"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", resourceNetHoming.getVnf().getResourceId(),"aic", - "testCloudRegionIdNet", - null, null), resourceNetHomingString); - assertEquals(homingSolutionCloud("cloud", "aic", - "testCloudRegionIdNet2", - false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", - "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), - resourceNetHoming2String); - assertEquals(verifyOofRequest(), expectedOofRequest); - - } - - @Test - @Ignore - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/BuildingBlock/DecomposeService.bpmn", - "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_vnfResourceList() throws Exception { - - // Create a Service Decomposition - MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", - "/BuildingBlocks/oofCatalogResp.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(); -//System.out.println(" vnfResourceList = " + vnfResourceList); - vnfResourceList.get(0).setResourceId("test-resource-id-000"); - - // Invoke Homing - - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - variables.put("homingService", "oof"); - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); - variables.put("serviceDecomposition", sd); - variables.put("subscriberInfo", subscriber2); - HashMap customerLocation = new HashMap<String, Object>(); - customerLocation.put("customerLatitude", "32.89748"); - customerLocation.put("customerLongitude", "-97.040443"); - customerLocation.put("customerName", "xyz"); - variables.put("customerLatitude", "32.89748"); - variables.put("customerLongitude", "-97.040443"); - variables.put("customerName", "xyz"); - variables.put("customerLocation", customerLocation); - variables.put("cloudOwner", "amazon"); - variables.put("cloudRegionId", "TNZED"); - - invokeSubProcess("Homing", businessKey, variables); - injectWorkflowMessages(callbacks, "oof3"); - waitForProcessEnd(businessKey, 10000); - - //Get Variables - - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, - "serviceDecomposition"); - System.out.println("serviceDecompositionExp is: " + serviceDecompositionExp); - - Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000"); - System.out.println("resourceVnf is: " + resourceVnf); - HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution(); - - String resourceVnfHomingString = resourceVnfHoming.toString(); - System.out.println("resourceVnfHomingString is: " + resourceVnfHomingString); - resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " "); - System.out.println("Now resourceVnfHomingString is: " + resourceVnfHomingString); - - assertNull(workflowException); - - //Verify request - String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); - System.out.println("oofRequest is: " + oofRequest); - assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf"). - replaceAll("\n", "").replaceAll("\r", ""). - replaceAll("\t", ""), oofRequest.replaceAll("\n", ""). - replaceAll("\r", "").replaceAll("\t", "")); - - //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId()); - - assertEquals(homingSolutionService("service", "service-instance-01234", - "MDTNJ01", "test-resource-id-000","att-aic", - "mtmnj1a", - "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + - " \"j1d563e8-e714-4393-8f99-cc480144a05e\"", - "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + - " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_existingLicense() throws Exception { - - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<String, Object>(); - setVariablesExistingLicense(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 oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); - - Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); - HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution(); - Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); - HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution(); - Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); - HomingSolution resourceVNFHoming = (HomingSolution) 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+", " "); - oofRequest = oofRequest.replaceAll("\\s+", ""); - - assertNull(workflowException); - assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", - "aic", "dfwtx", "KDTNJ01", - "\"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", - resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2", - null, null), resourceARHoming2String); - assertEquals(homingSolutionCloud("cloud", "aic", - "testCloudRegionId3", - false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", - "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), - resourceVNFHomingString); - assertEquals(verifyOofRequestExistingLicense(), oofRequest); - - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_inputVariable() throws Exception { - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables3(variables); - - invokeSubProcess("Homing", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - //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()); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_badResponse() throws Exception { - mockOof_500(); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - 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/OOF.]", workflowException.toString()); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_oofNoSolution() throws Exception { - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "oofNoSol"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - Boolean errorMatch = workflowException.toString().contains("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + - "Response contains error: Unable to find any candidate for demand *** Response:"); - assert(errorMatch); - } - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_oofPolicyException() throws Exception { - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "oofPolicyEx"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF 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_oofServiceException() throws Exception { - mockOof(); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - injectWorkflowMessages(callbacks, "oofServiceEx"); - - waitForProcessEnd(businessKey, 10000); - - //Get Variables - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, - "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + - "Response contains a Request Error Service Exception: OOF PlacementError: " + - "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("homingService", "oof"); - HashMap customerLocation = new HashMap<String, Object>(); - customerLocation.put("customerLatitude", "32.89748"); - customerLocation.put("customerLongitude", "-97.040443"); - customerLocation.put("customerName", "xyz"); - variables.put("customerLatitude", "32.89748"); - variables.put("customerLongitude", "-97.040443"); - variables.put("customerName", "xyz"); - variables.put("customerLocation", customerLocation); - variables.put("cloudOwner", "amazon"); - variables.put("cloudRegionId", "TNZED"); - variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); - variables.put("vgMuxInfraModelId", "testArModelUuid"); - // variables.put("mso-request-id", "testRequestId"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId123"); - variables.put("serviceInstanceName", "testServiceName"); - 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.setModelCustomizationName("testModelCustomizationNameNet2"); - netModel2.setModelInvariantUuid("testModelInvariantIdNet2"); - netModel2.setModelName("testModelNameNet2"); - netModel2.setModelVersion("testModelVersionNet2"); - net2.setModelInfo(netModel2); - netList.add(net2); - serviceDecomposition.setServiceNetworks(netList); - - variables.put("homingService", "oof"); - HashMap customerLocation = new HashMap<String, Object>(); - customerLocation.put("customerLatitude", "32.89748"); - customerLocation.put("customerLongitude", "-97.040443"); - customerLocation.put("customerName", "xyz"); - variables.put("customerLatitude", "32.89748"); - variables.put("customerLongitude", "-97.040443"); - variables.put("customerName", "xyz"); - variables.put("customerLocation", customerLocation); - variables.put("cloudOwner", "amazon"); - variables.put("cloudRegionId", "TNZED"); - variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); - variables.put("vgMuxInfraModelId", "testArModelUuid"); - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId123"); - variables.put("serviceInstanceName", "testServiceName"); - variables.put("serviceDecomposition", serviceDecomposition); - variables.put("subscriberInfo", subscriber2); - } - - private void setVariables3(Map<String, Object> variables) { - variables.put("homingService", "oof"); - HashMap customerLocation = new HashMap<String, Object>(); - customerLocation.put("customerLatitude", "32.89748"); - customerLocation.put("customerLongitude", "-97.040443"); - customerLocation.put("customerName", "xyz"); - variables.put("customerLatitude", "32.89748"); - variables.put("customerLongitude", "-97.040443"); - variables.put("customerName", "xyz"); - variables.put("customerLocation", customerLocation); - variables.put("cloudOwner", "amazon"); - variables.put("cloudRegionId", "TNZED"); - variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); - variables.put("vgMuxInfraModelId", "testArModelUuid"); - variables.put("isDebugLogEnabled", "true"); - // variables.put("mso-request-id", "testRequestId"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId123"); - variables.put("serviceInstanceName", "testServiceName"); - variables.put("serviceDecomposition", null); - variables.put("subscriberInfo", subscriber2); - } - - private void setVariablesExistingLicense(Map<String, Object> variables) { - HomingSolution currentHomingSolution = new HomingSolution(); - serviceDecomposition.getServiceVnfs().get(0).setCurrentHomingSolution(currentHomingSolution); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1"); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2"); - - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1"); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2"); - - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); - variables.put("serviceDecomposition", serviceDecomposition); - variables.put("subscriberInfo", subscriber2); - - } - - private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, - String vnfResourceId, String cloudOwner, - String cloudRegionId, String enList, - String licenseList){ - - String solution = ""; - if(enList == null){ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + - serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + - cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId + - "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" + - " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," + - " \"rehome\" : false } }"; - }else{ - //language=JSON - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + - serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + - cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" + - " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" + - " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" + - " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; - } - return solution; - } - - private String homingSolutionCloud(String type, String cloudOwner, - String cloudRegionId, Boolean flavors, String enList, - String licenseList){ - String solution = ""; - if(enList == null){ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + - cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + - "\", \"license\" : { }, \"rehome\" : false } }"; - } else if (flavors && enList == null){ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + - cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + - "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " + - "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " + - "\"license\" : { }, \"rehome\" : false } }"; - } else if (flavors) { - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + - cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + - "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " + - "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " + - "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + - licenseList + " ] }, \"rehome\" : false } }"; - } else { - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + - cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + - "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + - licenseList + " ] }, \"rehome\" : false } }"; - } - return solution; - } - - private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) { - variables.put("homingService", "oof"); - variables.put("isDebugLogEnabled", "true"); - variables.put("mso-request-id", requestId); - variables.put("msoRequestId", requestId); - variables.put("serviceInstanceId", siId); - HashMap customerLocation = new HashMap<String, Object>(); - customerLocation.put("customerLatitude", "32.89748"); - customerLocation.put("customerLongitude", "-97.040443"); - customerLocation.put("customerName", "xyz"); - variables.put("customerLatitude", "32.89748"); - variables.put("customerLongitude", "-97.040443"); - variables.put("customerName", "xyz"); - variables.put("customerLocation", customerLocation); - variables.put("cloudOwner", "amazon"); - variables.put("cloudRegionId", "TNZED"); - - - String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" + - "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}"; - variables.put("serviceModelInfo", serviceModelInfo); - } - - private String verifyOofRequest() { - String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," + - "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," + - "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," + - "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" + - "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" + - "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," + - "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"testARFunctionName\"" + - ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" + - "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," + - "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\",\"modelType\":" + - "\"\",\"modelVersion\":\"\",\"modelCustomizationName\":\"\"}}," + - "{\"resourceModuleName\":\"testAR2FunctionName\",\"serviceResourceId\":\"testResourceIdAR2\"," + - "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," + - "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\"," + - "\"modelType\":\"\",\"modelVersion\":\"\"," + - "\"modelCustomizationName\":\"\"}},{\"resourceModuleName\":\"testVnfFunctionName\",\"serviceResourceId\":\"" + - "testResourceIdVNF\",\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\"" + - ":\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":\"" + - "testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"" + - ",\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" + - "{\"serviceInstanceId\":\"testServiceInstanceId123\"," + - "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" + - "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," + - "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" + - "\"}}}"; - return request; - } - - private String verifyOofRequestExistingLicense(){ - String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," + - "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," + - "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," + - "\"numSolutions\":1,\"timeout\":1800},\"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\"}," + - "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," + - "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," + - "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" + - "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; - return request; - } -} 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 deleted file mode 100644 index be74770e98..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java +++ /dev/null @@ -1,212 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-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();
- }
-}
-
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 deleted file mode 100644 index d450dad05e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/RainyDayHandlerTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicyAbort;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-
-/**
- * Unit test for RainyDayHandler.bpmn.
- */
-public class RainyDayHandlerTest extends WorkflowTest {
-
- @Test
- @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");
- variables.put("vnfName", "vSAMP1");
-
- MockPolicyAbort();
-
-
- String businessKey = UUID.randomUUID().toString();
- invokeSubProcess("RainyDayHandler", businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- }
-
-
-
-}
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 deleted file mode 100644 index 64b8ba53b7..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ReceiveWorkflowMessageTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.WorkflowTest; -import org.openecomp.mso.bpmn.common.WorkflowTest.CallbackSet; -import org.openecomp.mso.bpmn.core.WorkflowException; - -/** - * Unit tests for SDNCAdapterRestV1. - */ -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\": {" + EOL + - " \"success-indicator\":\"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\": {" + EOL + - " \"success-indicator\":\"N\"," + EOL + - " \"error-message\":\"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", "PT5S"); - 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 deleted file mode 100644 index ec1a22347b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import javax.xml.ws.Endpoint; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; -import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; - -/** - * A JUnit rule that starts the SDNC Adapter Callback Service before - * every test, and tears it down after every test. Example: - * <pre> - * @Rule - * public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = - * new SDNCAdapterCallbackRule(processEngineRule); - * </pre> - */ -public class SDNCAdapterCallbackRule implements TestRule { - public static final String DEFAULT_ENDPOINT_URL = - "http://localhost:28080/mso/SDNCAdapterCallbackService"; - - private final ProcessEngineServices processEngineServices; - private final String endpointUrl; - - public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) { - this(processEngineServices, DEFAULT_ENDPOINT_URL); - } - - 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; - - 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.out.println("Publishing Endpoint - " + endpointUrl); - endpoint = Endpoint.publish(endpointUrl, sdncCallbackService); - - 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/SDNCAdapterRestV2Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterRestV2Test.java deleted file mode 100644 index 90336bb391..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterRestV2Test.java +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common;
-
-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.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.core.Response;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit tests for SDNCAdapterRestV2.bpmn.
- *
- * This version of SDNCAdapterRest allows for interim notifications to be sent for
- * any non-final response received from SDNC.
- */
-public class SDNCAdapterRestV2Test extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- /**
- * Constructor. Insert callbacks.
- *
- * @throws IOException
- */
- public SDNCAdapterRestV2Test() throws IOException {
- String sdncCallbackFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackFinal.json");
- String sdncCallbackNonFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackNonFinal.json");
- callbacks.put("nonfinal", sdncCallbackNonFinal);
- callbacks.put("final", sdncCallbackFinal);
- }
-
- /**
- * Test the success path through the subflow.
- */
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterRestV2.bpmn",
- "subprocess/GenericNotificationService.bpmn"
- })
- public void success() throws IOException {
- logStart();
- mocks();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put("mso-request-id", "a4383a52-b9de-4bc4-bedf-02f3f9466535");
- variables.put("mso-service-instance-id", "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5");
- variables.put("isDebugLogEnabled", "true");
- variables.put("SDNCREST_Request",
- FileUtil.readResourceFile("__files/SDNCAdapterRestV2Request.json"));
- variables.put("SDNCREST_InterimNotification1",
- FileUtil.readResourceFile("__files/SDNCInterimNotification1.json"));
-
- invokeSubProcess("SDNCAdapterRestV2", businessKey, variables);
-
- injectSDNCRestCallbacks(callbacks, "nonfinal");
-
- // First non-final response will have done a notification
- Object interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
- Assert.assertNotNull(interimNotification);
-
- injectSDNCRestCallbacks(callbacks, "nonfinal");
-
- // Second non-final response will not have done a notification
- interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
- Assert.assertNull(interimNotification);
-
- injectSDNCRestCallbacks(callbacks, "final");
-
- interimNotification = this.getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
- Assert.assertNull(interimNotification);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- logEnd();
- }
-
- /**
- * 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
- */
- @Override
- protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) {
- String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV2",
- "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;
- }
-
- /**
- * Defines WireMock stubs needed by these tests.
- */
- private void mocks() {
- stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
-}
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 deleted file mode 100644 index 02e029de46..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java +++ /dev/null @@ -1,475 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.core.Response;
-
-import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
-import org.camunda.bpm.engine.runtime.Job;
-import org.camunda.bpm.engine.test.Deployment;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.CallbackHeader;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
-import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl;
-import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl.SDNCAdapterErrorResponse;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-import org.openecomp.mso.bpmn.core.PropertyConfigurationSetup;
-import org.openecomp.mso.bpmn.core.xml.XmlTool;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit test cases for SDNCAdapterV1.bpmn
- */
-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);
-
- 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);
-// 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());
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java deleted file mode 100644 index 314d4d3b42..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java +++ /dev/null @@ -1,548 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -package org.openecomp.mso.bpmn.common; - -import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid; -import static org.openecomp.mso.bpmn.mock.StubResponseSNIRO.*; -import static org.junit.Assert.*; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; - -import org.openecomp.mso.bpmn.core.WorkflowException; -import org.openecomp.mso.bpmn.core.domain.*; -import org.openecomp.mso.bpmn.mock.FileUtil; - - -/** - * Test the SNIRO Homing subflow building block. - */ -public class SniroHomingTest extends WorkflowTest { - - ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); - String subscriber = ""; - String subscriber2 = ""; - - private final CallbackSet callbacks = new CallbackSet(); - - public SniroHomingTest() 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 - @Ignore // 1802 merge - @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 - @Ignore // 1802 merge - @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 - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/BuildingBlock/DecomposeService.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_vnfResourceList() throws Exception { - - // Create a Service Decomposition - MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", "/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"); - List<VnfResource> vnfResourceList = sd.getServiceVnfs(); - vnfResourceList.get(0).setResourceId("test-resource-id-000"); - - // Invoke Homing - - mockSNIRO(); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - variables.put("homingService", "sniro"); - 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); - - //Get Variables - - WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); - - Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000"); - HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution(); - - String resourceVnfHomingString = resourceVnfHoming.toString(); - resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " "); - - assertNull(workflowException); - - //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); - } - - @Test - @Ignore // 1802 merge - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_success_existingLicense() throws Exception { - - mockSNIRO(); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<String, Object>(); - setVariablesExistingLicense(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 sniroRequest = (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+", " "); - sniroRequest = sniroRequest.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_existingLicense(), sniroRequest); - - } - - - @Test - @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) - public void testHoming_error_inputVariable() throws Exception { - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables3(variables); - - invokeSubProcess("Homing", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - //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()); - } - - @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<>(); - setVariables(variables); - - invokeSubProcess("Homing", businessKey, variables); - - 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/OOF.]", workflowException.toString()); - } - - @Test - @Ignore // 1802 merge - @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("homingService", "sniro"); - 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("homingService", "sniro"); - 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("homingService", "sniro"); - 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 void setVariablesExistingLicense(Map<String, Object> variables) { - HomingSolution currentHomingSolution = new HomingSolution(); - serviceDecomposition.getServiceVnfs().get(0).setCurrentHomingSolution(currentHomingSolution); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1"); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2"); - - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1"); - serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2"); - - 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 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 + "\", \"license\" : { }, \"rehome\" : false } }"; - }else{ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; - } - 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 + "\", \"license\" : { }, \"rehome\" : false } }"; - }else{ - solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; - } - return solution; - } - - private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) { - variables.put("homingService", "sniro"); - 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\",\"requestType\":\"initial\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placement\":{\"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; - } - - private String verifySniroRequest_existingLicense(){ - String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placement\":{\"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\"},\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\",\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\",\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; - return request; - } - -} 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 deleted file mode 100644 index 7c557ffe63..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java +++ /dev/null @@ -1,175 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf_Bad;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-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();
- }
-}
-
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 deleted file mode 100644 index 30d7e6d8c6..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Test;
-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();
- }
-}
-
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 deleted file mode 100644 index ea49176df0..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java +++ /dev/null @@ -1,390 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPost; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; -import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFRollbackDelete; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.core.WorkflowException; - -/** - * Unit tests for VnfAdapterRestV1. - */ -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!=null && 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 deleted file mode 100644 index 5562cb80ae..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.camunda.bpm.engine.test.Deployment; -import org.camunda.bpm.engine.variable.impl.VariableMapImpl; -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource; -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.getContent()); - 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 deleted file mode 100644 index de346d2dbe..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import java.util.UUID; - -import javax.ws.rs.core.Response; - -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowCallbackResponse; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContext; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContextHolder; -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.getContent()); - 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 deleted file mode 100644 index de25107fcc..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java +++ /dev/null @@ -1,2094 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.openecomp.mso.bpmn.core.json.JsonUtils.getJsonValue;
-import static org.openecomp.mso.bpmn.core.json.JsonUtils.updJsonValue;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.core.Response;
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.history.HistoricProcessInstance;
-import org.camunda.bpm.engine.history.HistoricVariableInstance;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.test.ProcessEngineRule;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.custommonkey.xmlunit.DetailedDiff;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.jboss.resteasy.spi.AsynchronousResponse;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.junit.Before;
-import org.junit.Rule;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.CallbackHeader;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
-import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory;
-import org.openecomp.mso.bpmn.common.adapter.vnf.MsoRequest;
-import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback;
-import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl;
-import org.openecomp.mso.bpmn.common.workflow.service.VnfAdapterNotifyServiceImpl;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-import org.openecomp.mso.bpmn.core.PropertyConfigurationSetup;
-import org.openecomp.mso.bpmn.core.domain.Resource;
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.bpmn.core.utils.CamundaDBSetup;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
-import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-
-
-/**
- * A base class for Workflow tests.
- * <p>
- * WireMock response transformers may be specified by declaring public
- * static fields with the @WorkflowTestTransformer annotation. For example:
- * <pre>
- * @WorkflowTestTransformer
- * public static final ResponseTransformer sdncAdapterMockTransformer =
- * new SDNCAdapterMockTransformer();
- * </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 = 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
- * 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();
- }
- //TODO.. most other locations refer to solutionInfo.placementInfo
- String homingList = getJsonValue(content, "solutionInfo.placement");
- JSONArray placementArr = null;
- try {
- placementArr = new JSONArray(homingList);
- }
- catch (Exception e) {
- return false;
- }
- if(placementArr.length() == 1){
- content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
- }
- String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
- JSONArray licenseArr = null;
- try {
- licenseArr = new JSONArray(licenseInfoList);
- }
- catch (Exception e) {
- return false;
- }
- if(licenseArr.length() == 1){
- content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
- }
- }
- else {
- try {
- String homingList = getJsonValue(content, "solutionInfo.placement");
- String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
- JSONArray placementArr = new JSONArray(homingList);
- JSONArray licenseArr = new JSONArray(licenseInfoList);
- for (Resource resource: resourceList) {
- String resourceModuleName = resource.getModelInfo().getModelInstanceName();
- String resourceId = resource.getResourceId();
-
- for (int i=0; i<placementArr.length(); i++) {
- JSONObject placementObj = placementArr.getJSONObject(i);
- String placementModuleName = placementObj.getString("resourceModuleName");
- if (placementModuleName.equalsIgnoreCase(resourceModuleName)) {
- String placementString = placementObj.toString();
- placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId);
- JSONObject newPlacementObj = new JSONObject(placementString);
- placementArr.put(i, newPlacementObj);
- }
- }
-
- for (int i=0; i<licenseArr.length(); i++) {
- JSONObject licenseObj = licenseArr.getJSONObject(i);
- String licenseModuleName = licenseObj.getString("resourceModuleName");
- if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) {
- String licenseString = licenseObj.toString();
- licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId);
- JSONObject newLicenseObj = new JSONObject(licenseString);
- licenseArr.put(i, newLicenseObj);
- }
- }
- }
- String newPlacementInfos = placementArr.toString();
- String newLicenseInfos = licenseArr.toString();
- content = updJsonValue(content, "solutionInfo.placement", newPlacementInfos);
- content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
- }
- catch(Exception e) {
- return false;
- }
-
- }
- }
- }
- 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());
- }
-
- /**
- * 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);
- }
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java deleted file mode 100644 index 18a2108c86..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import static org.junit.Assert.*;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs;
-import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs.Entry;
-
-public class CreateVnfNotificationTest {
-
- @Test
- public void test() {
- CreateVnfNotification cvn=new CreateVnfNotification();
- Entry ent = new Entry();
- MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK;
- Outputs value=new Outputs();
- VnfRollback vnf=new VnfRollback();
- vnf.setCloudSiteId("cloud");
- cvn.setCompleted(true);
- cvn.setErrorMessage("emsg");
- cvn.setException(exception);
- cvn.setMessageId("id");
- cvn.setOutputs(value);
- ent.setKey("key");
- ent.setValue("value");
- cvn.setRollback(vnf);
- cvn.setVnfId("vnf");
- assertTrue(cvn.isCompleted());
- assert(cvn.getErrorMessage().equals("emsg"));
- assert(cvn.getException()).equals(exception);
- assert(cvn.getMessageId()).equals("id");
- assert(cvn.getRollback()).equals(vnf);
- assert(cvn.getOutputs()).equals(value);
- assert(cvn.getVnfId()).equals("vnf");
- assert(ent.getKey()).equals("key");
- assert(ent.getValue()).equals("value");
- assert(ent.toString()!=null);
- assert(cvn.toString()!=null);
- assert(vnf.getCloudSiteId().equals("cloud"));
- assert(value.getEntry()!=null);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java deleted file mode 100644 index 10e760e8de..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class DeleteVnfNotificationTest {
-
- @Test
- public void test() {
- DeleteVnfNotification dvn=new DeleteVnfNotification();
- MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK;
- dvn.setCompleted(true);
- dvn.setErrorMessage("msg");
- dvn.setMessageId("id");
- dvn.setException(exception);
- assert(dvn.getErrorMessage().equals("msg"));
- assert(dvn.getMessageId().equals("id"));
- assert(dvn.getException().equals(exception));
- assert(dvn.toString()!=null);
- assertTrue(dvn.isCompleted());
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java deleted file mode 100644 index 59aff8cf77..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class MsoRequestTest {
- private MsoRequest msorequest = new MsoRequest();
- @Test
- public void testMsoRequest() {
- msorequest.setRequestId("requestId");
- msorequest.setServiceInstanceId("serviceInstanceId");
- assertEquals(msorequest.getRequestId(), "requestId");
- assertEquals(msorequest.getServiceInstanceId(), "serviceInstanceId");
- }
- @Test
- public void testtoString() {
- assert(msorequest.toString())!= null;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java deleted file mode 100644 index 77ba0ea59b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import static org.mockito.Mockito.mock;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs;
-
-public class ObjectFactoryTest {
- private ObjectFactory ofa=new ObjectFactory();
-
- @Test
- public void test() {
- CreateVnfNotification cvn=mock( CreateVnfNotification.class);
- UpdateVnfNotification uvn=mock (UpdateVnfNotification.class);
- QueryVnfNotification qn=mock(QueryVnfNotification.class);
- DeleteVnfNotification dvn=mock( DeleteVnfNotification.class);
- RollbackVnfNotification rvn=mock( RollbackVnfNotification.class);
- MsoRequest mr=mock( MsoRequest.class);
- Outputs opt=mock(Outputs.class);
- ofa.createCreateVnfNotification();
- ofa.createCreateVnfNotificationOutputs();
- ofa.createDeleteVnfNotification();
- ofa.createQueryVnfNotification();
- ofa.createUpdateVnfNotification();
- ofa.createMsoRequest();
- ofa.createRollbackVnfNotification();
- ofa.createUpdateVnfNotificationOutputs();
- ofa.createQueryVnfNotificationOutputs();
- ofa.createVnfRollback();
- ofa.createUpdateVnfNotificationOutputsEntry();
- ofa.createQueryVnfNotificationOutputsEntry();
- ofa.createCreateVnfNotificationOutputsEntry();
- ofa.createCreateVnfNotification(cvn);
- ofa.createDeleteVnfNotification(dvn);
- ofa.createQueryVnfNotification(qn);
- ofa.createRollbackVnfNotification(rvn);
- ofa.createUpdateVnfNotification(uvn);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java deleted file mode 100644 index 59e10baedc..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import static org.junit.Assert.*;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs;
-import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs.Entry;
-
-public class QueryVnfNotificationTest {
- private QueryVnfNotification qvn=new QueryVnfNotification();
-
- @Test
- public void test() {
- Entry ent = new Entry();
- MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK;
- Outputs opt=new Outputs();
- VnfStatus vnf=VnfStatus.ACTIVE;
- qvn.setCompleted(true);
- qvn.setErrorMessage("error");
- qvn.setException(exception);
- qvn.setMessageId("id");
- qvn.setStatus(vnf);
- qvn.setVnfId("id");
- qvn.setVnfExists(true);
- ent.setKey("key");
- ent.setValue("value");
- assert(qvn.getErrorMessage().equals("error"));
- assert(qvn.getException()).equals(exception);
- assert(qvn.getMessageId()).equals("id");
- assert(qvn.getStatus()).equals(vnf);
- assert(qvn.getVnfId()).equals("id");
- assertTrue(qvn.isVnfExists());
- assertTrue(qvn.isCompleted());
- assert(opt.getEntry()!=null);
- assert(opt.toString()!=null);
- assert(ent.getValue()).equals("value");
- assert(ent.getKey()).equals("key");
- assert(ent.toString()!=null);
- assert(qvn.toString()!=null);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java deleted file mode 100644 index 825695b3dd..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import static org.junit.Assert.*;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs;
-import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs.Entry;
-
-public class UpdateVnfNotificationTest {
- private UpdateVnfNotification updatevnf = new UpdateVnfNotification();
- MsoExceptionCategory mso;
- Outputs value= new Outputs();
- VnfRollback roll = new VnfRollback();
- private Entry entry = new Entry();
-
- @Test
- public void testUpdateVnfNotification() {
- updatevnf.setMessageId("messageId");
- updatevnf.setCompleted(true);
- updatevnf.setException(mso);
- updatevnf.setErrorMessage("errorMessage");
- updatevnf.setOutputs(value);
- updatevnf.setRollback(roll);
- entry.setKey("key");
- entry.setValue("value");
- assertEquals(updatevnf.getMessageId(), "messageId");
- assertEquals(updatevnf.isCompleted(), true);
- assertEquals(updatevnf.getException(), mso);
- assertEquals(updatevnf.getErrorMessage(), "errorMessage");
- assertEquals(updatevnf.getOutputs(), value);
- assertEquals(updatevnf.getRollback(), roll);
- assertEquals(entry.getKey(), "key");
- assertEquals(entry.getValue(), "value");
- }
- @Test
- public void testtoString() {
- assert(updatevnf.toString()!= null);
- assert(entry.toString()!= null);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java deleted file mode 100644 index ebed8714df..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class VnfRollbackTest {
- private VnfRollback vnfrollback = new VnfRollback();
- MsoRequest mso = new MsoRequest();
- @Test
- public void testVnfRollback() {
- vnfrollback.setCloudSiteId("cloudSiteId");
- vnfrollback.setMsoRequest(mso);
- vnfrollback.setTenantCreated(true);
- vnfrollback.setTenantId("tenantId");
- vnfrollback.setVnfCreated(true);
- vnfrollback.setVnfId("vnfId");
- assertEquals(vnfrollback.getCloudSiteId(), "cloudSiteId");
- assertEquals(vnfrollback.getMsoRequest(), mso);
- assertEquals(vnfrollback.isTenantCreated(), true);
- assertEquals(vnfrollback.getTenantId(), "tenantId");
- assertEquals(vnfrollback.isVnfCreated(), true);
- assertEquals(vnfrollback.getVnfId(), "vnfId");
- }
- @Test
- public void testtoString() {
- assert(vnfrollback.toString() != null);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnParamTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnParamTest.java deleted file mode 100644 index 166e3d78c1..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnParamTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ - -package org.openecomp.mso.bpmn.common.recipe; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class BpmnParamTest { - - BpmnParam bp=new BpmnParam(); - - @Test - public void test() { - bp.setValue("testdata"); - assertEquals(bp.getValue(),"testdata"); - } - @Test - public void testToString(){ - assert(bp.toString()!=null); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClientTest.java deleted file mode 100644 index 89f538b085..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClientTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ -package org.openecomp.mso.bpmn.common.recipe; - -import static org.junit.Assert.*; -import org.junit.Test; - -public class BpmnRestClientTest { - - @Test - public void test() { - BpmnRestClient.getEncryptedPropValue("prop", "123", "456"); - BpmnRestClient.loadMsoProperties(); - assertEquals(true,BpmnRestClient.getNoPropertiesState()); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequestTest.java deleted file mode 100644 index 3b185bae22..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequestTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ -package org.openecomp.mso.bpmn.common.recipe; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class ResourceRecipeRequestTest { - - ResourceRecipeRequest rr=new ResourceRecipeRequest(); - BpmnParam bp=new BpmnParam(); - @Test - public void test() { - rr.setResourceInput(bp); - rr.setHost(bp); - rr.setRequestId(bp); - rr.setRequestAction(bp); - rr.setServiceInstanceId(bp); - rr.setServiceType(bp); - rr.setRecipeParams(bp); - assertEquals(rr.getResourceInput(),bp); - assertEquals(rr.getHost(),bp); - assertEquals(rr.getRequestId(),bp); - assertEquals(rr.getRequestAction(),bp); - assertEquals(rr.getServiceInstanceId(),bp); - assertEquals(rr.getServiceType(),bp); - assertEquals(rr.getRecipeParams(),bp); - } - @Test - public void testToString(){ - assert(rr.toString()!=null); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java deleted file mode 100644 index 0584bea012..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.adapter.network;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.BeforeClass;
-import org.junit.Ignore; -import org.junit.Rule;
-import org.junit.Test;
-import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse;
-import org.openecomp.mso.openstack.beans.NetworkRollback;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class NetworkAdapterClientTest {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090));
-
- private static final String TESTING_ID = "___TESTING___";
- private static final String AAI_NETWORK_ID = "test";
- private static final String REST_ENDPOINT = "/networks/rest/v1/networks";
-
- private NetworkAdapterClientImpl client = new NetworkAdapterClientImpl();
-
- @BeforeClass
- public static void setUp() {
- System.setProperty("mso.config.path", "src/test/resources");
- }
-
- @Test
- public void createNetworkTest() {
- CreateNetworkRequest request = new CreateNetworkRequest();
- request.setCloudSiteId(TESTING_ID);
-
- CreateNetworkResponse mockResponse = new CreateNetworkResponse();
- mockResponse.setNetworkCreated(true);
- wireMockRule.stubFor(post(urlPathEqualTo(REST_ENDPOINT)).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200)));
-
- CreateNetworkResponse response = client.createNetwork(request);
- assertEquals("Testing CreateVfModule response", true, response.getNetworkCreated());
- }
-
- @Test
- public void deleteNetworkTest() {
- DeleteNetworkRequest request = new DeleteNetworkRequest();
- request.setCloudSiteId(TESTING_ID);
-
- DeleteNetworkResponse mockResponse = new DeleteNetworkResponse();
- mockResponse.setNetworkDeleted(true);
-
- wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200)));
-
- DeleteNetworkResponse response = client.deleteNetwork(AAI_NETWORK_ID, request);
- assertEquals("Testing DeleteVfModule response", true, response.getNetworkDeleted());
- }
-
- @Test
- public void rollbackNetworkTest() {
- RollbackNetworkRequest request = new RollbackNetworkRequest();
- NetworkRollback rollback = new NetworkRollback();
- rollback.setCloudId(TESTING_ID);
- request.setNetworkRollback(rollback);
-
- RollbackNetworkResponse mockResponse = new RollbackNetworkResponse();
- mockResponse.setNetworkRolledBack(true);
-
- wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200)));
-
- RollbackNetworkResponse response = client.rollbackNetwork(AAI_NETWORK_ID, request);
- assertEquals("Testing DeleteVfModule response", true, response.getNetworkRolledBack());
- }
-
- @Test
- public void queryNetworkTest() {
- QueryNetworkResponse mockResponse = new QueryNetworkResponse();
- mockResponse.setNetworkExists(true);
-
- wireMockRule.stubFor(get(urlPathEqualTo(REST_ENDPOINT))
- .withQueryParam("cloudSiteId", equalTo(TESTING_ID))
- .withQueryParam("tenantId", equalTo(TESTING_ID))
- .withQueryParam("networkStackId", equalTo("networkStackId"))
- .withQueryParam("skipAAI", equalTo("true"))
- .withQueryParam("msoRequest.requestId", equalTo("testRequestId"))
- .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId"))
- .willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200)));
-
- QueryNetworkResponse response = client.queryNetwork(AAI_NETWORK_ID, TESTING_ID, TESTING_ID,
- "networkStackId", true, "testRequestId", "serviceInstanceId");
- assertEquals("Testing QueryVfModule response", true, response.getNetworkExists());
- }
-
- @Ignore - @Test
- public void updateNetworkTest() {
- UpdateNetworkRequest request = new UpdateNetworkRequest();
- request.setCloudSiteId(TESTING_ID);
- request.setNetworkId("test1");
-
- UpdateNetworkResponse mockResponse = new UpdateNetworkResponse();
- mockResponse.setNetworkId("test1");
- wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200)));
-
- UpdateNetworkResponse response = client.updateNetwork(AAI_NETWORK_ID, request);
- assertEquals("Testing UpdateVfModule response", "test1", response.getNetworkId());
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBeanTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBeanTest.java deleted file mode 100644 index f0c6e7ec52..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBeanTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ - -package org.openecomp.mso.client.adapter.requests.db.entities; - -import org.junit.Test; - -public class MsoRequestsDbExceptionBeanTest { - - @Test - public void test() { - MsoRequestsDbExceptionBean mrde=new MsoRequestsDbExceptionBean("msg"); - mrde.setMessage("msg"); - assert(mrde.getMessage().equals("msg")); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionTest.java deleted file mode 100644 index 28b8cc991f..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ - -package org.openecomp.mso.client.adapter.requests.db.entities; - -import org.junit.Test; - -public class MsoRequestsDbExceptionTest { - - @Test - public void test() { - Throwable e = new Throwable(); - MsoRequestsDbExceptionBean mredb=new MsoRequestsDbExceptionBean(); - MsoRequestsDbException mrde=new MsoRequestsDbException("msg",e); - MsoRequestsDbException mrd=new MsoRequestsDbException("msg"); - MsoRequestsDbException mrd1=new MsoRequestsDbException(e); - mrde.setFaultInfo(mredb); - assert(mrde.getFaultInfo().equals(mredb)); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequestTest.java deleted file mode 100644 index d01c11948b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequestTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ - -package org.openecomp.mso.client.adapter.requests.db.entities; - -import org.junit.Test; - -public class UpdateInfraRequestTest { - - @Test - public void test() { - UpdateInfraRequest uir=new UpdateInfraRequest(); - RequestStatusType requestStatus=RequestStatusType.COMPLETE; - uir.setConfigurationId("configurationId"); - uir.setConfigurationName("configurationName"); - uir.setLastModifiedBy("lastModifiedBy"); - uir.setNetworkId("networkId"); - uir.setProgress("progress"); - uir.setRequestId("requestId"); - uir.setRequestStatus(requestStatus); - uir.setResponseBody("responseBody"); - uir.setServiceInstanceId("serviceInstanceId"); - uir.setServiceInstanceName("serviceInstanceName"); - uir.setStatusMessage("statusMessage"); - uir.setVfModuleId("vfModuleId"); - uir.setVfModuleName("vfModuleName"); - uir.setVnfId("vnfId"); - uir.setVnfOutputs("vnfOutputs"); - uir.setVolumeGroupId("volumeGroupId"); - assert(uir.getConfigurationId().equals("configurationId")); - assert(uir.getConfigurationName().equals("configurationName")); - assert(uir.getLastModifiedBy().equals("lastModifiedBy")); - assert(uir.getNetworkId().equals("networkId")); - assert(uir.getProgress().equals("progress")); - assert(uir.getRequestId().equals("requestId")); - assert(uir.getRequestStatus().equals(requestStatus)); - assert(uir.getResponseBody().equals("responseBody")); - assert(uir.getServiceInstanceId().equals("serviceInstanceId")); - assert(uir.getServiceInstanceName().equals("serviceInstanceName")); - assert(uir.getStatusMessage().equals("statusMessage")); - assert(uir.getVfModuleId().equals("vfModuleId")); - assert(uir.getVnfOutputs().equals("vnfOutputs")); - assert(uir.getVolumeGroupId().equals("volumeGroupId")); - assert(uir.getVfModuleName().equals("vfModuleName")); - assert(uir.getVnfId().equals("vnfId")); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java deleted file mode 100644 index 21448256ed..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.adapter.vnf;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.VfModuleRollback;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class VnfAdapterClientTest {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090));
-
- private static final String TESTING_ID = "___TESTING___";
- private static final String AAI_VNF_ID = "test";
- private static final String AAI_VF_MODULE_ID = "test";
- private static final String REST_ENDPOINT = "/vnfs/rest/v1/vnfs";
-
- private VnfAdapterClientImpl client = new VnfAdapterClientImpl();
-
- @BeforeClass
- public static void setUp() {
- System.setProperty("mso.config.path", "src/test/resources");
- }
-
- @Test
- public void createVfModuleTest() {
- CreateVfModuleRequest request = new CreateVfModuleRequest();
- request.setCloudSiteId(TESTING_ID);
-
- CreateVfModuleResponse mockResponse = new CreateVfModuleResponse();
- mockResponse.setVfModuleCreated(true);
- wireMockRule.stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(mockResponse.toJsonString()).withStatus(200)));
-
- CreateVfModuleResponse response = client.createVfModule(AAI_VNF_ID, request);
- assertEquals("Testing CreateVfModule response", true, response.getVfModuleCreated());
- }
-
- @Test
- public void rollbackVfModuleTest() {
- RollbackVfModuleRequest request = new RollbackVfModuleRequest();
- VfModuleRollback rollback = new VfModuleRollback();
- rollback.setCloudSiteId(TESTING_ID);
- request.setVfModuleRollback(rollback);
-
- RollbackVfModuleResponse mockResponse = new RollbackVfModuleResponse();
- mockResponse.setVfModuleRolledback(true);
- wireMockRule.stubFor(
- put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(mockResponse.toJsonString()).withStatus(200)));
-
- RollbackVfModuleResponse response = client.rollbackVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
- assertEquals("Testing RollbackVfModule response", true, response.getVfModuleRolledback());
- }
-
- @Test
- public void deleteVfModuleTest() {
- DeleteVfModuleRequest request = new DeleteVfModuleRequest();
- request.setCloudSiteId(TESTING_ID);
-
- DeleteVfModuleResponse mockResponse = new DeleteVfModuleResponse();
- mockResponse.setVfModuleDeleted(true);
- wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(mockResponse.toJsonString()).withStatus(200)));
-
- DeleteVfModuleResponse response = client.deleteVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
- assertEquals("Testing DeleteVfModule response", true, response.getVfModuleDeleted());
- }
-
- @Test
- public void updateVfModuleTest() {
- UpdateVfModuleRequest request = new UpdateVfModuleRequest();
- request.setCloudSiteId(TESTING_ID);
- request.setVfModuleId("test1");
-
- UpdateVfModuleResponse mockResponse = new UpdateVfModuleResponse();
- mockResponse.setVfModuleId("test1");
- wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(mockResponse.toJsonString()).withStatus(200)));
-
- UpdateVfModuleResponse response = client.updateVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
- assertEquals("Testing UpdateVfModule response", "test1", response.getVfModuleId());
- }
-
- @Test
- public void queryVfModuleTest() {
- QueryVfModuleResponse mockResponse = new QueryVfModuleResponse();
- mockResponse.setVnfId(AAI_VNF_ID);
- mockResponse.setVfModuleId(AAI_VF_MODULE_ID);
- wireMockRule.stubFor(get(urlPathEqualTo(REST_ENDPOINT))
- .withQueryParam("cloudSiteId", equalTo(TESTING_ID))
- .withQueryParam("tenantId", equalTo(TESTING_ID))
- .withQueryParam("vfModuleName", equalTo("someName"))
- .withQueryParam("skipAAI", equalTo("true"))
- .withQueryParam("msoRequest.requestId", equalTo("testRequestId"))
- .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(mockResponse.toJsonString()).withStatus(200)));
- QueryVfModuleResponse response = client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID,
- "someName", true, "testRequestId", "serviceInstanceId");
- assertEquals("Testing QueryVfModule response", AAI_VF_MODULE_ID, response.getVfModuleId());
- }
-
- @Test
- public void healthCheckTest() {
- wireMockRule.stubFor(get(urlPathEqualTo("/vnfs/rest/v1/vnfs")).willReturn(
- aResponse().withHeader("Content-Type", "text/plain").withBody("healthCheck").withStatus(200)));
-
- String healthCheck = client.healthCheck();
- assertEquals("HealthCheck is correct", "healthCheck", healthCheck);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.java deleted file mode 100644 index d9c5654989..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.appc;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Optional;
-import java.util.UUID;
-
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.onap.appc.client.lcm.model.Action;
-import org.onap.appc.client.lcm.model.Status;
-
-public class ApplicationControllerOrchestratorTest {
-
- @BeforeClass
- public static void beforeClass() {
- System.setProperty("mso.config.path", "src/test/resources");
- }
-
- @Test
- @Ignore
- public void vnfCommandTest() {
- ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator();
- Status status;
- try {
- status = client.vnfCommand(Action.Lock, UUID.randomUUID().toString(),
- "3ffdee3c-94d2-45fe-904d-fc1efa0f8b59", Optional.of(""), "appc");
- } catch (ApplicationControllerOrchestratorException e) {
- status = new Status();
- status.setCode(e.getAppcCode());
- status.setMessage(e.getMessage());
- }
- assertEquals("Status of vnfCommand is correct", status.getCode(), 306);
- }
-
- @Test
- @Ignore
- public void vnfCommandTest1() {
- ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator();
- Status status;
- try {
- status = client.vnfCommand(Action.Unlock, UUID.randomUUID().toString(),
- "ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f", Optional.of(""), "appc");
- } catch (ApplicationControllerOrchestratorException e) {
- status = new Status();
- status.setCode(e.getAppcCode());
- status.setMessage(e.getMessage());
- }
- assertEquals("Status of vnfCommand is correct", status.getCode(), 306);
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/beans/SDNCRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/beans/SDNCRequestTest.java deleted file mode 100644 index 3fd433d017..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/beans/SDNCRequestTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ -package org.openecomp.mso.client.sdnc.beans; - -import static org.junit.Assert.*; - - - -import org.junit.Test; -public class SDNCRequestTest { - private SDNCRequest sdncrequest = new SDNCRequest(); - SDNCSvcAction svcaction = SDNCSvcAction.ACTIVATE; - SDNCSvcOperation svcoperation = SDNCSvcOperation.VNF_TOPOLOGY_OPERATION; - @Test - public void testSDNCRequestTest() { - sdncrequest.setRequestId("requestId"); - sdncrequest.setSvcInstanceId("svcInstanceId"); - sdncrequest.setSvcAction(svcaction); - sdncrequest.setSvcOperation(svcoperation); - sdncrequest.setCallbackUrl("callbackUrl"); - sdncrequest.setMsoAction("msoAction"); - sdncrequest.setRequestData("requestData"); - assertEquals(sdncrequest.getRequestId(), "requestId"); - assertEquals(sdncrequest.getSvcInstanceId(), "svcInstanceId"); - assertEquals(sdncrequest.getSvcAction(), svcaction); - assertEquals(sdncrequest.getSvcOperation(), svcoperation); - assertEquals(sdncrequest.getCallbackUrl(), "callbackUrl"); - assertEquals(sdncrequest.getMsoAction(), "msoAction"); - assertEquals(sdncrequest.getRequestData(), "requestData"); - } - @Test - public void testToString(){ - assert(sdncrequest.toString()!=null); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java deleted file mode 100644 index 995bb5b19c..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.client.sdnc.sync;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class CallbackHeaderTest {
-
- CallbackHeader cbh = new CallbackHeader();
- CallbackHeader cbh1 = new CallbackHeader("reqId", "respCode", "respMsg");
-
- @Test
- public void testCallbackHeader() {
- cbh.setRequestId("requestId");
- cbh.setResponseCode("responseCode");
- cbh.setResponseMessage("responseMessage");
- assertEquals(cbh.getRequestId(), "requestId");
- assertEquals(cbh.getResponseCode(), "responseCode");
- assertEquals(cbh.getResponseMessage(), "responseMessage");
- assert(cbh.toString()!=null);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java deleted file mode 100644 index 04bc7dc132..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.client.sdnc.sync;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ObjectFactoryTest {
- ObjectFactory of = new ObjectFactory();
-
- @Test
- public void testObjectFactory() {
- of.createRequestHeader();
- of.createSDNCAdapterRequest();
- of.createSDNCAdapterResponse();
-
-
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java deleted file mode 100644 index 1d04572207..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.client.sdnc.sync;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class RequestHeaderTest {
- RequestHeader rh = new RequestHeader();
-
- @Test
- public void testRequestHeader() {
- rh.setRequestId("requestId");
- rh.setSvcInstanceId("svcInstanceId");
- rh.setSvcAction("svcAction");
- rh.setSvcOperation("svcOperation");
- rh.setCallbackUrl("callbackUrl");
- rh.setMsoAction("msoAction");
- assertEquals(rh.getRequestId(), "requestId");
- assertEquals(rh.getSvcInstanceId(), "svcInstanceId");
- assertEquals(rh.getSvcAction(), "svcAction");
- assertEquals(rh.getSvcOperation(), "svcOperation");
- assertEquals(rh.getCallbackUrl(), "callbackUrl");
- assertEquals(rh.getMsoAction(), "msoAction");
- assert(rh.toString()!=null);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java deleted file mode 100644 index 1219f69874..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.client.sdnc.sync;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-public class RequestTunablesTest {
- MsoPropertiesFactory mpf = new MsoPropertiesFactory();
-
- RequestTunables rt = new RequestTunables("reqId", "msoAction", "operation", "action", mpf);
-
- @Test
- public void testRequestTunables() {
- rt.setReqId("reqId");
- rt.setReqMethod("reqMethod");
- rt.setMsoAction("msoAction");
- rt.setAction("action");
- rt.setOperation("operation");
- rt.setSdncUrl("sdncUrl");
- rt.setTimeout("timeout");
- rt.setAsyncInd("asyncInd");
- rt.setHeaderName("headerName");
- rt.setSdncaNotificationUrl("sdncaNotificationUrl");
- rt.setNamespace("namespace");
- assertEquals(rt.getReqId(), "reqId");
- assertEquals(rt.getReqMethod(), "reqMethod");
- assertEquals(rt.getMsoAction(), "msoAction");
- assertEquals(rt.getAction(), "action");
- assertEquals(rt.getOperation(), "operation");
- assertEquals(rt.getSdncUrl(), "sdncUrl");
- assertEquals(rt.getTimeout(), "timeout");
- assertEquals(rt.getAsyncInd(), "asyncInd");
- assertEquals(rt.getHeaderName(), "headerName");
- assertEquals(rt.getSdncaNotificationUrl(), "sdncaNotificationUrl");
- assertEquals(rt.getNamespace(), "namespace");
- assert(rt.toString()!=null);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java deleted file mode 100644 index 53fbb0a4aa..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.client.sdnc.sync;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class SDNCAdapterCallbackRequestTest {
-
- SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest();
- CallbackHeader cbh = new CallbackHeader();
- Object o = new Object();
-
- @Test
- public void testSDNCAdapterCallbackRequest() {
- sdnccall.setCallbackHeader(cbh);
- sdnccall.setRequestData(o);
- assertEquals(sdnccall.getCallbackHeader(), cbh);
- assertEquals(sdnccall.getRequestData(), o);
- assert(sdnccall.toString()!=null);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java deleted file mode 100644 index 6b10f25e70..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.client.sdnc.sync;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class SDNCAdapterRequestTest {
-
- SDNCAdapterRequest adapter = new SDNCAdapterRequest();
- RequestHeader rh = new RequestHeader();
- Object o = new Object();
-
- @Test
- public void testSDNCAdapterRequest() {
- adapter.setRequestHeader(rh);
- adapter.setRequestData(o);
- assertEquals(adapter.getRequestHeader(), rh);
- assertEquals(adapter.getRequestData(), o);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java deleted file mode 100644 index d8c23249c4..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.client.sdnc.sync;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class SDNCResponseTest {
-
- SDNCResponse sdnc = new SDNCResponse("reqId");
- SDNCResponse sdnc1 = new SDNCResponse("reqId", 0, "respMsg");
-
- @Test
- public void testSDNCResponse() {
- sdnc.setReqId("reqId");
- sdnc.setRespCode(0);
- sdnc.setRespMsg("respMsg");
- sdnc.setSdncResp("sdncResp");
- assertEquals(sdnc.getReqId(), "reqId");
- assertEquals(sdnc.getRespCode(), 0);
- assertEquals(sdnc.getRespMsg(), "respMsg");
- assertEquals(sdnc.getSdncResp(), "sdncResp");
- assert(sdnc.toString()!= null);
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.java deleted file mode 100644 index 724ae4a90d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sndc; - -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.bpmn.core.domain.Customer; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.bpmn.core.domain.Request; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.bpmn.core.domain.ServiceInstance; -import org.openecomp.mso.bpmn.core.json.JsonDecomposingException; -import org.openecomp.mso.client.orchestration.SDNCOrchestrator; -import org.openecomp.mso.client.sdnc.sync.SDNCSyncRpcClient; - -public class SDNCOrchTest { - - @BeforeClass - public static void setup() { - System.setProperty("mso.config.path", "src/test/resources/"); - } - - @Ignore // 1802 merge - @Test - public void run () throws JsonDecomposingException { - ServiceDecomposition serviceDecomp = new ServiceDecomposition ("{\"serviceResources\":{}}","123"); - - ServiceInstance servInst = new ServiceInstance(); - servInst.setInstanceId("RaaTest-1-id"); - servInst.setServiceType(""); - servInst.setInstanceName("some-junk-name"); - servInst.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - - ModelInfo model = new ModelInfo(); - model.setModelInvariantUuid("uuid-miu-svc-011-abcdef"); - model.setModelName("SIModelName1"); - model.setModelUuid(""); - model.setModelVersion("2"); - - Request req = new Request(); - req.setRequestId("RaaCSIRequestId-1"); - req.setSdncRequestId("c0c5e8bf-d5c4-4d81-b2a9-78832c2c789e"); - req.setModelInfo(model); - - Customer cust = new Customer(); - cust.setGlobalSubscriberId("MCBH-1610"); - cust.setSubscriptionServiceType("viprsvc"); - - serviceDecomp.setCustomer(cust); - serviceDecomp.setRequest(req); - serviceDecomp.setCallbackURN("http://localhost:28080/mso/SDNCAdapterCallbackService"); - serviceDecomp.setServiceInstance(servInst); - - SDNCOrchestrator sdncO = new SDNCOrchestrator(); - sdncO.createServiceInstance(serviceDecomp); - } - - @Test - public void runValidateSdncResponse () { - SDNCSyncRpcClient client = new SDNCSyncRpcClient(null, null); - client.validateSDNCResponse("{\"v1:RequestData\": {\"output\": {\"svc-request-id\": \"0ca5bf8f-c944-4318-810b-6ddfbec13cc5\",\"response-code\": \"200\",\"response-message\": \"a\"}}}"); - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml index 2cf94b2ef2..c9ec2f0a9d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> <soapenv:Header /> <soapenv:Body> <v1:SDNCAdapterCallback> - <SDNCAdapterCallbackRequest xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + <SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> <CallbackHeader> <RequestId>testRequestId</RequestId> <ResponseCode>200</ResponseCode> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml index 57dc2d6f30..d39df7934a 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> <soapenv:Header /> <soapenv:Body> - <SDNCAdapterCallbackRequest xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + <SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> <CallbackHeader> <RequestId>testRequestId</RequestId> <ResponseCode>200</ResponseCode> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json new file mode 100644 index 0000000000..4c4c9b3f00 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json @@ -0,0 +1,6 @@ +{ + "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testAllottedModelName1","modelVersionId":"testAllottedModelUuid1","modelVersion":"testAllottedModelVersion1","modelInvariantId":"testAllottedModelInvariantUuid1"},"resourceModuleName":"testAllottedInstanceName1","serviceResourceId":"testAllottedResourceId1"},{"resourceModelInfo":{"modelName":"testAllottedModelName2","modelVersionId":"testAllottedModelUuid2","modelVersion":"testAllottedModelVersion2","modelInvariantId":"testAllottedModelInvariantUuid2"},"resourceModuleName":"testAllottedInstanceName2","serviceResourceId":"testAllottedResourceId2"},{"resourceModelInfo":{"modelName":"testAllottedModelName3","modelVersionId":"testAllottedModelUuid3","modelVersion":"testAllottedModelVersion3","modelInvariantId":"testAllottedModelInvariantUuid3"},"resourceModuleName":"testAllottedInstanceName3","serviceResourceId":"testAllottedResourceId3"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, + "licenseInfo" : [] +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/catalogResp.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/catalogResp.json deleted file mode 100644 index 09026d1d8c..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/catalogResp.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "serviceResources": { - "serviceType": null, - "serviceAllottedResources": [], - "modelInfo": { - "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", - "modelName": "ADIOD vRouter vCE 011017 Service", - "modelVersion": "5.0", - "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4" - }, - "serviceRole": null, - "serviceVnfs": [ - { - "toscaNodeType": "org.openecomp.resource.vf.AdiodVce", - "vfModules": [ - { - "initialCount": null, - "vfModuleLabel": null, - "modelInfo": { - "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5", - "modelName": "AdiodVce..base_vCE..module-0", - "modelVersion": "2", - "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829", - "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276" - }, - "hasVolumeGroup": true, - "isBase": true - } - ], - "modelInfo": { - "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelName": "ADIoD vCE", - "modelVersion": "2.0", - "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587", - "modelInstanceName": "ADIoD vCE 0", - "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1" - }, - "nfRole": "", - "nfType": "", - "nfFunction": "", - "nfNamingCode": "", - "multiStageDesign": "N" - } - ], - "serviceNetworks": [] - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf deleted file mode 100644 index 53cd70c514..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf +++ /dev/null @@ -1,113 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "complete", - "statusMessage": "success", - "solutions": { - "licenseSolutions": [ - { - "entitlementPoolUUID": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupUUID": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_primary_1", - "serviceResourceId": "testResourceIdAR" - }, - { - "entitlementPoolUUID": [ - "91d563e8-e714-4393-8f99-cc480144a05e", - "21d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupUUID": [ - "31d563e8-e714-4393-8f99-cc480144a05e", - "71d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_secondary_1", - "serviceResourceId": "testResourceIdVNF" - } - ], - "placementSolutions": [ - [ - { - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID1", - "serviceResourceId": "testResourceIdAR", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["testSIID1"] - }, - "assignmentInfo": [ - { - "key": "cloudOwner", - "value": "aic" - }, - { - "key": "vnfHostName", - "value": "MDTNJ01" - }, - { - "key": "isRehome", - "value": "False" - }, - { - "key": "locationId", - "value": "dfwtx" - } - ] - }, - { "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceResourceId": "testResourceIdAR2", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["testSIID2"] - }, - "assignmentInfo": [ - { - "key": "cloudOwner", - "value": "aic" - }, - { - "key": "vnfHostName", - "value": "testVnfHostname2" - }, - { - "key": "isRehome", - "value": "False" - }, - { - "key": "locationId", - "value": "testCloudRegionId2" - } - ] - }, - { - "resourceModuleName": "VNF", - "serviceResourceId": "testResourceIdVNF", - "solution": { - "identifierType": "cloudRegionId", - "cloudOwner": "aic", - "identifiers": [ - "testCloudRegionId3" - ] - }, - "assignmentInfo": [ - { - "key": "cloudOwner", - "value": "aic" - }, - { - "key": "locationId", - "value": "testCloudRegionId3" - }, - { "key":"flavors", - "value":{"flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} - ] - } - ] - ] - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net deleted file mode 100644 index d95587746b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net +++ /dev/null @@ -1,119 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "completed", - "statusMessage": "success", - "solutions": { - "licenseSolutions": [ - { - "resourceModuleName": "vHNPortalaaS_primary_1", - "serviceResourceId": "testResourceIdAR", - "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e"], - "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e"], - "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] - }, - { - "resourceModuleName": "net", - "serviceResourceId": "testResourceIdNet2", - "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05n", - "j1d563e8-e714-4393-8f99-cc480144a05n"], - "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05n", - "b1d563e8-e714-4393-8f99-cc480144a05n"], - "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] - }, - { - "resourceModuleName": "vHNPortalaaS_secondary_1", - "serviceResourceId": "testResourceIdVNF", - "entitlementPoolUUID": ["91d563e8-e714-4393-8f99-cc480144a05e", - "21d563e8-e714-4393-8f99-cc480144a05e"], - "licenseKeyGroupUUID": [ "31d563e8-e714-4393-8f99-cc480144a05e", - "71d563e8-e714-4393-8f99-cc480144a05e"], - "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] - }, - ], - "placementSolutions": [ - [ - { - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceResourceId": "testResourceIdAR", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["testSIID1"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "aic" }, - { "key": "vnfHostName", "value": "MDTNJ01" }, - { "key": "isRehome", "value": "False" }, - { "key": "locationId", "value": "dfwtx" } - ] - }, - { - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceResourceId": "testResourceIdAR2", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["testSIID2"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "aic" }, - { "key": "vnfHostName", "value": "testVnfHostname2" }, - { "key": "isRehome", "value": "False" }, - { "key": "locationId", "value": "testCloudRegionId2" } - ] - }, - { - "resourceModuleName": "NETWORK", - "serviceResourceId": "testResourceIdNet", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["testServiceInstanceIdNet"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "aic" }, - { "key": "vnfHostName", "value": "testVnfHostNameNet" }, - { "key": "isRehome", "value": "False" }, - { "key": "locationId", "value": "testCloudRegionIdNet" } - ] - }, - { - "resourceModuleName": "NETWORK", - "serviceResourceId": "testResourceIdNet2", - "solution": { - "identifierType": "cloudRegionId", - "cloudOwner": "aic", - "identifiers": ["testCloudRegionIdNet2"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "aic" }, - { "key": "locationId", "value": "testCloudRegionIdNet2" } - ] - }, - { - "resourceModuleName": "VNF", - "serviceResourceId": "testResourceIdVNF", - "solution": { - "identifierType": "cloudRegionId", - "cloudOwner": "aic", - "identifiers": ["testCloudRegionId3"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "aic" }, - { "key": "locationId", "value": "testCloudRegionId3" }, - { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} - ] - } - ] - ] - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf deleted file mode 100644 index 15e601bae8..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf +++ /dev/null @@ -1,50 +0,0 @@ -{ - "transactionId": "xxx-xxx-xxxx", - "requestId": "yyy-yyy-yyyy", - "requestStatus": "completed", - "statusMessage": "success", - "solutions": { - "placementSolutions": [ - [ - { - "resourceModuleName": "vGMuxInfra", - "serviceResourceId": "some_resource_id", - "solution": { - "identifierType": "serviceInstanceId", - "identifiers": ["gjhd-098-fhd-987"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "amazon" }, - { "key": "vnfHostName", "value": "ahr344gh" }, - { "key": "isRehome", "value": "False" }, - { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } - ] - }, - { - "resourceModuleName": "vG", - "serviceResourceId": "some_resource_id", - "solution": { - "identifierType": "cloudRegionId", - "cloudOwner": "amazon", - "identifiers": ["gjhd-098-fhd-987"] - }, - "assignmentInfo": [ - { "key": "cloudOwner", "value": "amazon" }, - { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }, - { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} - ] - } - ] - ], - "licenseSolutions": [ - { - "resourceModuleName": "vGMuxInfra", - "serviceResourceId": "some_resource_id", - "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], - "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] - } - ] - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound deleted file mode 100644 index 2024df401b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound +++ /dev/null @@ -1,18 +0,0 @@ -{ - "plans":[ - { - "name":"356fdb73-cef2-4dda-8865-31fd6733d6e4", - "message":"Unable to find any candidate for demand vGW", - "links":[ - [ - { - "rel":"self", - "href":"http://172.17.0.6:8091/v1/plans/1c15e194-6df5-43fe-a5ff-42e6093b8ddd" - } - ] - ], - "id":"1c15e194-6df5-43fe-a5ff-42e6093b8ddd", - "status":"error" - } - ] -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException deleted file mode 100644 index b82688428e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException +++ /dev/null @@ -1,9 +0,0 @@ -{ - "requestError": { - "policyException": { - "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", - "text": "Message content size exceeds the allowable limit", - "messageId": "SVC0001" - } - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException deleted file mode 100644 index de43e82c9e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException +++ /dev/null @@ -1,12 +0,0 @@ -{ - "requestError": { - "serviceException": { - "variables": [ - "severity", 400 - ], - "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", - "text": "OOF PlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", - "messageId": "SVC0001" - } - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json deleted file mode 100644 index 889431663d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "serviceResources": { - "serviceType": null, - "serviceAllottedResources": [], - "modelInfo": { - "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", - "modelName": "ADIOD vRouter vCE 011017 Service", - "modelVersion": "5.0", - "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4" - }, - "serviceRole": null, - "serviceVnfs": [ - { - "toscaNodeType": "org.openecomp.resource.vf.AdiodVce", - "vfModules": [ - { - "initialCount": null, - "vfModuleLabel": null, - "modelInfo": { - "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5", - "modelName": "AdiodVce..base_vCE..module-0", - "modelVersion": "2", - "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829", - "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276" - }, - "hasVolumeGroup": true, - "isBase": true - } - ], - "modelInfo": { - "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelName": "ADIoD vCE", - "modelVersion": "2.0", - "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587", - "modelInstanceName": "ADIoD vCE 0", - "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1" - }, - "nfRole": "", - "nfType": "", - "nfFunction": "ADIoDvCE", - "nfNamingCode": "", - "multiStageDesign": "N" - } - ], - "serviceNetworks": [] - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest deleted file mode 100644 index 42b2a0f24a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest +++ /dev/null @@ -1,99 +0,0 @@ -{ - "requestInfo": { - "transactionId": "testRequestId-xxx-xxx", - "requestId": "testRequestId-yyy-yyy", - "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId", - "sourceId": "so", - "requestType": "create", - "numSolutions": 1, - "optimizers": ["placement"], - "timeout": 600 - }, - "placementInfo": { - "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" }, - "placementDemands": [ - { - "resourceModuleName": "vGMuxInfra", - "serviceResourceId": "vGMuxInfra-xx", - "tenantId": "vGMuxInfra-tenant", - "resourceModelInfo": { - "modelInvariantId": "vGMuxInfra-modelInvariantId", - "modelVersionId": "vGMuxInfra-versionId", - "modelName": "vGMuxInfra-model", - "modelType": "resource", - "modelVersion": "1.0", - "modelCustomizationName": "vGMuxInfra-customeModelName" - } - }, - { - "resourceModuleName": "vG", - "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e", - "tenantId": "vG-tenant", - "resourceModelInfo": { - "modelInvariantId": "vG-modelInvariantId", - "modelVersionId": "vG-versionId", - "modelName": "vG-model", - "modelType": "resource", - "modelVersion": "1.0", - "modelCustomizationName": "vG-customeModelName" - }, - "existingCandidates": [ - { - "identifierType": "service_instance_id", - "cloudOwner": "", - "identifiers": ["gjhd-098-fhd-987"] - } - ], - "excludedCandidates": [ - { - "identifierType": "service_instance_id", - "cloudOwner": "", - "identifiers": ["gjhd-098-fhd-987"] - }, - { - "identifierType": "vimId", - "cloudOwner": "vmware", - "identifiers": ["NYMDT67"] - } - ], - "requiredCandidates": [ - { - "identifierType": "vimId", - "cloudOwner": "amazon", - "identifiers": ["TXAUS219"] - } - ] - } - ] - }, - "serviceInfo": { - "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec", - "serviceName": "vCPE", - "modelInfo": { - "modelInvariantId": "vCPE-invariantId", - "modelVersionId": "vCPE-versionId", - "modelName": "vCPE-model", - "modelType": "service", - "modelVersion": "1.0", - "modelCustomizationName": "" - } - }, - "licenseDemands": [ - { - "resourceModuleName": "vGMuxInfra", - "serviceResourceId": "vGMuxInfra-xx", - "resourceModelInfo": { - "modelInvariantId": "vGMuxInfra-modelInvariantId", - "modelVersionId": "vGMuxInfra-versionId", - "modelName": "vGMuxInfra-model", - "modelType": "resource", - "modelVersion": "1.0", - "modelCustomizationName": "" - }, - "existingLicenses": { - "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"], - "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"] - } - } - ] -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf deleted file mode 100644 index 67c9fbedc9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf +++ /dev/null @@ -1,56 +0,0 @@ -{ - "requestInfo": { - "transactionId": "testRequestId", - "requestId": "testRequestId", - "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId", - "sourceId": "so", - "requestType": "create", - "numSolutions": 1, - "optimizers": ["placement"], - "timeout": 600 }, - "placementInfo": { - "requestParameters": { - "customerLatitude": "32.89748", - "customerLongitude": "-97.040443", - "customerName": "xyz" }, - "subscriberInfo": { "globalSubscriberId": "SUB12_0322_DS_1201", - "subscriberName": "SUB_12_0322_DS_1201", - "subscriberCommonSiteId": "" }, - "placementDemands": [ - {"resourceModuleName": "VNF","serviceResourceId": "test-resource-id-000","tenantId": "null","resourceModelInfo": { - "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", - "modelName": "ADIoD vCE", - "modelType": "", - "modelVersion": "2.0", - "modelCustomizationName": "" }} - ] - }, - "serviceInfo": { - "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "serviceName": "null", - "modelInfo": { - "modelType": "", - "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", - "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4", - "modelName": "ADIOD vRouter vCE 011017 Service", - "modelVersion": "5.0", - "modelCustomizationName": "" - } - }, - "licenseInfo": { - "licenseDemands": [ - { -"resourceModuleName": "VNF", -"serviceResourceId": "test-resource-id-000", -"resourceInstanceType": "VNF", -"resourceModelInfo": { - "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", - "modelName": "ADIoD vCE", - "modelType": "", - "modelVersion": "2.0", - "modelCustomizationName": "" - } - }] - }}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf deleted file mode 100644 index 372f5d9e4d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf +++ /dev/null @@ -1,110 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "complete", - "statusMessage": "", - "solutionInfo": { - "licenseInfo": [ - { - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_primary_1", - "serviceResourceId": "testResourceIdAR" - }, - { - "entitlementPoolList": [ - "91d563e8-e714-4393-8f99-cc480144a05e", - "21d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "31d563e8-e714-4393-8f99-cc480144a05e", - "71d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_secondary_1", - "serviceResourceId": "testResourceIdVNF" - } - ], - "placementInfo": [ - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "MDTNJ01" - }, - { - "variableName": "aicClli", - "variableValue": "KDTNJ01" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "dfwtx", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID1", - "serviceResourceId": "testResourceIdAR", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "testVnfHostname2" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli2" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId2", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID2", - "serviceResourceId": "testResourceIdAR2", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli3" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId3", - "inventoryType": "cloud", - "resourceModuleName": "VNF", - "serviceInstanceId": "", - "serviceResourceId": "testResourceIdVNF", - "isRehome": "False" - } - ] - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net deleted file mode 100644 index 694419700d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net +++ /dev/null @@ -1,170 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "complete", - "statusMessage": "", - "solutionInfo": { - "licenseInfo": [ - { - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_primary_1", - "serviceResourceId": "testResourceIdAR" - }, - { - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05n", - "j1d563e8-e714-4393-8f99-cc480144a05n" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05n", - "b1d563e8-e714-4393-8f99-cc480144a05n" - ], - "resourceModuleName": "net", - "serviceResourceId": "testResourceIdNet2" - }, - { - "entitlementPoolList": [ - "91d563e8-e714-4393-8f99-cc480144a05e", - "21d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "31d563e8-e714-4393-8f99-cc480144a05e", - "71d563e8-e714-4393-8f99-cc480144a05e" - ], - "resourceModuleName": "vHNPortalaaS_secondary_1", - "serviceResourceId": "testResourceIdVNF" - } - ], - "placementInfo": [ - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "MDTNJ01" - }, - { - "variableName": "aicClli", - "variableValue": "KDTNJ01" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "dfwtx", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID1", - "serviceResourceId": "testResourceIdAR", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "testVnfHostname2" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli2" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId2", - "inventoryType": "service", - "resourceModuleName": "ALLOTTED_RESOURCE", - "serviceInstanceId": "testSIID2", - "serviceResourceId": "testResourceIdAR2", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "testVnfHostNameNet" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClliNet" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionIdNet", - "inventoryType": "service", - "resourceModuleName": "NETWORK", - "serviceInstanceId": "testServiceInstanceIdNet", - "serviceResourceId": "testResourceIdNet", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClliNet2" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionIdNet2", - "inventoryType": "cloud", - "resourceModuleName": "NETWORK", - "serviceInstanceId": "", - "serviceResourceId": "testResourceIdNet2", - "isRehome": "False" - }, - { - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "aic" - }, - { - "variableName": "aicClli", - "variableValue": "testAicClli3" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ], - "cloudRegionId": "testCloudRegionId3", - "inventoryType": "cloud", - "resourceModuleName": "VNF", - "serviceInstanceId": "", - "serviceResourceId": "testResourceIdVNF", - "isRehome": "False" - } - ] - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf deleted file mode 100644 index 9159d80c43..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf +++ /dev/null @@ -1,50 +0,0 @@ -{ - "transactionId": "testRequestId", - "requestId": "testRequestId", - "requestState": "complete", - "statusMessage": "", - "solutionInfo": { - "placementInfo": [ - { - "serviceResourceId": "test-resource-id-000", - "resourceModuleName": "ADIOD vRouter vCE", - "inventoryType": "service", - "serviceInstanceId": "service-instance-01234", - "cloudRegionId": "mtmnj1a", - "isRehome": "False", - "assignmentInfo": [ - { - "variableName": "cloudOwner", - "variableValue": "att-aic" - }, - { - "variableName": "vnfHostName", - "variableValue": "MDTNJ01" - }, - { - "variableName": "aicClli", - "variableValue": "KDTNJ01" - }, - { - "variableName": "aicVersion", - "variableValue": "3.0" - } - ] - } - ], - "licenseInfo": [ - { - "serviceResourceId": "test-resource-id-000", - "resourceModuleName": "ADIOD vRouter vCE", - "entitlementPoolList": [ - "f1d563e8-e714-4393-8f99-cc480144a05e", - "j1d563e8-e714-4393-8f99-cc480144a05e" - ], - "licenseKeyGroupList": [ - "s1d563e8-e714-4393-8f99-cc480144a05e", - "b1d563e8-e714-4393-8f99-cc480144a05e" - ] - } - ] - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound deleted file mode 100644 index 5cb748ae9d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound +++ /dev/null @@ -1,15 +0,0 @@ -{ - "requestState": "", - "responseTime": "", - "solutionInfo": { - "placement": [], - "licenseInfo": { - "featureGroupId": "" - } - }, - "percentProgress": "", - "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e", - "startTime": "", - "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8", - "requestType": "" -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException deleted file mode 100644 index b82688428e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException +++ /dev/null @@ -1,9 +0,0 @@ -{ - "requestError": { - "policyException": { - "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", - "text": "Message content size exceeds the allowable limit", - "messageId": "SVC0001" - } - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException deleted file mode 100644 index 6cc78a7cdb..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException +++ /dev/null @@ -1,12 +0,0 @@ -{ - "requestError": { - "serviceException": { - "variables": [ - "severity", 400 - ], - "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", - "text": "SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", - "messageId": "SVC0001" - } - } -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf deleted file mode 100644 index 2af6bf3423..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf +++ /dev/null @@ -1,65 +0,0 @@ -{ - "requestInfo": { - "transactionId": "testRequestId", - "requestId": "testRequestId", - "callbackUrl": "http://localhost:8090/workflows/messages/message/SNIROResponse/testRequestId", - "sourceId": "mso", - "optimizer": [ - "placement", - "license" - ], - "numSolutions": 1, - "timeout": 600 - }, - "placementInfo": { - "serviceModelInfo": { - "modelType": "", - "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", - "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4", - "modelName": "ADIOD vRouter vCE 011017 Service", - "modelVersion": "5.0" - }, - "subscriberInfo": { - "globalSubscriberId": "SUB12_0322_DS_1201", - "subscriberName": "SUB_12_0322_DS_1201", - "subscriberCommonSiteId": "" - }, - "demandInfo": { - "placementDemand": [ - { - "resourceInstanceType": "VNF", - "serviceResourceId": "test-resource-id-000", - "resourceModuleName": "ADIoD vCE 0", - "resourceModelInfo": { - "modelCustomizationId": "bdaeed40-c964-4966-bdb8-51320dcaf587", - "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelName": "ADIoD vCE", - "modelVersion": "2.0", - "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", - "modelType": "" - }, - "tenantId": "", - "tenantName": "" - } - ], - "licenseDemand": [ - { - "resourceInstanceType": "VNF", - "serviceResourceId": "test-resource-id-000", - "resourceModuleName": "ADIoD vCE 0", - "resourceModelInfo": { - "modelCustomizationId": "bdaeed40-c964-4966-bdb8-51320dcaf587", - "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", - "modelName": "ADIoD vCE", - "modelVersion": "2.0", - "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", - "modelType": "" - } - } - ] - }, - "policyId": [], - "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", - "orderInfo": "{\"requestParameters\": null}" - } - }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml index 182d7c9a11..c7a42923c8 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml @@ -1,22 +1,22 @@ - <volume-group xmlns="http://com.aai.inventory/v6">
- <volume-group-id>a8399879-31b3-4973-be26-0a0cbe776b58</volume-group-id>
- <volume-group-name>MoG_CinderVolumes_2</volume-group-name>
- <heat-stack-id>MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845</heat-stack-id>
- <vnf-type>VmogSvc/moge2e2</vnf-type>
- <orchestration-status>Active</orchestration-status>
- <resource-version>1458839419</resource-version>
- <relationship-list>
- <relationship>
- <related-to>tenant</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value>
- </relationship-data>
- <related-to-property>
- <property-key>tenant.tenant-name</property-key>
- <property-value>MOG-25208-D-01</property-value>
- </related-to-property>
- </relationship>
- </relationship-list>
+ <volume-group xmlns="http://com.aai.inventory/v6"> + <volume-group-id>a8399879-31b3-4973-be26-0a0cbe776b58</volume-group-id> + <volume-group-name>MoG_CinderVolumes_2</volume-group-name> + <heat-stack-id>MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845</heat-stack-id> + <vnf-type>VmogSvc/moge2e2</vnf-type> + <orchestration-status>Active</orchestration-status> + <resource-version>1458839419</resource-version> + <relationship-list> + <relationship> + <related-to>tenant</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value> + </relationship-data> + <related-to-property> + <property-key>tenant.tenant-name</property-key> + <property-value>MOG-25208-D-01</property-value> + </related-to-property> + </relationship> + </relationship-list> </volume-group>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml index 9b91bc5beb..ffa5829cdc 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml @@ -1,22 +1,22 @@ - <volume-group xmlns="http://com.aai.inventory/v6">
- <volume-group-id>a8399879-31b3-4973-be26-0a0cbe776b58</volume-group-id>
- <volume-group-name>MoG_CinderVolumes_2</volume-group-name>
- <heat-stack-id>MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845</heat-stack-id>
- <vnf-type>VmogSvc/moge2e2</vnf-type>
- <orchestration-status>Active</orchestration-status>
- <resource-version>1458839419</resource-version>
- <relationship-list>
- <relationship>
- <related-to>tenant</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>83464847234ee8937416c65507d267</relationship-value>
- </relationship-data>
- <related-to-property>
- <property-key>tenant.tenant-name</property-key>
- <property-value>MOG-25208-D-01</property-value>
- </related-to-property>
- </relationship>
- </relationship-list>
+ <volume-group xmlns="http://com.aai.inventory/v6"> + <volume-group-id>a8399879-31b3-4973-be26-0a0cbe776b58</volume-group-id> + <volume-group-name>MoG_CinderVolumes_2</volume-group-name> + <heat-stack-id>MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845</heat-stack-id> + <vnf-type>VmogSvc/moge2e2</vnf-type> + <orchestration-status>Active</orchestration-status> + <resource-version>1458839419</resource-version> + <relationship-list> + <relationship> + <related-to>tenant</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>83464847234ee8937416c65507d267</relationship-value> + </relationship-data> + <related-to-property> + <property-key>tenant.tenant-name</property-key> + <property-value>MOG-25208-D-01</property-value> + </related-to-property> + </relationship> + </relationship-list> </volume-group>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql index 6ebc6e221e..027f2d92fc 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql @@ -1,75 +1,75 @@ -use camundabpmn;
-/*
-Drop a archive tables
-*/
-/*-- TMP_ARCHIVING_PROCINST */
-DROP TABLE IF EXISTS TMP_ARCHIVING_PROCINST;
-
-/*-- TMP_ARCHIVING_BYTEARRAY */
-DROP TABLE IF EXISTS TMP_ARCHIVING_BYTEARRAY;
-
-/*-- TMP LOG TABLE */
-DROP TABLE IF EXISTS TMPLOGTABLE;
-
-/* -- Camunda Hi Tables --*/
-DROP TABLE IF EXISTS Camunda_Hi_Tables;
-
-/* drop own extentions columns:
-alter table ARCHIVE_ACT_HI_PROCINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS);
-alter table ARCHIVE_ACT_HI_ACTINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS);
-alter table ARCHIVE_ACT_HI_TASKINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS);
-alter table ARCHIVE_ACT_HI_VARINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS);
-alter table ARCHIVE_ACT_HI_DETAIL DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS);
-alter table ARCHIVE_ACT_HI_COMMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS);
-alter table ARCHIVE_ACT_HI_ATTACHMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS);
-alter table ARCHIVE_ACT_HI_OP_LOG DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS);
-alter table ARCHIVE_ACT_HI_INCIDENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS);
-*/
-
-/*--#1 */
-DROP TABLE IF EXISTS ARCHIVE_ACT_HI_PROCINST;
-/*--#2 */
-DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ACTINST;
-/*--#3 */
-DROP TABLE IF EXISTS ARCHIVE_ACT_HI_TASKINST;
-/*--#4 */
-DROP TABLE IF EXISTS ARCHIVE_ACT_HI_VARINST;
-/*--#5 */
-DROP TABLE IF EXISTS ARCHIVE_ACT_HI_DETAIL;
-/*--#6 */
-DROP TABLE IF EXISTS ARCHIVE_ACT_HI_COMMENT;
-/*--#7 */
-DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ATTACHMENT;
-/*--#8 */
-DROP TABLE IF EXISTS ARCHIVE_ACT_HI_OP_LOG;
-/*--#9 */
-DROP TABLE IF EXISTS ARCHIVE_ACT_HI_INCIDENT;
-/*--#10 */
-DROP TABLE IF EXISTS ARCHIVE_ACT_GE_BYTEARRAY;
-
-/* drop PL SQL procedures: */
-DROP PROCEDURE IF EXISTS ARCHIVE_CAMUNDA_HISTORY;
-DROP PROCEDURE IF EXISTS ROLLB_ARCHIVE_CAMUNDA_HISTORY;
-
-/*-- Sequence */
--- as sequence drop doesn't work automatically in MariaDB, use this procedure to drop sequence
- DROP PROCEDURE IF EXISTS DropSequence;
-
- DELIMITER //
-
- CREATE PROCEDURE DropSequence (vname VARCHAR(30))
- BEGIN
- -- Drop the sequence
- DELETE FROM _sequences WHERE name = vname;
- END
- //
- DELIMITER ;
-
--- use the above procedure to drop sequence
-CALL DropSequence('STAT_EXECUTION_SEQ');
-
-/*-- To Drop the MariaDB specific user defined procedures and functions */
-DROP FUNCTION IF EXISTS NextVal;
-DROP PROCEDURE IF EXISTS CreateSequence;
-DROP PROCEDURE IF EXISTS DropSequence;
+use camundabpmn; +/* +Drop a archive tables +*/ +/*-- TMP_ARCHIVING_PROCINST */ +DROP TABLE IF EXISTS TMP_ARCHIVING_PROCINST; + +/*-- TMP_ARCHIVING_BYTEARRAY */ +DROP TABLE IF EXISTS TMP_ARCHIVING_BYTEARRAY; + +/*-- TMP LOG TABLE */ +DROP TABLE IF EXISTS TMPLOGTABLE; + +/* -- Camunda Hi Tables --*/ +DROP TABLE IF EXISTS Camunda_Hi_Tables; + +/* drop own extentions columns: +alter table ARCHIVE_ACT_HI_PROCINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_ACTINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_TASKINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_VARINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_DETAIL DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_COMMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_ATTACHMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_OP_LOG DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_INCIDENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +*/ + +/*--#1 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_PROCINST; +/*--#2 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ACTINST; +/*--#3 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_TASKINST; +/*--#4 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_VARINST; +/*--#5 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_DETAIL; +/*--#6 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_COMMENT; +/*--#7 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ATTACHMENT; +/*--#8 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_OP_LOG; +/*--#9 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_INCIDENT; +/*--#10 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_GE_BYTEARRAY; + +/* drop PL SQL procedures: */ +DROP PROCEDURE IF EXISTS ARCHIVE_CAMUNDA_HISTORY; +DROP PROCEDURE IF EXISTS ROLLB_ARCHIVE_CAMUNDA_HISTORY; + +/*-- Sequence */ +-- as sequence drop doesn't work automatically in MariaDB, use this procedure to drop sequence + DROP PROCEDURE IF EXISTS DropSequence; + + DELIMITER // + + CREATE PROCEDURE DropSequence (vname VARCHAR(30)) + BEGIN + -- Drop the sequence + DELETE FROM _sequences WHERE name = vname; + END + // + DELIMITER ; + +-- use the above procedure to drop sequence +CALL DropSequence('STAT_EXECUTION_SEQ'); + +/*-- To Drop the MariaDB specific user defined procedures and functions */ +DROP FUNCTION IF EXISTS NextVal; +DROP PROCEDURE IF EXISTS CreateSequence; +DROP PROCEDURE IF EXISTS DropSequence; DROP TABLE IF EXISTS _sequences;
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql index c5b69c7a34..81485d3433 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql @@ -1,221 +1,221 @@ -use camundabpmn;
-/*
- 1. Add some Camunda Indexes to history schema part (for Archiving)
-*/
-create INDEX IF NOT EXISTS IDX_ACT_HI_TASKINST_PIID ON ACT_HI_TASKINST (PROC_INST_ID_);
-create INDEX IF NOT EXISTS IDX_ACT_HI_COMMENT_PIID ON ACT_HI_COMMENT (PROC_INST_ID_);
-create INDEX IF NOT EXISTS IDX_ACT_HI_ATTACHMENT_PIID ON ACT_HI_ATTACHMENT (PROC_INST_ID_);
-create INDEX IF NOT EXISTS IDX_ACT_HI_OP_LOG_PIID ON ACT_HI_OP_LOG (PROC_INST_ID_);
-create INDEX IF NOT EXISTS IDX_ACT_HI_INCIDENT_PIID ON ACT_HI_INCIDENT (PROC_INST_ID_);
-create INDEX IF NOT EXISTS IDX_ACT_HI_ACTINST_PIID ON ACT_HI_ACTINST(PROC_INST_ID_);
-
-
-/*
- 2. Create Archiving Tables in current schema
-*/
-
-/*-- TMP_ARCHIVING_PROCINST */
-CREATE TABLE TMP_ARCHIVING_PROCINST
-( PROC_INST_ID_ varchar(64) not null,
- END_TIME_ datetime(3)
-);
-CREATE INDEX AI_TMP_ARCH_PROCINST_PI_ID ON TMP_ARCHIVING_PROCINST(PROC_INST_ID_);
-
-/*-- TMP_ARCHIVING_BYTEARRAY */
-CREATE TABLE TMP_ARCHIVING_BYTEARRAY
-( BYTEARRAY_ID_ varchar(64) not null,
- PROC_INST_ID_ varchar(64)
-);
-CREATE INDEX AI_TMP_ARCH_BYTEARRAY_BAID ON TMP_ARCHIVING_BYTEARRAY(BYTEARRAY_ID_);
-
-
-/*--#1 ARCHIVE_ACT_HI_PROCINST; */
-create TABLE ARCHIVE_ACT_HI_PROCINST
-AS ( select * from ACT_HI_PROCINST where 1=0);
-
-create index AI_HI_PROCINST_END_TIME on ARCHIVE_ACT_HI_PROCINST(END_TIME_);
-ALTER TABLE ARCHIVE_ACT_HI_PROCINST ADD CONSTRAINT ARCHIVE_ACT_HI_PROCINST_UQ UNIQUE ( PROC_INST_ID_);
-
-/*--#2 ARCHIVE_ACT_HI_ACTINST; */
-create TABLE ARCHIVE_ACT_HI_ACTINST
-AS ( select * from ACT_HI_ACTINST where 1=0);
-
-create index AI_HI_ACTINST_PROC_INST_ID on ARCHIVE_ACT_HI_ACTINST(PROC_INST_ID_);
-create index AI_HI_ACTINST_END_TIME on ARCHIVE_ACT_HI_ACTINST(END_TIME_);
-
-/*--#3 ARCHIVE_ACT_HI_TASKINST; */
-create TABLE ARCHIVE_ACT_HI_TASKINST
-AS ( select * from ACT_HI_TASKINST where 1=0);
-
-create index AI_HI_TASKINST_PROC_INST_ID on ARCHIVE_ACT_HI_TASKINST(PROC_INST_ID_);
-create index AI_HI_TASKINST_END_TIME on ARCHIVE_ACT_HI_TASKINST(END_TIME_);
-
-/*--#4 ARCHIVE_ACT_HI_VARINST; */
-create TABLE ARCHIVE_ACT_HI_VARINST
-AS ( select * from ACT_HI_VARINST where 1=0);
-
-create index AI_HI_VARINST_PROC_INST_ID on ARCHIVE_ACT_HI_VARINST(PROC_INST_ID_);
-
-/*--#5 ARCHIVE_ACT_HI_DETAIL; */
-create TABLE ARCHIVE_ACT_HI_DETAIL
-AS ( select * from ACT_HI_DETAIL where 1=0);
-
-create index AI_HI_DETAIL_PROC_INST_ID on ARCHIVE_ACT_HI_DETAIL(PROC_INST_ID_);
-create index AI_HI_DETAIL_TIME on ARCHIVE_ACT_HI_DETAIL(TIME_);
-
-/*--#6 ARCHIVE_ACT_HI_COMMENT; */
-create TABLE ARCHIVE_ACT_HI_COMMENT
-AS ( select * from ACT_HI_COMMENT where 1=0);
-
-create index AI_HI_COMMENT_PROC_INST_ID on ARCHIVE_ACT_HI_COMMENT(PROC_INST_ID_);
-create index AI_HI_COMMENT_TIME on ARCHIVE_ACT_HI_COMMENT(TIME_);
-
-/*--#7 ARCHIVE_ACT_HI_ATTACHMENT; */
-create TABLE ARCHIVE_ACT_HI_ATTACHMENT
-AS ( select * from ACT_HI_ATTACHMENT where 1=0);
-
-create index AI_HI_ATTACHMENT_PROC_INST_ID on ARCHIVE_ACT_HI_ATTACHMENT(PROC_INST_ID_);
-
-/*--#8 ARCHIVE_ACT_HI_OP_LOG; */
-create TABLE ARCHIVE_ACT_HI_OP_LOG
-AS ( select * from ACT_HI_OP_LOG where 1=0);
-
-create index AI_HI_OP_LOG_PROC_INST_ID on ARCHIVE_ACT_HI_OP_LOG(PROC_INST_ID_);
-create index AI_HI_OP_LOG_TIMESTAMP on ARCHIVE_ACT_HI_OP_LOG(TIMESTAMP_);
-
-/*--#9 ARCHIVE_ACT_HI_INCIDENT; */
-create TABLE ARCHIVE_ACT_HI_INCIDENT
-AS ( select * from ACT_HI_INCIDENT where 1=0);
-
-create index AI_HI_INCIDENT_PROC_INST_ID on ARCHIVE_ACT_HI_INCIDENT(PROC_INST_ID_);
-
-/*--#10 ARCHIVE_ACT_GE_BYTEARRAY; */
-create TABLE ARCHIVE_ACT_GE_BYTEARRAY
-AS ( select * from ACT_GE_BYTEARRAY where 1=0);
-
-create index AI_GE_BYTEARRAY_ID_ on ARCHIVE_ACT_GE_BYTEARRAY(ID_);
-
-/* -----------------------------------------------------------------------------
-Extend a ARCHIVE: Table by two attributes: STAT_EXECUTION_ID, STAT_EXECUTION_TS
-*/
-
-/*
---TEMPLATE:
-alter table ARCHIVE_%TableName%
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_%TableName%_EXE_ID ON ARCHIVE_%TableName%(STAT_EXECUTION_ID);
-*/
-
-
-/*--#1 ACT_HI_PROCINST */
-alter table ARCHIVE_ACT_HI_PROCINST
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_ACT_HI_PROCINST_EXE_ID ON ARCHIVE_ACT_HI_PROCINST(STAT_EXECUTION_ID);
-
-/*--#2 ACT_HI_ACTINST */
-alter table ARCHIVE_ACT_HI_ACTINST
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_ACT_HI_ACTINST_EXE_ID ON ARCHIVE_ACT_HI_ACTINST(STAT_EXECUTION_ID);
-
-/*--#3 ACT_HI_TASKINST */
-alter table ARCHIVE_ACT_HI_TASKINST
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_ACT_HI_TASKINST_EXE_ID ON ARCHIVE_ACT_HI_TASKINST(STAT_EXECUTION_ID);
-
-/*--#4 ACT_HI_VARINST */
-alter table ARCHIVE_ACT_HI_VARINST
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_ACT_HI_VARINST_EXE_ID ON ARCHIVE_ACT_HI_VARINST(STAT_EXECUTION_ID);
-
-/*--#5 ACT_HI_DETAIL */
-alter table ARCHIVE_ACT_HI_DETAIL
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_ACT_HI_DETAIL_EXE_ID ON ARCHIVE_ACT_HI_DETAIL(STAT_EXECUTION_ID);
-
-/*--#6 ACT_HI_COMMENT */
-alter table ARCHIVE_ACT_HI_COMMENT
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_ACT_HI_COMMENT_EXE_ID ON ARCHIVE_ACT_HI_COMMENT(STAT_EXECUTION_ID);
-
-/*--#7 ACT_HI_ATTACHMENT */
-alter table ARCHIVE_ACT_HI_ATTACHMENT
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_ACT_HI_ATTACHMENT_EXE_ID ON ARCHIVE_ACT_HI_ATTACHMENT(STAT_EXECUTION_ID);
-
-/*--#8 ACT_HI_OP_LOG */
-alter table ARCHIVE_ACT_HI_OP_LOG
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_ACT_HI_OP_LOG_EXE_ID ON ARCHIVE_ACT_HI_OP_LOG(STAT_EXECUTION_ID);
-
-/*--#9 ACT_HI_INCIDENT */
-alter table ARCHIVE_ACT_HI_INCIDENT
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_ACT_HI_INCIDENT_EXE_ID ON ARCHIVE_ACT_HI_INCIDENT(STAT_EXECUTION_ID);
-
-/*--#10 ACT_GE_BYTEARRAY */
-alter table ARCHIVE_ACT_GE_BYTEARRAY
- add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP );
-CREATE INDEX AI_ACT_GE_BYTEARRAY_EXE_ID ON ARCHIVE_ACT_GE_BYTEARRAY(STAT_EXECUTION_ID);
-
-
-/* -- Next Val as a user defined function needed only in MariaDB--*/
-DROP FUNCTION IF EXISTS NextVal;
- DELIMITER //
- CREATE FUNCTION NextVal (vname VARCHAR(30))
- RETURNS INT
- BEGIN
- -- Retrieve and update in single statement
- UPDATE _sequences
- SET next = next + 1
- WHERE name = vname;
-
- RETURN (SELECT next FROM _sequences LIMIT 1);
- END
- //
- DELIMITER ;
-
-/* -- History tables for use in archive procedure, there is no array type in MariaDB --*/
-Create Table Camunda_Hi_Tables (id_ MEDIUMINT NOT NULL AUTO_INCREMENT,
- TableName_ varchar(80) NOT NULL,
- PRIMARY KEY (id_));
-
-Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_PROCINST');
-Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ACTINST');
-Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_TASKINST');
-Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_VARINST');
-Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_DETAIL');
-Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_COMMENT');
-Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ATTACHMENT');
-Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_OP_LOG');
-Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_INCIDENT');
-
-/*-- log table --*/
-CREATE TABLE TMPLOGTABLE (LogMessage Varchar(700));
-
-
-/* -- Below user defined functions and procedures needed only in MariaDB, they are in-built in Oracle --*/
-/*-- Create a sequence SP */
-DROP PROCEDURE IF EXISTS CreateSequence;
- DELIMITER //
- CREATE PROCEDURE CreateSequence (name VARCHAR(30), start INT, inc INT)
- BEGIN
- -- Create a table to store sequences
- CREATE TABLE IF NOT EXISTS _sequences
- (
- name VARCHAR(70) NOT NULL UNIQUE,
- next INT NOT NULL,
- inc INT NOT NULL
- );
-
- -- Add the new sequence
- INSERT INTO _sequences VALUES (name, start, inc);
- END
- //
- DELIMITER ;
-
-/*--------------------------------------------------------------------------------------------------
- Add Meta to Archive
- -------------------------------------------------------------------------------------------------- */
-
-/* Create STAT_EXECUTION_SEQ: each Archive Entry has a same Execution ID during one Archiving Run */
-CALL CreateSequence('STAT_EXECUTION_SEQ', 1, 1);
+use camundabpmn; +/* + 1. Add some Camunda Indexes to history schema part (for Archiving) +*/ +create INDEX IF NOT EXISTS IDX_ACT_HI_TASKINST_PIID ON ACT_HI_TASKINST (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_COMMENT_PIID ON ACT_HI_COMMENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_ATTACHMENT_PIID ON ACT_HI_ATTACHMENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_OP_LOG_PIID ON ACT_HI_OP_LOG (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_INCIDENT_PIID ON ACT_HI_INCIDENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_ACTINST_PIID ON ACT_HI_ACTINST(PROC_INST_ID_); + + +/* + 2. Create Archiving Tables in current schema +*/ + +/*-- TMP_ARCHIVING_PROCINST */ +CREATE TABLE TMP_ARCHIVING_PROCINST +( PROC_INST_ID_ varchar(64) not null, + END_TIME_ datetime(3) +); +CREATE INDEX AI_TMP_ARCH_PROCINST_PI_ID ON TMP_ARCHIVING_PROCINST(PROC_INST_ID_); + +/*-- TMP_ARCHIVING_BYTEARRAY */ +CREATE TABLE TMP_ARCHIVING_BYTEARRAY +( BYTEARRAY_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) +); +CREATE INDEX AI_TMP_ARCH_BYTEARRAY_BAID ON TMP_ARCHIVING_BYTEARRAY(BYTEARRAY_ID_); + + +/*--#1 ARCHIVE_ACT_HI_PROCINST; */ +create TABLE ARCHIVE_ACT_HI_PROCINST +AS ( select * from ACT_HI_PROCINST where 1=0); + +create index AI_HI_PROCINST_END_TIME on ARCHIVE_ACT_HI_PROCINST(END_TIME_); +ALTER TABLE ARCHIVE_ACT_HI_PROCINST ADD CONSTRAINT ARCHIVE_ACT_HI_PROCINST_UQ UNIQUE ( PROC_INST_ID_); + +/*--#2 ARCHIVE_ACT_HI_ACTINST; */ +create TABLE ARCHIVE_ACT_HI_ACTINST +AS ( select * from ACT_HI_ACTINST where 1=0); + +create index AI_HI_ACTINST_PROC_INST_ID on ARCHIVE_ACT_HI_ACTINST(PROC_INST_ID_); +create index AI_HI_ACTINST_END_TIME on ARCHIVE_ACT_HI_ACTINST(END_TIME_); + +/*--#3 ARCHIVE_ACT_HI_TASKINST; */ +create TABLE ARCHIVE_ACT_HI_TASKINST +AS ( select * from ACT_HI_TASKINST where 1=0); + +create index AI_HI_TASKINST_PROC_INST_ID on ARCHIVE_ACT_HI_TASKINST(PROC_INST_ID_); +create index AI_HI_TASKINST_END_TIME on ARCHIVE_ACT_HI_TASKINST(END_TIME_); + +/*--#4 ARCHIVE_ACT_HI_VARINST; */ +create TABLE ARCHIVE_ACT_HI_VARINST +AS ( select * from ACT_HI_VARINST where 1=0); + +create index AI_HI_VARINST_PROC_INST_ID on ARCHIVE_ACT_HI_VARINST(PROC_INST_ID_); + +/*--#5 ARCHIVE_ACT_HI_DETAIL; */ +create TABLE ARCHIVE_ACT_HI_DETAIL +AS ( select * from ACT_HI_DETAIL where 1=0); + +create index AI_HI_DETAIL_PROC_INST_ID on ARCHIVE_ACT_HI_DETAIL(PROC_INST_ID_); +create index AI_HI_DETAIL_TIME on ARCHIVE_ACT_HI_DETAIL(TIME_); + +/*--#6 ARCHIVE_ACT_HI_COMMENT; */ +create TABLE ARCHIVE_ACT_HI_COMMENT +AS ( select * from ACT_HI_COMMENT where 1=0); + +create index AI_HI_COMMENT_PROC_INST_ID on ARCHIVE_ACT_HI_COMMENT(PROC_INST_ID_); +create index AI_HI_COMMENT_TIME on ARCHIVE_ACT_HI_COMMENT(TIME_); + +/*--#7 ARCHIVE_ACT_HI_ATTACHMENT; */ +create TABLE ARCHIVE_ACT_HI_ATTACHMENT +AS ( select * from ACT_HI_ATTACHMENT where 1=0); + +create index AI_HI_ATTACHMENT_PROC_INST_ID on ARCHIVE_ACT_HI_ATTACHMENT(PROC_INST_ID_); + +/*--#8 ARCHIVE_ACT_HI_OP_LOG; */ +create TABLE ARCHIVE_ACT_HI_OP_LOG +AS ( select * from ACT_HI_OP_LOG where 1=0); + +create index AI_HI_OP_LOG_PROC_INST_ID on ARCHIVE_ACT_HI_OP_LOG(PROC_INST_ID_); +create index AI_HI_OP_LOG_TIMESTAMP on ARCHIVE_ACT_HI_OP_LOG(TIMESTAMP_); + +/*--#9 ARCHIVE_ACT_HI_INCIDENT; */ +create TABLE ARCHIVE_ACT_HI_INCIDENT +AS ( select * from ACT_HI_INCIDENT where 1=0); + +create index AI_HI_INCIDENT_PROC_INST_ID on ARCHIVE_ACT_HI_INCIDENT(PROC_INST_ID_); + +/*--#10 ARCHIVE_ACT_GE_BYTEARRAY; */ +create TABLE ARCHIVE_ACT_GE_BYTEARRAY +AS ( select * from ACT_GE_BYTEARRAY where 1=0); + +create index AI_GE_BYTEARRAY_ID_ on ARCHIVE_ACT_GE_BYTEARRAY(ID_); + +/* ----------------------------------------------------------------------------- +Extend a ARCHIVE: Table by two attributes: STAT_EXECUTION_ID, STAT_EXECUTION_TS +*/ + +/* +--TEMPLATE: +alter table ARCHIVE_%TableName% + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_%TableName%_EXE_ID ON ARCHIVE_%TableName%(STAT_EXECUTION_ID); +*/ + + +/*--#1 ACT_HI_PROCINST */ +alter table ARCHIVE_ACT_HI_PROCINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_PROCINST_EXE_ID ON ARCHIVE_ACT_HI_PROCINST(STAT_EXECUTION_ID); + +/*--#2 ACT_HI_ACTINST */ +alter table ARCHIVE_ACT_HI_ACTINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_ACTINST_EXE_ID ON ARCHIVE_ACT_HI_ACTINST(STAT_EXECUTION_ID); + +/*--#3 ACT_HI_TASKINST */ +alter table ARCHIVE_ACT_HI_TASKINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_TASKINST_EXE_ID ON ARCHIVE_ACT_HI_TASKINST(STAT_EXECUTION_ID); + +/*--#4 ACT_HI_VARINST */ +alter table ARCHIVE_ACT_HI_VARINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_VARINST_EXE_ID ON ARCHIVE_ACT_HI_VARINST(STAT_EXECUTION_ID); + +/*--#5 ACT_HI_DETAIL */ +alter table ARCHIVE_ACT_HI_DETAIL + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_DETAIL_EXE_ID ON ARCHIVE_ACT_HI_DETAIL(STAT_EXECUTION_ID); + +/*--#6 ACT_HI_COMMENT */ +alter table ARCHIVE_ACT_HI_COMMENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_COMMENT_EXE_ID ON ARCHIVE_ACT_HI_COMMENT(STAT_EXECUTION_ID); + +/*--#7 ACT_HI_ATTACHMENT */ +alter table ARCHIVE_ACT_HI_ATTACHMENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_ATTACHMENT_EXE_ID ON ARCHIVE_ACT_HI_ATTACHMENT(STAT_EXECUTION_ID); + +/*--#8 ACT_HI_OP_LOG */ +alter table ARCHIVE_ACT_HI_OP_LOG + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_OP_LOG_EXE_ID ON ARCHIVE_ACT_HI_OP_LOG(STAT_EXECUTION_ID); + +/*--#9 ACT_HI_INCIDENT */ +alter table ARCHIVE_ACT_HI_INCIDENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_INCIDENT_EXE_ID ON ARCHIVE_ACT_HI_INCIDENT(STAT_EXECUTION_ID); + +/*--#10 ACT_GE_BYTEARRAY */ +alter table ARCHIVE_ACT_GE_BYTEARRAY + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_GE_BYTEARRAY_EXE_ID ON ARCHIVE_ACT_GE_BYTEARRAY(STAT_EXECUTION_ID); + + +/* -- Next Val as a user defined function needed only in MariaDB--*/ +DROP FUNCTION IF EXISTS NextVal; + DELIMITER // + CREATE FUNCTION NextVal (vname VARCHAR(30)) + RETURNS INT + BEGIN + -- Retrieve and update in single statement + UPDATE _sequences + SET next = next + 1 + WHERE name = vname; + + RETURN (SELECT next FROM _sequences LIMIT 1); + END + // + DELIMITER ; + +/* -- History tables for use in archive procedure, there is no array type in MariaDB --*/ +Create Table Camunda_Hi_Tables (id_ MEDIUMINT NOT NULL AUTO_INCREMENT, + TableName_ varchar(80) NOT NULL, + PRIMARY KEY (id_)); + +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_PROCINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ACTINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_TASKINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_VARINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_DETAIL'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_COMMENT'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ATTACHMENT'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_OP_LOG'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_INCIDENT'); + +/*-- log table --*/ +CREATE TABLE TMPLOGTABLE (LogMessage Varchar(700)); + + +/* -- Below user defined functions and procedures needed only in MariaDB, they are in-built in Oracle --*/ +/*-- Create a sequence SP */ +DROP PROCEDURE IF EXISTS CreateSequence; + DELIMITER // + CREATE PROCEDURE CreateSequence (name VARCHAR(30), start INT, inc INT) + BEGIN + -- Create a table to store sequences + CREATE TABLE IF NOT EXISTS _sequences + ( + name VARCHAR(70) NOT NULL UNIQUE, + next INT NOT NULL, + inc INT NOT NULL + ); + + -- Add the new sequence + INSERT INTO _sequences VALUES (name, start, inc); + END + // + DELIMITER ; + +/*-------------------------------------------------------------------------------------------------- + Add Meta to Archive + -------------------------------------------------------------------------------------------------- */ + +/* Create STAT_EXECUTION_SEQ: each Archive Entry has a same Execution ID during one Archiving Run */ +CALL CreateSequence('STAT_EXECUTION_SEQ', 1, 1); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql index bf866b4878..810bce6d0d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql @@ -1096,25 +1096,6 @@ alter table ACT_ID_TENANT_MEMBER foreign key (GROUP_ID_) references ACT_ID_GROUP (ID_); -CREATE TABLE `mso_urn_mapping` ( -`NAME_` VARCHAR(64) NOT NULL COLLATE 'utf8_bin', -`VALUE_` VARCHAR(300) NULL DEFAULT NULL COLLATE 'utf8_bin', -`REV_` INT(11) NULL DEFAULT NULL -) -COLLATE='latin1_swedish_ci' -ENGINE=InnoDB -; - -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:rollback', 'true', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('aai:endpoint', 'http://localhost:28090', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:adapters:tenant:endpoint', 'http://localhost:28090/tenantAdapterMock', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:adapters:sdnc:endpoint', 'http://localhost:28090/sdncAdapterMock', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:workflow:sdncadapter:callback', 'http://localhost:28080/mso/SDNCAdapterCallbackService', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:timeout', 'PT5M', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:firewall:yang:model', 'http://com/att/svc/mis/firewall-lite-gui', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:firewall:yang:model:version', '2015-05-15', 1); -INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:timeout:firewall:minutes', '20', 1); - -- add indexes on PROC_DEF_KEY_ columns in history tables CAM-6679 create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/CatalogServiceExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/CatalogServiceExpected.json new file mode 100644 index 0000000000..c4a0a29b34 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/CatalogServiceExpected.json @@ -0,0 +1,17 @@ +{ + "modelName": "modelName", + "description": "description", + "modelUUID": "modelUUID", + "modelInvariantUUID": "modelInvariantUUID", + "created": 10, + "modelVersion": "modelVersion", + "serviceType": "serviceType", + "serviceRole": "serviceRole", + "environmentContext": "environmentContext", + "workloadContext": "workloadContext", + "networkCustomizations": null, + "vnfCustomizations": [], + "allottedCustomizations": null, + "recipes": null, + "csar": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json new file mode 100644 index 0000000000..fe58357d53 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Client/InfraActiveRequestExpected.json @@ -0,0 +1,46 @@ +{ + "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017", + "clientRequestId": "00032ab7-3fb3-42e5-965d-8ea592502016", + "action": "deleteInstance", + "requestStatus": "COMPLETE", + "statusMessage": "Vf Module has been deleted successfully.", + "progress": 100, + "startTime": 1482451194000, + "endTime": 1482451228000, + "source": "VID", + "vnfId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vnfName": null, + "vnfType": null, + "serviceType": null, + "aicNodeClli": null, + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "provStatus": null, + "vnfParams": null, + "vnfOutputs": null, + "requestBody": "{\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"vSAMP10aDEV::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"mtn6\"}}", + "responseBody": null, + "lastModifiedBy": "BPMN", + "modifyTime": 1482451228000, + "requestType": null, + "volumeGroupId": null, + "volumeGroupName": null, + "vfModuleId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992", + "vfModuleName": null, + "vfModuleModelName": "vSAMP10aDEV::base::module-0", + "aaiServiceId": null, + "aicCloudRegion": "mtn6", + "callBackUrl": null, + "correlator": null, + "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "serviceInstanceName": null, + "requestScope": "vfModule", + "requestAction": "deleteInstance", + "networkId": null, + "networkName": null, + "networkType": null, + "requestorId": null, + "configurationId": null, + "configurationName": null, + "operationalEnvId": null, + "operationalEnvName": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml index 40bb93bda0..81e8e2a233 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> <soapenv:Header /> <soapenv:Body> <v1:SDNCAdapterCallback> - <SDNCAdapterCallbackRequest xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + <SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> <CallbackHeader> <RequestId>testRequestId</RequestId> <ResponseCode>200</ResponseCode> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml index fce5afafec..2b59145bc8 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml @@ -1,13 +1,13 @@ -<search-results xmlns="http://com.aai.inventory">
- <service-instances>
- <service-instance>
- <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
- <persona-model-id>gg0e927b-6087-5574-9ef8-c5e4d5847db5</persona-model-id>
- <persona-model-version>V1.0</persona-model-version>
- <service-instance-name>vMOG-AKRON-1234</service-instance-name>
- <resource-version>1462561835</resource-version>
- <relationship-list/>
- <metadata/>
- </service-instance>
- </service-instances>
+<search-results xmlns="http://com.aai.inventory"> + <service-instances> + <service-instance> + <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id> + <persona-model-id>gg0e927b-6087-5574-9ef8-c5e4d5847db5</persona-model-id> + <persona-model-version>V1.0</persona-model-version> + <service-instance-name>vMOG-AKRON-1234</service-instance-name> + <resource-version>1462561835</resource-version> + <relationship-list/> + <metadata/> + </service-instance> + </service-instances> </search-results>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml index 7c30f75497..0ae5b79484 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml @@ -1,4 +1,4 @@ -<ns2:updateRequestResponse xmlns:ns2="http://org.openecomp.mso/requestsdb" +<ns2:updateRequestResponse xmlns:ns2="http://org.onap.so/requestsdb" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"/>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml index cb5d0001f7..41441b6f41 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> <soapenv:Header /> <soapenv:Body> <v1:SDNCAdapterCallback> - <SDNCAdapterCallbackRequest xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + <SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> <CallbackHeader> <RequestId>19174929-3809-49ca-89eb-17f84a035389</RequestId> <ResponseCode>200</ResponseCode> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogDBService_getServiceInstanceNOAAIInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogDBService_getServiceInstanceNOAAIInput.json new file mode 100644 index 0000000000..630b6f36c5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogDBService_getServiceInstanceNOAAIInput.json @@ -0,0 +1,17 @@ +{ + "modelName": "modelName", + "description": "description", + "modelUUID": "modelUUID", + "modelInvariantUUID": "modelInvariantUUID", + "created": null, + "modelVersion": "modelVersion", + "serviceType": "serviceType", + "serviceRole": "serviceRole", + "environmentContext": "environmentContext", + "workloadContext": "workloadContext", + "networkCustomizations": null, + "vnfCustomizations": [], + "allottedCustomizations": null, + "recipes": null, + "csar": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceExpected.json new file mode 100644 index 0000000000..c4a0a29b34 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceExpected.json @@ -0,0 +1,17 @@ +{ + "modelName": "modelName", + "description": "description", + "modelUUID": "modelUUID", + "modelInvariantUUID": "modelInvariantUUID", + "created": 10, + "modelVersion": "modelVersion", + "serviceType": "serviceType", + "serviceRole": "serviceRole", + "environmentContext": "environmentContext", + "workloadContext": "workloadContext", + "networkCustomizations": null, + "vnfCustomizations": [], + "allottedCustomizations": null, + "recipes": null, + "csar": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceInput.json new file mode 100644 index 0000000000..630b6f36c5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CatalogServiceInput.json @@ -0,0 +1,17 @@ +{ + "modelName": "modelName", + "description": "description", + "modelUUID": "modelUUID", + "modelInvariantUUID": "modelInvariantUUID", + "created": null, + "modelVersion": "modelVersion", + "serviceType": "serviceType", + "serviceRole": "serviceRole", + "environmentContext": "environmentContext", + "workloadContext": "workloadContext", + "networkCustomizations": null, + "vnfCustomizations": [], + "allottedCustomizations": null, + "recipes": null, + "csar": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionExpected.json new file mode 100644 index 0000000000..ffdf75a256 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionExpected.json @@ -0,0 +1,6 @@ +{ + "id" : "collectionId", + "model-info-collection" : null, + "instance-group" : null, + "orchestration-status" : "PRECREATED" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionInput.json new file mode 100644 index 0000000000..5c71fdc93c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionInput.json @@ -0,0 +1,4 @@ +{ + "collectionId" : "collectionId", + "orchestrationStatus" : "PRECREATED" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json new file mode 100644 index 0000000000..a500e0ba88 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json @@ -0,0 +1,11 @@ +{ + "modelUUID":null, + "modelName":null, + "modelInvariantUUID":"modelInvariantUUID", + "modelVersion":null, + "toscaNodeType":null, + "description":"description", + "created":null, + "collectionResourceCustomization":null, + "instanceGroup":null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json new file mode 100644 index 0000000000..d87875da81 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json @@ -0,0 +1,9 @@ +{ + "modelCustomizationUUID":null, + "modelInstanceName":null, + "type":"type", + "role":"role", + "function":"function", + "created":null, + "collectionResource":null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationExpected.json new file mode 100644 index 0000000000..a27c488aca --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationExpected.json @@ -0,0 +1,27 @@ +{ + "configuration-id" : "configurationId", + "orchestration-status" : "PRECREATED", + "tunnel-bandwidth" : "tunnelBandwidth", + "vendor-allowed-max-bandwidth" : "vendorAllowedMaxBandwidth", + "management-option" : "managementOption", + "configuration-name" : "configurationName", + "configuration-type" : "configurationType", + "configuration-sub-type" : "configurationSubType", + "operational-status" : "operationalStatus", + "configuration-selflink" : "configurationSelflink", + "metadata" : null, + "forwarder-evcs" : [ + { + "forwarder-evc-id": "forwarderEvcId" + } + ], + "evcs" : [ + { + "evc-id": "evcId" + } + ], + "model-info-configuration" : null, + "related-configuration" : null, + "l3-network" : null, + "l-interface" : null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationInput.json new file mode 100644 index 0000000000..748f3cde5a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ConfigurationInput.json @@ -0,0 +1,32 @@ +{ + "configurationId" : "configurationId", + "managementOption" : "managementOption", + "configurationName" : "configurationName", + "configurationType" : "configurationType", + "configurationSubType" : "configurationSubType", + "modelInvariantId" : "modelInvariantId", + "modelVersionId" : "modelVersionId", + "orchestrationStatus" : "PRECREATED", + "operationalStatus" : "operationalStatus", + "configurationSelflink" : "configurationSelflink", + "modelCustomizationId" : "modelCustomizationId", + "tunnelBandwidth" : "tunnelBandwidth", + "vendorAllowedMaxBandwidth" : "vendorAllowedMaxBandwidth", + "resourceVersion" : "resourceVersion", + "relationshipList" : {}, + "metadata" : {}, + "forwarderEvcs" : { + "forwarderEvc": [ + { + "forwarderEvcId": "forwarderEvcId" + } + ] + }, + "evcs" : { + "evc": [ + { + "evcId": "evcId" + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer.json new file mode 100644 index 0000000000..8f6483b4d4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer.json @@ -0,0 +1,6 @@ +{ + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer_AAI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer_AAI.json new file mode 100644 index 0000000000..3069c10e07 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Customer_AAI.json @@ -0,0 +1,16 @@ +{ + "globalCustomerId":"globalCustomerId", + "subscriberName":"subscriberName", + "subscriberType":"subscriberType", + "resourceVersion":null, + "serviceSubscriptions":{ + "serviceSubscription":[{ + "serviceType":"subscriptionServiceType", + "tempUbSubAccountId":null, + "resourceVersion":null, + "serviceInstances":null, + "relationshipList":null + }] + }, + "relationshipList":null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ExecuteBuildingBlockSimple.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ExecuteBuildingBlockSimple.json new file mode 100644 index 0000000000..ede5264a02 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ExecuteBuildingBlockSimple.json @@ -0,0 +1,7 @@ +{ + "buildingBlock":{ + "mso-id":"msoId", + "bpmn-flow-name":"bbName" + }, + "requestId":"requestId" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json new file mode 100644 index 0000000000..9b021ae1e7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json @@ -0,0 +1,99 @@ +{ + "requestContext": { + "product-family-id": "productFamilyId", + "source": "source", + "requestor-id": "requestorId", + "mso-request-id": "requestId", + "subscription-service-type": "subscriptionServiceType", + "user-params": null, + "action": "createInstance", + "callback-url": "callbackURL", + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType" + } + }, + "orchContext": { + "is-rollback-enabled": false + }, + "cloudRegion": { + "lcp-cloud-region-id": "lcpCloudRegionId", + "cloud-owner": "att-aic", + "tenant-id": "tenantId", + "complex": "complexName" + }, + "userInput": null, + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType", + "service-instances": [ + { + "service-instance-id": "3655a595-05d1-433c-93c0-3afd6b572545", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "PRECREATED", + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } + } + ] + } + }, + "serviceInstance": { + "service-instance-id": "3655a595-05d1-433c-93c0-3afd6b572545", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "PRECREATED", + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json new file mode 100644 index 0000000000..0d00e4d007 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json @@ -0,0 +1,72 @@ +{ + "closedLoopDisabled":false, + "vnf-id":"vnfId", + "vnf-name":"vnfName", + "vnf-type":"vnfType", + "orchestration-status":"PRECREATED", + "vf-modules":[{ + "vf-module-id":"vfModuleId", + "vf-module-name":"vfModuleName", + "orchestration-status":"PRECREATED", + "cascaded":false, + "heat-stack-id":"heatStackId", + "contrail-service-instance-fqdn":"contrailServiceInstanceFqdn", + "module-index":1,"selflink":"selflink", + "model-info-vf-module":null + }], + "volume-groups":[], + "line-of-business":null, + "platform":null, + "cascaded":false, + "cloud-params":{}, + "cloud-context":null, + "solution":null, + "vnf-name-2":null, + "service-id":null, + "regional-resource-zone":null, + "prov-status":null, + "operational-status":null, + "equipment-role":null, + "management-option":null, + "ipv4-oam-address":null, + "ipv4-loopback0-address":null, + "nm-lan-v6-address":null, + "management-v6-address":null, + "vcpu":null, + "vcpu-units":null, + "vmemory":null, + "vmemory-units":null, + "vdisk":null, + "vdisk-units":null, + "in-maint":false, + "is-closed-loop-disabled":false, + "summary-status":null, + "encrypted-access-flag":null, + "as-number":null, + "regional-resource-subzone":null, + "self-link":null, + "ipv4-oam-gateway-address":null, + "ipv4-oam-gateway-address-prefix-length":null, + "vlan-id-outer":null,"nm-profile-name":null, + "l-interfaces":[], + "lag-interfaces":[{ + "interface-name":"interfaceName", + "interface-description":"interfaceDescription", + "speed-value":"speedValue", + "speed-units":"speedUnits", + "interface-id":"interfaceId", + "interface-role":"interfaceRole", + "prov-status":"provStatus", + "in-maint":true, + "l-interfaces":[] + }], + "license": { + "entitlement-pool-uuids": [], + "license-key-group-uuids": [] + }, + "entitlements":[{ + "group-uuid":"groupUuid", + "resource-uuid":"resourceUuid" + }], + "model-info-generic-vnf":null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsExpected.json new file mode 100644 index 0000000000..79c9c3015a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsExpected.json @@ -0,0 +1,23 @@ +{ + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType" + } + }, + "project": { + "project-name": "projectName" + }, + "owningEntity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "platform": { + "platform-name": "platformName" + }, + "lineOfBusiness": { + "line-of-business-name": "lineOfBusinessName" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsInput.json new file mode 100644 index 0000000000..403ca30450 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjectsInput.json @@ -0,0 +1,19 @@ +{ + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType" + } + }, + "project": { + "project-name": "projectName" + }, + "owningEntity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "platform": null, + "lineOfBusiness": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjects_getServiceInstanceNOAAIInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjects_getServiceInstanceNOAAIInput.json new file mode 100644 index 0000000000..403ca30450 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/HighLevelObjects_getServiceInstanceNOAAIInput.json @@ -0,0 +1,19 @@ +{ + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType" + } + }, + "project": { + "project-name": "projectName" + }, + "owningEntity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "platform": null, + "lineOfBusiness": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json new file mode 100644 index 0000000000..dd4dc65190 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InfraActiveRequestExpected.json @@ -0,0 +1,46 @@ +{ + "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017", + "clientRequestId": "00032ab7-3fb3-42e5-965d-8ea592502016", + "action": "deleteInstance", + "requestStatus": "COMPLETE", + "statusMessage": "Vf Module has been deleted successfully.", + "progress": 100, + "startTime": 1482451194000, + "endTime": 1482451228000, + "source": "VID", + "vnfId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vnfName": null, + "vnfType": null, + "serviceType": null, + "aicNodeClli": null, + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "provStatus": null, + "vnfParams": null, + "vnfOutputs": null, + "requestBody": "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"vSAMP10aDEV::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"mtn6\"}}}", + "responseBody": null, + "lastModifiedBy": "BPMN", + "modifyTime": 1482451228000, + "requestType": null, + "volumeGroupId": null, + "volumeGroupName": null, + "vfModuleId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992", + "vfModuleName": null, + "vfModuleModelName": "vSAMP10aDEV::base::module-0", + "aaiServiceId": null, + "aicCloudRegion": "mtn6", + "callBackUrl": null, + "correlator": null, + "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "serviceInstanceName": null, + "requestScope": "vfModule", + "requestAction": "deleteInstance", + "networkId": null, + "networkName": null, + "networkType": null, + "requestorId": null, + "configurationId": null, + "configurationName": null, + "operationalEnvId": null, + "operationalEnvName": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroup.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroup.json new file mode 100644 index 0000000000..723905b226 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroup.json @@ -0,0 +1,11 @@ +{ + "modelUUID" : "modelUUID", + "modelName" : null, + "modelInvariantUUID" : "modelInvariantUUID", + "modelVersion" : null, + "role" : "instanceGroupRole", + "toscaNodeType" : null, + "type" : "VNFC", + "created" : null, + "collectionResource" : null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupExpected.json new file mode 100644 index 0000000000..b2e7b719f3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupExpected.json @@ -0,0 +1,8 @@ +{ + "id" : "instanceGroupId", + "description" : "description", + "resource-version" : "resourceVersion", + "instance-group-name" : "instanceGroupName", + "model-info-instance-group" : null, + "instance-group-function" : "instanceGroupFunction" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupInput.json new file mode 100644 index 0000000000..ec116fe74c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/InstanceGroupInput.json @@ -0,0 +1,12 @@ +{ + "id" : "instanceGroupId", + "instanceGroupRole" : "instanceGroupRole", + "modelInvariantId" : "modelInvariantId", + "modelVersionId" : "modelVersionId", + "description" : "description", + "instanceGroupType" : "instanceGroupType", + "resourceVersion" : "resourceVersion", + "instanceGroupName" : "instanceGroupName", + "instanceGroupFunction" : "instanceGroupFunction", + "relationshipList" : {} +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusiness.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusiness.json new file mode 100644 index 0000000000..b2446c753a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusiness.json @@ -0,0 +1,3 @@ +{ + "line-of-business-name": "lineOfBusinessName" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusinessExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusinessExpected.json new file mode 100644 index 0000000000..b2446c753a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/LineOfBusinessExpected.json @@ -0,0 +1,3 @@ +{ + "line-of-business-name": "lineOfBusinessName" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json new file mode 100644 index 0000000000..45ca00bd32 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json @@ -0,0 +1,8 @@ +{ + "model-invariant-uuid":"modelInvariantUUID", + "collection-function":"function", + "collection-role":"role", + "collection-type":"type", + "description":"description", + "quantity":0 +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json new file mode 100644 index 0000000000..98f966e753 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json @@ -0,0 +1,21 @@ +{ + "tosca-node-type": "toscaNodeType", + "description": "description", + "orchestration-mode": "orchestrationMode", + "aic-version-min" : "aicVersionMin", + "aic-version-max" : "aicVersionMax", + "min-instances": 2, + "max-instances": 3, + "availability-zone-max-count": 5, + "nf-function" : "nfFunction", + "nf-type" : "nfType", + "nf-role" : "nfRole", + "nf-naming-code" : "nfNamingCode", + "multi-stage-design" : "multiStageDesign", + "model-customization-uuid": "modelCustomizationUUID", + "model-instance-name": "modelInstanceName", + "model-version" : "modelVersion", + "model-invariant-uuid" : "modelInvariantUUID", + "model-name" : "modelName", + "model-uuid" : "modelUUID" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoInstanceGroup.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoInstanceGroup.json new file mode 100644 index 0000000000..f7bc4c33db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoInstanceGroup.json @@ -0,0 +1,10 @@ +{ + "modelUUID":"modelUUID", + "modelInvariantUUID":"modelInvariantUUID", + "model-uuid":"modelUUID", + "model-invariant-uuid":"modelInvariantUUID", + "type":"VNFC", + "instance-group-role":"instanceGroupRole", + "function": "function", + "description": "description" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoNetworkExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoNetworkExpected.json new file mode 100644 index 0000000000..d082cd91bf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoNetworkExpected.json @@ -0,0 +1,18 @@ +{ + "model-customization-uuid": "modelCustomizationUUID", + "model-instance-name": "modelInstanceName", + "network-technology": "networkTechnology", + "network-type": "networkType", + "network-scope": "networkScope", + "network-role": "networkRole", + "description" : "description", + "model-version" : "modelVersion", + "model-invariant-uuid" : "modelInvariantUUID", + "model-name" : "modelName", + "model-uuid" : "modelUUID", + "neutron-network-type" : "neutronNetworkType", + "aic-version-min" : "aicVersionMin", + "aic-version-max" : "aicVersionMax", + "orchestration-mode" : "orchestrationMode", + "tosca-node-type" : "toscaNodeType" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json new file mode 100644 index 0000000000..42ae25a7b1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json @@ -0,0 +1,12 @@ +{ + "model-name": "modelName", + "description": "description", + "created": null, + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json new file mode 100644 index 0000000000..1f9a8be5cf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json @@ -0,0 +1,14 @@ +{ + "model-customization-uuid": "modelCustomizationUUID", + "model-name" : "modelName", + "model-uuid" : "modelUUID", + "model-invariant-uuid" : "modelInvariantUUID", + "model-version" : "modelVersion", + "description": "description", + "is-base-boolean": true, + "min-instances": 2, + "max-instances": 3, + "availability-zone-count": 5, + "label": "label", + "initial-count": null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkPolicy.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkPolicy.json new file mode 100644 index 0000000000..90b5108bc1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkPolicy.json @@ -0,0 +1,6 @@ +{ + "network-policy-id": "networkPolicyId", + "network-policy-fqdn" : "networkPolicyFqdn", + "heat-stack-id" : "heatStackId", + "resource-version" : "resourceVersion" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkResourceCustomizationInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkResourceCustomizationInput.json new file mode 100644 index 0000000000..f1e5969117 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/NetworkResourceCustomizationInput.json @@ -0,0 +1,25 @@ +{ + "modelCustomizationUUID" : "modelCustomizationUUID", + "modelInstanceName" : "modelInstanceName", + "networkTechnology" : "networkTechnology", + "networkType" : "networkType", + "networkScope" : "networkScope", + "networkRole" : "networkRole", + "networkResource" : { + "modelUUID" : "modelUUID", + "orchestrationMode" : "orchestrationMode", + "description" : "description", + "neutronNetworkType" : "neutronNetworkType", + "aicVersionMin" : "aicVersionMin", + "aicVersionMax" : "aicVersionMax", + "modelName" : "modelName", + "modelInvariantUUID" : "modelInvariantUUID", + "modelVersion" : "modelVersion", + "toscaNodeType" : "toscaNodeType", + "category" : "category", + "subCategory" : "subCategory", + "networkResourceCustomization" : [], + "collectionNetworkResourceCustomization" : [], + "heatTemplate" : {} + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/OwningEntity.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/OwningEntity.json new file mode 100644 index 0000000000..699079f6f9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/OwningEntity.json @@ -0,0 +1,4 @@ +{ + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Platform.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Platform.json new file mode 100644 index 0000000000..12b4e0b530 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Platform.json @@ -0,0 +1,3 @@ +{ + "platform-name": "platformName" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PlatformExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PlatformExpected.json new file mode 100644 index 0000000000..12b4e0b530 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PlatformExpected.json @@ -0,0 +1,3 @@ +{ + "platform-name": "platformName" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Project.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Project.json new file mode 100644 index 0000000000..4904d2cdb5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/Project.json @@ -0,0 +1,3 @@ +{ + "project-name": "projectName" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json new file mode 100644 index 0000000000..6f82a9dd75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json @@ -0,0 +1,12 @@ +{ + "product-family-id": "productFamilyId", + "source": "source", + "requestor-id": "requestorId", + "subscription-service-type": "subscriptionServiceType", + "user-params": null, + "action": null, + "callback-url": "callbackURL", + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsExpected.json new file mode 100644 index 0000000000..fa5fd9740c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsExpected.json @@ -0,0 +1,14 @@ +{ + "modelInfo": { + "modelType": "vfModule", + "modelName": "vSAMP10aDEV::base::module-0" + }, + "requestInfo": { + "source": "VID", + "suppressRollback": false + }, + "cloudConfiguration": { + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "lcpCloudRegionId": "mtn6" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput.json new file mode 100644 index 0000000000..e3c6e8c61e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput.json @@ -0,0 +1,18 @@ +{ + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType" + }, + "project": { + "projectName": "projectName" + }, + "owningEntity": { + "owningEntityId": "owningEntityId", + "owningEntityName": "owningEntityName" + }, + "platform": { + "platformName": "platformName" + }, + "lineOfBusiness": { + "lineOfBusinessName": "lineOfBusinessName" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json new file mode 100644 index 0000000000..e91875135b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json @@ -0,0 +1,13 @@ +{ + "requestInfo": { + "callbackUrl": "callbackURL", + "productFamilyId": "productFamilyId", + "source": "source", + "suppressRollback": false, + "requestorId": "requestorId" + }, + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType" + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json new file mode 100644 index 0000000000..1cc387aaa0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json @@ -0,0 +1,151 @@ +{ + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10.0" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "projectName" + }, + "subscriberInfo": { + "globalSubscriberId": "subscriberId" + }, + "requestInfo": { + "instanceName": "vPE_Service", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceName": "vPE_Service", + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceName": "vmxnjr001_AVPN_base_vPE_BV_base_001", + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_002", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceName": "vmxnjr001_AVPN_vPFE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "192.168.0.16" + } + ] + } + ] + } + ], + "networks": [ + { + "modelInfo": { + "modelType": "network", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001" + } + ] + } + } + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json new file mode 100644 index 0000000000..bb1612b11d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json @@ -0,0 +1,19 @@ +{ + "modelInfo":{ + "modelType":"service", + "modelVersionId":"modelUUID", + "modelUuid":"modelUUID", + "modelInvariantId":"modelInvariantId", + "modelVersion":"modelVersion" + }, + "relatedInstanceList":[{ + "relatedInstance":{ + "instanceId":"instanceId", + "modelInfo":{ + "modelType":"service", + "modelVersionId":"modelUUID", + "modelUuid":"modelUUID" + } + } + }] +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withoutRelatedInstanceList.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withoutRelatedInstanceList.json new file mode 100644 index 0000000000..4111c7835f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withoutRelatedInstanceList.json @@ -0,0 +1,17 @@ +{ + "modelInfo":{ + "modelType":"service", + "modelVersionId":"modelUUID", + "modelUuid":"modelUUID" + }, + "relatedInstanceList":[{ + "relatedInstance":{ + "instanceId":"instanceId", + "modelInfo":{ + "modelType":"service", + "modelVersionId":"modelUUID", + "modelUuid":"modelUUID" + } + } + }] +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetails_CreateVnf.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetails_CreateVnf.json new file mode 100644 index 0000000000..8332ddc28f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetails_CreateVnf.json @@ -0,0 +1,60 @@ +{ + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelVersionId": "fe042c22-ba82-43c6-b2f6-8f1fc4164091", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelCustomizationName": "vSAMP12 1", + "modelCustomizationId": "a7f1d08e-b02d-11e6-80f5-76304dec7eb7" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "subscriberInfo": { + "globalSubscriberId": "subscriberId" + }, + "requestInfo": { + "instanceName": "MSOTEST103a", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "platform": { + "platformName": "{some platformName}" + }, + "lineOfBusiness": { + "lineOfBusinessName": "{some string}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{serviceInstanceId}", + "modelInfo": { + "modelType": "service", + "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "{instanceGroupId}", + "modelInfo": { + "modelType": "networkCollection", + "modelInvariantId": "9ea660dc-155f-44d3-b45c-cc7648b4f31c", + "modelVersionId": "bb07aad1-ce2d-40c1-85cb-5392f76bb1ef", + "modelName": "{network collection model name}", + "modelVersion": "1.0" + } + } + } + ], + "requestParameters": { + "userParams": [] + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestLineOfBusinessInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestLineOfBusinessInput.json new file mode 100644 index 0000000000..1fd5fffaef --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestLineOfBusinessInput.json @@ -0,0 +1,3 @@ +{ + "lineOfBusinessName": "lineOfBusinessName" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestPlatformInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestPlatformInput.json new file mode 100644 index 0000000000..80a5d6201a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestPlatformInput.json @@ -0,0 +1,3 @@ +{ + "platformName": "platformName" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceExpected.json new file mode 100644 index 0000000000..dcef8b5831 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceExpected.json @@ -0,0 +1,5 @@ +{ + "route-table-reference-id": "routeTableReferenceId", + "route-table-reference-fqdn": "routeTableReferenceFqdn", + "resource-version": "resourceVersion" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceInput.json new file mode 100644 index 0000000000..5aec724ab3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RouteTableReferenceInput.json @@ -0,0 +1,6 @@ +{ + "routeTableReferenceId": "routeTableReferenceId", + "routeTableReferenceFqdn": "routeTableReferenceFqdn", + "resourceVersion": "resourceVersion", + "relationshipList": {} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/SerializationTest.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/SerializationTest.json new file mode 100644 index 0000000000..5e879dc78e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/SerializationTest.json @@ -0,0 +1,86 @@ +{ + "requestContext" : { + "product-family-id" : null, + "source" : "VID", + "requestor-id" : "xxxxxx", + "subscription-service-type" : "Mobility", + "user-params" : null, + "action" : "createInstance", + "callback-url" : null, + "service-uri" : null, + "mso-request-id" : "fa807605-ebf5-4edd-83aa-c23edba607a2", + "requestParameters" : { + "subscriptionServiceType" : "Mobility", + "aLaCarte" : true, + "testApi" : "GR_API" + } + }, + "orchContext" : { + "is-rollback-enabled" : false + }, + "locationContext" : { + "cloud-owner" : null, + "cloud-region-id" : null, + "tenant-id" : null, + "complex" : null, + "aic-version" : null + }, + "userInput" : null, + "serviceInstance" : { + "service-instance-id" : "a446e2ab-7c92-4b4c-bfc2-9ab88f3c99c3", + "service-instance-name" : "Network_vprobes_mgmt_1_SI_sk316t", + "orchestration-status" : "PRECREATED", + "owning-entity" : { + "owning-entity-id" : "f160c875-ddd1-4ef5-84d8-d098784daa3a", + "owning-entity-name" : "OE1" + }, + "customer" : { + "global-customer-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "subscriber-name" : "Mobility", + "subscriber-type" : "INFRA", + "service-subscription" : { + "service-type" : "Mobility", + "temp-ub-sub-account-id" : null, + "service-instances" : [ ] + }, + "vpn-bindings" : [ ] + }, + "project" : { + "project-name" : "project1" + }, + "collection" : null, + "vnfs" : [ ], + "allotted-resources" : [ ], + "networks" : [ ], + "bandwidth-total" : null, + "bandwidth-up-wan-1" : null, + "bandwidth-down-wan-1" : null, + "bandwidth-up-wan-2" : null, + "bandwidth-down-wan-2" : null, + "vhn-portal-url" : null, + "service-instance-location-id" : null, + "selflink" : null, + "metadata" : null, + "configuration" : null, + "vpn-bonding-links" : [ ], + "model-info-service-instance" : { + "model-name" : "Network_vprobes_mgmt_1", + "description" : "tbd", + "created" : "Mon Jan 15 10:54:06 GMT 2018", + "model-uuid" : "13da7f84-f380-4591-a714-937d4bef0c34", + "model-invariant-uuid" : "0bd8b143-41cf-4373-8601-61be1bf01c9a", + "model-version" : "1.0", + "service-type" : "", + "service-role" : "", + "environment-context" : "General_Revenue-Bearing", + "workload-context" : "Production" + } + }, + "cloudRegion" : { + "lcp-cloud-region-id" : null, + "tenant-id" : null, + "cloud-owner" : null, + "cloud-region-version" : null + }, + "customer" : null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json new file mode 100644 index 0000000000..8cf6f6c3ab --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json @@ -0,0 +1,32 @@ +{ + "serviceInstanceId": "serviceInstanceId", + "serviceInstanceName": "serviceInstanceName", + "serviceType": null, + "serviceRole": null, + "environmentContext": null, + "workloadContext": null, + "modelInvariantId": null, + "modelVersionId": null, + "personaModelVersion": null, + "widgetModelId": null, + "widgetModelVersion": null, + "bandwidthTotal": "bandwidthTotal", + "bandwidthUpWan1": "bandwidthUpWan1", + "bandwidthDownWan1": "bandwidthDownWan1", + "bandwidthUpWan2": "bandwidthUpWan2", + "bandwidthDownWan2": "bandwidthDownWan2", + "vhnPortalUrl": "vhnPortalUrl", + "serviceInstanceLocationId": "serviceInstanceLocId", + "resourceVersion": null, + "selflink": "selfLink", + "orchestrationStatus": "Created", + "relationshipList": null, + "metadata": null, + "allottedResources": { + "allottedResource": [ + { + "id": "allottedID" + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIPlatformAndLOBInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIPlatformAndLOBInput.json new file mode 100644 index 0000000000..9bf854c31d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIPlatformAndLOBInput.json @@ -0,0 +1,72 @@ +{ + "service-instance-id": null, + "service-instance-name": null, + "orchestration-status": null, + "owning-entity": null, + "project": null, + "vnfs": [ + { + "closedLoopDisabled": false, + "vnf-id": "vnfId", + "vnf-name": null, + "vnf-type": null, + "orchestration-status": null, + "vf-modules": [], + "volume-groups": [], + "line-of-business": { + "line-of-business-name": "lineOfBusinessName" + }, + "platform": { + "platform-name": "platformName" + }, + "cascaded": false, + "cloud-params": null, + "cloud-context": null, + "solution": null, + "vnf-name-2": null, + "service-id": null, + "regional-resource-zone": null, + "prov-status": null, + "operational-status": null, + "equipment-role": null, + "management-option": null, + "ipv4-oam-address": null, + "ipv4-loopback0-address": null, + "nm-lan-v6-address": null, + "management-v6-address": null, + "vcpu": null, + "vcpu-units": null, + "vmemory": null, + "vmemory-units": null, + "vdisk": null, + "vdisk-units": null, + "in-maint": false, + "is-closed-loop-disabled": false, + "summary-status": null, + "encrypted-access-flag": null, + "as-number": null, + "regional-resource-subzone": null, + "self-link": null, + "ipv4-oam-gateway-address": null, + "ipv4-oam-gateway-address-prefix-length": null, + "vlan-id-outer": null, + "nm-profile-name": null, + "l-interfaces": [], + "lag-interfaces": [], + "license": { + "entitlement-pool-uuids": [], + "license-key-group-uuids": [] + }, + "entitlements": [], + "model-info-generic-vnf": null + } + ], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiPlatformAndLOBToSI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiPlatformAndLOBToSI.json new file mode 100644 index 0000000000..9d4851d34c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiPlatformAndLOBToSI.json @@ -0,0 +1,72 @@ +{ + "service-instance-id": null, + "service-instance-name": null, + "orchestration-status": null, + "owning-entity": null, + "project": null, + "vnfs": [ + { + "closedLoopDisabled": false, + "vnf-id": "vnfId", + "vnf-name": null, + "vnf-type": null, + "orchestration-status": null, + "vf-modules": [], + "volume-groups": [], + "line-of-business": { + "line-of-business-name": "lineOfBusinessName" + }, + "platform": { + "platform-name": "platformName" + }, + "cascaded": false, + "cloud-params": null, + "cloud-context": null, + "solution": null, + "vnf-name-2": null, + "service-id": null, + "regional-resource-zone": null, + "prov-status": null, + "operational-status": null, + "equipment-role": null, + "management-option": null, + "ipv4-oam-address": null, + "ipv4-loopback0-address": null, + "nm-lan-v6-address": null, + "management-v6-address": null, + "vcpu": null, + "vcpu-units": null, + "vmemory": null, + "vmemory-units": null, + "vdisk": null, + "vdisk-units": null, + "in-maint": false, + "is-closed-loop-disabled": false, + "summary-status": null, + "encrypted-access-flag": null, + "as-number": null, + "regional-resource-subzone": null, + "self-link": null, + "ipv4-oam-gateway-address": null, + "ipv4-oam-gateway-address-prefix-length": null, + "vlan-id-outer": null, + "nm-profile-name": null, + "l-interfaces": [], + "lag-interfaces": [], + "license": { + "entitlement-pool-uuids": [], + "license-key-group-uuids": [] + }, + "entitlements": [], + "model-info-generic-vnf": null + } + ], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiServiceInstanceToSI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiServiceInstanceToSI.json new file mode 100644 index 0000000000..19d6e6dea1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_aaiServiceInstanceToSI.json @@ -0,0 +1,27 @@ +{ + "service-instance-id": "serviceInstanceId", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "CREATED", + "owning-entity": null, + "project": null, + "vnfs": [], + "allotted-resources": [ + { + "id": "allottedID", + "target-network-role": null, + "self-link": null, + "orchestration-status": null, + "operational-status": null, + "type": null, + "role": null, + "model-info-allotted-resource": null + } + ], + "networks": [], + "vhn-portal-url": "vhnPortalUrl", + "service-instance-location-id": "serviceInstanceLocId", + "selflink": "selfLink", + "metadata": null, + "configurations": [], + "model-info-service-instance": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_catalogServiceToSI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_catalogServiceToSI.json new file mode 100644 index 0000000000..0906ea29ab --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_catalogServiceToSI.json @@ -0,0 +1,34 @@ +{ + "service-instance-id": null, + "service-instance-name": null, + "orchestration-status": null, + "owning-entity": null, + "customer": null, + "project": null, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "bandwidth-total": null, + "bandwidth-up-wan-1": null, + "bandwidth-down-wan-1": null, + "bandwidth-up-wan-2": null, + "bandwidth-down-wan-2": null, + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "volume-groups": [], + "configuration": null, + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_getServiceInstanceNOAAIExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_getServiceInstanceNOAAIExpected.json new file mode 100644 index 0000000000..38cca740c7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_getServiceInstanceNOAAIExpected.json @@ -0,0 +1,32 @@ +{ + "service-instance-id": "3655a595-05d1-433c-93c0-3afd6b572545", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "PRECREATED", + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_highLevelObjectsToSI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_highLevelObjectsToSI.json new file mode 100644 index 0000000000..4cb6940a74 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstance_highLevelObjectsToSI.json @@ -0,0 +1,35 @@ +{ + "service-instance-id": null, + "service-instance-name": null, + "orchestration-status": null, + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType" + } + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "bandwidth-total": null, + "bandwidth-up-wan-1": null, + "bandwidth-down-wan-1": null, + "bandwidth-up-wan-2": null, + "bandwidth-down-wan-2": null, + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "volume-groups": [], + "configuration": null, + "model-info-service-instance": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json new file mode 100644 index 0000000000..f458d732d2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json @@ -0,0 +1,109 @@ +{ + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceName": "vPE_Service", + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceName": "vmxnjr001_AVPN_base_vPE_BV_base_001", + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_002", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceName": "vmxnjr001_AVPN_vPFE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "128.0.0.16" + } + ] + } + ] + } + ], + "networks": [ + { + "modelInfo": { + "modelType": "network", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001" + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json new file mode 100644 index 0000000000..0c3d8e709e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json @@ -0,0 +1,105 @@ +{ + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceName": "vPE_Service", + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceName": "vmxnjr001_AVPN_base_vPE_BV_base_001", + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_002", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceName": "vmxnjr001_AVPN_vPFE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "128.0.0.16" + } + ] + } + ] + } + ], + "networks": [ + { + "modelInfo": { + "modelType": "network", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001" + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json new file mode 100644 index 0000000000..3f07e8d526 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json @@ -0,0 +1,113 @@ +{ + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceName": "vPE_Service", + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceName": "vmxnjr001_AVPN_base_vPE_BV_base_001", + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_002", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceName": "vmxnjr001_AVPN_vPFE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "128.0.0.16" + } + ] + } + ] + } + ], + "networks": [ + { + "modelInfo": { + "modelType": "network", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001" + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json new file mode 100644 index 0000000000..4c29f96361 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json @@ -0,0 +1,113 @@ +{ + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceName": "vPE_Service", + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceName": "vmxnjr001_AVPN_base_vPE_BV_base_001", + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_002", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceName": "vmxnjr001_AVPN_vPFE_BV_expansion_001", + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "128.0.0.16" + } + ] + } + ] + } + ], + "networks": [ + { + "modelInfo": { + "modelType": "network", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceName": "vmxnjr001" + } + ] + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscriptionExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscriptionExpected.json new file mode 100644 index 0000000000..5c41329fb8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscriptionExpected.json @@ -0,0 +1,5 @@ +{ + "service-type": "serviceType", + "temp-ub-sub-account-id" : "tempUbSubAccountId", + "service-instances" : [] +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscription_AAI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscription_AAI.json new file mode 100644 index 0000000000..bc72bea767 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceSubscription_AAI.json @@ -0,0 +1,7 @@ +{ + "serviceType" : "serviceType", + "tempUbSubAccountId" : "tempUbSubAccountId", + "resourceVersion" : "resourceVersion", + "serviceInstances" : {}, + "relationshipList" : {} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VfModuleCustomizationInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VfModuleCustomizationInput.json new file mode 100644 index 0000000000..08bd8c7d14 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VfModuleCustomizationInput.json @@ -0,0 +1,24 @@ +{ + "modelCustomizationUUID" : "modelCustomizationUUID", + "label" : "label", + "minInstances": 2, + "maxInstances": 3, + "availabilityZoneCount": 5, + "volumeHeatEnv" : {}, + "heatEnvironment" : {}, + "vfModule" : { + "modelUUID" : "modelUUID", + "modelInvariantUUID" : "modelInvariantUUID", + "modelName" : "modelName", + "modelVersion" : "modelVersion", + "description" : "description", + "isBase" : true, + "volumeHeatTemplate" : {}, + "moduleHeatTemplate" : {}, + "heatFiles" : [], + "vfModuleCustomization" : [], + "vnfResources" : { + "modelName" : "vnfResourceModelName" + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json new file mode 100644 index 0000000000..26516ce907 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json @@ -0,0 +1,25 @@ +{ + "modelCustomizationUUID" : "modelCustomizationUUID", + "modelInstanceName" : "modelInstanceName", + "minInstances": 2, + "maxInstances": 3, + "availabilityZoneMaxCount": 5, + "nfFunction" : "nfFunction", + "nfType" : "nfType", + "nfRole" : "nfRole", + "nfNamingCode" : "nfNamingCode", + "multiStageDesign" : "multiStageDesign", + "vnfResources" : { + "modelUUID" : "modelUUID", + "modelInvariantUUID" : "modelInvariantUUID", + "modelName" : "modelName", + "modelVersion" : "modelVersion", + "toscaNodeType" : "toscaNodeType", + "description" : "description", + "orchestrationMode" : "orchestrationMode", + "aicVersionMin" : "aicVersionMin", + "aicVersionMax" : "aicVersionMax", + "category" : "category", + "subCategory" : "subCategory" + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json new file mode 100644 index 0000000000..457b23f841 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfcInstanceGroupCustomization.json @@ -0,0 +1,8 @@ +{ + "modelCustomizationUUID" : "modelCustomizationUUID", + "modelUUID" : "modelUUID", + "vnfResourceCust" : {}, + "instanceGroup" : {}, + "function" : "function", + "description" : "description" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json new file mode 100644 index 0000000000..f807276773 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json @@ -0,0 +1,9 @@ +{ + "volume-group-id":"volumeGroupId", + "volume-group-name":"volumeGroupName", + "vnf-type":"vnfType", + "orchestration-status":"PRECREATED", + "cloud-params":{}, + "cascaded":false, + "heat-stack-id":"heatStackId" +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup_AAI.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup_AAI.json new file mode 100644 index 0000000000..fb46478592 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup_AAI.json @@ -0,0 +1,11 @@ +{ + "volumeGroupId" : "volumeGroupId", + "volumeGroupName" : "volumeGroupName", + "heatStackId" : "heatStackId", + "vnfType" : "vnfType", + "orchestrationStatus" : "PRECREATED", + "modelCustomizationId" : "modelCustomizationId", + "vfModuleModelCustomizationId" : "vfModuleModelCustomizationId", + "resourceVersion" : null, + "relationshipList" : {} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiGenericVnfInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiGenericVnfInput.json new file mode 100644 index 0000000000..14b316d001 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiGenericVnfInput.json @@ -0,0 +1,104 @@ +{ + "vnfId":"vnfId", + "vnfName":"vnfName", + "vnfName2":null, + "vnfType":"vnfType", + "serviceId":null, + "regionalResourceZone":null, + "provStatus":null, + "operationalStatus":null, + "licenseKey":null, + "equipmentRole":null, + "orchestrationStatus":"PRECREATED", + "heatStackId":null, + "msoCatalogKey":null, + "managementOption":null, + "ipv4OamAddress":null, + "ipv4Loopback0Address":null, + "nmLanV6Address":null, + "managementV6Address":null, + "vcpu":null, + "vcpuUnits":null, + "vmemory":null, + "vmemoryUnits":null, + "vdisk":null, + "vdiskUnits":null, + "inMaint":false, + "isClosedLoopDisabled":false, + "resourceVersion":null, + "summaryStatus":null, + "encryptedAccessFlag":null, + "entitlementAssignmentGroupUuid":null, + "entitlementResourceUuid":null, + "licenseAssignmentGroupUuid":null, + "licenseKeyUuid":null, + "modelInvariantId":null, + "modelVersionId":null, + "personaModelVersion":null, + "modelCustomizationId":null, + "widgetModelId":null, + "widgetModelVersion":null, + "asNumber":null, + "regionalResourceSubzone":null, + "nfType":null, + "nfFunction":null, + "nfRole":null, + "nfNamingCode":null, + "selflink":null, + "ipv4OamGatewayAddress":null, + "ipv4OamGatewayAddressPrefixLength":null, + "vlanIdOuter":null, + "nmProfileName":null, + "relationshipList":null, + "lagInterfaces":{ + "lagInterface":[{ + "interfaceName":"interfaceName", + "interfaceDescription":"interfaceDescription", + "resourceVersion":null, + "speedValue":"speedValue", + "speedUnits":"speedUnits", + "interfaceId":"interfaceId", + "interfaceRole":"interfaceRole", + "provStatus":"provStatus", + "inMaint":true,"relationshipList":null, + "linterfaces":null + }] + }, + "vfModules":{ + "vfModule":[{ + "vfModuleId":"vfModuleId", + "vfModuleName":"vfModuleName", + "heatStackId":"heatStackId", + "orchestrationStatus":"PRECREATED", + "isBaseVfModule":false, + "resourceVersion":null, + "modelInvariantId":null, + "modelVersionId":null, + "personaModelVersion":null, + "modelCustomizationId":null, + "widgetModelId":null, + "widgetModelVersion":null, + "contrailServiceInstanceFqdn":"contrailServiceInstanceFqdn", + "moduleIndex":1, + "selflink":"selflink", + "relationshipList":null + }] + }, + "licenses":{ + "license":[{ + "groupUuid":"groupUuid", + "resourceUuid":null, + "resourceVersion":null, + "relationshipList":null + }] + }, + "entitlements":{ + "entitlement":[{ + "groupUuid":"groupUuid", + "resourceUuid":"resourceUuid", + "resourceVersion":null, + "relationshipList":null + }] + }, + "linterfaces":null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInput.json new file mode 100644 index 0000000000..212074ba06 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInput.json @@ -0,0 +1,50 @@ +{ + "networkId": "networkId", + "networkName": "networkName", + "networkType": null, + "networkRole": null, + "networkTechnology": null, + "neutronNetworkId": null, + "isBoundToVpn": true, + "serviceId": "serviceId", + "networkRoleInstance": 1234, + "resourceVersion": null, + "orchestrationStatus": "Assigned", + "heatStackId": "heatStackId", + "msoCatalogKey": null, + "contrailNetworkFqdn": "contrailNetworkFqdn", + "modelInvariantId": null, + "modelVersionId": null, + "personaModelVersion": null, + "modelCustomizationId": null, + "widgetModelId": "widgetModelId", + "widgetModelVersion": "widgetModelVersion", + "physicalNetworkName": "physicalNetworkName", + "isProviderNetwork": true, + "isSharedNetwork": true, + "isExternalNetwork": true, + "selflink": "selflink", + "operationalStatus": "operationalStatus", + "subnets": { + "subnet": [ + { + "subnetId": "subnetId" + } + ] + }, + "ctagAssignments": { + "ctagAssignment": [ + { + "vlanIdInner": 1234 + } + ] + }, + "segmentationAssignments": { + "segmentationAssignment": [ + { + "segmentationId": "segmentationId" + } + ] + }, + "relationshipList": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiVolumeGroupInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiVolumeGroupInput.json new file mode 100644 index 0000000000..dce65e7b67 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiVolumeGroupInput.json @@ -0,0 +1,11 @@ +{ + "volumeGroupId":"volumeGroupId", + "volumeGroupName":"volumeGroupId", + "heatStackId":"heatStackId", + "vnfType":"vnfType", + "orchestrationStatus":"PRECREATED", + "modelCustomizationId":"modelCustomizationId", + "vfModuleModelCustomizationId":"vfModuleModelCustomizationId", + "resourceVersion":null, + "relationshipList":null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpected.json new file mode 100644 index 0000000000..5006717a02 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpected.json @@ -0,0 +1,36 @@ +{ + "network-id": "networkId", + "cascaded": null, + "cloud-params": {}, + "network-name": "networkName", + "is-bound-to-vpn": true, + "service-id": "serviceId", + "network-role-instance": 1234, + "orchestration-status": "ASSIGNED", + "heat-stack-id": "heatStackId", + "contrail-network-fqdn": "contrailNetworkFqdn", + "widget-model-id": "widgetModelId", + "widget-model-version": "widgetModelVersion", + "physical-network-name": "physicalNetworkName", + "is-provider-network": true, + "is-shared-network": true, + "is-external-network": true, + "self-link": "selflink", + "operational-status": "operationalStatus", + "subnets": [ + { + "subnet-id": "subnetId" + } + ], + "ctag-assignments": [ + { + "vlan-id-inner": 1234 + } + ], + "segmentation-assignments": [ + { + "segmentation-id": "segmentationId" + } + ], + "model-info-network": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml index 30b0afb3dc..e11c4499e0 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml @@ -1,35 +1,35 @@ - <service-subscription xmlns="http://com.aai.inventory">
- <service-type>SDN-ETHERNET-INTERNET</service-type>
- <resource-version>1234</resource-version>
- <service-instances>
- <service-instance>
- <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id>
- <relationship-list>
- <relationship>
- <related-to>cvlan-tag</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link>
- <relationship-data>
- <relationship-key>cvlan-tag.cvlan-tag</relationship-key>
- <relationship-value>2003</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>port-group.interface-id</relationship-key>
- <relationship-value>slcp1447vbc.ipag</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>vce.vnf-id</relationship-key>
- <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>vce</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link>
- <relationship-data>
- <relationship-key>vce.vnf-id</relationship-key>
- <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- </service-instance>
- </service-instances>
+ <service-subscription xmlns="http://com.aai.inventory"> + <service-type>SDN-ETHERNET-INTERNET</service-type> + <resource-version>1234</resource-version> + <service-instances> + <service-instance> + <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id> + <relationship-list> + <relationship> + <related-to>cvlan-tag</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link> + <relationship-data> + <relationship-key>cvlan-tag.cvlan-tag</relationship-key> + <relationship-value>2003</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>port-group.interface-id</relationship-key> + <relationship-value>slcp1447vbc.ipag</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>vce.vnf-id</relationship-key> + <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>vce</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link> + <relationship-data> + <relationship-key>vce.vnf-id</relationship-key> + <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </service-instance> + </service-instances> </service-subscription>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml index a609a35857..7c879879ef 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml @@ -1,23 +1,23 @@ -<generic-vnfs xmlns="http://com.aai.inventory/v3">
- <generic-vnf>
- <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id>
- <vnf-name>testVnfName123</vnf-name>
- <vnf-type>mmsc-capacity</vnf-type>
- <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
- <equipment-role>vMMSC</equipment-role>
- <orchestration-status>pending-create</orchestration-status>
- <resource-version>testReVer123</resource-version>
- <relationship-list>
- <relationship>
- <related-to>nothing</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- <l-interfaces/>
- <lag-interfaces/>
- </generic-vnf>
+<generic-vnfs xmlns="http://com.aai.inventory/v3"> + <generic-vnf> + <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id> + <vnf-name>testVnfName123</vnf-name> + <vnf-type>mmsc-capacity</vnf-type> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + <equipment-role>vMMSC</equipment-role> + <orchestration-status>pending-create</orchestration-status> + <resource-version>testReVer123</resource-version> + <relationship-list> + <relationship> + <related-to>nothing</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + <l-interfaces/> + <lag-interfaces/> + </generic-vnf> </generic-vnfs>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml index 2b70f0b600..0b5a822b68 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml @@ -1,90 +1,90 @@ -<generic-vnfs xmlns="http://com.aai.inventory/v3">
- <generic-vnf>
- <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id>
- <vnf-name>testVnfName123</vnf-name>
- <vnf-type>mmsc-capacity</vnf-type>
- <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
- <equipment-role>vMMSC</equipment-role>
- <orchestration-status>pending-create</orchestration-status>
- <relationship-list>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- <l-interfaces/>
- <lag-interfaces/>
- </generic-vnf>
- <generic-vnf>
- <vnf-id>802767b3-18a6-4432-96db-25522786aee0</vnf-id>
- <vnf-name>ZRDM1MMSC03</vnf-name>
- <vnf-type>mmsc-capacity</vnf-type>
- <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
- <equipment-role>vMMSC</equipment-role>
- <orchestration-status>pending-create</orchestration-status>
- <relationship-list>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- <l-interfaces/>
- <lag-interfaces/>
- </generic-vnf>
+<generic-vnfs xmlns="http://com.aai.inventory/v3"> + <generic-vnf> + <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id> + <vnf-name>testVnfName123</vnf-name> + <vnf-type>mmsc-capacity</vnf-type> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + <equipment-role>vMMSC</equipment-role> + <orchestration-status>pending-create</orchestration-status> + <relationship-list> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + <l-interfaces/> + <lag-interfaces/> + </generic-vnf> + <generic-vnf> + <vnf-id>802767b3-18a6-4432-96db-25522786aee0</vnf-id> + <vnf-name>ZRDM1MMSC03</vnf-name> + <vnf-type>mmsc-capacity</vnf-type> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + <equipment-role>vMMSC</equipment-role> + <orchestration-status>pending-create</orchestration-status> + <relationship-list> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + <l-interfaces/> + <lag-interfaces/> + </generic-vnf> </generic-vnfs>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml index 2b70f0b600..0b5a822b68 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml @@ -1,90 +1,90 @@ -<generic-vnfs xmlns="http://com.aai.inventory/v3">
- <generic-vnf>
- <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id>
- <vnf-name>testVnfName123</vnf-name>
- <vnf-type>mmsc-capacity</vnf-type>
- <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
- <equipment-role>vMMSC</equipment-role>
- <orchestration-status>pending-create</orchestration-status>
- <relationship-list>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- <l-interfaces/>
- <lag-interfaces/>
- </generic-vnf>
- <generic-vnf>
- <vnf-id>802767b3-18a6-4432-96db-25522786aee0</vnf-id>
- <vnf-name>ZRDM1MMSC03</vnf-name>
- <vnf-type>mmsc-capacity</vnf-type>
- <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
- <equipment-role>vMMSC</equipment-role>
- <orchestration-status>pending-create</orchestration-status>
- <relationship-list>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>l3-network</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link>
- <relationship-data>
- <relationship-key>l3-network.network-id</relationship-key>
- <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- <l-interfaces/>
- <lag-interfaces/>
- </generic-vnf>
+<generic-vnfs xmlns="http://com.aai.inventory/v3"> + <generic-vnf> + <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id> + <vnf-name>testVnfName123</vnf-name> + <vnf-type>mmsc-capacity</vnf-type> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + <equipment-role>vMMSC</equipment-role> + <orchestration-status>pending-create</orchestration-status> + <relationship-list> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + <l-interfaces/> + <lag-interfaces/> + </generic-vnf> + <generic-vnf> + <vnf-id>802767b3-18a6-4432-96db-25522786aee0</vnf-id> + <vnf-name>ZRDM1MMSC03</vnf-name> + <vnf-type>mmsc-capacity</vnf-type> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + <equipment-role>vMMSC</equipment-role> + <orchestration-status>pending-create</orchestration-status> + <relationship-list> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>l3-network</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> + <relationship-data> + <relationship-key>l3-network.network-id</relationship-key> + <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + <l-interfaces/> + <lag-interfaces/> + </generic-vnf> </generic-vnfs>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml index b1f640f47f..d0fccd80c9 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml @@ -1,6 +1,6 @@ - <search-results xmlns="http://com.aai.inventory">
- <result-data>
- <resource-type>service-instance</resource-type>
- <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link>
- </result-data>
+ <search-results xmlns="http://com.aai.inventory"> + <result-data> + <resource-type>service-instance</resource-type> + <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link> + </result-data> </search-results>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml index b1f640f47f..d0fccd80c9 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml @@ -1,6 +1,6 @@ - <search-results xmlns="http://com.aai.inventory">
- <result-data>
- <resource-type>service-instance</resource-type>
- <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link>
- </result-data>
+ <search-results xmlns="http://com.aai.inventory"> + <result-data> + <resource-type>service-instance</resource-type> + <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link> + </result-data> </search-results>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml index 84d8600eac..e377c70474 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml @@ -1,30 +1,30 @@ -<service-instance>
- <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id>
- <resource-version>123456789</resource-version>
- <relationship-list>
- <relationship>
- <related-to>cvlan-tag</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link>
- <relationship-data>
- <relationship-key>cvlan-tag.cvlan-tag</relationship-key>
- <relationship-value>2003</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>port-group.interface-id</relationship-key>
- <relationship-value>slcp1447vbc.ipag</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>vce.vnf-id</relationship-key>
- <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>vce</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link>
- <relationship-data>
- <relationship-key>vce.vnf-id</relationship-key>
- <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
+<service-instance> + <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id> + <resource-version>123456789</resource-version> + <relationship-list> + <relationship> + <related-to>cvlan-tag</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link> + <relationship-data> + <relationship-key>cvlan-tag.cvlan-tag</relationship-key> + <relationship-value>2003</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>port-group.interface-id</relationship-key> + <relationship-value>slcp1447vbc.ipag</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>vce.vnf-id</relationship-key> + <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>vce</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link> + <relationship-data> + <relationship-key>vce.vnf-id</relationship-key> + <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> + </relationship-data> + </relationship> + </relationship-list> </service-instance>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml index 85cd5d605a..52e75d970a 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml @@ -1,34 +1,34 @@ -<service-subscription xmlns="http://com.aai.inventory">
- <service-type>SDN-ETHERNET-INTERNET</service-type>
- <resource-version>1234</resource-version>
- <service-instance>
- <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id>
- <resource-version>123456789</resource-version>
- <relationship-list>
- <relationship>
- <related-to>cvlan-tag</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link>
- <relationship-data>
- <relationship-key>cvlan-tag.cvlan-tag</relationship-key>
- <relationship-value>2003</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>port-group.interface-id</relationship-key>
- <relationship-value>slcp1447vbc.ipag</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>vce.vnf-id</relationship-key>
- <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>vce</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link>
- <relationship-data>
- <relationship-key>vce.vnf-id</relationship-key>
- <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- </service-instance>
+<service-subscription xmlns="http://com.aai.inventory"> + <service-type>SDN-ETHERNET-INTERNET</service-type> + <resource-version>1234</resource-version> + <service-instance> + <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id> + <resource-version>123456789</resource-version> + <relationship-list> + <relationship> + <related-to>cvlan-tag</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link> + <relationship-data> + <relationship-key>cvlan-tag.cvlan-tag</relationship-key> + <relationship-value>2003</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>port-group.interface-id</relationship-key> + <relationship-value>slcp1447vbc.ipag</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>vce.vnf-id</relationship-key> + <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>vce</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link> + <relationship-data> + <relationship-key>vce.vnf-id</relationship-key> + <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </service-instance> </service-subscription>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml index 7ada696cb7..b55d51971d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml @@ -1,97 +1,97 @@ -<vce xmlns="http://com.aai.inventory">
- <vnf-id>1936628a-d22f-4943-8587-a57bab2ece7a</vnf-id>
- <vnf-name>testVnfName123</vnf-name>
- <vnf-name2>US0112SLCP1VBRT076</vnf-name2>
- <vnf-type>esx-vce</vnf-type>
- <prov-status>NVTPROV</prov-status>
- <orchestration-status>created</orchestration-status>
- <resource-version>0000020</resource-version>
- <heat-stack-id>slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d</heat-stack-id>
- <mso-catalog-key/>
- <vpe-id>VPESAT-mtanjrsv126</vpe-id>
- <ipv4-oam-address>135.21.249.160</ipv4-oam-address>
- <port-groups>
- <port-group>
- <interface-id>slcp1476vbc.vpe</interface-id>
- <neutron-network-id>e7568706-a2a9-45f8-aef8-95a0e2910953</neutron-network-id>
- <neutron-network-name>dvspg-VCE_VPE-slcp1476vbc</neutron-network-name>
- <interface-role>Internet</interface-role>
- <port-group-name>dvspg-VCE_VPE-slcp1476vbc</port-group-name>
- <resource-version>0000020</resource-version>
- <switch-name>dvs-slcp1-01</switch-name>
- <orchestration-status>created</orchestration-status>
- <heat-stack-id>dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196</heat-stack-id>
- <mso-catalog-key/>
- <cvlan-tags>
- <cvlan-tag-entry>
- <cvlan-tag>3012</cvlan-tag>
- <resource-version>0000020</resource-version>
- </cvlan-tag-entry>
- </cvlan-tags>
- </port-group>
- <port-group>
- <interface-id>slcp1476vbc.ipag</interface-id>
- <neutron-network-id>3477ddb6-b925-4971-ab62-c84b69634c49</neutron-network-id>
- <neutron-network-name>dvspg-IPAG_VCE-slcp1476vbc</neutron-network-name>
- <interface-role>Customer</interface-role>
- <port-group-name>dvspg-IPAG_VCE-slcp1476vbc</port-group-name>
- <switch-name>dvs-slcp1-01</switch-name>
- <resource-version>0000020</resource-version>
- <orchestration-status>created</orchestration-status>
- <heat-stack-id>dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7</heat-stack-id>
- <mso-catalog-key/>
- <cvlan-tags>
- <cvlan-tag-entry>
- <cvlan-tag>2003</cvlan-tag>
- <resource-version>0000020</resource-version>
- </cvlan-tag-entry>
- </cvlan-tags>
- </port-group>
- </port-groups>
- <relationship-list>
- <relationship>
- <related-to>service-instance</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/</related-link>
- <relationship-data>
- <relationship-key>service-instance.service-instance-id</relationship-key>
- <relationship-value>SDNC/VLXM/0112001//SW_INTERNET</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>service-subscription.service-type</relationship-key>
- <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>customer.global-customer-id</relationship-key>
- <relationship-value>011216-1602-SDNC001</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>vserver</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/</related-link>
- <relationship-data>
- <relationship-key>vserver.vserver-id</relationship-key>
- <relationship-value>ecab47d5-3450-4507-ada9-2b3c58485c51</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>3d5f3fe23821416fac2b69af65248c74</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>complex</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/</related-link>
- <relationship-data>
- <relationship-key>complex.physical-location-id</relationship-key>
- <relationship-value>MDTWNJ21A4</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>availability-zone</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/</related-link>
- <relationship-data>
- <relationship-key>availability-zone.availability-zone-name</relationship-key>
- <relationship-value>slcp1-esx-az01</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
+<vce xmlns="http://com.aai.inventory"> + <vnf-id>1936628a-d22f-4943-8587-a57bab2ece7a</vnf-id> + <vnf-name>testVnfName123</vnf-name> + <vnf-name2>US0112SLCP1VBRT076</vnf-name2> + <vnf-type>esx-vce</vnf-type> + <prov-status>NVTPROV</prov-status> + <orchestration-status>created</orchestration-status> + <resource-version>0000020</resource-version> + <heat-stack-id>slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d</heat-stack-id> + <mso-catalog-key/> + <vpe-id>VPESAT-mtanjrsv126</vpe-id> + <ipv4-oam-address>135.21.249.160</ipv4-oam-address> + <port-groups> + <port-group> + <interface-id>slcp1476vbc.vpe</interface-id> + <neutron-network-id>e7568706-a2a9-45f8-aef8-95a0e2910953</neutron-network-id> + <neutron-network-name>dvspg-VCE_VPE-slcp1476vbc</neutron-network-name> + <interface-role>Internet</interface-role> + <port-group-name>dvspg-VCE_VPE-slcp1476vbc</port-group-name> + <resource-version>0000020</resource-version> + <switch-name>dvs-slcp1-01</switch-name> + <orchestration-status>created</orchestration-status> + <heat-stack-id>dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196</heat-stack-id> + <mso-catalog-key/> + <cvlan-tags> + <cvlan-tag-entry> + <cvlan-tag>3012</cvlan-tag> + <resource-version>0000020</resource-version> + </cvlan-tag-entry> + </cvlan-tags> + </port-group> + <port-group> + <interface-id>slcp1476vbc.ipag</interface-id> + <neutron-network-id>3477ddb6-b925-4971-ab62-c84b69634c49</neutron-network-id> + <neutron-network-name>dvspg-IPAG_VCE-slcp1476vbc</neutron-network-name> + <interface-role>Customer</interface-role> + <port-group-name>dvspg-IPAG_VCE-slcp1476vbc</port-group-name> + <switch-name>dvs-slcp1-01</switch-name> + <resource-version>0000020</resource-version> + <orchestration-status>created</orchestration-status> + <heat-stack-id>dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7</heat-stack-id> + <mso-catalog-key/> + <cvlan-tags> + <cvlan-tag-entry> + <cvlan-tag>2003</cvlan-tag> + <resource-version>0000020</resource-version> + </cvlan-tag-entry> + </cvlan-tags> + </port-group> + </port-groups> + <relationship-list> + <relationship> + <related-to>service-instance</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/</related-link> + <relationship-data> + <relationship-key>service-instance.service-instance-id</relationship-key> + <relationship-value>SDNC/VLXM/0112001//SW_INTERNET</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>service-subscription.service-type</relationship-key> + <relationship-value>SDN-ETHERNET-INTERNET</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>customer.global-customer-id</relationship-key> + <relationship-value>011216-1602-SDNC001</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>vserver</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/</related-link> + <relationship-data> + <relationship-key>vserver.vserver-id</relationship-key> + <relationship-value>ecab47d5-3450-4507-ada9-2b3c58485c51</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>3d5f3fe23821416fac2b69af65248c74</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>complex</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/</related-link> + <relationship-data> + <relationship-key>complex.physical-location-id</relationship-key> + <relationship-value>MDTWNJ21A4</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>availability-zone</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/</related-link> + <relationship-data> + <relationship-key>availability-zone.availability-zone-name</relationship-key> + <relationship-value>slcp1-esx-az01</relationship-value> + </relationship-data> + </relationship> + </relationship-list> </vce>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml index 5dc3033445..e5f98bfe33 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml @@ -1,97 +1,92 @@ -<vce xmlns="http://com.aai.inventory">
- <vnf-id>1936628a-d22f-4943-8587-a57bab2ece7a</vnf-id>
- <vnf-name>testVnfName123</vnf-name>
- <vnf-name2>US0112SLCP1VBRT076</vnf-name2>
- <vnf-type>esx-vce</vnf-type>
- <prov-status>NVTPROV</prov-status>
- <orchestration-status>created</orchestration-status>
- <resource-version>0000020</resource-version>
- <heat-stack-id>slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d</heat-stack-id>
- <mso-catalog-key/>
- <vpe-id>VPESAT-mtanjrsv126</vpe-id>
- <ipv4-oam-address>135.21.249.160</ipv4-oam-address>
- <port-groups>
- <port-group>
- <interface-id>slcp1476vbc.vpe</interface-id>
- <neutron-network-id>e7568706-a2a9-45f8-aef8-95a0e2910953</neutron-network-id>
- <neutron-network-name>dvspg-VCE_VPE-slcp1476vbc</neutron-network-name>
- <interface-role>Internet</interface-role>
- <port-group-name>dvspg-VCE_VPE-slcp1476vbc</port-group-name>
- <resource-version>0000020</resource-version>
- <switch-name>dvs-slcp1-01</switch-name>
- <orchestration-status>created</orchestration-status>
- <heat-stack-id>dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196</heat-stack-id>
- <mso-catalog-key/>
- <cvlan-tags>
- <cvlan-tag-entry>
- <cvlan-tag>3012</cvlan-tag>
- <resource-version>0000020</resource-version>
- </cvlan-tag-entry>
- </cvlan-tags>
- </port-group>
- <port-group>
- <interface-id>slcp1476vbc.ipag</interface-id>
- <neutron-network-id>3477ddb6-b925-4971-ab62-c84b69634c49</neutron-network-id>
- <neutron-network-name>dvspg-IPAG_VCE-slcp1476vbc</neutron-network-name>
- <interface-role>Customer</interface-role>
- <port-group-name>dvspg-IPAG_VCE-slcp1476vbc</port-group-name>
- <switch-name>dvs-slcp1-01</switch-name>
- <resource-version>0000020</resource-version>
- <orchestration-status>created</orchestration-status>
- <heat-stack-id>dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7</heat-stack-id>
- <mso-catalog-key/>
- <cvlan-tags>
- <cvlan-tag-entry>
- <cvlan-tag>2003</cvlan-tag>
- <resource-version>0000020</resource-version>
- </cvlan-tag-entry>
- </cvlan-tags>
- </port-group>
- </port-groups>
- <relationship-list>
- <relationship>
- <related-to>service-instance</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/</related-link>
- <relationship-data>
- <relationship-key>service-instance.service-instance-id</relationship-key>
- <relationship-value>SDNC/VLXM/0112001//SW_INTERNET</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>service-subscription.service-type</relationship-key>
- <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>customer.global-customer-id</relationship-key>
- <relationship-value>011216-1602-SDNC001</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>vserver</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/</related-link>
- <relationship-data>
- <relationship-key>vserver.vserver-id</relationship-key>
- <relationship-value>ecab47d5-3450-4507-ada9-2b3c58485c51</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>3d5f3fe23821416fac2b69af65248c74</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>complex</related-to>
- <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/</related-link>
- <relationship-data>
- <relationship-key>complex.physical-location-id</relationship-key>
- <relationship-value>MDTWNJ21A4</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>availability-zone</related-to>
- <related-link>https://aai-ext1.test..com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/</related-link>
- <relationship-data>
- <relationship-key>availability-zone.availability-zone-name</relationship-key>
- <relationship-value>slcp1-esx-az01</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
+<vce xmlns="http://com.aai.inventory"> + <vnf-id>1936628a-d22f-4943-8587-a57bab2ece7a</vnf-id> + <vnf-name>testVnfName123</vnf-name> + <vnf-name2>US0112SLCP1VBRT076</vnf-name2> + <vnf-type>esx-vce</vnf-type> + <prov-status>NVTPROV</prov-status> + <orchestration-status>created</orchestration-status> + <heat-stack-id>slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d</heat-stack-id> + <mso-catalog-key/> + <vpe-id>VPESAT-mtanjrsv126</vpe-id> + <ipv4-oam-address>135.21.249.160</ipv4-oam-address> + <port-groups> + <port-group> + <interface-id>slcp1476vbc.vpe</interface-id> + <neutron-network-id>e7568706-a2a9-45f8-aef8-95a0e2910953</neutron-network-id> + <neutron-network-name>dvspg-VCE_VPE-slcp1476vbc</neutron-network-name> + <interface-role>Internet</interface-role> + <port-group-name>dvspg-VCE_VPE-slcp1476vbc</port-group-name> + <switch-name>dvs-slcp1-01</switch-name> + <orchestration-status>created</orchestration-status> + <heat-stack-id>dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196</heat-stack-id> + <mso-catalog-key/> + <cvlan-tags> + <cvlan-tag-entry> + <cvlan-tag>3012</cvlan-tag> + </cvlan-tag-entry> + </cvlan-tags> + </port-group> + <port-group> + <interface-id>slcp1476vbc.ipag</interface-id> + <neutron-network-id>3477ddb6-b925-4971-ab62-c84b69634c49</neutron-network-id> + <neutron-network-name>dvspg-IPAG_VCE-slcp1476vbc</neutron-network-name> + <interface-role>Customer</interface-role> + <port-group-name>dvspg-IPAG_VCE-slcp1476vbc</port-group-name> + <switch-name>dvs-slcp1-01</switch-name> + <orchestration-status>created</orchestration-status> + <heat-stack-id>dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7</heat-stack-id> + <mso-catalog-key/> + <cvlan-tags> + <cvlan-tag-entry> + <cvlan-tag>2003</cvlan-tag> + </cvlan-tag-entry> + </cvlan-tags> + </port-group> + </port-groups> + <relationship-list> + <relationship> + <related-to>service-instance</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/</related-link> + <relationship-data> + <relationship-key>service-instance.service-instance-id</relationship-key> + <relationship-value>SDNC/VLXM/0112001//SW_INTERNET</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>service-subscription.service-type</relationship-key> + <relationship-value>SDN-ETHERNET-INTERNET</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>customer.global-customer-id</relationship-key> + <relationship-value>011216-1602-SDNC001</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>vserver</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/</related-link> + <relationship-data> + <relationship-key>vserver.vserver-id</relationship-key> + <relationship-value>ecab47d5-3450-4507-ada9-2b3c58485c51</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>3d5f3fe23821416fac2b69af65248c74</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>complex</related-to> + <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/</related-link> + <relationship-data> + <relationship-key>complex.physical-location-id</relationship-key> + <relationship-value>MDTWNJ21A4</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>availability-zone</related-to> + <related-link>https://aai-ext1.test..com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/</related-link> + <relationship-data> + <relationship-key>availability-zone.availability-zone-name</relationship-key> + <relationship-value>slcp1-esx-az01</relationship-value> + </relationship-data> + </relationship> + </relationship-list> </vce>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json new file mode 100644 index 0000000000..83a5478668 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterRestV1/sdnc_request.json @@ -0,0 +1,21 @@ +{ + "SDNCServiceRequest": { + "requestInformation": { + "requestId": "0d883b7f-dd34-4e1b-9ed5-341d33052360", + "source": "MSO", + "notificationUrl": "null" + }, + "serviceInformation": { + "serviceType": "vRRaaS", + "serviceInstanceId": "5dad9aac-6e05-4bdb-a8ec-4f3cd718c5c6", + "subscriberName": "MSO-MUX-User", + "subscriberGlobalId": "MSO-MUX-User" + }, + "bpNotificationUrl": "http://localhost:18080/mso/WorkflowMessage/SDNCAResponse/0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479", + "sdncRequestId": "0d883b7f-dd34-4e1b-9ed5-341d33052360-1511808197479", + "sdncService": "infra", + "sdncOperation": "service-topology-infra-assign-operation", + "sdncServiceDataType": "XML", + "sdncServiceData": "<infra-assign-information> <vnf-host-name>vRR-Internal-Network-L2</vnf-host-name> <aic-clli>MTJWNJA4LCP</aic-clli> <cloud-region-id>RegionOne</cloud-region-id> <tenant>22eb191dd41a4f3c9be370fc638322f4</tenant> <vnf-id>6d2e2469-8708-47c3-a0d4-73fa28a8a50b</vnf-id> <vnf-license-information> <vnf-license-details> <service-provider-part-number>no</service-provider-part-number> </vnf-license-details> </vnf-license-information> <service-ecomp-model-information> <model-invariant-uuid>d6c7c582-cf7f-4542-a19e-5fa7e7d89bf2</model-invariant-uuid> <model-version>1.0</model-version> <model-name>vRR_AIC30_1702-0505-SRVS</model-name> <model-uuid>5add3a0f-5379-4800-b87a-430ff45f8793</model-uuid> </service-ecomp-model-information> <vnf-ecomp-model-information> <model-invariant-uuid>532ff79f-fbe8-4c88-aecf-4fe885b93b47</model-invariant-uuid> <vnf-model-customization-uuid>87056771-4d7c-47d0-b5df-6cf02e227458</vnf-model-customization-uuid> <model-version>1.0</model-version> <model-name>vRR_AIC30_1702-0505-VSP</model-name> <model-uuid>978ac869-b506-41d0-9125-9d0e95097c29</model-uuid> </vnf-ecomp-model-information> <vf-module-ecomp-model-information> <model-invariant-uuid>4e5868c5-8321-492b-882f-e4476c878746</model-invariant-uuid> <vf-module-model-customization-uuid-list> <vf-module-model-customization-uuid>2badc305-b2c0-4e2b-b03a-4e5d22079b30</vf-module-model-customization-uuid> </vf-module-model-customization-uuid-list> <vf-module-model-customization-uuid-list> <vf-module-model-customization-uuid>2badc305-b2c0-4e2b-b03a-4e5d22079b31</vf-module-model-customization-uuid> </vf-module-model-customization-uuid-list> <model-uuid>e1b1819f-a9d1-4c27-b419-d98a2500fc47</model-uuid> <model-version>1</model-version> <model-name>Vrr_Internal_Networks_module-1</model-name> </vf-module-ecomp-model-information> </infra-assign-information>" + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml index f71f529593..8cbcce138f 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp/mso/workflow/schema/v1" - xmlns:v11="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:v1="http://org.onap/so/workflow/schema/v1" + xmlns:v11="http://org.onap/workflow/sdnc/adapter/schema/v1"> <soapenv:Header/> <soapenv:Body> <v1:SDNCAdapterWorkflowRequest> @@ -13,7 +13,7 @@ </v11:RequestHeader> <v1:SDNCRequestData> <rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" contentType="text/xml"> - <tag0:service-request xmlns:tag0="http://org.openecomp/mso/request/details/schema/v1"> + <tag0:service-request xmlns:tag0="http://org.onap/so/request/details/schema/v1"> <tag0:request-information> <tag0:request-id>12570a36-7388-4c0a-bec4-189ce3kg9956</tag0:request-id> <tag0:request-action>GetLayer3ServiceDetailsRequest</tag0:request-action> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml index 3d1e03916d..1d707a6cc5 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml @@ -1,350 +1,350 @@ -<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:v1="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <soapenv:Header />
- <soapenv:Body>
- <v1:SDNCAdapterCallback>
-<SDNCAdapterCallbackRequest xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <CallbackHeader>
- <RequestId>testRequestId</RequestId>
- <ResponseCode>200</ResponseCode>
- <ResponseMessage>OK</ResponseMessage>
- </CallbackHeader>
- <RequestData xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <layer3-service-list xmlns="com:att:sdnctl:l3api">
- <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
- <service-status>
- <rpc-name>service-configuration-operation</rpc-name>
- <rpc-action>activate</rpc-action>
- <request-status>synccomplete</request-status>
- <final-indicator>N</final-indicator>
- <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action>
- <l3sdn-subaction>SUPP</l3sdn-subaction>
- <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp>
- </service-status>
- <service-data>
- <internet-evc-access-information>
- <ip-version>ds</ip-version>
- <internet-evc-speed-value>8</internet-evc-speed-value>
- <internet-evc-speed-units>Mbps</internet-evc-speed-units>
- </internet-evc-access-information>
- <vr-lan xmlns="com:att:sdnctl:l3api">
- <vr-lan-interface>
- <static-routes>
- <v6-static-routes>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
- <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
- </v6-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- <v6-static-routes>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
- <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
- </v6-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- </static-routes>
- <dhcp>
- <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled>
- <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled>
- <use-v6-default-pool>N</use-v6-default-pool>
- <excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-address>192.168.1.7</excluded-v4-address>
- </excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-address>192.168.1.8</excluded-v4-address>
- </excluded-v4-dhcp-addresses-from-default-pool>
- <v4-dhcp-pools>
- <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address>
- <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.5</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.6</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix>
- </v4-dhcp-pools>
- <v4-dhcp-pools>
- <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address>
- <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.6</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.7</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix>
- </v4-dhcp-pools>
- <use-v4-default-pool>Y</use-v4-default-pool>
- <excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-address>1:5</excluded-v6-address>
- </excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-address>1:6</excluded-v6-address>
- </excluded-v6-dhcp-addresses-from-default-pool>
- <v6-dhcp-pools>
- <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
- <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
- <excluded-v6-addresses>
- <excluded-v6-address>1:1</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
- <excluded-v6-addresses>
- <excluded-v6-address>2:2</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
- </v6-dhcp-pools>
- <v6-dhcp-pools>
- <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
- <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
- <excluded-v6-addresses>
- <excluded-v6-address>1:1</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
- <excluded-v6-addresses>
- <excluded-v6-address>2:2</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
- </v6-dhcp-pools>
- </dhcp>
- <firewall-lite>
- <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled>
- <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled>
- <v4-firewall-packet-filters>
- <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix>
- <v4-firewall-prefix-length>1</v4-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>1</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>1</port-number>
- </tcp-ports>
- </v4-firewall-packet-filters>
- <v4-firewall-packet-filters>
- <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix>
- <v4-firewall-prefix-length>2</v4-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>2</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>2</port-number>
- </tcp-ports>
- </v4-firewall-packet-filters>
- <v6-firewall-packet-filters>
- <v6-firewall-prefix>:</v6-firewall-prefix>
- <v6-firewall-prefix-length>0</v6-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>3</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>3</port-number>
- </tcp-ports>
- </v6-firewall-packet-filters>
- <v6-firewall-packet-filters>
- <v6-firewall-prefix>:</v6-firewall-prefix>
- <v6-firewall-prefix-length>1</v6-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>4</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>4</port-number>
- </tcp-ports>
- </v6-firewall-packet-filters>
- </firewall-lite>
- <pat>
- <v4-pat-pools>
- <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix>
- <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address>
- <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length>
- </v4-pat-pools>
- <use-v4-default-pool>Y</use-v4-default-pool>
- <v4-pat-enabled>N</v4-pat-enabled>
- <v4-pat-pools>
- <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix>
- <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address>
- <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length>
- </v4-pat-pools>
- </pat>
- <nat>
- <v4-nat-enabled>Y</v4-nat-enabled>
- <v4-nat-mapping-entries>
- <v4-nat-internal>0.0.0.0</v4-nat-internal>
- <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address>
- <v4-nat-external>0.0.0.0</v4-nat-external>
- </v4-nat-mapping-entries>
- <v4-nat-mapping-entries>
- <v4-nat-internal>0.0.0.1</v4-nat-internal>
- <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address>
- <v4-nat-external>0.0.0.1</v4-nat-external>
- </v4-nat-mapping-entries>
- </nat>
- <vr-designation>primary</vr-designation>
- <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address>
- <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length>
- <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address>
- <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix>
- <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length>
- <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix>
- <v4-public-lan-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.2</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.72</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.68</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- </v4-public-lan-prefixes>
- <v6-public-lan-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- </v6-public-lan-prefixes>
- </vr-lan-interface>
- <routing-protocol>none</routing-protocol>
- </vr-lan>
-<ucpe-vms-service-information>
- <transport-service-information>
- <transport-service-type>AVPN</transport-service-type>
- <access-circuit-info>
- <access-circuit-id>1</access-circuit-id>
- <dual-mode>Active</dual-mode>
- </access-circuit-info>
- <access-circuit-info>
- <access-circuit-id>2</access-circuit-id>
- <dual-mode>Standby</dual-mode>
- </access-circuit-info>
- </transport-service-information>
- <ucpe-information>
- <ucpe-host-name>hostname</ucpe-host-name>
- <ucpe-activation-code>activecode</ucpe-activation-code>
- <out-of-band-management-modem>OOB</out-of-band-management-modem>
- </ucpe-information>
- <vnf-list>
- <vnf-information>
- <vnf-instance-id>1</vnf-instance-id>
- <vnf-sequence-number>1</vnf-sequence-number>
- <vnf-type>ZZ</vnf-type>
- <vnf-vendor>JUNIPER</vnf-vendor>
- <vnf-model>MODEL1</vnf-model>
- <vnf-id>1</vnf-id>
- <prov-status>1</prov-status>
- <operational-state>1</operational-state>
- <orchestration-status>1</orchestration-status>
- <equipment-role>1</equipment-role>
- </vnf-information>
- <vnf-information>
- <vnf-instance-id>2</vnf-instance-id>
- <vnf-sequence-number>2</vnf-sequence-number>
- <vnf-type>HY</vnf-type>
- <vnf-vendor>JUNIPER</vnf-vendor>
- <vnf-model>MODEL2</vnf-model>
- <vnf-id>2</vnf-id>
- <prov-status>2</prov-status>
- <operational-state>2</operational-state>
- <orchestration-status>2</orchestration-status>
- <equipment-role>2</equipment-role>
- </vnf-information>
- </vnf-list>
- </ucpe-vms-service-information>
- <request-information>
- <request-action>Layer3ServiceActivateRequest</request-action>
- <order-number>4281555</order-number>
- <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id>
- <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url>
- <source>OMX</source>
- <order-version>1</order-version>
- </request-information>
- <sdnc-request-header>
- <svc-action>activate</svc-action>
- <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify</svc-notification-url>
- <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id>
- </sdnc-request-header>
- <l2-homing-information>
- <topology>MultiPoint</topology>
- <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli>
- <evc-name>AS/VLXM/003717//SW</evc-name>
- </l2-homing-information>
- <service-information>
- <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
- <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name>
- <service-type>SDN-ETHERNET-INTERNET</service-type>
- </service-information>
- <internet-service-change-details>
- <internet-evc-speed-value>10</internet-evc-speed-value>
- <internet-evc-speed-units>Kbps</internet-evc-speed-units>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>2</request-index>
- <v4-next-hop-address>192.168.1.16</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- </internet-service-change-details>
- </service-data>
- </layer3-service-list>
-</RequestData>
-</SDNCAdapterCallbackRequest>
-</v1:SDNCAdapterCallback>
-</soapenv:Body>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <soapenv:Header /> + <soapenv:Body> + <v1:SDNCAdapterCallback> +<SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <CallbackHeader> + <RequestId>testRequestId</RequestId> + <ResponseCode>200</ResponseCode> + <ResponseMessage>OK</ResponseMessage> + </CallbackHeader> + <RequestData xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> +</RequestData> +</SDNCAdapterCallbackRequest> +</v1:SDNCAdapterCallback> +</soapenv:Body> </soapenv:Envelope>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDNCAdapterRestV2Request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDNCAdapterRestV2Request.json index 68af27db9f..ccb9587d04 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDNCAdapterRestV2Request.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDNCAdapterRestV2Request.json @@ -1,21 +1,21 @@ -{
- "SDNCServiceRequest": {
- "bpNotificationUrl": "http://localhost:28080/mso/WorkflowMesssage/SDNCAResponse/a4383a52-b9de-4bc4-bedf-02f3f9466535-1510232328526",
- "sdncRequestId": "a4383a52-b9de-4bc4-bedf-02f3f9466535-1510232328526",
- "requestInformation": {
- "requestId": "a4383a52-b9de-4bc4-bedf-02f3f9466535",
- "source": "CCD",
- "notificationUrl": "http://localhost:28090/CCD/StatusNotification"
- },
- "serviceInformation": {
- "serviceType": "vWanX",
- "serviceInstanceId": "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5",
- "subscriberName": "Monster Joe's Truck & Tow",
- "subscriberGlobalId": "8310000058863"
- },
- "sdncService": "ucpe-vnf",
- "sdncOperation": "service-topology-cust-assign-operation",
- "sdncServiceDataType": "XML",
- "sdncServiceData": "<ucpe-vnf-assign-service-information><access-circuit-information><access-circuit-id>BT/SLIR/70901</access-circuit-id></access-circuit-information><access-circuit-information><access-circuit-id>AS/KRFN/34601</access-circuit-id></access-circuit-information><vnf-information><vnf-host-name>USOSTCDALTX0101VFWX01</vnf-host-name><ucpe-host-name>USOSTCDALTX0101UJZZ11</ucpe-host-name><vnf-type>WX</vnf-type><vnf-att-part-number>WX-VM00*</vnf-att-part-number><vnf-version-number>1.0.2</vnf-version-number><vnf-management-option>ATT</vnf-management-option><vnf-alternative-ownership>ATT-VENDOR-OWNED</vnf-alternative-ownership></vnf-information></ucpe-vnf-assign-service-information>"
- }
+{ + "SDNCServiceRequest": { + "bpNotificationUrl": "http://localhost:28080/mso/WorkflowMesssage/SDNCAResponse/a4383a52-b9de-4bc4-bedf-02f3f9466535-1510232328526", + "sdncRequestId": "a4383a52-b9de-4bc4-bedf-02f3f9466535-1510232328526", + "requestInformation": { + "requestId": "a4383a52-b9de-4bc4-bedf-02f3f9466535", + "source": "CCD", + "notificationUrl": "http://localhost:28090/CCD/StatusNotification" + }, + "serviceInformation": { + "serviceType": "vWanX", + "serviceInstanceId": "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5", + "subscriberName": "Monster Joe's Truck & Tow", + "subscriberGlobalId": "8310000058863" + }, + "sdncService": "ucpe-vnf", + "sdncOperation": "service-topology-cust-assign-operation", + "sdncServiceDataType": "XML", + "sdncServiceData": "<ucpe-vnf-assign-service-information><access-circuit-information><access-circuit-id>BT/SLIR/70901</access-circuit-id></access-circuit-information><access-circuit-information><access-circuit-id>AS/KRFN/34601</access-circuit-id></access-circuit-information><vnf-information><vnf-host-name>USOSTCDALTX0101VFWX01</vnf-host-name><ucpe-host-name>USOSTCDALTX0101UJZZ11</ucpe-host-name><vnf-type>WX</vnf-type><vnf-att-part-number>WX-VM00*</vnf-att-part-number><vnf-version-number>1.0.2</vnf-version-number><vnf-management-option>ATT</vnf-management-option><vnf-alternative-ownership>ATT-VENDOR-OWNED</vnf-alternative-ownership></vnf-information></ucpe-vnf-assign-service-information>" + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Schemas/CreateServiceInstanceV3Schema.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/Schemas/CreateServiceInstanceV3Schema.json new file mode 100644 index 0000000000..36b51e9575 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Schemas/CreateServiceInstanceV3Schema.json @@ -0,0 +1,16 @@ +{ + "CreateServiceInstanceV3": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "project": { + "@class": "inventory.aai.onap.org.v12.Project" + }, + "owningEntity": { + "@class": "inventory.aai.onap.org.v12.OwningEntity" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SetupServiceDecompJson.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/SetupServiceDecompJson.json new file mode 100644 index 0000000000..a6efe9663f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SetupServiceDecompJson.json @@ -0,0 +1,36 @@ +{ + "requestDetails": { + "serviceInstance": { + "serviceInstanceId": "MSORefactorTest2", + "serviceInstanceName": "bensServiceInstance2", + "serviceType": "MSO-dev-service-type", + "serviceRole": "abc", + "modelInvariantUuid": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelUuid": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "environmentContext": "Luna", + "workloadContext": "Oxygen", + "orchestrationStatus": "ACTIVE" + }, + "project": { + "projectName": "MSORefactorTest1234" + }, + "owningEntity": { + "owningEntityId": "MSORefactorTestId1234", + "owningEntityName": "MSORefactorTest1234" + }, + "customer": { + "subscriptionServiceType": "MSO-dev-service-type", + "globalSubscriberId": "MSO_1610_dev" + }, + "request": { + "sdncRequestId": "736c7370-640b-4f7a-975d-320f73340dd3", + "callbackURL": "abc", + "requestId": "223c2e74-a23a-4ab8-bddb-2c2431dcb67f", + "productFamilyId": "abc", + "callbackUrl": "http://localhost:8080/adapters/rest/SDNCNotify", + "serviceId": "123" + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/StandardSDNCSynchResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/StandardSDNCSynchResponse.xml index 919ff2c36b..77528ccf61 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/StandardSDNCSynchResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/StandardSDNCSynchResponse.xml @@ -1,5 +1,5 @@ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> - <SDNCAdapterResponse xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"/> + <SDNCAdapterResponse xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"/> </soap:Body> </soap:Envelope>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml index 07730e2df9..02996a13ea 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml @@ -42,14 +42,14 @@ org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) - org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35) + org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35) </pre> </p> <p> <b>JBWEB000071: root cause</b> <pre>java.lang.NullPointerException - org.openecomp.mso.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128) - org.openecomp.mso.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64) + org.onap.so.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128) + org.onap.so.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) @@ -65,7 +65,7 @@ org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) - org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35) + org.onap.so.logger.LogFilter.doFilter(LogFilter.java:35) </pre> </p> <p> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml index 7a00744103..0faec794b0 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml @@ -1,4 +1,4 @@ -<ns2:updateNetworkContrailResponse xmlns:ns2="http://org.openecomp.mso/network" +<ns2:updateNetworkContrailResponse xmlns:ns2="http://org.onap.so/network" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <networkId>MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641</networkId> <neutronNetworkId>c4f4e878-cde0-4b15-ae9a-bda857759cea</neutronNetworkId> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml index 09f01fb7ca..ca5145c226 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml @@ -1,4 +1,4 @@ -<result-data>
- <resource-type>service-instance</resource-type>
- <resource-link>https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4</resource-link>
+<result-data> + <resource-type>service-instance</resource-type> + <resource-link>https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4</resource-link> </result-data>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml index 196558633b..99ea5bace6 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml @@ -1,73 +1,73 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<l3-network xmlns="http://com.aai.inventory/v8">
- <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id>
- <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
- <network-type>CONTRAIL_EXTERNAL</network-type>
- <network-role>dmz_direct</network-role>
- <network-technology>contrail</network-technology>
- <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
- <network-role-instance>0</network-role-instance>
- <orchestration-status>pending-create</orchestration-status>
- <physical-network-name>networkName</physical-network-name>
- <is-provider-network>false</is-provider-network>
- <is-shared-network>true</is-shared-network>
- <is-external-network>false</is-external-network>
- <subnets>
- <subnet>
- <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id>
- <gateway-address>107.239.52.1</gateway-address>
- <network-start-address>107.239.52.0</network-start-address>
- <cidr-mask>24</cidr-mask>
- <ip-version>4</ip-version>
- <orchestration-status>pending-create</orchestration-status>
- <dhcp-enabled>true</dhcp-enabled>
- <subnet-name>subnetName</subnet-name>
- <relationship-list/>
- </subnet>
- </subnets>
- <segmentation-assignments>
- <segmentation-id>413</segmentation-id>
- <resource-version>4132176</resource-version>
- </segmentation-assignments>
- <relationship-list>
- <relationship>
- <related-to>vpn-binding</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link>
- <relationship-data>
- <relationship-key>vpn-binding.vpn-id</relationship-key>
- <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>vpn-binding</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/</related-link>
- <relationship-data>
- <relationship-key>vpn-binding.vpn-id</relationship-key>
- <relationship-value>c980a6ef-3b88-49f0-9751-dbad8608d0a6</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>tenant</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>network-policy</related-to>
- <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg</related-link>
- <relationship-data>
- <relationship-key>network-policy.network-policy-id</relationship-key>
- <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0cg</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>route-table-reference</related-to>
- <relationship-data>
- <relationship-key>route-table-reference.route-table-reference-id</relationship-key>
- <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
-</l3-network>
+<?xml version="1.0" encoding="UTF-8"?> +<l3-network xmlns="http://com.aai.inventory/v8"> + <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> + <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> + <network-type>CONTRAIL_EXTERNAL</network-type> + <network-role>dmz_direct</network-role> + <network-technology>contrail</network-technology> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + <network-role-instance>0</network-role-instance> + <orchestration-status>pending-create</orchestration-status> + <physical-network-name>networkName</physical-network-name> + <is-provider-network>false</is-provider-network> + <is-shared-network>true</is-shared-network> + <is-external-network>false</is-external-network> + <subnets> + <subnet> + <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> + <gateway-address>107.239.52.1</gateway-address> + <network-start-address>107.239.52.0</network-start-address> + <cidr-mask>24</cidr-mask> + <ip-version>4</ip-version> + <orchestration-status>pending-create</orchestration-status> + <dhcp-enabled>true</dhcp-enabled> + <subnet-name>subnetName</subnet-name> + <relationship-list/> + </subnet> + </subnets> + <segmentation-assignments> + <segmentation-id>413</segmentation-id> + <resource-version>4132176</resource-version> + </segmentation-assignments> + <relationship-list> + <relationship> + <related-to>vpn-binding</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> + <relationship-data> + <relationship-key>vpn-binding.vpn-id</relationship-key> + <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>vpn-binding</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/</related-link> + <relationship-data> + <relationship-key>vpn-binding.vpn-id</relationship-key> + <relationship-value>c980a6ef-3b88-49f0-9751-dbad8608d0a6</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>tenant</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>network-policy</related-to> + <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg</related-link> + <relationship-data> + <relationship-key>network-policy.network-policy-id</relationship-key> + <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0cg</relationship-value> + </relationship-data> + </relationship> + <relationship> + <related-to>route-table-reference</related-to> + <relationship-data> + <relationship-key>route-table-reference.route-table-reference-id</relationship-key> + <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> + </relationship-data> + </relationship> + </relationship-list> +</l3-network> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml index 48f652cc0e..886c9b4ce2 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml @@ -1,20 +1,20 @@ -<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
- statusCode="200">
- <rest:headers>
- <rest:header name="Transfer-Encoding" value="chunked"/>
- <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/>
- <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
- <rest:header name="X-AAI-TXID"
- value="mtcnjv9aaas01.mtcnj.aic.cip.com-20160314-20:53:33:487-134392"/>
- <rest:header name="Content-Type" value="application/xml"/>
- <rest:header name="Server" value="Apache-Coyote/1.1"/>
- <rest:header name="Cache-Control" value="private"/>
- </rest:headers>
- <rest:payload contentType="text/xml">
- <route-table-references xmlns="http://com.aai.inventory/v8">
- <route-table-reference-id>5938baec-03ca-2bd5-a3f1-d54x123e253a</route-table-reference-id>
- <route-table-reference-fqdn>refFQDN1</route-table-reference-fqdn>
- <resource-version>12345</resource-version>
- </route-table-references>
- </rest:payload>
+<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + statusCode="200"> + <rest:headers> + <rest:header name="Transfer-Encoding" value="chunked"/> + <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/> + <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> + <rest:header name="X-AAI-TXID" + value="localhost-20160314-20:53:33:487-134392"/> + <rest:header name="Content-Type" value="application/xml"/> + <rest:header name="Server" value="Apache-Coyote/1.1"/> + <rest:header name="Cache-Control" value="private"/> + </rest:headers> + <rest:payload contentType="text/xml"> + <route-table-references xmlns="http://com.aai.inventory/v8"> + <route-table-reference-id>5938baec-03ca-2bd5-a3f1-d54x123e253a</route-table-reference-id> + <route-table-reference-fqdn>refFQDN1</route-table-reference-fqdn> + <resource-version>12345</resource-version> + </route-table-references> + </rest:payload> </rest:RESTResponse>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml index c911d320ec..7509fd8625 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml @@ -1,20 +1,20 @@ -<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
- statusCode="200">
- <rest:headers>
- <rest:header name="Transfer-Encoding" value="chunked"/>
- <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/>
- <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
- <rest:header name="X-AAI-TXID"
- value="mtcnjv9aaas01.mtcnj.aic.cip.com-20160314-20:53:33:487-134392"/>
- <rest:header name="Content-Type" value="application/xml"/>
- <rest:header name="Server" value="Apache-Coyote/1.1"/>
- <rest:header name="Cache-Control" value="private"/>
- </rest:headers>
- <rest:payload contentType="text/xml">
- <route-table-references xmlns="http://com.aai.inventory/v8">
- <route-table-reference-id>5938baec-03ca-2bd5-a3f1-d54x123e253a</route-table-reference-id>
- <route-table-reference-fqdn>refFQDN2</route-table-reference-fqdn>
- <resource-version>12345</resource-version>
- </route-table-references>
- </rest:payload>
+<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + statusCode="200"> + <rest:headers> + <rest:header name="Transfer-Encoding" value="chunked"/> + <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/> + <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> + <rest:header name="X-AAI-TXID" + value="localhost-20160314-20:53:33:487-134392"/> + <rest:header name="Content-Type" value="application/xml"/> + <rest:header name="Server" value="Apache-Coyote/1.1"/> + <rest:header name="Cache-Control" value="private"/> + </rest:headers> + <rest:payload contentType="text/xml"> + <route-table-references xmlns="http://com.aai.inventory/v8"> + <route-table-reference-id>5938baec-03ca-2bd5-a3f1-d54x123e253a</route-table-reference-id> + <route-table-reference-fqdn>refFQDN2</route-table-reference-fqdn> + <resource-version>12345</resource-version> + </route-table-references> + </rest:payload> </rest:RESTResponse>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml index 2cf94b2ef2..c9ec2f0a9d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> <soapenv:Header /> <soapenv:Body> <v1:SDNCAdapterCallback> - <SDNCAdapterCallbackRequest xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + <SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> <CallbackHeader> <RequestId>testRequestId</RequestId> <ResponseCode>200</ResponseCode> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml index 40bb93bda0..81e8e2a233 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> <soapenv:Header /> <soapenv:Body> <v1:SDNCAdapterCallback> - <SDNCAdapterCallbackRequest xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + <SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> <CallbackHeader> <RequestId>testRequestId</RequestId> <ResponseCode>200</ResponseCode> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml index d3f9c1eaf3..e2db499929 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml @@ -1,21 +1,21 @@ -<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
- statusCode="200">
- <rest:headers>
- <rest:header name="Transfer-Encoding" value="chunked"/>
- <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/>
- <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
- <rest:header name="X-AAI-TXID"
- value="mtcnjv9aaas01.mtcnj.aic.cip.com-20160314-20:53:33:487-134392"/>
- <rest:header name="Content-Type" value="application/xml"/>
- <rest:header name="Server" value="Apache-Coyote/1.1"/>
- <rest:header name="Cache-Control" value="private"/>
- </rest:headers>
- <rest:payload contentType="text/xml">
- <network-policy xmlns="http://com.aai.inventory/v8">
- <network-policy-id>9a7b327d9-287aa00-82c4b0-105757</network-policy-id>
- <network-policy-fqdn>fqdn123</network-policy-fqdn>
- <heat-stack-id>slowburn</heat-stack-id>
- <resource-version>145878989</resource-version>
- </network-policy>
- </rest:payload>
+<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + statusCode="200"> + <rest:headers> + <rest:header name="Transfer-Encoding" value="chunked"/> + <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/> + <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> + <rest:header name="X-AAI-TXID" + value="localhost-20160314-20:53:33:487-134392"/> + <rest:header name="Content-Type" value="application/xml"/> + <rest:header name="Server" value="Apache-Coyote/1.1"/> + <rest:header name="Cache-Control" value="private"/> + </rest:headers> + <rest:payload contentType="text/xml"> + <network-policy xmlns="http://com.aai.inventory/v8"> + <network-policy-id>9a7b327d9-287aa00-82c4b0-105757</network-policy-id> + <network-policy-fqdn>fqdn123</network-policy-fqdn> + <heat-stack-id>slowburn</heat-stack-id> + <resource-version>145878989</resource-version> + </network-policy> + </rest:payload> </rest:RESTResponse>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml index d041565ac7..5232e530e9 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml @@ -1,4 +1,4 @@ -<vnf-request xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> +<vnf-request xmlns="http://org.onap/so/infra/vnf-request/v1"> <request-info> <request-id>DEV-VF-0011</request-id> <action>UPDATE_VF_MODULE</action> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml index c159e2eae2..c86a4aaa73 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml @@ -1,38 +1,38 @@ -<generic-vnf xmlns="http://com.aai.inventory/v7">
- <vnf-id>skask</vnf-id>
- <vnf-name>STMTN5MMSC20</vnf-name>
- <vnf-type>pcrf-capacity</vnf-type>
- <service-id>SDN-MOBILITY</service-id>
- <equipment-role>vPCRF</equipment-role>
- <orchestration-status>pending-create</orchestration-status>
- <in-maint>false</in-maint>
- <is-closed-loop-disabled>false</is-closed-loop-disabled>
- <persona-model-id>introvert</persona-model-id>
- <persona-model-version>2.0</persona-model-version>
- <resource-version>0000020</resource-version>
- <vf-modules>
- <vf-module>
- <vf-module-id>lukewarm</vf-module-id>
- <vf-module-name>PCRF::module-0-0</vf-module-name>
- <persona-model-id>introvert</persona-model-id>
- <persona-model-version>2.0</persona-model-version>
- <is-base-vf-module>true</is-base-vf-module>
- <heat-stack-id>fastburn</heat-stack-id>
- <orchestration-status>pending-create</orchestration-status>
- <resource-version>0000074</resource-version>
- </vf-module>
- <vf-module>
- <vf-module-id>supercool</vf-module-id>
- <vf-module-name>PCRF::module-1-0</vf-module-name>
- <persona-model-id>extrovert</persona-model-id>
- <persona-model-version>2.0</persona-model-version>
- <is-base-vf-module>false</is-base-vf-module>
- <heat-stack-id>slowburn</heat-stack-id>
- <orchestration-status>pending-create</orchestration-status>
- <resource-version>0000075</resource-version>
- </vf-module>
- </vf-modules>
- <relationship-list/>
- <l-interfaces/>
- <lag-interfaces/>
-</generic-vnf>
+<generic-vnf xmlns="http://com.aai.inventory/v7"> + <vnf-id>skask</vnf-id> + <vnf-name>STMTN5MMSC20</vnf-name> + <vnf-type>pcrf-capacity</vnf-type> + <service-id>SDN-MOBILITY</service-id> + <equipment-role>vPCRF</equipment-role> + <orchestration-status>pending-create</orchestration-status> + <in-maint>false</in-maint> + <is-closed-loop-disabled>false</is-closed-loop-disabled> + <persona-model-id>introvert</persona-model-id> + <persona-model-version>2.0</persona-model-version> + <resource-version>0000020</resource-version> + <vf-modules> + <vf-module> + <vf-module-id>lukewarm</vf-module-id> + <vf-module-name>PCRF::module-0-0</vf-module-name> + <persona-model-id>introvert</persona-model-id> + <persona-model-version>2.0</persona-model-version> + <is-base-vf-module>true</is-base-vf-module> + <heat-stack-id>fastburn</heat-stack-id> + <orchestration-status>pending-create</orchestration-status> + <resource-version>0000074</resource-version> + </vf-module> + <vf-module> + <vf-module-id>supercool</vf-module-id> + <vf-module-name>PCRF::module-1-0</vf-module-name> + <persona-model-id>extrovert</persona-model-id> + <persona-model-version>2.0</persona-model-version> + <is-base-vf-module>false</is-base-vf-module> + <heat-stack-id>slowburn</heat-stack-id> + <orchestration-status>pending-create</orchestration-status> + <resource-version>0000075</resource-version> + </vf-module> + </vf-modules> + <relationship-list/> + <l-interfaces/> + <lag-interfaces/> +</generic-vnf> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml index 94e00427a2..f40b6bc991 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml @@ -1,21 +1,21 @@ -<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
- statusCode="200">
- <rest:headers>
- <rest:header name="Transfer-Encoding" value="chunked"/>
- <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/>
- <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
- <rest:header name="X-AAI-TXID"
- value="mtcnjv9aaas01.mtcnj.aic.cip.com-20160314-20:53:33:487-134392"/>
- <rest:header name="Content-Type" value="application/xml"/>
- <rest:header name="Server" value="Apache-Coyote/1.1"/>
- <rest:header name="Cache-Control" value="private"/>
- </rest:headers>
- <rest:payload contentType="text/xml">
- <network-policy xmlns="http://com.aai.inventory/v8">
- <network-policy-id>9a7b327d9-287aa00-82c4b0-105757</network-policy-id>
- <network-policy-fqdn>GN_EVPN_Test</network-policy-fqdn>
- <heat-stack-id>195159195</heat-stack-id>
- <resource-version>14567890</resource-version>
- </network-policy>
- </rest:payload>
+<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + statusCode="200"> + <rest:headers> + <rest:header name="Transfer-Encoding" value="chunked"/> + <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/> + <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> + <rest:header name="X-AAI-TXID" + value="localhost-20160314-20:53:33:487-134392"/> + <rest:header name="Content-Type" value="application/xml"/> + <rest:header name="Server" value="Apache-Coyote/1.1"/> + <rest:header name="Cache-Control" value="private"/> + </rest:headers> + <rest:payload contentType="text/xml"> + <network-policy xmlns="http://com.aai.inventory/v8"> + <network-policy-id>9a7b327d9-287aa00-82c4b0-105757</network-policy-id> + <network-policy-fqdn>GN_EVPN_Test</network-policy-fqdn> + <heat-stack-id>195159195</heat-stack-id> + <resource-version>14567890</resource-version> + </network-policy> + </rest:payload> </rest:RESTResponse>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml index 7c67095af1..dbd55b0cf4 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml @@ -1,315 +1,315 @@ -<output xmlns="com:att:sdnctl:vnf">
-<vnf-list xmlns="com:att:sdnctl:vnf">
- <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id>
- <service-data>
- <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id>
- <sdnc-request-header>
- <svc-request-id>9ddf628a-9eca-430e-8974-22d520a31be1</svc-request-id>
- <svc-action>assign</svc-action>
- <svc-notification-url>https://msojra.infra.aic.net:8443/adapters/rest/SDNCNotify</svc-notification-url>
- </sdnc-request-header>
- <service-information>
- <subscriber-name>notsurewecare</subscriber-name>
- <service-instance-id>bd1b3789-6474-4935-94b2-90b656e035d0</service-instance-id>
- <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type>
- <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
- </service-information>
- <oper-status>
- <order-status>PendingCreate</order-status>
- </oper-status>
- <vnf-request-information>
- <aic-cloud-region>VNN1CA52LCP</aic-cloud-region>
- <vnf-name>ZVNNMOGX01_base</vnf-name>
- <generic-vnf-id>afd0f02a-1ddb-43bb-aded-5113e46e82ae</generic-vnf-id>
- <generic-vnf-type>ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1</generic-vnf-type>
- <generic-vnf-name>ZVNN1MOGX01</generic-vnf-name>
- <tenant>33d209df14ac4c08ad60747185d2f3e0</tenant>
- <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id>
- <vnf-type>ZVNN1MOGX01 - VF AUG 1::module-0</vnf-type>
- </vnf-request-information>
- <vnf-topology-information>
- <vnf-assignments>
- <vnf-networks>
- <network-role>mog_exn</network-role>
- <network-id>03dbd833-785c-40c0-bf32-37594b5334bc</network-id>
- <network-name>MNS-25180-P-VNNYCA01_exn_protected_net_1</network-name>
- <contrail-network-fqdn/>
- <subnet-id/>
- <neutron-id>6f82d234-41a4-48e9-a9e8-415667a72929</neutron-id>
- <sriov-vlan-filter-list>
- <sriov-vlan-filter>filter1</sriov-vlan-filter>
- </sriov-vlan-filter-list>
- <sriov-vlan-filter-list>
- <sriov-vlan-filter>filter2</sriov-vlan-filter>
- </sriov-vlan-filter-list>
- </vnf-networks>
- <vnf-networks>
- <network-role>mog_oam</network-role>
- <network-id>3f181cde-9380-4c20-9d3a-e1a4ee74f994</network-id>
- <network-name>MNS-25180-P-VNNYCA01_oam_protected_net_1</network-name>
- <contrail-network-fqdn/>
- <subnet-id/>
- <neutron-id>713b6770-13fa-4949-8dbb-a1288c5e5932</neutron-id>
- </vnf-networks>
- <vnf-networks>
- <network-role>mog_cor_B</network-role>
- <network-id>821a550a-3f50-4725-995b-f212d5caec7c</network-id>
- <network-name>MNS-25180-P-VNNYCA01_cor_direct_net_1</network-name>
- <contrail-network-fqdn/>
- <subnet-id/>
- <neutron-id>18926e56-12b6-4a4d-98b6-37e0c05626ee</neutron-id>
- </vnf-networks>
- <vnf-networks>
- <network-role>mog_cor_A</network-role>
- <network-id>3dabf5c0-cffb-420c-8960-8499c74eb25f</network-id>
- <network-name>MNS-25180-P-VNNYCA01_cor_direct_net_2</network-name>
- <contrail-network-fqdn/>
- <subnet-id/>
- <neutron-id>35530b29-a4de-48ff-a014-111110ccc652</neutron-id>
- </vnf-networks>
- <vnf-networks>
- <network-role>mog_gn</network-role>
- <network-id>3ce97321-6e7f-49af-bd12-f833e377c310</network-id>
- <network-name>MNS-25180-P-VNNYCA01_gn_direct_net_1</network-name>
- <contrail-network-fqdn/>
- <subnet-id/>
- <neutron-id>32bfdd2c-28e1-4895-87a6-373bf12c3129</neutron-id>
- </vnf-networks>
- <vnf-networks>
- <network-role>mog_dmz</network-role>
- <network-id>d43ca910-02a5-47dc-8510-100a68a3c9e0</network-id>
- <network-name>MNS-25180-P-VNNYCA01_dmz_protected_net_1</network-name>
- <contrail-network-fqdn/>
- <subnet-id/>
- <neutron-id>cb9500fb-943f-412e-aea6-458711564a75</neutron-id>
- </vnf-networks>
- <availability-zones>
- <availability-zone>nova</availability-zone>
- </availability-zones>
- <vnf-vms>
- <vm-type>ps</vm-type>
- <vm-names>
- <vm-name>ZVNN1MOGX01MPS001</vm-name>
- </vm-names>
- <vm-names>
- <vm-name>ZVNN1MOGX01MPS002</vm-name>
- </vm-names>
- <vm-names>
- <vm-name>ZVNN1MOGX01MPS003</vm-name>
- </vm-names>
- <vm-names>
- <vm-name>ZVNN1MOGX01MPS004</vm-name>
- </vm-names>
- <vm-count>4</vm-count>
- <vm-networks>
- <network-role>mog_cor_B</network-role>
- <network-ips>
- <ip-address>107.224.36.251</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.36.252</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.36.253</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.36.254</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- </vm-networks>
- </vnf-vms>
- <vnf-vms>
- <vm-type>cm</vm-type>
- <vm-names>
- <vm-name>ZVNN1MOGX01MCM001</vm-name>
- </vm-names>
- <vm-names>
- <vm-name>ZVNN1MOGX01OAM002</vm-name>
- </vm-names>
- <vm-count>1</vm-count>
- <vm-networks>
- <network-role>mog_cor_B</network-role>
- <network-ips>
- <ip-address>107.224.36.249</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.36.250</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- </vm-networks>
- <vm-networks>
- <network-role>mog_oam</network-role>
- <network-ips>
- <ip-address>107.239.167.250</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.239.167.251</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- </vm-networks>
- </vnf-vms>
- <vnf-vms>
- <vm-type>oam</vm-type>
- <vm-names>
- <vm-name>ZVNN1MOGX01OAM001</vm-name>
- </vm-names>
- <vm-names>
- <vm-name>ZVNN1MOGX01OAM002</vm-name>
- </vm-names>
- <vm-count>2</vm-count>
- <vm-networks>
- <network-role>mog_oam</network-role>
- <network-ips>
- <ip-address>107.239.167.252</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.239.167.251</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- </vm-networks>
- <vm-networks>
- <network-role>mog_cor_B</network-role>
- <network-ips>
- <ip-address>107.224.36.249</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.36.250</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- </vm-networks>
- </vnf-vms>
- <vnf-vms>
- <vm-type>pd</vm-type>
- <vm-names>
- <vm-name>ZVNN1MOGX01MPD001</vm-name>
- </vm-names>
- <vm-names>
- <vm-name>ZVNN1MOGX01MPD002</vm-name>
- </vm-names>
- <vm-count>2</vm-count>
- <vm-networks>
- <network-role>mog_dmz</network-role>
- <network-ips>
- <ip-address>107.225.25.253</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.225.25.254</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- <floating-ip>107.225.254.253</floating-ip>
- </vm-networks>
- <vm-networks>
- <network-role>mog_oam</network-role>
- <network-ips>
- <ip-address>107.239.167.254</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.239.167.253</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- <floating-ip>107.239.167.249</floating-ip>
- </vm-networks>
- <vm-networks>
- <network-role>mog_exn</network-role>
- <network-ips>
- <ip-address>107.224.46.253</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.46.254</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- <floating-ip>107.224.46.252</floating-ip>
- </vm-networks>
- <vm-networks>
- <network-role>mog_cor_B</network-role>
- <network-ips>
- <ip-address>107.224.36.247</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.36.248</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- <floating-ip>107.224.41.252</floating-ip>
- </vm-networks>
- <vm-networks>
- <network-role>mog_gn</network-role>
- <network-ips>
- <ip-address>107.224.41.253</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.41.254</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- <floating-ip>107.224.41.252</floating-ip>
- </vm-networks>
- <vm-networks>
- <network-role>mog_cor_A</network-role>
- <network-ips>
- <ip-address>107.224.38.253</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.38.254</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- </vm-networks>
- </vnf-vms>
- <vnf-vms>
- <vm-type>sm</vm-type>
- <vm-names>
- <vm-name>ZVNN1MOGX01MSM001</vm-name>
- </vm-names>
- <vm-names>
- <vm-name>ZVNN1MOGX01MSM002</vm-name>
- </vm-names>
- <vm-names>
- <vm-name>ZVNN1MOGX01MSM003</vm-name>
- </vm-names>
- <vm-names>
- <vm-name>ZVNN1MOGX01MSM004</vm-name>
- </vm-names>
- <vm-count>4</vm-count>
- <vm-networks>
- <network-role>mog_cor_B</network-role>
- <network-ips>
- <ip-address>107.224.36.243</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.36.244</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.36.245</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.36.246</ip-address>
- </network-ips>
- <use-dhcp>N</use-dhcp>
- </vm-networks>
- </vnf-vms>
- </vnf-assignments>
- <vnf-topology-identifier>
- <vnf-name>ZVNNMOGX01_base</vnf-name>
- <service-type>SDN-MOBILITY</service-type>
- <vnf-type>ZVNN1MOGX01 - VF AUG 1::module-0</vnf-type>
- <generic-vnf-type>ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1</generic-vnf-type>
- <generic-vnf-name>ZVNN1MOGX01</generic-vnf-name>
- </vnf-topology-identifier>
- </vnf-topology-information>
- <request-information>
- <request-id>9ddf628a-9eca-430e-8974-22d520a31be1</request-id>
- <notification-url/>
- <source>PORTAL</source>
- <request-action>VNFActivateRequest</request-action>
- </request-information>
- </service-data>
- <service-status>
- <response-code>200</response-code>
- <final-indicator>Y</final-indicator>
- <request-status>synccomplete</request-status>
- <response-timestamp>2016-08-05T16:15:19.398Z</response-timestamp>
- <rpc-name>vnf-topology-operation</rpc-name>
- <vnfsdn-action>VNFActivateRequest</vnfsdn-action>
- <rpc-action>assign</rpc-action>
- </service-status>
-</vnf-list>
-
-</output>
+<output xmlns="com:att:sdnctl:vnf"> +<vnf-list xmlns="com:att:sdnctl:vnf"> + <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id> + <service-data> + <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id> + <sdnc-request-header> + <svc-request-id>9ddf628a-9eca-430e-8974-22d520a31be1</svc-request-id> + <svc-action>assign</svc-action> + <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> + </sdnc-request-header> + <service-information> + <subscriber-name>notsurewecare</subscriber-name> + <service-instance-id>bd1b3789-6474-4935-94b2-90b656e035d0</service-instance-id> + <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + </service-information> + <oper-status> + <order-status>PendingCreate</order-status> + </oper-status> + <vnf-request-information> + <aic-cloud-region>VNN1CA52LCP</aic-cloud-region> + <vnf-name>ZVNNMOGX01_base</vnf-name> + <generic-vnf-id>afd0f02a-1ddb-43bb-aded-5113e46e82ae</generic-vnf-id> + <generic-vnf-type>ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1</generic-vnf-type> + <generic-vnf-name>ZVNN1MOGX01</generic-vnf-name> + <tenant>33d209df14ac4c08ad60747185d2f3e0</tenant> + <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id> + <vnf-type>ZVNN1MOGX01 - VF AUG 1::module-0</vnf-type> + </vnf-request-information> + <vnf-topology-information> + <vnf-assignments> + <vnf-networks> + <network-role>mog_exn</network-role> + <network-id>03dbd833-785c-40c0-bf32-37594b5334bc</network-id> + <network-name>MNS-25180-P-VNNYCA01_exn_protected_net_1</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>6f82d234-41a4-48e9-a9e8-415667a72929</neutron-id> + <sriov-vlan-filter-list> + <sriov-vlan-filter>filter1</sriov-vlan-filter> + </sriov-vlan-filter-list> + <sriov-vlan-filter-list> + <sriov-vlan-filter>filter2</sriov-vlan-filter> + </sriov-vlan-filter-list> + </vnf-networks> + <vnf-networks> + <network-role>mog_oam</network-role> + <network-id>3f181cde-9380-4c20-9d3a-e1a4ee74f994</network-id> + <network-name>MNS-25180-P-VNNYCA01_oam_protected_net_1</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>713b6770-13fa-4949-8dbb-a1288c5e5932</neutron-id> + </vnf-networks> + <vnf-networks> + <network-role>mog_cor_B</network-role> + <network-id>821a550a-3f50-4725-995b-f212d5caec7c</network-id> + <network-name>MNS-25180-P-VNNYCA01_cor_direct_net_1</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>18926e56-12b6-4a4d-98b6-37e0c05626ee</neutron-id> + </vnf-networks> + <vnf-networks> + <network-role>mog_cor_A</network-role> + <network-id>3dabf5c0-cffb-420c-8960-8499c74eb25f</network-id> + <network-name>MNS-25180-P-VNNYCA01_cor_direct_net_2</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>35530b29-a4de-48ff-a014-111110ccc652</neutron-id> + </vnf-networks> + <vnf-networks> + <network-role>mog_gn</network-role> + <network-id>3ce97321-6e7f-49af-bd12-f833e377c310</network-id> + <network-name>MNS-25180-P-VNNYCA01_gn_direct_net_1</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>32bfdd2c-28e1-4895-87a6-373bf12c3129</neutron-id> + </vnf-networks> + <vnf-networks> + <network-role>mog_dmz</network-role> + <network-id>d43ca910-02a5-47dc-8510-100a68a3c9e0</network-id> + <network-name>MNS-25180-P-VNNYCA01_dmz_protected_net_1</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>cb9500fb-943f-412e-aea6-458711564a75</neutron-id> + </vnf-networks> + <availability-zones> + <availability-zone>nova</availability-zone> + </availability-zones> + <vnf-vms> + <vm-type>ps</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01MPS001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MPS002</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MPS003</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MPS004</vm-name> + </vm-names> + <vm-count>4</vm-count> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.251</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.252</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.253</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.254</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + </vnf-vms> + <vnf-vms> + <vm-type>cm</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01MCM001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01OAM002</vm-name> + </vm-names> + <vm-count>1</vm-count> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.249</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.250</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + <vm-networks> + <network-role>mog_oam</network-role> + <network-ips> + <ip-address>107.239.167.250</ip-address> + </network-ips> + <network-ips> + <ip-address>107.239.167.251</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + </vnf-vms> + <vnf-vms> + <vm-type>oam</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01OAM001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01OAM002</vm-name> + </vm-names> + <vm-count>2</vm-count> + <vm-networks> + <network-role>mog_oam</network-role> + <network-ips> + <ip-address>107.239.167.252</ip-address> + </network-ips> + <network-ips> + <ip-address>107.239.167.251</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.249</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.250</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + </vnf-vms> + <vnf-vms> + <vm-type>pd</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01MPD001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MPD002</vm-name> + </vm-names> + <vm-count>2</vm-count> + <vm-networks> + <network-role>mog_dmz</network-role> + <network-ips> + <ip-address>107.225.25.253</ip-address> + </network-ips> + <network-ips> + <ip-address>107.225.25.254</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + <floating-ip>107.225.254.253</floating-ip> + </vm-networks> + <vm-networks> + <network-role>mog_oam</network-role> + <network-ips> + <ip-address>107.239.167.254</ip-address> + </network-ips> + <network-ips> + <ip-address>107.239.167.253</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + <floating-ip>107.239.167.249</floating-ip> + </vm-networks> + <vm-networks> + <network-role>mog_exn</network-role> + <network-ips> + <ip-address>107.224.46.253</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.46.254</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + <floating-ip>107.224.46.252</floating-ip> + </vm-networks> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.247</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.248</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + <floating-ip>107.224.41.252</floating-ip> + </vm-networks> + <vm-networks> + <network-role>mog_gn</network-role> + <network-ips> + <ip-address>107.224.41.253</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.41.254</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + <floating-ip>107.224.41.252</floating-ip> + </vm-networks> + <vm-networks> + <network-role>mog_cor_A</network-role> + <network-ips> + <ip-address>107.224.38.253</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.38.254</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + </vnf-vms> + <vnf-vms> + <vm-type>sm</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01MSM001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MSM002</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MSM003</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MSM004</vm-name> + </vm-names> + <vm-count>4</vm-count> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.243</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.244</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.245</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.246</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + </vnf-vms> + </vnf-assignments> + <vnf-topology-identifier> + <vnf-name>ZVNNMOGX01_base</vnf-name> + <service-type>SDN-MOBILITY</service-type> + <vnf-type>ZVNN1MOGX01 - VF AUG 1::module-0</vnf-type> + <generic-vnf-type>ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1</generic-vnf-type> + <generic-vnf-name>ZVNN1MOGX01</generic-vnf-name> + </vnf-topology-identifier> + </vnf-topology-information> + <request-information> + <request-id>9ddf628a-9eca-430e-8974-22d520a31be1</request-id> + <notification-url/> + <source>PORTAL</source> + <request-action>VNFActivateRequest</request-action> + </request-information> + </service-data> + <service-status> + <response-code>200</response-code> + <final-indicator>Y</final-indicator> + <request-status>synccomplete</request-status> + <response-timestamp>2016-08-05T16:15:19.398Z</response-timestamp> + <rpc-name>vnf-topology-operation</rpc-name> + <vnfsdn-action>VNFActivateRequest</vnfsdn-action> + <rpc-action>assign</rpc-action> + </service-status> +</vnf-list> + +</output> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml index 9b69fdc053..e8a69da0f8 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml @@ -1,141 +1,141 @@ -<output xmlns="com:att:sdnctl:vnf">
- <vnf-list xmlns="com:att:sdnctl:vnf">
- <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743a</vnf-id>
- <service-status>
- <response-code>200</response-code>
- <final-indicator>Y</final-indicator>
- <request-status>synccomplete</request-status>
- <response-timestamp>2016-06-08T19:44:59.138Z</response-timestamp>
- <rpc-name>vnf-topology-operation</rpc-name>
- <vnfsdn-action>VNFActivateRequest</vnfsdn-action>
- <rpc-action>assign</rpc-action>
- </service-status>
- <service-data>
- <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743</vnf-id>
- <service-information>
- <subscriber-name>notsurewecare</subscriber-name>
- <service-instance-id>28455973-1ee5-4ad1-8d35-c4732679743a</service-instance-id>
- <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type>
- <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
- </service-information>
- <sdnc-request-header>
- <svc-request-id>5e168556-a5c6-4813-bff3-cc03007afbbc</svc-request-id>
- <svc-notification-url>http://mtanjv9moja01-eth1-0.aic.cip.com:28080/adapters/rest/SDNCNotify</svc-notification-url>
- <svc-action>assign</svc-action>
- </sdnc-request-header>
- <vnf-request-information>
- <aic-cloud-region>AAIAIC25</aic-cloud-region>
- <vnf-name>MSOTEST06-vSAMP3::base::module-0</vnf-name>
- <generic-vnf-id>91ad7ab0-9ffd-471d-971c-3eb913a2cc75</generic-vnf-id>
- <generic-vnf-type>Test/vSAMP3 1</generic-vnf-type>
- <generic-vnf-name>MSOTEST06</generic-vnf-name>
- <tenant>4ae1d3446a4c48b2bec44b6cfba06d68</tenant>
- <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743a</vnf-id>
- <vnf-type>vSAMP3::base::module-0</vnf-type>
- </vnf-request-information>
- <oper-status>
- <order-status>PendingCreate</order-status>
- </oper-status>
- <vnf-topology-information>
- <vnf-parameters>
- <vnf-parameter-name>image</vnf-parameter-name>
- <vnf-parameter-value>Ubuntu_Perf</vnf-parameter-value>
- </vnf-parameters>
- <vnf-parameters>
- <vnf-parameter-name>flavor</vnf-parameter-name>
- <vnf-parameter-value>m1.small</vnf-parameter-value>
- </vnf-parameters>
- <vnf-assignments>
- <vnf-networks>
- <network-role>int_imbl</network-role>
- <network-id>680b7453-0ec4-4d96-b355-280d981d418f</network-id>
- <network-name>Nimbus-25193-T-Willows2_int_imbl_net_1</network-name>
- <contrail-network-fqdn>default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1</contrail-network-fqdn>
- <subnet-id></subnet-id>
- <ipv6-subnet-id>775607fb-e16a-45ef-94a7-82fba0d16eec</ipv6-subnet-id>
- <neutron-id>640d07fb-e16a-45ef-94a7-82fba0d169bf</neutron-id>
- <sriov-vlan-filter-list>
- <sriov-vlan-filter>filter1</sriov-vlan-filter>
- </sriov-vlan-filter-list>
- <sriov-vlan-filter-list>
- <sriov-vlan-filter>filter2</sriov-vlan-filter>
- </sriov-vlan-filter-list>
- </vnf-networks>
- <vnf-networks>
- <network-role>sgi_protected</network-role>
- <network-id>f9039ce9-e3cf-4716-b2d1-ec7912178ea4</network-id>
- <network-name>Nimbus-25193-T-Willows2_sgi_protected_net_1</network-name>
- <contrail-network-fqdn>default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1</contrail-network-fqdn>
- <subnet-id>b9999ce9-e3cf-4716-b2d1-ec791217678c</subnet-id>
- <ipv6-subnet-id></ipv6-subnet-id>
- <neutron-id>bf11bba8-b971-4ab5-8281-215b3fedcd3c</neutron-id>
- </vnf-networks>
- <vnf-vms>
- <vm-type>cm</vm-type>
- <vm-names>
- <vm-name>ZVNN1MOGX01MCM001</vm-name>
- </vm-names>
- <vm-names>
- <vm-name>ZVNN1MOGX01OAM002</vm-name>
- </vm-names>
- <vm-count>1</vm-count>
- <vm-networks>
- <network-role>mog_cor_B</network-role>
- <network-ips>
- <ip-address>107.224.36.249</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.224.36.250</ip-address>
- </network-ips>
- <network-ips-v6>
- <ip-address-ipv6>2606:ae00:2e01:800::67</ip-address-ipv6>
- </network-ips-v6>
- <use-dhcp>N</use-dhcp>
- <floating-ip>107.224.41.252</floating-ip>
- <floating-ip-v6>2001:1890:1001:2B32::29:C</floating-ip-v6>
- </vm-networks>
- <vm-networks>
- <network-role>mog_oam</network-role>
- <network-ips>
- <ip-address>107.239.167.250</ip-address>
- </network-ips>
- <network-ips>
- <ip-address>107.239.167.251</ip-address>
- </network-ips>
- <network-ips-v6>
- <ip-address-ipv6>aa::aa::aa::aa::aa::aa</ip-address-ipv6>
- </network-ips-v6>
- <network-ips-v6>
- <ip-address-ipv6>bb::bb::bb::bb::bb::bb</ip-address-ipv6>
- </network-ips-v6>
- <interface-route-prefixes>
- <interface-route-prefix-cidr>1.2.3.4/26</interface-route-prefix-cidr>
- </interface-route-prefixes>
- <interface-route-prefixes>
- <interface-route-prefix-cidr>2002::/64</interface-route-prefix-cidr>
- </interface-route-prefixes>
- <use-dhcp>N</use-dhcp>
- <floating-ip-v6>1111:1890:1001:2B32::29:D</floating-ip-v6>
- </vm-networks>
- </vnf-vms>
- <availability-zones>
- <availability-zone>nova</availability-zone>
- </availability-zones>
- </vnf-assignments>
- <vnf-topology-identifier>
- <vnf-name>MSOTEST06-vSAMP3::base::module-0</vnf-name>
- <service-type>SDN-MOBILITY</service-type>
- <vnf-type>vSAMP3::base::module-0</vnf-type>
- <generic-vnf-type>Test/vSAMP3 1</generic-vnf-type>
- <generic-vnf-name>MSOTEST06</generic-vnf-name>
- </vnf-topology-identifier>
- </vnf-topology-information>
- <request-information>
- <request-id>5e168556-a5c6-4813-bff3-cc03007afbbc</request-id>
- <notification-url></notification-url>
- <source>SoapUI-bns-vf-base-vSAMP3-9001</source>
- <request-action>VNFActivateRequest</request-action>
- </request-information>
- </service-data>
-</vnf-list>
-</output>
+<output xmlns="com:att:sdnctl:vnf"> + <vnf-list xmlns="com:att:sdnctl:vnf"> + <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743a</vnf-id> + <service-status> + <response-code>200</response-code> + <final-indicator>Y</final-indicator> + <request-status>synccomplete</request-status> + <response-timestamp>2016-06-08T19:44:59.138Z</response-timestamp> + <rpc-name>vnf-topology-operation</rpc-name> + <vnfsdn-action>VNFActivateRequest</vnfsdn-action> + <rpc-action>assign</rpc-action> + </service-status> + <service-data> + <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743</vnf-id> + <service-information> + <subscriber-name>notsurewecare</subscriber-name> + <service-instance-id>28455973-1ee5-4ad1-8d35-c4732679743a</service-instance-id> + <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + </service-information> + <sdnc-request-header> + <svc-request-id>5e168556-a5c6-4813-bff3-cc03007afbbc</svc-request-id> + <svc-notification-url>http://localhost:28080/adapters/rest/SDNCNotify</svc-notification-url> + <svc-action>assign</svc-action> + </sdnc-request-header> + <vnf-request-information> + <aic-cloud-region>AAIAIC25</aic-cloud-region> + <vnf-name>MSOTEST06-vSAMP3::base::module-0</vnf-name> + <generic-vnf-id>91ad7ab0-9ffd-471d-971c-3eb913a2cc75</generic-vnf-id> + <generic-vnf-type>Test/vSAMP3 1</generic-vnf-type> + <generic-vnf-name>MSOTEST06</generic-vnf-name> + <tenant>4ae1d3446a4c48b2bec44b6cfba06d68</tenant> + <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743a</vnf-id> + <vnf-type>vSAMP3::base::module-0</vnf-type> + </vnf-request-information> + <oper-status> + <order-status>PendingCreate</order-status> + </oper-status> + <vnf-topology-information> + <vnf-parameters> + <vnf-parameter-name>image</vnf-parameter-name> + <vnf-parameter-value>Ubuntu_Perf</vnf-parameter-value> + </vnf-parameters> + <vnf-parameters> + <vnf-parameter-name>flavor</vnf-parameter-name> + <vnf-parameter-value>m1.small</vnf-parameter-value> + </vnf-parameters> + <vnf-assignments> + <vnf-networks> + <network-role>int_imbl</network-role> + <network-id>680b7453-0ec4-4d96-b355-280d981d418f</network-id> + <network-name>Nimbus-25193-T-Willows2_int_imbl_net_1</network-name> + <contrail-network-fqdn>default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1</contrail-network-fqdn> + <subnet-id></subnet-id> + <ipv6-subnet-id>775607fb-e16a-45ef-94a7-82fba0d16eec</ipv6-subnet-id> + <neutron-id>640d07fb-e16a-45ef-94a7-82fba0d169bf</neutron-id> + <sriov-vlan-filter-list> + <sriov-vlan-filter>filter1</sriov-vlan-filter> + </sriov-vlan-filter-list> + <sriov-vlan-filter-list> + <sriov-vlan-filter>filter2</sriov-vlan-filter> + </sriov-vlan-filter-list> + </vnf-networks> + <vnf-networks> + <network-role>sgi_protected</network-role> + <network-id>f9039ce9-e3cf-4716-b2d1-ec7912178ea4</network-id> + <network-name>Nimbus-25193-T-Willows2_sgi_protected_net_1</network-name> + <contrail-network-fqdn>default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1</contrail-network-fqdn> + <subnet-id>b9999ce9-e3cf-4716-b2d1-ec791217678c</subnet-id> + <ipv6-subnet-id></ipv6-subnet-id> + <neutron-id>bf11bba8-b971-4ab5-8281-215b3fedcd3c</neutron-id> + </vnf-networks> + <vnf-vms> + <vm-type>cm</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01MCM001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01OAM002</vm-name> + </vm-names> + <vm-count>1</vm-count> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.249</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.250</ip-address> + </network-ips> + <network-ips-v6> + <ip-address-ipv6>2606:ae00:2e01:800::67</ip-address-ipv6> + </network-ips-v6> + <use-dhcp>N</use-dhcp> + <floating-ip>107.224.41.252</floating-ip> + <floating-ip-v6>2001:1890:1001:2B32::29:C</floating-ip-v6> + </vm-networks> + <vm-networks> + <network-role>mog_oam</network-role> + <network-ips> + <ip-address>107.239.167.250</ip-address> + </network-ips> + <network-ips> + <ip-address>107.239.167.251</ip-address> + </network-ips> + <network-ips-v6> + <ip-address-ipv6>aa::aa::aa::aa::aa::aa</ip-address-ipv6> + </network-ips-v6> + <network-ips-v6> + <ip-address-ipv6>bb::bb::bb::bb::bb::bb</ip-address-ipv6> + </network-ips-v6> + <interface-route-prefixes> + <interface-route-prefix-cidr>1.2.3.4/26</interface-route-prefix-cidr> + </interface-route-prefixes> + <interface-route-prefixes> + <interface-route-prefix-cidr>2002::/64</interface-route-prefix-cidr> + </interface-route-prefixes> + <use-dhcp>N</use-dhcp> + <floating-ip-v6>1111:1890:1001:2B32::29:D</floating-ip-v6> + </vm-networks> + </vnf-vms> + <availability-zones> + <availability-zone>nova</availability-zone> + </availability-zones> + </vnf-assignments> + <vnf-topology-identifier> + <vnf-name>MSOTEST06-vSAMP3::base::module-0</vnf-name> + <service-type>SDN-MOBILITY</service-type> + <vnf-type>vSAMP3::base::module-0</vnf-type> + <generic-vnf-type>Test/vSAMP3 1</generic-vnf-type> + <generic-vnf-name>MSOTEST06</generic-vnf-name> + </vnf-topology-identifier> + </vnf-topology-information> + <request-information> + <request-id>5e168556-a5c6-4813-bff3-cc03007afbbc</request-id> + <notification-url></notification-url> + <source>SoapUI-bns-vf-base-vSAMP3-9001</source> + <request-action>VNFActivateRequest</request-action> + </request-information> + </service-data> +</vnf-list> +</output> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml index 919ff2c36b..77528ccf61 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml @@ -1,5 +1,5 @@ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> - <SDNCAdapterResponse xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"/> + <SDNCAdapterResponse xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"/> </soap:Body> </soap:Envelope>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml index 7b72812f1a..8a690403c4 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml @@ -1,10 +1,10 @@ -<UpdateAAIVfModuleRequest>
- <vnf-id>skask</vnf-id>
- <vf-module-id>supercool</vf-module-id>
- <heat-stack-id>slowburn</heat-stack-id>
- <orchestration-status>complete</orchestration-status>
- <volume-group-id>78987</volume-group-id>
- <persona-model-id>introvert</persona-model-id>
- <persona-model-version>3.14</persona-model-version>
- <contrail-service-instance-fqdn>myhost.appl.com</contrail-service-instance-fqdn>
+<UpdateAAIVfModuleRequest> + <vnf-id>skask</vnf-id> + <vf-module-id>supercool</vf-module-id> + <heat-stack-id>slowburn</heat-stack-id> + <orchestration-status>complete</orchestration-status> + <volume-group-id>78987</volume-group-id> + <persona-model-id>introvert</persona-model-id> + <persona-model-version>3.14</persona-model-version> + <contrail-service-instance-fqdn>myhost.appl.com</contrail-service-instance-fqdn> </UpdateAAIVfModuleRequest>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml index 966ca50b16..0dc1b1d410 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml @@ -1,4 +1,4 @@ -<vnf-request xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> +<vnf-request xmlns="http://org.onap/so/infra/vnf-request/v1"> <request-info> <request-id>DEV-VF-0011</request-id> <action>UPDATE_VF_MODULE</action> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml index cfbf903ce9..b882c4c6f4 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml @@ -1,10 +1,10 @@ -<vf-module xmlns="http://com.aai.inventory/v7">
- <vf-module-id>lukewarm</vf-module-id>
- <vf-module-name>PCRF::module-1</vf-module-name>
- <heat-stack-id>slowburn</heat-stack-id>
- <orchestration-status>pending-create</orchestration-status>
- <is-base-vf-module>true</is-base-vf-module>
- <resource-version>330-90</resource-version>
- <persona-model-id>introvert</persona-model-id>
- <persona-model-version>2.0</persona-model-version>
+<vf-module xmlns="http://com.aai.inventory/v7"> + <vf-module-id>lukewarm</vf-module-id> + <vf-module-name>PCRF::module-1</vf-module-name> + <heat-stack-id>slowburn</heat-stack-id> + <orchestration-status>pending-create</orchestration-status> + <is-base-vf-module>true</is-base-vf-module> + <resource-version>330-90</resource-version> + <persona-model-id>introvert</persona-model-id> + <persona-model-version>2.0</persona-model-version> </vf-module>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml index 27c8ecf60a..3b8bea4e4e 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml @@ -1,9 +1,9 @@ -<vf-module xmlns="http://com.aai.inventory/v7">
- <vf-module-id>b37d96db-7d2c-47ce-bf61-a6c7b82fe161</vf-module-id>
- <vf-module-name>PCRF::module-0-2</vf-module-name>
- <persona-model-id>00000000-0000-0000-0000-000000000000</persona-model-id>
- <persona-model-version>1.0</persona-model-version>
- <is-base-vf-module>false</is-base-vf-module>
- <orchestration-status>pending-create</orchestration-status>
- <resource-version>330-90</resource-version>
+<vf-module xmlns="http://com.aai.inventory/v7"> + <vf-module-id>b37d96db-7d2c-47ce-bf61-a6c7b82fe161</vf-module-id> + <vf-module-name>PCRF::module-0-2</vf-module-name> + <persona-model-id>00000000-0000-0000-0000-000000000000</persona-model-id> + <persona-model-version>1.0</persona-model-version> + <is-base-vf-module>false</is-base-vf-module> + <orchestration-status>pending-create</orchestration-status> + <resource-version>330-90</resource-version> </vf-module>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml index ee09c9bc4a..5a2b7300b1 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -1,27 +1,27 @@ -<vf-module xmlns="http://com.aai.inventory/v7">
- <vf-module-id>supercool</vf-module-id>
- <vf-module-name>PCRF::module-2</vf-module-name>
- <heat-stack-id>fastburn</heat-stack-id>
- <orchestration-status>pending-create</orchestration-status>
- <is-base-vf-module>false</is-base-vf-module>
- <resource-version>330-89</resource-version>
- <model-invariant-id>introvert</model-invariant-id>
- <model-version-id>2.0</model-version-id>
- <relationship-list>
- <relationship>
- <related-to>volume-group</related-to>
- <relationship-data>
- <relationship-key>cloud-region.cloud-owner</relationship-key>
- <relationship-value>att-aic</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>cloud-region.cloud-region-id</relationship-key>
- <relationship-value>pdk1</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>volume-group.volume-group-id</relationship-key>
- <relationship-value>78987</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
+<vf-module xmlns="http://com.aai.inventory/v7"> + <vf-module-id>supercool</vf-module-id> + <vf-module-name>PCRF::module-2</vf-module-name> + <heat-stack-id>fastburn</heat-stack-id> + <orchestration-status>pending-create</orchestration-status> + <is-base-vf-module>false</is-base-vf-module> + <resource-version>330-89</resource-version> + <model-invariant-id>introvert</model-invariant-id> + <model-version-id>2.0</model-version-id> + <relationship-list> + <relationship> + <related-to>volume-group</related-to> + <relationship-data> + <relationship-key>cloud-region.cloud-owner</relationship-key> + <relationship-value>att-aic</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-region-id</relationship-key> + <relationship-value>pdk1</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>volume-group.volume-group-id</relationship-key> + <relationship-value>78987</relationship-value> + </relationship-data> + </relationship> + </relationship-list> </vf-module>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml index b44c977eaf..7e913dd418 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -1,25 +1,25 @@ - <volume-group xmlns="http://com.aai.inventory/v7">
- <volume-group-id>78987</volume-group-id>
- <volume-group-name>Volume_2</volume-group-name>
- <heat-stack-id>slowburn</heat-stack-id>
- <vnf-type>pcrf-capacity</vnf-type>
- <orchestration-status>Active</orchestration-status>
- <resource-version>0000020</resource-version>
- <relationship-list>
- <relationship>
- <related-to>tenant</related-to>
- <relationship-data>
- <relationship-key>cloud-region.cloud-owner</relationship-key>
- <relationship-value>att-aic</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>cloud-region.cloud-region-id</relationship-key>
- <relationship-value>MDTWNJ21</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
+ <volume-group xmlns="http://com.aai.inventory/v7"> + <volume-group-id>78987</volume-group-id> + <volume-group-name>Volume_2</volume-group-name> + <heat-stack-id>slowburn</heat-stack-id> + <vnf-type>pcrf-capacity</vnf-type> + <orchestration-status>Active</orchestration-status> + <resource-version>0000020</resource-version> + <relationship-list> + <relationship> + <related-to>tenant</related-to> + <relationship-data> + <relationship-key>cloud-region.cloud-owner</relationship-key> + <relationship-value>att-aic</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-region-id</relationship-key> + <relationship-value>MDTWNJ21</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> + </relationship-data> + </relationship> + </relationship-list> </volume-group>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml index 396f553b60..4167e2e87d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml @@ -1,28 +1,28 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<tns:volume-group xmlns:tns="http://com.aai.inventory/v6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://com.aai.inventory/v6 aai_schema_v6.xsd ">
- <tns:volume-group-id>VOLUME_GROUP_ID_1</tns:volume-group-id>
- <tns:volume-group-name>VOLUME_GROUP_ID_1_NAME</tns:volume-group-name>
- <tns:heat-stack-id>heat-stack-id</tns:heat-stack-id>
- <tns:vnf-type>vnf-type</tns:vnf-type>
- <tns:orchestration-status>OK</tns:orchestration-status>
- <tns:resource-version>1</tns:resource-version>
- <tns:relationship-list>
- <tns:relationship>
- <tns:related-to>tenant</tns:related-to>
- <tns:relationship-data>
- <tns:relationship-key>cloud-region.cloud-owner</tns:relationship-key>
- <tns:relationship-value>att-aic</tns:relationship-value>
- </tns:relationship-data>
- <tns:relationship-data>
- <tns:relationship-key>cloud-region.cloud-region-id</tns:relationship-key>
- <tns:relationship-value>pdk1</tns:relationship-value>
- </tns:relationship-data>
- <tns:relationship-data>
- <tns:relationship-key>tenant.tenant-id</tns:relationship-key>
- <tns:relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0cg</tns:relationship-value>
- </tns:relationship-data>
- </tns:relationship>
- </tns:relationship-list>
- </tns:volume-group>
-
-
+<?xml version="1.0" encoding="UTF-8"?> +<tns:volume-group xmlns:tns="http://com.aai.inventory/v6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://com.aai.inventory/v6 aai_schema_v6.xsd "> + <tns:volume-group-id>VOLUME_GROUP_ID_1</tns:volume-group-id> + <tns:volume-group-name>VOLUME_GROUP_ID_1_NAME</tns:volume-group-name> + <tns:heat-stack-id>heat-stack-id</tns:heat-stack-id> + <tns:vnf-type>vnf-type</tns:vnf-type> + <tns:orchestration-status>OK</tns:orchestration-status> + <tns:resource-version>1</tns:resource-version> + <tns:relationship-list> + <tns:relationship> + <tns:related-to>tenant</tns:related-to> + <tns:relationship-data> + <tns:relationship-key>cloud-region.cloud-owner</tns:relationship-key> + <tns:relationship-value>att-aic</tns:relationship-value> + </tns:relationship-data> + <tns:relationship-data> + <tns:relationship-key>cloud-region.cloud-region-id</tns:relationship-key> + <tns:relationship-value>pdk1</tns:relationship-value> + </tns:relationship-data> + <tns:relationship-data> + <tns:relationship-key>tenant.tenant-id</tns:relationship-key> + <tns:relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0cg</tns:relationship-value> + </tns:relationship-data> + </tns:relationship> + </tns:relationship-list> + </tns:volume-group> + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json index 6fc9cb36e6..21bacbd5ce 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/e2e-complex.json @@ -24,7 +24,7 @@ "relationship": [ { "related-to": "vpls-pe", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vpls-pes/vpls-pe/sfcca301vr1", + "related-link": "https://localhost:8443/aai/v9/network/vpls-pes/vpls-pe/sfcca301vr1", "relationship-data": [ { "relationship-key": "vpls-pe.equipment-name", @@ -48,7 +48,7 @@ "relationship": [ { "related-to": "vce", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", + "related-link": "https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", "relationship-data": [ { "relationship-key": "vce.vnf-id", @@ -64,7 +64,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj104snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj104snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -79,7 +79,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj105snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj105snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -94,7 +94,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/compute_host", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/compute_host", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -109,7 +109,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj106snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj106snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -124,7 +124,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj126sd9", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj126sd9", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -139,7 +139,7 @@ }, { "related-to": "vce", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/8ae1e5f8-61f1-4c71-913a-b40cc4593cb9", + "related-link": "https://localhost:8443/aai/v9/network/vces/vce/8ae1e5f8-61f1-4c71-913a-b40cc4593cb9", "relationship-data": [ { "relationship-key": "vce.vnf-id", @@ -155,7 +155,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102sta", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102sta", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -170,7 +170,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax102", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax102", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -185,7 +185,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj107snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj107snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -200,7 +200,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj118snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj118snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -215,7 +215,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj110snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj110snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -230,7 +230,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj109snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj109snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -245,7 +245,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj114snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj114snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -260,7 +260,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj119snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj119snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -275,7 +275,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj116snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj116snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -290,7 +290,7 @@ }, { "related-to": "vce", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a2935fa9-b743-49f4-9813-a127f13c4e93", + "related-link": "https://localhost:8443/aai/v9/network/vces/vce/a2935fa9-b743-49f4-9813-a127f13c4e93", "relationship-data": [ { "relationship-key": "vce.vnf-id", @@ -306,7 +306,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj108snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj108snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -321,7 +321,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj123sd9", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj123sd9", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -336,7 +336,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -351,7 +351,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -366,7 +366,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax101", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax101", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -381,7 +381,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj113snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj113snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -396,7 +396,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj111snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj111snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -411,7 +411,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj103snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj103snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -426,7 +426,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj117snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj117snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -441,7 +441,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101sta", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101sta", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -456,7 +456,7 @@ }, { "related-to": "vce", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/c7fe7698-8063-4e26-8bd3-ca3edde0b0d4", + "related-link": "https://localhost:8443/aai/v9/network/vces/vce/c7fe7698-8063-4e26-8bd3-ca3edde0b0d4", "relationship-data": [ { "relationship-key": "vce.vnf-id", @@ -472,7 +472,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj120snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj120snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -487,7 +487,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj124sd9", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj124sd9", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -502,7 +502,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj125sd9", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj125sd9", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -517,7 +517,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj112snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj112snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -532,7 +532,7 @@ }, { "related-to": "pserver", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj115snd", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj115snd", "relationship-data": [ { "relationship-key": "pserver.hostname", @@ -547,7 +547,7 @@ }, { "related-to": "cloud-region", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtcnj2", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtcnj2", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", @@ -567,7 +567,7 @@ }, { "related-to": "oam-network", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", @@ -591,7 +591,7 @@ }, { "related-to": "oam-network", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", @@ -615,7 +615,7 @@ }, { "related-to": "oam-network", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", @@ -639,7 +639,7 @@ }, { "related-to": "availability-zone", - "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01", + "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/service-instance-pathed-query.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/service-instance-pathed-query.json index 6ec513e4bb..0fa9515820 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/service-instance-pathed-query.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/resources/service-instance-pathed-query.json @@ -2,7 +2,7 @@ "results": [ { "resource-type": "service-instance", - "resource-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3" + "resource-link": "https://localhost:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3" } ] }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/catalogDbFiles/DoCreateServiceInstance_request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/catalogDbFiles/DoCreateServiceInstance_request.json new file mode 100644 index 0000000000..c135923f84 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/catalogDbFiles/DoCreateServiceInstance_request.json @@ -0,0 +1,162 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSOTADevInfra_vSAMP10a_Service", + "modelUuid" : "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantUuid" : "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion" : "1.0" + }, + "serviceType" : "PortMirroring", + "serviceRole" : "InfraRole", + "environmentContext" : "Luna", + "workloadContext" : "Oxygen", + "serviceVnfs": [ + + { "modelInfo" : { + "modelName" : "vSAMP10a", + "modelUuid" : "ff2ae348-214a-11e7-93ae-92361f002671", + "modelInvariantUuid" : "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "68dc9a92-214c-11e7-93ae-92361f002671", + "modelInstanceName" : "vSAMP10a 1" + }, + "toscaNodeType" : "VF", + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "multiStageDesign" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest4", + "modelUuid" : "025606c1-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba01a", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba01a" + }, "isBase" : true, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest3", + "modelUuid" : "02560575-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba0bb", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d13cba0bb" + }, "isBase" : true, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "NetworkFqdnTest5", + "modelUuid" : "025607e4-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : "06bd0a18-65c0-4418-83c7-5b0d14cba01a", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "06bd0a18-65c0-4418-83c7-5b0d14cba01a" + }, "isBase" : false, + "vfModuleLabel" : "label", + "initialCount" : 0, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::PCM::module-2", + "modelUuid" : "7774b4e4-7d37-11e7-bb31-be2e44b06b34", + "modelInvariantUuid" : "93e9c1d2-7d37-11e7-bb31-be2e44b06b34", + "modelVersion" : "2", + "modelCustomizationUuid" : "6728bee8-7d3a-11e7-bb31-be2e44b06b34" + }, "isBase" : false, + "vfModuleLabel" : "PCM", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::PCM::module-1", + "modelUuid" : "066de97e-253e-11e7-93ae-92361f002671", + "modelInvariantUuid" : "64efd51a-2544-11e7-93ae-92361f002671", + "modelVersion" : "2", + "modelCustomizationUuid" : "b4ea86b4-253f-11e7-93ae-92361f002671" + }, "isBase" : false, + "vfModuleLabel" : "PCM", + "initialCount" : 0, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10aDEV::base::module-0", + "modelUuid" : "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantUuid" : "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion" : "2", + "modelCustomizationUuid" : "cb82ffd8-252a-11e7-93ae-92361f002671" + }, "isBase" : true, + "vfModuleLabel" : "base", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "vSAMP10a::base::module-0", + "modelUuid" : "02560de2-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "2", + "modelCustomizationUuid" : "MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4" + }, "isBase" : true, + "vfModuleLabel" : "base", + "initialCount" : 1, + "hasVolumeGroup" : true + }, + { + "modelInfo" : { + "modelName" : "base::module-0", + "modelUuid" : "02561381-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "1", + "modelCustomizationUuid" : "MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5" + }, "isBase" : true, + "vfModuleLabel" : "module-0", + "initialCount" : 1, + "hasVolumeGroup" : false + }, + { + "modelInfo" : { + "modelName" : "vSAMP10a::PCM::module-1", + "modelUuid" : "02560f1b-4223-11e7-9252-005056850d2e", + "modelInvariantUuid" : null, + "modelVersion" : "1", + "modelCustomizationUuid" : "MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8" + }, "isBase" : true, + "vfModuleLabel" : "PCM", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "Tunnel_Xconn", + "modelUuid" : "f6b7d4c6-e8a4-46e2-81bc-31cad5072842", + "modelInvariantUuid" : "b7a1b78e-6b6b-4b36-9698-8c9530da14af", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "5b9bee43-f537-4fb3-9e8b-4de9f714d28a", + "modelInstanceName" : "Pri_Tunnel_Xconn 9" + }, + "toscaNodeType" : null, + "allottedResourceType" : null, + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ] + }} + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/getCatalogServiceResourcesDataWithConfig.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/getCatalogServiceResourcesDataWithConfig.json index 610965038f..b408af8f2c 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/getCatalogServiceResourcesDataWithConfig.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/getCatalogServiceResourcesDataWithConfig.json @@ -1,182 +1,182 @@ -{
- "serviceResources": {
- "modelInfo": {
- "modelName": "MSOTADevInfra_vSAMP10a_Service",
- "modelUuid": "5df8b6de-2083-11e7-93ae-92361f002671",
- "modelInvariantUuid": "9647dfc4-2083-11e7-93ae-92361f002671",
- "modelVersion": "1.0"
- },
- "serviceType": "PortMirroring",
- "serviceRole": "InfraRole",
- "serviceVnfs": [
- {
- "modelInfo": {
- "modelName": "vSAMP10a",
- "modelUuid": "ff2ae348-214a-11e7-93ae-92361f002671",
- "modelInvariantUuid": "2fff5b20-214b-11e7-93ae-92361f002671",
- "modelVersion": "1.0",
- "modelCustomizationUuid": "68dc9a92-214c-11e7-93ae-92361f002671",
- "modelInstanceName": "vSAMP10a 1"
- },
- "toscaNodeType": "VF",
- "nfFunction": null,
- "nfType": null,
- "nfRole": null,
- "nfNamingCode": null,
- "vfModules": [
- {
- "modelInfo": {
- "modelName": "NetworkFqdnTest4",
- "modelUuid": "025606c1-4223-11e7-9252-005056850d2e",
- "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba01a",
- "modelVersion": "2.0",
- "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba01a"
- },
- "isBase": true,
- "vfModuleLabel": "label",
- "initialCount": 0,
- "hasVolumeGroup": true
- },
- {
- "modelInfo": {
- "modelName": "NetworkFqdnTest3",
- "modelUuid": "02560575-4223-11e7-9252-005056850d2e",
- "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba0bb",
- "modelVersion": "1.0",
- "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba0bb"
- },
- "isBase": true,
- "vfModuleLabel": "label",
- "initialCount": 0,
- "hasVolumeGroup": false
- },
- {
- "modelInfo": {
- "modelName": "NetworkFqdnTest5",
- "modelUuid": "025607e4-4223-11e7-9252-005056850d2e",
- "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d14cba01a",
- "modelVersion": "1.0",
- "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d14cba01a"
- },
- "isBase": false,
- "vfModuleLabel": "label",
- "initialCount": 0,
- "hasVolumeGroup": false
- },
- {
- "modelInfo": {
- "modelName": "vSAMP10aDEV::PCM::module-2",
- "modelUuid": "7774b4e4-7d37-11e7-bb31-be2e44b06b34",
- "modelInvariantUuid": "93e9c1d2-7d37-11e7-bb31-be2e44b06b34",
- "modelVersion": "2",
- "modelCustomizationUuid": "6728bee8-7d3a-11e7-bb31-be2e44b06b34"
- },
- "isBase": false,
- "vfModuleLabel": "PCM",
- "initialCount": 0,
- "hasVolumeGroup": true
- },
- {
- "modelInfo": {
- "modelName": "vSAMP10aDEV::PCM::module-1",
- "modelUuid": "066de97e-253e-11e7-93ae-92361f002671",
- "modelInvariantUuid": "64efd51a-2544-11e7-93ae-92361f002671",
- "modelVersion": "2",
- "modelCustomizationUuid": "b4ea86b4-253f-11e7-93ae-92361f002671"
- },
- "isBase": false,
- "vfModuleLabel": "PCM",
- "initialCount": 0,
- "hasVolumeGroup": true
- },
- {
- "modelInfo": {
- "modelName": "vSAMP10aDEV::base::module-0",
- "modelUuid": "20c4431c-246d-11e7-93ae-92361f002671",
- "modelInvariantUuid": "78ca26d0-246d-11e7-93ae-92361f002671",
- "modelVersion": "2",
- "modelCustomizationUuid": "cb82ffd8-252a-11e7-93ae-92361f002671"
- },
- "isBase": true,
- "vfModuleLabel": "base",
- "initialCount": 1,
- "hasVolumeGroup": true
- },
- {
- "modelInfo": {
- "modelName": "vSAMP10a::base::module-0",
- "modelUuid": "02560de2-4223-11e7-9252-005056850d2e",
- "modelInvariantUuid": null,
- "modelVersion": "2",
- "modelCustomizationUuid": "MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4"
- },
- "isBase": true,
- "vfModuleLabel": "base",
- "initialCount": 1,
- "hasVolumeGroup": true
- },
- {
- "modelInfo": {
- "modelName": "base::module-0",
- "modelUuid": "02561381-4223-11e7-9252-005056850d2e",
- "modelInvariantUuid": null,
- "modelVersion": "1",
- "modelCustomizationUuid": "MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5"
- },
- "isBase": true,
- "vfModuleLabel": "module-0",
- "initialCount": 1,
- "hasVolumeGroup": false
- },
- {
- "modelInfo": {
- "modelName": "vSAMP10a::PCM::module-1",
- "modelUuid": "02560f1b-4223-11e7-9252-005056850d2e",
- "modelInvariantUuid": null,
- "modelVersion": "1",
- "modelCustomizationUuid": "MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8"
- },
- "isBase": true,
- "vfModuleLabel": "PCM",
- "initialCount": 1,
- "hasVolumeGroup": true
- }
- ]
- }
- ],
- "serviceNetworks": [],
- "serviceAllottedResources": [
- {
- "modelInfo": {
- "modelName": "Tunnel_Xconn",
- "modelUuid": "f6b7d4c6-e8a4-46e2-81bc-31cad5072842",
- "modelInvariantUuid": "b7a1b78e-6b6b-4b36-9698-8c9530da14af",
- "modelVersion": "1.0",
- "modelCustomizationUuid": "5b9bee43-f537-4fb3-9e8b-4de9f714d28a",
- "modelInstanceName": "Pri_Tunnel_Xconn 9"
- },
- "toscaNodeType": null,
- "allottedResourceType": null,
- "allottedResourceRole": null,
- "providingServiceModelInvariantUuid": null,
- "nfFunction": null,
- "nfType": null,
- "nfRole": null,
- "nfNamingCode": null
- }
- ],
- "serviceConfigs": [
- {
- "modelInfo": {
- "modelName": "Molder",
- "modelUuid": "025606c1-4fff-11e7-9252-005056850d2e",
- "modelInvariantUuid": "025606c1-4eee-11e7-9252-005056850d2e",
- "modelVersion": "1.0",
- "modelCustomizationUuid": "025606c1-4ddd-11e7-9252-005056850d2e",
- "modelInstanceName": "X_FILES_001"
- },
- "toscaNodeType": "Scully"
- }
- ]
- }
+{ + "serviceResources": { + "modelInfo": { + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelUuid": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantUuid": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + }, + "serviceType": "PortMirroring", + "serviceRole": "InfraRole", + "serviceVnfs": [ + { + "modelInfo": { + "modelName": "vSAMP10a", + "modelUuid": "ff2ae348-214a-11e7-93ae-92361f002671", + "modelInvariantUuid": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationUuid": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelInstanceName": "vSAMP10a 1" + }, + "toscaNodeType": "VF", + "nfFunction": null, + "nfType": null, + "nfRole": null, + "nfNamingCode": null, + "vfModules": [ + { + "modelInfo": { + "modelName": "NetworkFqdnTest4", + "modelUuid": "025606c1-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba01a", + "modelVersion": "2.0", + "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba01a" + }, + "isBase": true, + "vfModuleLabel": "label", + "initialCount": 0, + "hasVolumeGroup": true + }, + { + "modelInfo": { + "modelName": "NetworkFqdnTest3", + "modelUuid": "02560575-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba0bb", + "modelVersion": "1.0", + "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d13cba0bb" + }, + "isBase": true, + "vfModuleLabel": "label", + "initialCount": 0, + "hasVolumeGroup": false + }, + { + "modelInfo": { + "modelName": "NetworkFqdnTest5", + "modelUuid": "025607e4-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": "06bd0a18-65c0-4418-83c7-5b0d14cba01a", + "modelVersion": "1.0", + "modelCustomizationUuid": "06bd0a18-65c0-4418-83c7-5b0d14cba01a" + }, + "isBase": false, + "vfModuleLabel": "label", + "initialCount": 0, + "hasVolumeGroup": false + }, + { + "modelInfo": { + "modelName": "vSAMP10aDEV::PCM::module-2", + "modelUuid": "7774b4e4-7d37-11e7-bb31-be2e44b06b34", + "modelInvariantUuid": "93e9c1d2-7d37-11e7-bb31-be2e44b06b34", + "modelVersion": "2", + "modelCustomizationUuid": "6728bee8-7d3a-11e7-bb31-be2e44b06b34" + }, + "isBase": false, + "vfModuleLabel": "PCM", + "initialCount": 0, + "hasVolumeGroup": true + }, + { + "modelInfo": { + "modelName": "vSAMP10aDEV::PCM::module-1", + "modelUuid": "066de97e-253e-11e7-93ae-92361f002671", + "modelInvariantUuid": "64efd51a-2544-11e7-93ae-92361f002671", + "modelVersion": "2", + "modelCustomizationUuid": "b4ea86b4-253f-11e7-93ae-92361f002671" + }, + "isBase": false, + "vfModuleLabel": "PCM", + "initialCount": 0, + "hasVolumeGroup": true + }, + { + "modelInfo": { + "modelName": "vSAMP10aDEV::base::module-0", + "modelUuid": "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantUuid": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion": "2", + "modelCustomizationUuid": "cb82ffd8-252a-11e7-93ae-92361f002671" + }, + "isBase": true, + "vfModuleLabel": "base", + "initialCount": 1, + "hasVolumeGroup": true + }, + { + "modelInfo": { + "modelName": "vSAMP10a::base::module-0", + "modelUuid": "02560de2-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": null, + "modelVersion": "2", + "modelCustomizationUuid": "MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4" + }, + "isBase": true, + "vfModuleLabel": "base", + "initialCount": 1, + "hasVolumeGroup": true + }, + { + "modelInfo": { + "modelName": "base::module-0", + "modelUuid": "02561381-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": null, + "modelVersion": "1", + "modelCustomizationUuid": "MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5" + }, + "isBase": true, + "vfModuleLabel": "module-0", + "initialCount": 1, + "hasVolumeGroup": false + }, + { + "modelInfo": { + "modelName": "vSAMP10a::PCM::module-1", + "modelUuid": "02560f1b-4223-11e7-9252-005056850d2e", + "modelInvariantUuid": null, + "modelVersion": "1", + "modelCustomizationUuid": "MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8" + }, + "isBase": true, + "vfModuleLabel": "PCM", + "initialCount": 1, + "hasVolumeGroup": true + } + ] + } + ], + "serviceNetworks": [], + "serviceAllottedResources": [ + { + "modelInfo": { + "modelName": "Tunnel_Xconn", + "modelUuid": "f6b7d4c6-e8a4-46e2-81bc-31cad5072842", + "modelInvariantUuid": "b7a1b78e-6b6b-4b36-9698-8c9530da14af", + "modelVersion": "1.0", + "modelCustomizationUuid": "5b9bee43-f537-4fb3-9e8b-4de9f714d28a", + "modelInstanceName": "Pri_Tunnel_Xconn 9" + }, + "toscaNodeType": null, + "allottedResourceType": null, + "allottedResourceRole": null, + "providingServiceModelInvariantUuid": null, + "nfFunction": null, + "nfType": null, + "nfRole": null, + "nfNamingCode": null + } + ], + "serviceConfigs": [ + { + "modelInfo": { + "modelName": "Molder", + "modelUuid": "025606c1-4fff-11e7-9252-005056850d2e", + "modelInvariantUuid": "025606c1-4eee-11e7-9252-005056850d2e", + "modelVersion": "1.0", + "modelCustomizationUuid": "025606c1-4ddd-11e7-9252-005056850d2e", + "modelInstanceName": "X_FILES_001" + }, + "toscaNodeType": "Scully" + } + ] + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessage.txt b/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessage.txt new file mode 100644 index 0000000000..d28b8f9920 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessage.txt @@ -0,0 +1 @@ +{"messageId":"43b634ca-903f-47bb-8ef9-5ceb9f1b04bd","message":"0 : Stack error (CREATE_FAILED): Resource CREATE failed: Exception: resources.network: HTTP Status: 500 Content: <pre>Traceback (most recent call last):\n File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py\", line 622, in http_resource_create\n ok, result = stateful_create()\n File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_api_server.py\", line 566, in stateful_create\n tenant_name, obj_dict, db_conn)\n File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py\", line 1463, in pre_dbe_create\n vn_uuid)\n File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_cfg_types.py\", line 1396, in _check_ipam_network_subnets\n (ok, result) = cls.addr_mgmt.net_check_subnet(ipam_subnets)\n File \"/usr/lib/python2.7/dist-packages/vnc_cfg_api_server/vnc_addr_mgmt.py\", line 987, in net_check_subnet\n network = IPNetwork('%s/%s' % (prefix, prefix_len))\n File \"/usr/lib/python2.7/dist-packages/netaddr/ip/__init__.py\", line 933, in __init__\n raise AddrFormatError('invalid IPNetwork %s' % addr)\nAddrFormatError: invalid IPNetwork /0\n</pre>\n","category":"INTERNAL","rolledBack":true} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessageFlag.txt b/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessageFlag.txt new file mode 100644 index 0000000000..9eef2b4a48 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/invalidErrorMessageFlag.txt @@ -0,0 +1 @@ +{ %1$d Two: %2$d, # '-' /# } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/requestDetails.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/requestDetails.json new file mode 100644 index 0000000000..76616e14a5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/requestDetails.json @@ -0,0 +1,37 @@ +{ + "requestDetails": { + "project": { + "projectName": "vSAMP12 Project" + }, + "owningEntity": { + "owningEntityId": "MSO-Test-OE", + "owningEntityName": "MSO-Test123" + }, + "modelInfo": { + "modelType": "service", + "modelInvariantUuid": "d214abcc-2083-11e7-93ae-92361f002671", + "modelUuid": "c4503baa-2083-11e7-93ae-92361f002671", + "modelName": "MSOTADevInfra_vSAMP12_Service", + "modelVersion": "1.0" + }, + "subscriberInfo": { + "globalSubscriberId": "MSO_1610_dev", + "subscriberName": "MSO_1610_dev" + }, + "requestInfo": { + "instanceName": "bensServiceInstance3", + "source": "VID", + "suppressRollback": "true", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": { + "subscriptionServiceType": "MSO-dev-service-type", + "aLaCarte": "false", + "userParams": [] + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/schema.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/schema.json new file mode 100644 index 0000000000..36b51e9575 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/schema.json @@ -0,0 +1,16 @@ +{ + "CreateServiceInstanceV3": { + "serviceInstance": { + "@class": "inventory.aai.onap.org.v12.ServiceInstance" + }, + "project": { + "@class": "inventory.aai.onap.org.v12.Project" + }, + "owningEntity": { + "@class": "inventory.aai.onap.org.v12.OwningEntity" + }, + "customer": { + "@class": "inventory.aai.onap.org.v12.Customer" + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/sdncCallbackSoapWrapper.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/sdncCallbackSoapWrapper.xml index 0b1baf2cb4..3907f463be 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/sdncCallbackSoapWrapper.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/sdncCallbackSoapWrapper.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:v1="http://org.onap/workflow/sdnc/adapter/schema/v1"> <soapenv:Header /> <soapenv:Body> <SDNCAdapterCallbackRequest - xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> <CallbackHeader> <RequestId>SDNC_REQUEST_ID</RequestId> <ResponseCode>200</ResponseCode> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml index 7b5d22a1de..2c10f83b05 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp.mso/vnfNotify"> + xmlns:v1="http://org.onap.so/vnfNotify"> <soapenv:Header /> <soapenv:Body> - <ns2:createVnfNotification xmlns:ns2="http://org.openecomp.mso/vnfNotify"> + <ns2:createVnfNotification xmlns:ns2="http://org.onap.so/vnfNotify"> <messageId>edab9ec7-6cf8-47cf-b58c-9ba4ef5d3f70</messageId> <completed>true</completed> <vnfId>slcp34248vbc/020a112b-a0c8-4143-87a3-698680ba2efe</vnfId> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml index a4b0becee4..923ae70b4b 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp.mso/vnfNotify"> + xmlns:v1="http://org.onap.so/vnfNotify"> <soapenv:Header /> <soapenv:Body> - <ns2:deleteVnfNotification xmlns:ns2="http://org.openecomp.mso/vnfNotify" > + <ns2:deleteVnfNotification xmlns:ns2="http://org.onap.so/vnfNotify" > <messageId>f5e42814-72c0-4422-b840-e14e757a709b</messageId> <completed>true</completed> </ns2:deleteVnfNotification> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml index 3b99363ea8..290749bba0 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp.mso/vnfNotify"> + xmlns:v1="http://org.onap.so/vnfNotify"> <soapenv:Header /> <soapenv:Body> - <ns2:queryVnfNotification xmlns:ns2="http://org.openecomp.mso/vnfNotify"> + <ns2:queryVnfNotification xmlns:ns2="http://org.onap.so/vnfNotify"> <messageId>b1a82ce6-7f5c-45fd-9273-acaf88fc2222</messageId> <completed>true</completed> <vnfExists>true</vnfExists> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml index 4fd0b62610..554dc2cdc0 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp.mso/vnfNotify"> + xmlns:v1="http://org.onap.so/vnfNotify"> <soapenv:Header /> <soapenv:Body> - <ns2:rollbackVnfNotification xmlns:ns2="http://org.openecomp.mso/vnfNotify" > + <ns2:rollbackVnfNotification xmlns:ns2="http://org.onap.so/vnfNotify" > <messageId>b1a82ce6-7f5c-45fd-9273-acaf88fc2137</messageId> <completed>true</completed> </ns2:rollbackVnfNotification> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfadapter_request.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfadapter_request.xml new file mode 100644 index 0000000000..fb18d77ad7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfadapter_request.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> + <createVfModuleRequest> + <backout>true</backout> + <baseVfModuleId /> + <baseVfModuleStackId /> + <cloudSiteId>RegionOne</cloudSiteId> + <failIfExists>true</failIfExists> + <messageId>8892cffa-3514-45d4-b2b0-0fde9a96e323-1511813289000</messageId> + <modelCustomizationUuid>2badc305-b2c0-4e2b-b03a-4e5d22079b30</modelCustomizationUuid> + <msoRequest> + <requestId>8892cffa-3514-45d4-b2b0-0fde9a96e323</requestId> + <serviceInstanceId>5dad9aac-6e05-4bdb-a8ec-4f3cd718c5c6</serviceInstanceId> + </msoRequest> + <notificationUrl>http://localhost:18080/mso/WorkflowMessage/VNFAResponse/8892cffa-3514-45d4-b2b0-0fde9a96e323-1511813289000</notificationUrl> + <requestType /> + <skipAAI>true</skipAAI> + <synchronous>false</synchronous> + <tenantId>22eb191dd41a4f3c9be370fc638322f4</tenantId> + <vfModuleId>dbfad358-de02-4370-a0aa-c6651a5848b8</vfModuleId> + <vfModuleName>vRR-Internal-Network-L2</vfModuleName> + <vfModuleParams> + <aic_clli>MTJWNJA4LCP</aic_clli> + <availability_zone_0>nova</availability_zone_0> + <int_ctl_net_name_1>VRR-STMTN5MMSC20-INT1</int_ctl_net_name_1> + <int_ctl_net_name_2>VRR-STMTN5MMSC20-INT2</int_ctl_net_name_2> + <svc_provider_part_number>no</svc_provider_part_number> + <vnf_id>6d2e2469-8708-47c3-a0d4-73fa28a8a50b</vnf_id> + <vnf_name>STMTN5MMSC20</vnf_name> + <vrr_flavor_name>ns.c16r32d128.v1</vrr_flavor_name> + <vrr_image_name>MDT17</vrr_image_name> + <vrr_int_ctl_forwarding>12</vrr_int_ctl_forwarding> + <vrr_int_ctl_len_1>24</vrr_int_ctl_len_1> + <vrr_int_ctl_len_2>24</vrr_int_ctl_len_2> + </vfModuleParams> + <vfModuleType>Vrr_Internal_Networks_module-1</vfModuleType> + <vnfId>6d2e2469-8708-47c3-a0d4-73fa28a8a50b</vnfId> + <vnfType>STMTN5MMSC20</vnfType> + <vnfVersion>1.0</vnfVersion> + <volumeGroupId /> + <volumeGroupStackId /> + </createVfModuleRequest>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..715ddaa937 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml @@ -0,0 +1,223 @@ +aai: + auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + endpoint: http://localhost:${wiremock.server.port} +appc: + client: + key: iaEMAfjsVsZnraBP + response: + timeout: '120000' + secret: wcivUjsjXzmGFBfxMmyJu9dz + poolMembers: localhost + service: ueb + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: '120000' + write: APPC-TEST-AMDOCS1-DEV3 + sdnc: + read: SDNC-LCM-READ + write: SDNC-LCM-WRITE +log: + debug: + CompleteMsoProcess: 'true' + CreateNetworkInstanceInfra: 'true' + CreateServiceInstanceInfra: 'true' + DeleteNetworkInstanceInfra: 'true' + FalloutHandler: 'true' + UpdateNetworkInstanceInfra: 'true' + VnfAdapterRestV1: 'true' + sdncAdapter: 'true' + vnfAdapterCreateV1: 'true' + vnfAdapterRestV1: 'true' +mso: + adapters: + completemsoprocess: + endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess + db: + auth: 757A94191D685FD2092AC1490730A4FC + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + att-endpoint: http://localhost:${wiremock.server.port}/dbadapters/AttRequestsDbAdapter + spring: + endpoint: http://localhost:${wiremock.server.port} + network: + endpoint: http://localhost:${wiremock.server.port}/networks/NetworkAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/networks/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter/v1/sdnc + timeout: PT60S + tenant: + endpoint: http://localhost:${wiremock.server.port}/tenantAdapterMock + vnf: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapterAsync + workflow: + message: + endpoint: http://localhost:${wiremock.server.port}/workflows/messages/message + + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + + bpmn: + optimisticlockingexception: + retrycount: '3' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:${wiremock.server.port}/ + spring: + endpoint: http://localhost:${wiremock.server.port} + correlation: + timeout: 60 + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://org.onap.so + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + logPath: logs + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + po: + timeout: PT60S + request: + db: + endpoint: http://localhost:${wiremock.server.port}/ + rollback: 'true' + site-name: localDevEnv + workflow: + default: + aai: + cloud-region: + version: '9' + generic-vnf: + version: '9' + v8: + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + global: + default: + aai: + namespace: http://org.openecomp.aai.inventory/ + version: '8' + message: + endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage + notification: + name: GenericNotificationService + sdncadapter: + callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + delete: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + query: + callback: http://localhost:${wiremock.server.port}/mso/services/VNFAdapterQuerCallbackV1 + rollback: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + global: + dmaap: + username: dmaapUsername + password: dmaapPassword + host: http://localhost:${wiremock.server.port} + publisher: + topic: com.att.mso.asyncStatusUpdate + oof: + auth: test + timeout: PT10S + service: + agnostic: + endpoint: /api/oof/v1/placement + host: http://localhost:${wiremock.server.port} +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sdnc: + auth: Basic YWRtaW46YWRtaW4= + host: http://localhost:8446 + path: /restconf/operations/GENERIC-RESOURCE-API +sniro: + conductor: + enabled: true + host: http://localhost:${wiremock.server.port} + uri: /v1/release-orders + headers.auth: Basic dGVzdDp0ZXN0cHdk + manager: + timeout: PT30M + host: http://localhost:${wiremock.server.port} + uri.v1: /sniro/api/v2/placement + uri.v2: /sniro/api/placement/v2 + headers.auth: Basic dGVzdDp0ZXN0cHdk + headers.patchVersion: 1 + headers.minorVersion: 1 + headers.latestVersion: 2 + +spring: + datasource: + url: jdbc:mariadb://localhost:3307/camundabpmn + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + +mariaDB4j: + dataDir: + port: 3307 + databaseName: camundabpmn +camunda: + bpm: + metrics: + enabled: false + db-reporter-activate: false diff --git a/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml b/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml deleted file mode 100644 index e151aca5fd..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - - <bean id="processEngineConfiguration" class="org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration"> - - <property name="jdbcUrl" value="jdbc:h2:mem:camunda;DB_CLOSE_DELAY=1000" /> - <property name="jdbcDriver" value="org.h2.Driver" /> - <property name="jdbcUsername" value="sa" /> - <property name="jdbcPassword" value="" /> - - <!-- Database configurations --> - <property name="databaseSchemaUpdate" value="true" /> - - <!-- job executor configurations --> - <property name="jobExecutorActivate" value="true" /> - - <property name="history" value="full" /> - - <!--<property name="idGenerator" ref="uuidGenerator" />--> - - <!-- engine plugins --> - <property name="processEnginePlugins"> - <list> - <ref bean="connectProcessEnginePlugin" /> - <ref bean="spinProcessEnginePlugin" /> - <ref bean="loggingPlugin" /> - <ref bean="workflowExceptionPlugin" /> - </list> - </property> - </bean> - - <bean id="loggingPlugin" class="org.openecomp.mso.bpmn.core.plugins.LoggingAndURNMappingPlugin" /> - - <!-- Needed until all subflows generate MSOWorkflowException events --> - <bean id="workflowExceptionPlugin" class="org.openecomp.mso.bpmn.core.plugins.WorkflowExceptionPlugin" /> - - <!--<bean id="uuidGenerator" class="org.camunda.bpm.engine.impl.persistence.StrongUuidGenerator" />--> - - <!-- engine plugin beans --> - <bean id="connectProcessEnginePlugin" class="org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin" /> - <bean id="spinProcessEnginePlugin" class="org.camunda.spin.plugin.impl.SpinProcessEnginePlugin" /> - -</beans> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..d8f6ba3930 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml @@ -0,0 +1,30 @@ +<configuration > + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n + </pattern> + </encoder> + </appender> + + <logger name="AUDIT" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.error" level="ERROR" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + <root level="WARN"> + <appender-ref ref="STDOUT" /> + </root> + + <logger name="wiremock.org" level="DEBUG" /> + +</configuration>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logging.properties b/bpmn/MSOCommonBPMN/src/test/resources/logging.properties deleted file mode 100644 index 4941c55971..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/logging.properties +++ /dev/null @@ -1,2 +0,0 @@ -#register SLF4JBridgeHandler as handler for the j.u.l. root logger -handlers = org.slf4j.bridge.SLF4JBridgeHandler diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties deleted file mode 100644 index f800d00245..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Default BPMN properties for unit tests - -URNMapping.FileSystemLoading.Enabled=true
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties deleted file mode 100644 index 4b338aed0c..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties +++ /dev/null @@ -1,139 +0,0 @@ -# Default URN Mappings for unit tests - -mso.rollback=true - -canopi.auth=757A94191D685FD2092AC1490730A4FC -csi.aots.addincidentmanagement.endpoint=http://localhost:28090/AddIncidentManagementTicketRequest -csi.networkstatus.endpoint=http://localhost:28090/SendManagedNetworkStatusNotification -mso.csi.pwd=4EA237303511EFBBC37F17A351562131 -mso.csi.usrname=mso -mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7 - -mso.healthcheck.log.debug=false - -mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess - -mso.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter -mso.adapters.openecomp.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter -mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC - -mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter -mso.adapters.network.rest.endpoint=http://localhost:28090/networks/rest/v1/networks - -mso.adapters.po.auth=757A94191D685FD2092AC1490730A4FC -mso.adapters.po.password=3141634BF7E070AA289CF2892C986C0B -mso.po.timeout=PT60S -mso.default.adapter.namespace=http://org.openecomp.mso -mso.adapters.workflow.message.endpoint=http://localhost:28090/workflows/messages/message - -aai.auth=26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 - -policy.endpoint=https://mtanjvsgcvm02.nvp.cip.att.com:8081/pdp/api/ -policy.client.auth=Basic bTAzNzQzOnBvbGljeVIwY2sk -policy.auth=Basic dGVzdHBkcDphbHBoYTEyMw== -policy.environment=TEST - -appc.client.topic.read=APPC-TEST-AMDOCS2 -appc.client.topic.write=APPC-TEST-AMDOCS1-DEV3 -appc.client.topic.sdnc.read=SDNC-LCM-READ -appc.client.topic.sdnc.write=SDNC-LCM-WRITE -appc.client.topic.read.timeout=120000 -appc.client.response.timeout=120000 -appc.client.poolMembers=uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904 -appc.client.key=iaEMAfjsVsZnraBP -appc.client.secret=wcivUjsjXzmGFBfxMmyJu9dz -appc.client.service=ueb - -mso.adapters.sdnc.endpoint=http://localhost:28090/SDNCAdapter -mso.adapters.sdnc.rest.endpoint=http://localhost:28090/SDNCAdapter/v1/sdnc -mso.adapters.sdnc.timeout=PT60S -mso.sdnc.firewall.yang.model=http://com/openecomp/svc/mis/firewall-lite-gui -mso.sdnc.firewall.yang.model.version=2015-05-15 -mso.sdnc.password=3141634BF7E070AA289CF2892C986C0B -mso.sdnc.timeout.firewall.minutes=20 -mso.callbackRetryAttempts=5 -mso.sdnc.timeout=PT10S -mso.sdnc.timeout.ucpe.async.hours=120 -mso.sdnc.timeout.ucpe.async.minutes=5 -mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage -mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService - -mso.sniro.auth=test:testpwd -mso.sniro.timeout=PT30M -mso.sniro.policies.dhv.2vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1 -mso.sniro.policies.dhv.4vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.VNFPolicy_vvigprimary2_v1,SNIRO.VNFPolicy_vvigsecondary2_v1,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1 - -mso.service.agnostic.sniro.host=http://localhost:28090 -mso.service.agnostic.sniro.endpoint=/sniro/api/v2/placement - -mso.oof.auth=test:testpwd -mso.oof.endpoint=http://localhost:28090/api/oof/v1/placement -mso.oof.timeout=PT30M -mso.service.agnostic.oof.host=http://localhost:28090 -mso.service.agnostic.oof.endpoint=/api/oof/v1/placement - -mso.catalog.db.endpoint=http://localhost:28090/ - -ruby.create-ticket-request.dmaap.username=m04768@mso.ecomp.att.com -ruby.create-ticket-request.dmaap.password=eHQ1cUJrOUc -ruby.create-ticket-request.publisher.topic=com.att.pdas.st1.msoCMFallout-v1 - - -mso.adapters.tenant.endpoint=http://localhost:28090/tenantAdapterMock -mso.adapters.vnf-async.endpoint=http://localhost:28090/vnfs/VnfAdapterAsync -mso.adapters.vnf.endpoint=http://localhost:28090/vnfs/VnfAdapter -mso.adapters.vnf.rest.endpoint=http://localhost:28090/vnfs/rest/v1/vnfs -mso.workflow.vnfadapter.create.callback=http://localhost:28080/mso/vnfAdapterNotify -mso.workflow.vnfadapter.delete.callback=http://localhost:28080/mso/vnfAdapterNotify -mso.workflow.vnfadapter.query.callback=http://localhost:28080/mso/services/VNFAdapterQuerCallbackV1 -mso.workflow.vnfadapter.rollback.callback=http://localhost:28080/mso/vnfAdapterNotify -mso.workflow.createvce.delay.seconds=1 -mso.infra.customer.id=testCustIdInfra - -aai.endpoint=http://localhost:28090 - -# AAI version mappings - -# Example to override default version for a resource: -#mso.workflow.default.aai.vce.version=6 -#mso.workflow.default.aai.v6.vce.uri=/aai/v6/network/vces/vce -mso.workflow.global.default.aai.namespace=http://org.openecomp.aai.inventory/ -mso.workflow.global.default.aai.version=8 -mso.workflow.default.aai.cloud-region.version=9 -mso.workflow.default.aai.generic-vnf.version=9 - -mso.workflow.default.aai.v9.cloud-region.uri=/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic -mso.workflow.default.aai.v8.customer.uri=/aai/v8/business/customers/customer -mso.workflow.default.aai.v8.generic-query.uri=/aai/v8/search/generic-query -mso.workflow.default.aai.v9.generic-vnf.uri=/aai/v9/network/generic-vnfs/generic-vnf -mso.workflow.default.aai.v8.l3-network.uri=/aai/v8/network/l3-networks/l3-network -mso.workflow.default.aai.v8.network-policy.uri=/aai/v8/network/network-policies/network-policy -mso.workflow.default.aai.v8.nodes-query.uri=/aai/v8/search/nodes-query -mso.workflow.default.aai.v8.route-table-reference.uri=/aai/v8/network/route-table-references/route-table-reference -mso.workflow.default.aai.v8.tenant.uri=/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant -mso.workflow.default.aai.v8.vce.uri=/aai/v8/network/vces/vce -mso.workflow.default.aai.v8.vpn-binding.uri=/aai/v8/network/vpn-bindings/vpn-binding -mso.workflow.notification.name=GenericNotificationService -mso.bpmn.optimisticlockingexception.retrycount=3 - -log.debug.CompleteMsoProcess=true -log.debug.CreateNetworkInstanceInfra=true -log.debug.CreateServiceInstanceInfra=true -log.debug.DeleteNetworkInstanceInfra=true -log.debug.FalloutHandler=true -log.debug.GenericGetService=true -log.debug.sdncAdapter=true -log.debug.UpdateNetworkInstanceInfra=true -log.debug.VnfAdapterRestV1=true -log.debug.GenericGetNetwork=true -log.debug.GenericGetVnf=true -log.debug.GenericDeleteService=true -log.debug.GenericDeleteNetwork=true -log.debug.GenericDeleteVnf=true -log.debug.vnfAdapterCreateV1=true -log.debug.vnfAdapterRestV1=true - -sdno.health-check.dmaap.username=m04768@mso.ecomp.att.com -sdno.health-check.dmaap.password=eHQ1cUJrOUc -sdno.health-check.dmaap.subscriber.topic=com.att.sdno.test-health-diagnostic-v02 -sdno.health-check.dmaap.publisher.topic=com.att.sdno.test-health-diagnostic-v02 diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.properties deleted file mode 100644 index 2428b512b1..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/mso.properties +++ /dev/null @@ -1,42 +0,0 @@ -### -# ============LICENSE_START======================================================= -# ECOMP MSO -# ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -### - -### SDNCURL -### -#EE# -org.openecomp.mso.adapters.sdnc.sdncgeturl=https://localhost:8443/restconf/config/L3SDN-API: -org.openecomp.mso.adapters.sdnc.sdncposturl=https://localhost:8443/restconf/operations/L3SDN-API: -### -### BPEL ASYNC CALLLBACK/NOTIFICATION URL -### -#EE# -org.openecomp.mso.adapters.sdnc.bpelurl=http://localhost:8080/active-bpel/services/SDNCAdapterCallbackV1 -### -### SDNC ASYNC NOTIFICATION/RESPONSE URL -### -#EE# -org.openecomp.mso.adapters.sdnc.myurl=https://localhost:8443/adapters/rest/SDNCNotify -### -org.openecomp.mso.adapters.sdnc.sdncauth=admin:admin -org.openecomp.mso.adapters.sdnc.bpelauth=avosAdmin:jboss123 -org.openecomp.mso.adapters.sdnc.sdncconnecttime=2000 -org.openecomp.mso.adapters.sdnc.sdncreadtime=5000 - -org.openecomp.mso.adapters.sdnc...query=toto diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.sdnc.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.sdnc.properties deleted file mode 100644 index f53e2d2b65..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/mso.sdnc.properties +++ /dev/null @@ -1,152 +0,0 @@ -#MSO SDNCA Properties go here -### -### UNIQUE SDNCURLs for Requests supported by SDNCA. URLS have unique tags eg a format like sdncurlXY (XY is unique eg digits) -### -org.openecomp.mso.adapters.sdnc.sdncurl1=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/L3SDN-API: -org.openecomp.mso.adapters.sdnc.sdncurl2=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/config/L3SDN-API: -org.openecomp.mso.adapters.sdnc.sdncurl3=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/AicHoming: -org.openecomp.mso.adapters.sdnc.sdncurl4=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/Firewall-API: -org.openecomp.mso.adapters.sdnc.sdncurl5=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/config -org.openecomp.mso.adapters.sdnc.sdncurl6=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/VNF-API: -org.openecomp.mso.adapters.sdnc.sdncurl7=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/L3UCPE-API: -org.openecomp.mso.adapters.sdnc.sdncurl8=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/NBNC-API: -org.openecomp.mso.adapters.sdnc.sdncurl9=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/NORTHBOUND-API:service-topology-operation -org.openecomp.mso.adapters.sdnc.sdncurl10=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/GENERIC-RESOURCE-API: -org.openecomp.mso.adapters.sdnc.sdncurl11=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/VNFTOPOLOGYAIC-API: -org.openecomp.mso.adapters.sdnc.sdncurl12=https://sdncodl.it.us.03.aic.cip.att.com:8443/ -org.openecomp.mso.adapters.sdnc.sdncurl13=http://mtznjv1fcbc01.kvm.cip.att.com:8181/restconf/operations/SDNW-API: -#org.openecomp.mso.adapters.sdnc.sdncurl14=http://txcdtl01bb2697.itservices.sbc.com:8181/restconf/operations/GENERIC-RESOURCE-API:port-mirror-topology-operation -org.openecomp.mso.adapters.sdnc.sdncurl14=http://mtanjv9sdbc51-eth1-0.aic.cip.att.com:8443/restconf/operations/GENERIC-RESOURCE-API: -### BPEL ASYNC CALLBACK/NOTIFICATION URL -### -org.openecomp.mso.adapters.sdnc.bpelurl=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080/mso/SDNCAdapterCallbackService -org.openecomp.mso.adapters.sdnc.rest.bpelurl=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080/mso/WorkflowMessage -### -### SDNC ASYNC NOTIFICATION/RESPONSE URL -### -org.openecomp.mso.adapters.sdnc.myurl=http://mtanjv9moja02-eth1-0.aic.cip.att.com:8080/adapters/rest/SDNCNotify -### Production value diff from other servers -org.openecomp.mso.adapters.sdnc.sdncauth=406B2AE613211B6FB52466DE6E1769AC -org.openecomp.mso.adapters.sdnc.bpelauth=F8E9452B55DDE4CCE77547B0E748105C54CF5EF1351B4E2CBAABF2981EFE776D -org.openecomp.mso.adapters.sdnc.sdncconnecttime=5000 -### -### Distinct Requests Supported by SDNCA. sdncurls added on top of file. fields may be null eg msoaction,operation resulting in .. construct -### -###org.openecomp.mso.adapters.sdnc.MSOACTION.OPERATION.ACTION=METHOD|TIMEOUT|URL|HEADERNAME|NAMESPACE -### -org.openecomp.mso.adapters.sdnc..service-homing-operation.homing=POST|60000|sdncurl3|sdnc-homing-header|com:att:sdnctl:aicHoming -org.openecomp.mso.adapters.sdnc.infra..query=GET|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc.mobility..query=GET|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc.vfmodule..query=GET|60000|sdncurl12| -org.openecomp.mso.adapters.sdnc...query=GET|60000|sdncurl2| -org.openecomp.mso.adapters.sdnc...put=PUT|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc...restdelete=DELETE|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc.gammainternet.svc-topology-operation.assign=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.svc-topology-operation.delete=POST|250000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.reserve=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.activate=POST|90000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.delete=POST|250000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.turnup=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.changereserve=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.changedelete=POST|250000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.changeactivate=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc..feature-configuration-operation.activate=POST|60000|sdncurl4|sdnc-feature-request-header|com:att:sdnctl:firewallapi -org.openecomp.mso.adapters.sdnc..feature-configuration-operation.changeactivate=POST|60000|sdncurl4|sdnc-feature-request-header|com:att:sdnctl:firewallapi -org.openecomp.mso.adapters.sdnc..feature-configuration-operation.delete=POST|60000|sdncurl4|sdnc-feature-request-header|com:att:sdnctl:firewallapi -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.assign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.activate=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.rollback=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.delete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.changeassign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.changedelete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.reserve=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.assign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.activate=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.rollback=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.delete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.changeassign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.changedelete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.prepare=POST|360000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.activate=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.delete=POST|360000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.complete=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.activatevnf=POST|600000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.designvnf=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.removevnf=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc..svc-topology-operation.assign=POST|285000|sdncurl8|sdnc-request-header|com:att:sdnctl:nbncapi -org.openecomp.mso.adapters.sdnc..svc-topology-operation.activate=POST|285000|sdncurl8|sdnc-request-header|com:att:sdnctl:nbncapi -org.openecomp.mso.adapters.sdnc..svc-topology-operation.delete=POST|285000|sdncurl8|sdnc-request-header|com:att:sdnctl:nbncapi - -org.openecomp.mso.adapters.sdnc.service.ucpe.service-topology-assign-operation=POST|120000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe.service-topology-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-stage-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-remove-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.dhv.service-topology-assign-operation=POST|120000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.infra.service-topology-infra-assign-operation=POST|120000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.infra.service-topology-infra-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhnportal.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhnportal.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhngw.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhngw.service-topology-infra-register-vnf-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhngw.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vvig.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vvig.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.pe.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.pe.service-topology-cust-stage-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.pe.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 - -org.openecomp.mso.adapters.sdnc..service-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..service-topology-operation.rollback=POST|270000|sdncur10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..service-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..service-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.rollback=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.changeassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.changedelete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.rollback=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.changeassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.changedelete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.create=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.create=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource - -org.openecomp.mso.adapters.sdnc..vnf-topology-aic-operation.assign=POST|270000|sdncurl11|sdnc-request-header|com:att:sdnctl:vnftopologyaic -org.openecomp.mso.adapters.sdnc..vnf-topology-aic-operation.activate=POST|270000|sdncurl11|sdnc-request-header|com:att:sdnctl:vnftopologyaic - -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.assign=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.rollback=POST|270000|sdncur13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.delete=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.deactivate=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.activate=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource - -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.enable=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.disable=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource - diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/avpn/dmaap/avpnDmaapAsyncRequestStatus.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/avpn/dmaap/avpnDmaapAsyncRequestStatus.json new file mode 100644 index 0000000000..e9172c5ba0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/avpn/dmaap/avpnDmaapAsyncRequestStatus.json @@ -0,0 +1,21 @@ +{ + "asyncRequestStatus" : { + "requestId" : "rq1234d1-5a33-55df-13ab-12abad84e331", + "clientSource" : "SPP", + "correlator" : "myClientId123", + "instanceReferences" : { + "serviceInstanceId" : "bc305d54-75b4-431b-adb2-eb6b9e546014" + }, + "startTime" : "2017-11-17T09:30:47Z", + "finishTime" : "2017-11-17T09:30:47Z", + "requestScope" : "service", + "requestType" : "createInstance", + "requestStatus" : { + "timestamp" : "2017-11-17T09:30:47Z", + "requestState" : "COMPLETE", + "statusMessage" : "Success", + "percentProgress" : "100", + "wasRolledBack" : true + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/ruby/create-ticket/create-ticket-request.json index e388d3e9ad..e388d3e9ad 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/ruby/create-ticket/create-ticket-request.json diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json index b9ad7a1f94..8c3ca1938d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json @@ -1,26 +1,26 @@ -{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000004",
- "operation-type": "lport_mirroring_check",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- },
- {
- "key": "interface-id",
- "value": "test-interface-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
+{ + "body": { + "input": { + "request-hd-custom": { + "request-client-name": "MSO", + "request-user-id": "test-user", + "request-id": "test-request-id", + "health-diagnostic-code": "VROUTER000004", + "operation-type": "lport_mirroring_check", + "aai-param-list": [ + { + "key": "configuration-id", + "value": "test-configuration-id" + }, + { + "key": "interface-id", + "value": "test-interface-id" + } + ] + } + } + }, + "operation": "health-diagnostic-custom", + "nodeLoc": "test-clli", + "nodeType": "VROUTER" }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json index ee28da86b9..08220abe2d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json @@ -1,26 +1,26 @@ -{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000003",
- "operation-type": "lport_mirroring_check",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- },
- {
- "key": "interface-id",
- "value": "test-interface-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
+{ + "body": { + "input": { + "request-hd-custom": { + "request-client-name": "MSO", + "request-user-id": "test-user", + "request-id": "test-request-id", + "health-diagnostic-code": "VROUTER000003", + "operation-type": "lport_mirroring_check", + "aai-param-list": [ + { + "key": "configuration-id", + "value": "test-configuration-id" + }, + { + "key": "interface-id", + "value": "test-interface-id" + } + ] + } + } + }, + "operation": "health-diagnostic-custom", + "nodeLoc": "test-clli", + "nodeType": "VROUTER" }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json index 95746ec3f9..834fcc8e72 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json @@ -1,22 +1,22 @@ -{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000004",
- "operation-type": "mirroring_check",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
+{ + "body": { + "input": { + "request-hd-custom": { + "request-client-name": "MSO", + "request-user-id": "test-user", + "request-id": "test-request-id", + "health-diagnostic-code": "VROUTER000004", + "operation-type": "mirroring_check", + "aai-param-list": [ + { + "key": "configuration-id", + "value": "test-configuration-id" + } + ] + } + } + }, + "operation": "health-diagnostic-custom", + "nodeLoc": "test-clli", + "nodeType": "VROUTER" }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json index 19d934d291..19d934d291 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-failure.json index 15160b9dd9..8cf0a820cd 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-failure.json @@ -8,7 +8,7 @@ "response-id": "191bf423-8473-4f7c-9fbb-e5dcbb40a12b", "remote_end_time": "2017-10-13T14:51:53.490+0000", "response-client-name": "MSO", - "user_id": "md5621", + "user_id": "xxxxxx", "remote_start_time": "2017-10-13T14:51:53.173+0000", "error-message": "my error message", "connection-failure-msg": "SDNO was unable to connect to an Ansible REST API server; Please ensure Ansible REST server is running" diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-success.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-success.json index a6794327d8..a6794327d8 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/output-success.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/output-success.json diff --git a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/response.json b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/response.json index 2355e86938..2355e86938 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/org/openecomp/mso/client/sdno/response.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/org/onap/so/client/sdno/response.json diff --git a/bpmn/MSOCommonBPMN/src/test/resources/response/clientServiceResponse.json b/bpmn/MSOCommonBPMN/src/test/resources/response/clientServiceResponse.json new file mode 100644 index 0000000000..0259e2f7fe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/response/clientServiceResponse.json @@ -0,0 +1,105 @@ +{ + "version": null, + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "description": "MSO aLaCarte Vfmodule with addon", + "modelUUID": "5df8b6de-2083-11e7-93ae-92361f002672", + "modelInvariantUUID": "9647dfc4-2083-11e7-93ae-92361f002671", + "created": 1492191759000, + "modelVersion": "2.0", + "serviceType": "NA", + "serviceRole": "NA", + "environmentContext": "Luna", + "workloadContext": "Oxygen", + "networkCustomizations": [ + { + "modelCustomizationUUID": "3bdbb104-476c-483e-9f8b-c095b3d308ac", + "modelInstanceName": "CONTRAIL30_GNDIRECT 9", + "created": 1484703305000, + "networkTechnology": "", + "networkType": "", + "networkScope": "", + "networkRole": "", + "networkResource": null, + "handler": { + + } + } + ], + "vnfCustomizations": [ + { + "version": null, + "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002672", + "modelInstanceName": "vSAMP10a 2", + "created": "2017-04-14 21:46:28.000", + "minInstances": 0, + "maxInstances": 0, + "availabilityZoneMaxCount": 0, + "nfFunction": "vSAMP", + "nfType": "vSAMP", + "nfRole": "vSAMP", + "nfNamingCode": "vSAMP", + "multiStageDesign": null, + "vnfResources": null, + "vfModuleCustomizations": [ + { + "modelCustomizationUUID": "cb82ffd8-252a-11e7-93ae-92361f002672", + "label": "base", + "minInstances": 0, + "maxInstances": 0, + "initialCount": 1, + "availabilityZoneCount": 0, + "created": "2016-09-14 18:19:56.000", + "volumeHeatEnv": null, + "heatEnvironment": null, + "vfModule": null + }, + { + "modelCustomizationUUID": "b4ea86b4-253f-11e7-93ae-92361f002672", + "label": "PCM", + "minInstances": 0, + "maxInstances": 0, + "initialCount": 0, + "availabilityZoneCount": 0, + "created": "2016-09-14 18:19:56.000", + "volumeHeatEnv": null, + "heatEnvironment": null, + "vfModule": null + } + ], + "handler": { + + }, + "vnfResource": null, + "creationTimestamp": 1492206388000 + } + ], + "allottedCustomizations": [ + { + "version": null, + "modelCustomizationUUID": null, + "created": 1484946860000, + "modelInstanceName": "Sec_Tunnel_Xconn 11", + "providingServiceModelInvariantUUID": null, + "providingServiceModelUUID": null, + "providingServiceModelName": null, + "targetNetworkRole": null, + "nfFunction": null, + "nfType": null, + "nfRole": null, + "nfNamingCode": null, + "minInstances": null, + "maxInstances": null, + "allottedResource": null, + "handler": { + + } + } + ], + "recipes": { + + }, + "csar": null, + "handler": { + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json b/bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json new file mode 100644 index 0000000000..9cc84f2cd4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/response/infraActiveRequestsResponse.json @@ -0,0 +1,46 @@ +{ + "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017", + "clientRequestId": "00032ab7-3fb3-42e5-965d-8ea592502016", + "action": "deleteInstance", + "requestStatus": "COMPLETE", + "statusMessage": "Vf Module has been deleted successfully.", + "progress": 100, + "startTime": 1482451194000, + "endTime": 1482451228000, + "source": "VID", + "vnfId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vnfName": null, + "vnfType": null, + "serviceType": null, + "aicNodeClli": null, + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "provStatus": null, + "vnfParams": null, + "vnfOutputs": null, + "requestBody": "{\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"vSAMP10aDEV::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"mtn6\"}}", + "responseBody": null, + "lastModifiedBy": "BPMN", + "modifyTime": 1482451228000, + "requestType": null, + "volumeGroupId": null, + "volumeGroupName": null, + "vfModuleId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992", + "vfModuleName": null, + "vfModuleModelName": "vSAMP10aDEV::base::module-0", + "aaiServiceId": null, + "aicCloudRegion": "mtn6", + "callBackUrl": null, + "correlator": null, + "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "serviceInstanceName": null, + "requestScope": "vfModule", + "requestAction": "deleteInstance", + "networkId": null, + "networkName": null, + "networkType": null, + "requestorId": null, + "configurationId": null, + "configurationName": null, + "operationalEnvId": null, + "operationalEnvName": null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/schema.sql b/bpmn/MSOCommonBPMN/src/test/resources/schema.sql new file mode 100644 index 0000000000..7a15e84662 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/schema.sql @@ -0,0 +1,1188 @@ + +USE `camundabpmn`; + + +create table ACT_GE_PROPERTY ( + NAME_ varchar(64), + VALUE_ varchar(300), + REV_ integer, + primary key (NAME_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create table ACT_GE_BYTEARRAY ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + BYTES_ LONGBLOB, + GENERATED_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_DEPLOYMENT ( + ID_ varchar(64), + NAME_ varchar(255), + DEPLOY_TIME_ timestamp(3), + SOURCE_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXECUTION ( + ID_ varchar(64), + REV_ integer, + PROC_INST_ID_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + SUPER_EXEC_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + IS_ACTIVE_ TINYINT, + IS_CONCURRENT_ TINYINT, + IS_SCOPE_ TINYINT, + IS_EVENT_SCOPE_ TINYINT, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOB ( + ID_ varchar(64) NOT NULL, + REV_ integer, + TYPE_ varchar(255) NOT NULL, + LOCK_EXP_TIME_ timestamp(3) NULL, + LOCK_OWNER_ varchar(255), + EXCLUSIVE_ boolean, + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + RETRIES_ integer, + EXCEPTION_STACK_ID_ varchar(64), + EXCEPTION_MSG_ varchar(4000), + DUEDATE_ timestamp(3) NULL, + REPEAT_ varchar(255), + HANDLER_TYPE_ varchar(255), + HANDLER_CFG_ varchar(4000), + DEPLOYMENT_ID_ varchar(64), + SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, + JOB_DEF_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOBDEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + JOB_TYPE_ varchar(255) NOT NULL, + JOB_CONFIGURATION_ varchar(255), + SUSPENSION_STATE_ integer, + JOB_PRIORITY_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_PROCDEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + HAS_START_FORM_KEY_ TINYINT, + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + VERSION_TAG_ varchar(64), + HISTORY_TTL_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_TASK ( + ID_ varchar(64), + REV_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + TASK_DEF_KEY_ varchar(255), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + DELEGATION_ varchar(64), + PRIORITY_ integer, + CREATE_TIME_ timestamp(3), + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_IDENTITYLINK ( + ID_ varchar(64), + REV_ integer, + GROUP_ID_ varchar(255), + TYPE_ varchar(255), + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_VARIABLE ( + ID_ varchar(64) not null, + REV_ integer, + TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + TASK_ID_ varchar(64), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + VAR_SCOPE_ varchar(64) not null, + SEQUENCE_COUNTER_ bigint, + IS_CONCURRENT_LOCAL_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EVENT_SUBSCR ( + ID_ varchar(64) not null, + REV_ integer, + EVENT_TYPE_ varchar(255) not null, + EVENT_NAME_ varchar(255), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + CONFIGURATION_ varchar(255), + CREATED_ timestamp(3) not null, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_INCIDENT ( + ID_ varchar(64) not null, + REV_ integer not null, + INCIDENT_TIMESTAMP_ timestamp(3) not null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_AUTHORIZATION ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ integer not null, + GROUP_ID_ varchar(255), + USER_ID_ varchar(255), + RESOURCE_TYPE_ integer not null, + RESOURCE_ID_ varchar(255), + PERMS_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_FILTER ( + ID_ varchar(64) not null, + REV_ integer not null, + RESOURCE_TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + OWNER_ varchar(255), + QUERY_ LONGTEXT not null, + PROPERTIES_ LONGTEXT, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_METER_LOG ( + ID_ varchar(64) not null, + NAME_ varchar(64) not null, + REPORTER_ varchar(255), + VALUE_ bigint, + TIMESTAMP_ timestamp(3), + MILLISECONDS_ bigint DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + LOCK_EXP_TIME_ timestamp(3) NULL, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + TENANT_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); +create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); +create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); +create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); +create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); +create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); +create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); +create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); +-- CAM-5914 +create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_); +-- this index needs to be limited in mariadb see CAM-6938 +create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155)); +create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); + +-- new metric milliseconds column +CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_); + +-- old metric timestamp column +CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_); +CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_); + +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); +create index ACT_IDX_EXT_TASK_ERR_DETAILS ON ACT_RU_EXT_TASK(ERROR_DETAILS_ID_); +create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_); +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); + +alter table ACT_GE_BYTEARRAY + add constraint ACT_FK_BYTEARR_DEPL + foreign key (DEPLOYMENT_ID_) + references ACT_RE_DEPLOYMENT (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_SUPER + foreign key (SUPER_EXEC_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_TSKASS_TASK + foreign key (TASK_ID_) + references ACT_RU_TASK (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_ATHRZ_PROCEDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_BYTEARRAY + foreign key (BYTEARRAY_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_JOB + add constraint ACT_FK_JOB_EXCEPTION + foreign key (EXCEPTION_STACK_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_EVENT_SUBSCR + add constraint ACT_FK_EVENT_EXEC + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_CAUSE + foreign key (CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_RCAUSE + foreign key (ROOT_CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_ERROR_DETAILS + foreign key (ERROR_DETAILS_ID_) + references ACT_GE_BYTEARRAY (ID_); + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_USER + unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_GROUP + unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_UNIQ_VARIABLE + unique (VAR_SCOPE_, NAME_); + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +-- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- +create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); +create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); +create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); +create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); +create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); +-- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- +create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); +-- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- +create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); + +-- indexes to improve deployment +create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); +create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); +create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); +create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); +create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); +create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); +create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); +-- create case definition table -- +create table ACT_RE_CASE_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + HISTORY_TTL_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case execution table -- +create table ACT_RU_CASE_EXECUTION ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + SUPER_EXEC_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + ACT_ID_ varchar(255), + PREV_STATE_ integer, + CURRENT_STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case sentry part table -- + +create table ACT_RU_CASE_SENTRY_PART ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + CASE_EXEC_ID_ varchar(64), + SENTRY_ID_ varchar(255), + TYPE_ varchar(255), + SOURCE_CASE_EXEC_ID_ varchar(64), + STANDARD_EVENT_ varchar(255), + SOURCE_ varchar(255), + VARIABLE_EVENT_ varchar(255), + VARIABLE_NAME_ varchar(255), + SATISFIED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create index on business key -- +create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); + +-- create foreign key constraints on ACT_RU_CASE_EXECUTION -- +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade; + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_VARIABLE -- +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +-- create foreign key constraints on ACT_RU_TASK -- +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_EXEC + foreign key (CASE_EXEC_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + HISTORY_TTL_ integer, + VERSION_TAG_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create decision requirements definition table -- +create table ACT_RE_DECISION_REQ_DEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_RE_DECISION_DEF + add constraint ACT_FK_DEC_REQ + foreign key (DEC_REQ_ID_) + references ACT_RE_DECISION_REQ_DEF(ID_); + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); +create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_); +create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_); +create table ACT_HI_PROCINST ( + ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + START_USER_ID_ varchar(255), + START_ACT_ID_ varchar(255), + END_ACT_ID_ varchar(255), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + SUPER_CASE_INSTANCE_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(64), + STATE_ varchar(255), + primary key (ID_), + unique (PROC_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + EXECUTION_ID_ varchar(64) not null, + ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + ACT_NAME_ varchar(255), + ACT_TYPE_ varchar(255) not null, + ASSIGNEE_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + ACT_INST_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_TASKINST ( + ID_ varchar(64) not null, + TASK_DEF_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + DELETE_REASON_ varchar(4000), + PRIORITY_ integer, + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_VARINST ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(100), + REV_ integer, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + STATE_ varchar(20), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_DETAIL ( + ID_ varchar(64) not null, + TYPE_ varchar(255) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + VAR_INST_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(255), + REV_ integer, + TIME_ datetime(3) not null, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + OPERATION_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_COMMENT ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TIME_ datetime(3) not null, + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTION_ varchar(255), + MESSAGE_ varchar(4000), + FULL_MSG_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ATTACHMENT ( + ID_ varchar(64) not null, + REV_ integer, + USER_ID_ varchar(255), + NAME_ varchar(255), + DESCRIPTION_ varchar(4000), + TYPE_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + URL_ varchar(4000), + CONTENT_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_OP_LOG ( + ID_ varchar(64) not null, + DEPLOYMENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + JOB_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + BATCH_ID_ varchar(64), + USER_ID_ varchar(255), + TIMESTAMP_ timestamp(3) not null, + OPERATION_TYPE_ varchar(64), + OPERATION_ID_ varchar(64), + ENTITY_TYPE_ varchar(30), + PROPERTY_ varchar(64), + ORG_VALUE_ varchar(4000), + NEW_VALUE_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_INCIDENT ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CREATE_TIME_ timestamp(3) not null, + END_TIME_ timestamp(3) null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + ACTIVITY_ID_ varchar(255), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + INCIDENT_STATE_ integer, + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_JOB_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + JOB_ID_ varchar(64) not null, + JOB_DUEDATE_ timestamp(3) NULL, + JOB_RETRIES_ integer, + JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, + JOB_EXCEPTION_MSG_ varchar(4000), + JOB_EXCEPTION_STACK_ID_ varchar(64), + JOB_STATE_ integer, + JOB_DEF_ID_ varchar(64), + JOB_DEF_TYPE_ varchar(255), + JOB_DEF_CONFIGURATION_ varchar(255), + ACT_ID_ varchar(255), + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_EXT_TASK_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + EXT_TASK_ID_ varchar(64) not null, + RETRIES_ integer, + TOPIC_NAME_ varchar(255), + WORKER_ID_ varchar(255), + PRIORITY_ bigint NOT NULL DEFAULT 0, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + STATE_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); +create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); +create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); +create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); +create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_TASKINST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_); +create index ACT_IDX_HI_TASKINSTID_PROCINST on ACT_HI_TASKINST(ID_,PROC_INST_ID_); + +create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); +create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); +create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); +create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); +create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); +create index ACT_IDX_HI_DETAIL_BYTEAR on ACT_HI_DETAIL(BYTEARRAY_ID_); + +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); +create index ACT_IDX_HI_IDENT_LINK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); + +create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); +create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); +create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_VARINST_BYTEAR on ACT_HI_VARINST(BYTEARRAY_ID_); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); +create index ACT_IDX_HI_INCIDENT_PROCINST on ACT_HI_INCIDENT(PROC_INST_ID_); + +create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); +create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); +create index ACT_IDX_HI_JOB_LOG_EX_STACK on ACT_HI_JOB_LOG(JOB_EXCEPTION_STACK_ID_); + +create index ACT_HI_EXT_TASK_LOG_PROCINST on ACT_HI_EXT_TASK_LOG(PROC_INST_ID_); +create index ACT_HI_EXT_TASK_LOG_PROCDEF on ACT_HI_EXT_TASK_LOG(PROC_DEF_ID_); +create index ACT_HI_EXT_TASK_LOG_PROC_DEF_KEY on ACT_HI_EXT_TASK_LOG(PROC_DEF_KEY_); +create index ACT_HI_EXT_TASK_LOG_TENANT_ID on ACT_HI_EXT_TASK_LOG(TENANT_ID_); +create index ACT_IDX_HI_EXTTASKLOG_ERRORDET on ACT_HI_EXT_TASK_LOG(ERROR_DETAILS_ID_); + +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); + +create index ACT_IDX_HI_COMMENT_TASK on ACT_HI_COMMENT(TASK_ID_); +create index ACT_IDX_HI_COMMENT_PROCINST on ACT_HI_COMMENT(PROC_INST_ID_); + +create index ACT_IDX_HI_ATTACHMENT_CONTENT on ACT_HI_ATTACHMENT(CONTENT_ID_); +create index ACT_IDX_HI_ATTACHMENT_PROCINST on ACT_HI_ATTACHMENT(PROC_INST_ID_); +create index ACT_IDX_HI_ATTACHMENT_TASK on ACT_HI_ATTACHMENT(TASK_ID_); +create table ACT_HI_CASEINST ( + ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64) not null, + CREATE_TIME_ datetime(3) not null, + CLOSE_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + CREATE_USER_ID_ varchar(255), + SUPER_CASE_INSTANCE_ID_ varchar(64), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_), + unique (CASE_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_CASEACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + CASE_ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + CASE_ACT_NAME_ varchar(255), + CASE_ACT_TYPE_ varchar(255), + CREATE_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); +create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); +create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); +create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); +create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_); +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ datetime(3) not null, + COLLECT_VALUE_ double, + USER_ID_ varchar(255), + ROOT_DEC_INST_ID_ varchar(64), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64), + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); +create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_); + + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); + +-- mariadb_identity_7.8.0-ee + +create table ACT_ID_GROUP ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + TYPE_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_MEMBERSHIP ( + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (USER_ID_, GROUP_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_USER ( + ID_ varchar(64), + REV_ integer, + FIRST_ varchar(255), + LAST_ varchar(255), + EMAIL_ varchar(255), + PWD_ varchar(255), + SALT_ varchar(255), + PICTURE_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_INFO ( + ID_ varchar(64), + REV_ integer, + USER_ID_ varchar(64), + TYPE_ varchar(64), + KEY_ varchar(255), + VALUE_ varchar(255), + PASSWORD_ LONGBLOB, + PARENT_ID_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml index 136917c5ff..24b7988db1 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml @@ -1 +1 @@ -<SDNCAdapterCallbackRequest xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1"><CallbackHeader><RequestId>1a152f97-566e-4f22-b17b-761f807bfedc</RequestId><ResponseCode>404</ResponseCode><ResponseMessage>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.]</ResponseMessage></CallbackHeader></SDNCAdapterCallbackRequest>
\ No newline at end of file +<SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"><CallbackHeader><RequestId>1a152f97-566e-4f22-b17b-761f807bfedc</RequestId><ResponseCode>404</ResponseCode><ResponseMessage>Error processing request to SDNC. Not Found. https://localhost: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.]</ResponseMessage></CallbackHeader></SDNCAdapterCallbackRequest>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml index c8a2e30282..6e4f4160ec 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml @@ -1,212 +1,212 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<sdncadapterworkflow:SDNCAdapterWorkflowResponse
- xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
- <sdncadapterworkflow:response-data>
- <tag0:RequestData
- xmlns:tag0="http://org.openecomp/workflow/sdnc/adapter/schema/v1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
- <output xmlns="com:att:sdnctl:nbncapi">
- <ack-final-indicator>Y</ack-final-indicator>
- <svc-request-id>SK-2016-10-22-001</svc-request-id>
- <nbnc-response-information>
- <response-info>
- <result>SUCCESS</result>
- <aai-status>ERROR</aai-status>
- </response-info>
- <virtual-datacenter-list>
- <vdc-id>15001417</vdc-id>
- <router-list>
- <router-name>ALPRTR2</router-name>
- <ipe-loopback-address>1.1.1.2</ipe-loopback-address>
- <vlan-list>
- <vlan-id>1255.ae81</vlan-id>
- <border-element-type>VDBE</border-element-type>
- <border-element-tangibility>VIRTUAL</border-element-tangibility>
- <port-id></port-id>
- <border-element-id>ALPVDBE1</border-element-id>
- <border-element-v4-subnet>3.1.1.0/22</border-element-v4-subnet>
- <lag-id>ae81</lag-id>
- <border-element-v6-subnet>3:1:1::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>1995.ae81</vlan-id>
- <border-element-type>ASBG</border-element-type>
- <border-element-tangibility>VIRTUAL</border-element-tangibility>
- <port-id></port-id>
- <border-element-id>ALPASBG1</border-element-id>
- <border-element-v4-subnet>3.1.1.0/22</border-element-v4-subnet>
- <lag-id>ae81</lag-id>
- <border-element-v6-subnet>3:1:1::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>85.xe-10/0/2</vlan-id>
- <border-element-type>BGF2</border-element-type>
- <border-element-tangibility>PHYSICAL</border-element-tangibility>
- <port-id>xe-10/0/2</port-id>
- <border-element-id>ALPBGF2</border-element-id>
- <border-element-v4-subnet>3.1.2.0/22</border-element-v4-subnet>
- <lag-id></lag-id>
- <border-element-v6-subnet>3:1:2::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>85.xe-10/0/1</vlan-id>
- <border-element-type>BGF1</border-element-type>
- <border-element-tangibility>PHYSICAL</border-element-tangibility>
- <port-id>xe-10/0/1</port-id>
- <border-element-id>ALPBGF1</border-element-id>
- <border-element-v4-subnet>3.1.2.0/22</border-element-v4-subnet>
- <lag-id></lag-id>
- <border-element-v6-subnet>3:1:2::0/22</border-element-v6-subnet>
- </vlan-list>
- <ipe-id>2</ipe-id>
- </router-list>
- <router-list>
- <router-name>ALPRTR1</router-name>
- <ipe-loopback-address>1.1.1.1</ipe-loopback-address>
- <vlan-list>
- <vlan-id>1255.ae81</vlan-id>
- <border-element-type>VDBE</border-element-type>
- <border-element-tangibility>VIRTUAL</border-element-tangibility>
- <port-id></port-id>
- <border-element-id>ALPVDBE1</border-element-id>
- <border-element-v4-subnet>3.1.1.0/22</border-element-v4-subnet>
- <lag-id>ae81</lag-id>
- <border-element-v6-subnet>3:1:1::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>1995.ae81</vlan-id>
- <border-element-type>ASBG</border-element-type>
- <border-element-tangibility>VIRTUAL</border-element-tangibility>
- <port-id></port-id>
- <border-element-id>ALPASBG1</border-element-id>
- <border-element-v4-subnet>3.1.1.0/22</border-element-v4-subnet>
- <lag-id>ae81</lag-id>
- <border-element-v6-subnet>3:1:1::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>85.xe-10/0/2</vlan-id>
- <border-element-type>BGF2</border-element-type>
- <border-element-tangibility>PHYSICAL</border-element-tangibility>
- <port-id>xe-10/0/2</port-id>
- <border-element-id>ALPBGF2</border-element-id>
- <border-element-v4-subnet>3.1.2.0/22</border-element-v4-subnet>
- <lag-id></lag-id>
- <border-element-v6-subnet>3:1:2::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>85.xe-10/0/1</vlan-id>
- <border-element-type>BGF1</border-element-type>
- <border-element-tangibility>PHYSICAL</border-element-tangibility>
- <port-id>xe-10/0/1</port-id>
- <border-element-id>ALPBGF1</border-element-id>
- <border-element-v4-subnet>3.1.2.0/22</border-element-v4-subnet>
- <lag-id></lag-id>
- <border-element-v6-subnet>3:1:2::0/22</border-element-v6-subnet>
- </vlan-list>
- <ipe-id>1</ipe-id>
- </router-list>
- </virtual-datacenter-list>
- <virtual-datacenter-list>
- <vdc-id>15001418</vdc-id>
- <router-list>
- <router-name>SANRTR1</router-name>
- <ipe-loopback-address>2.1.1.1</ipe-loopback-address>
- <vlan-list>
- <vlan-id>1255.ae81</vlan-id>
- <border-element-type>VDBE</border-element-type>
- <border-element-tangibility>VIRTUAL</border-element-tangibility>
- <port-id></port-id>
- <border-element-id>SANVDBE1</border-element-id>
- <border-element-v4-subnet>4.1.1.0/22</border-element-v4-subnet>
- <lag-id>ae81</lag-id>
- <border-element-v6-subnet>4:1:1::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>1995.ae81</vlan-id>
- <border-element-type>ASBG</border-element-type>
- <border-element-tangibility>VIRTUAL</border-element-tangibility>
- <port-id></port-id>
- <border-element-id>SANASBG1</border-element-id>
- <border-element-v4-subnet>4.1.1.0/22</border-element-v4-subnet>
- <lag-id>ae81</lag-id>
- <border-element-v6-subnet>4:1:1::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>85.xe-10/0/2</vlan-id>
- <border-element-type>BGF2</border-element-type>
- <border-element-tangibility>PHYSICAL</border-element-tangibility>
- <port-id>xe-10/0/2</port-id>
- <border-element-id>SANBGF2</border-element-id>
- <border-element-v4-subnet>4.1.2.0/22</border-element-v4-subnet>
- <lag-id></lag-id>
- <border-element-v6-subnet>4:1:2::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>85.xe-10/0/1</vlan-id>
- <border-element-type>BGF1</border-element-type>
- <border-element-tangibility>PHYSICAL</border-element-tangibility>
- <port-id>xe-10/0/1</port-id>
- <border-element-id>SANBGF1</border-element-id>
- <border-element-v4-subnet>4.1.2.0/22</border-element-v4-subnet>
- <lag-id></lag-id>
- <border-element-v6-subnet>4:1:2::0/22</border-element-v6-subnet>
- </vlan-list>
- <ipe-id>1</ipe-id>
- </router-list>
- <router-list>
- <router-name>SANRTR2</router-name>
- <ipe-loopback-address>2.1.1.2</ipe-loopback-address>
- <vlan-list>
- <vlan-id>1255.ae81</vlan-id>
- <border-element-type>VDBE</border-element-type>
- <border-element-tangibility>VIRTUAL</border-element-tangibility>
- <port-id></port-id>
- <border-element-id>SANVDBE1</border-element-id>
- <border-element-v4-subnet>4.1.1.0/22</border-element-v4-subnet>
- <lag-id>ae81</lag-id>
- <border-element-v6-subnet>4:1:1::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>1995.ae81</vlan-id>
- <border-element-type>ASBG</border-element-type>
- <border-element-tangibility>VIRTUAL</border-element-tangibility>
- <port-id></port-id>
- <border-element-id>SANASBG1</border-element-id>
- <border-element-v4-subnet>4.1.1.0/22</border-element-v4-subnet>
- <lag-id>ae81</lag-id>
- <border-element-v6-subnet>4:1:1::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>85.xe-10/0/2</vlan-id>
- <border-element-type>BGF2</border-element-type>
- <border-element-tangibility>PHYSICAL</border-element-tangibility>
- <port-id>xe-10/0/2</port-id>
- <border-element-id>SANBGF2</border-element-id>
- <border-element-v4-subnet>4.1.2.0/22</border-element-v4-subnet>
- <lag-id></lag-id>
- <border-element-v6-subnet>4:1:2::0/22</border-element-v6-subnet>
- </vlan-list>
- <vlan-list>
- <vlan-id>85.xe-10/0/1</vlan-id>
- <border-element-type>BGF1</border-element-type>
- <border-element-tangibility>PHYSICAL</border-element-tangibility>
- <port-id>xe-10/0/1</port-id>
- <border-element-id>SANBGF1</border-element-id>
- <border-element-v4-subnet>4.1.2.0/22</border-element-v4-subnet>
- <lag-id></lag-id>
- <border-element-v6-subnet>4:1:2::0/22</border-element-v6-subnet>
- </vlan-list>
- <ipe-id>2</ipe-id>
- </router-list>
- </virtual-datacenter-list>
- <service-type>COLLABORATE</service-type>
- <interface-status>DISABLE</interface-status>
- <customer-id>custid-888</customer-id>
- <service-instance-id>SII-2016-10-22-001</service-instance-id>
- <provision-type>CUSTOMER</provision-type>
- <vni-id>100668</vni-id>
- </nbnc-response-information>
- </output>
- </tag0:RequestData>
- </sdncadapterworkflow:response-data>
+<?xml version="1.0" encoding="UTF-8"?> +<sdncadapterworkflow:SDNCAdapterWorkflowResponse + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapterworkflow:response-data> + <tag0:RequestData + xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string"> + <output xmlns="com:att:sdnctl:nbncapi"> + <ack-final-indicator>Y</ack-final-indicator> + <svc-request-id>SK-2016-10-22-001</svc-request-id> + <nbnc-response-information> + <response-info> + <result>SUCCESS</result> + <aai-status>ERROR</aai-status> + </response-info> + <virtual-datacenter-list> + <vdc-id>15001417</vdc-id> + <router-list> + <router-name>ALPRTR2</router-name> + <ipe-loopback-address>1.1.1.2</ipe-loopback-address> + <vlan-list> + <vlan-id>1255.ae81</vlan-id> + <border-element-type>VDBE</border-element-type> + <border-element-tangibility>VIRTUAL</border-element-tangibility> + <port-id></port-id> + <border-element-id>ALPVDBE1</border-element-id> + <border-element-v4-subnet>3.1.1.0/22</border-element-v4-subnet> + <lag-id>ae81</lag-id> + <border-element-v6-subnet>3:1:1::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>1995.ae81</vlan-id> + <border-element-type>ASBG</border-element-type> + <border-element-tangibility>VIRTUAL</border-element-tangibility> + <port-id></port-id> + <border-element-id>ALPASBG1</border-element-id> + <border-element-v4-subnet>3.1.1.0/22</border-element-v4-subnet> + <lag-id>ae81</lag-id> + <border-element-v6-subnet>3:1:1::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>85.xe-10/0/2</vlan-id> + <border-element-type>BGF2</border-element-type> + <border-element-tangibility>PHYSICAL</border-element-tangibility> + <port-id>xe-10/0/2</port-id> + <border-element-id>ALPBGF2</border-element-id> + <border-element-v4-subnet>3.1.2.0/22</border-element-v4-subnet> + <lag-id></lag-id> + <border-element-v6-subnet>3:1:2::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>85.xe-10/0/1</vlan-id> + <border-element-type>BGF1</border-element-type> + <border-element-tangibility>PHYSICAL</border-element-tangibility> + <port-id>xe-10/0/1</port-id> + <border-element-id>ALPBGF1</border-element-id> + <border-element-v4-subnet>3.1.2.0/22</border-element-v4-subnet> + <lag-id></lag-id> + <border-element-v6-subnet>3:1:2::0/22</border-element-v6-subnet> + </vlan-list> + <ipe-id>2</ipe-id> + </router-list> + <router-list> + <router-name>ALPRTR1</router-name> + <ipe-loopback-address>1.1.1.1</ipe-loopback-address> + <vlan-list> + <vlan-id>1255.ae81</vlan-id> + <border-element-type>VDBE</border-element-type> + <border-element-tangibility>VIRTUAL</border-element-tangibility> + <port-id></port-id> + <border-element-id>ALPVDBE1</border-element-id> + <border-element-v4-subnet>3.1.1.0/22</border-element-v4-subnet> + <lag-id>ae81</lag-id> + <border-element-v6-subnet>3:1:1::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>1995.ae81</vlan-id> + <border-element-type>ASBG</border-element-type> + <border-element-tangibility>VIRTUAL</border-element-tangibility> + <port-id></port-id> + <border-element-id>ALPASBG1</border-element-id> + <border-element-v4-subnet>3.1.1.0/22</border-element-v4-subnet> + <lag-id>ae81</lag-id> + <border-element-v6-subnet>3:1:1::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>85.xe-10/0/2</vlan-id> + <border-element-type>BGF2</border-element-type> + <border-element-tangibility>PHYSICAL</border-element-tangibility> + <port-id>xe-10/0/2</port-id> + <border-element-id>ALPBGF2</border-element-id> + <border-element-v4-subnet>3.1.2.0/22</border-element-v4-subnet> + <lag-id></lag-id> + <border-element-v6-subnet>3:1:2::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>85.xe-10/0/1</vlan-id> + <border-element-type>BGF1</border-element-type> + <border-element-tangibility>PHYSICAL</border-element-tangibility> + <port-id>xe-10/0/1</port-id> + <border-element-id>ALPBGF1</border-element-id> + <border-element-v4-subnet>3.1.2.0/22</border-element-v4-subnet> + <lag-id></lag-id> + <border-element-v6-subnet>3:1:2::0/22</border-element-v6-subnet> + </vlan-list> + <ipe-id>1</ipe-id> + </router-list> + </virtual-datacenter-list> + <virtual-datacenter-list> + <vdc-id>15001418</vdc-id> + <router-list> + <router-name>SANRTR1</router-name> + <ipe-loopback-address>2.1.1.1</ipe-loopback-address> + <vlan-list> + <vlan-id>1255.ae81</vlan-id> + <border-element-type>VDBE</border-element-type> + <border-element-tangibility>VIRTUAL</border-element-tangibility> + <port-id></port-id> + <border-element-id>SANVDBE1</border-element-id> + <border-element-v4-subnet>4.1.1.0/22</border-element-v4-subnet> + <lag-id>ae81</lag-id> + <border-element-v6-subnet>4:1:1::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>1995.ae81</vlan-id> + <border-element-type>ASBG</border-element-type> + <border-element-tangibility>VIRTUAL</border-element-tangibility> + <port-id></port-id> + <border-element-id>SANASBG1</border-element-id> + <border-element-v4-subnet>4.1.1.0/22</border-element-v4-subnet> + <lag-id>ae81</lag-id> + <border-element-v6-subnet>4:1:1::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>85.xe-10/0/2</vlan-id> + <border-element-type>BGF2</border-element-type> + <border-element-tangibility>PHYSICAL</border-element-tangibility> + <port-id>xe-10/0/2</port-id> + <border-element-id>SANBGF2</border-element-id> + <border-element-v4-subnet>4.1.2.0/22</border-element-v4-subnet> + <lag-id></lag-id> + <border-element-v6-subnet>4:1:2::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>85.xe-10/0/1</vlan-id> + <border-element-type>BGF1</border-element-type> + <border-element-tangibility>PHYSICAL</border-element-tangibility> + <port-id>xe-10/0/1</port-id> + <border-element-id>SANBGF1</border-element-id> + <border-element-v4-subnet>4.1.2.0/22</border-element-v4-subnet> + <lag-id></lag-id> + <border-element-v6-subnet>4:1:2::0/22</border-element-v6-subnet> + </vlan-list> + <ipe-id>1</ipe-id> + </router-list> + <router-list> + <router-name>SANRTR2</router-name> + <ipe-loopback-address>2.1.1.2</ipe-loopback-address> + <vlan-list> + <vlan-id>1255.ae81</vlan-id> + <border-element-type>VDBE</border-element-type> + <border-element-tangibility>VIRTUAL</border-element-tangibility> + <port-id></port-id> + <border-element-id>SANVDBE1</border-element-id> + <border-element-v4-subnet>4.1.1.0/22</border-element-v4-subnet> + <lag-id>ae81</lag-id> + <border-element-v6-subnet>4:1:1::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>1995.ae81</vlan-id> + <border-element-type>ASBG</border-element-type> + <border-element-tangibility>VIRTUAL</border-element-tangibility> + <port-id></port-id> + <border-element-id>SANASBG1</border-element-id> + <border-element-v4-subnet>4.1.1.0/22</border-element-v4-subnet> + <lag-id>ae81</lag-id> + <border-element-v6-subnet>4:1:1::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>85.xe-10/0/2</vlan-id> + <border-element-type>BGF2</border-element-type> + <border-element-tangibility>PHYSICAL</border-element-tangibility> + <port-id>xe-10/0/2</port-id> + <border-element-id>SANBGF2</border-element-id> + <border-element-v4-subnet>4.1.2.0/22</border-element-v4-subnet> + <lag-id></lag-id> + <border-element-v6-subnet>4:1:2::0/22</border-element-v6-subnet> + </vlan-list> + <vlan-list> + <vlan-id>85.xe-10/0/1</vlan-id> + <border-element-type>BGF1</border-element-type> + <border-element-tangibility>PHYSICAL</border-element-tangibility> + <port-id>xe-10/0/1</port-id> + <border-element-id>SANBGF1</border-element-id> + <border-element-v4-subnet>4.1.2.0/22</border-element-v4-subnet> + <lag-id></lag-id> + <border-element-v6-subnet>4:1:2::0/22</border-element-v6-subnet> + </vlan-list> + <ipe-id>2</ipe-id> + </router-list> + </virtual-datacenter-list> + <service-type>COLLABORATE</service-type> + <interface-status>DISABLE</interface-status> + <customer-id>custid-888</customer-id> + <service-instance-id>SII-2016-10-22-001</service-instance-id> + <provision-type>CUSTOMER</provision-type> + <vni-id>100668</vni-id> + </nbnc-response-information> + </output> + </tag0:RequestData> + </sdncadapterworkflow:response-data> </sdncadapterworkflow:SDNCAdapterWorkflowResponse>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_data_request.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_data_request.xml index 24fe72c62e..6962946ab2 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_data_request.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_data_request.xml @@ -1,33 +1,33 @@ -<SDNCRequestData>
- <request-information>
- <request-id>ca424e60-cb22-43c5-88f9-ed68e17cebe2</request-id>
- <source>MSO</source>
- <notification-url />
- <order-number />
- <order-version />
- <request-action>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</request-action>
- </request-information>
- <service-information>
- <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
- <subscription-service-type>MSO-dev-service-type
- </subscription-service-type>
- <ecomp-model-information>
- <model-invariant-uuid>de19ae10-9a25-11e7-abc4-cec278b6b50a</model-invariant-uuid>
- <model-uuid>ee938612-9a25-11e7-abc4-cec278b6b50a</model-uuid>
- <model-version>1.0</model-version>
- <model-name>MSOTADevInfra_Configuration_Service</model-name>
- </ecomp-model-information>
- <service-instance-id>14c5c14f-6caf-4028-9788-bb5ec9e8f9b8</service-instance-id>
- <subscriber-name />
- <global-customer-id>MSO_1610_dev</global-customer-id>
- </service-information>
- <service-request-input>
- <service-instance-name>MSO-DEV-SI-1802-PCM-926-100</service-instance-name>
- <service-input-parameters>
- <param>
- <name>paramName</name>
- <value>paramValue</value>
- </param>
- </service-input-parameters>
- </service-request-input>
+<SDNCRequestData> + <request-information> + <request-id>ca424e60-cb22-43c5-88f9-ed68e17cebe2</request-id> + <source>MSO</source> + <notification-url /> + <order-number /> + <order-version /> + <request-action>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</request-action> + </request-information> + <service-information> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + <subscription-service-type>MSO-dev-service-type + </subscription-service-type> + <onap-model-information> + <model-invariant-uuid>de19ae10-9a25-11e7-abc4-cec278b6b50a</model-invariant-uuid> + <model-uuid>ee938612-9a25-11e7-abc4-cec278b6b50a</model-uuid> + <model-version>1.0</model-version> + <model-name>MSOTADevInfra_Configuration_Service</model-name> + </onap-model-information> + <service-instance-id>14c5c14f-6caf-4028-9788-bb5ec9e8f9b8</service-instance-id> + <subscriber-name /> + <global-customer-id>MSO_1610_dev</global-customer-id> + </service-information> + <service-request-input> + <service-instance-name>MSO-DEV-SI-1802-PCM-926-100</service-instance-name> + <service-input-parameters> + <param> + <name>paramName</name> + <value>paramValue</value> + </param> + </service-input-parameters> + </service-request-input> </SDNCRequestData>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_request.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_request.xml index 2ecd36d68b..17ba0cee65 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_request.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdnc_adapter_request.xml @@ -1,7 +1,7 @@ <sdncadapterworkflow:SDNCAdapterWorkflowRequest - xmlns:ns5="http://org.openecomp/mso/request/types/v1" - xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" - xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:ns5="http://org.onap/so/request/types/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> <sdncadapter:RequestHeader> <sdncadapter:RequestId>3a77913d-6d36-4507-8c6d-ab523af21fbf</sdncadapter:RequestId> <sdncadapter:SvcInstanceId>14c5c14f-6caf-4028-9788-bb5ec9e8f9b8</sdncadapter:SvcInstanceId> @@ -24,12 +24,12 @@ <service-id>serviceId-test</service-id> <subscription-service-type>subscriptionServiceType-test </subscription-service-type> - <ecomp-model-information> + <onap-model-information> <model-invariant-uuid>modelInvariantUuid-test</model-invariant-uuid> <model-uuid>modelUuid-test</model-uuid> <model-version>modelVersion-test</model-version> <model-name>modelName-test</model-name> - </ecomp-model-information> + </onap-model-information> <service-instance-id>serviceInstanceId-test</service-instance-id> <subscriber-name /> <global-customer-id>globalSubscriberId-test</global-customer-id> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml index 754dc20ee6..21cf3460a9 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml @@ -1,342 +1,342 @@ -<SDNCAdapterCallbackRequest xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <CallbackHeader>
- <RequestId>2f7d1b38-2b78-4ef2-8ad6-1552d88620fa</RequestId>
- <ResponseCode>200</ResponseCode>
- <ResponseMessage>OK</ResponseMessage>
- </CallbackHeader>
- <RequestData xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <layer3-service-list xmlns="com:att:sdnctl:l3api">
- <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
- <service-status>
- <rpc-name>service-configuration-operation</rpc-name>
- <rpc-action>activate</rpc-action>
- <request-status>synccomplete</request-status>
- <final-indicator>N</final-indicator>
- <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action>
- <l3sdn-subaction>SUPP</l3sdn-subaction>
- <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp>
- </service-status>
- <service-data>
- <internet-evc-access-information>
- <ip-version>ds</ip-version>
- <internet-evc-speed-value>8</internet-evc-speed-value>
- <internet-evc-speed-units>Mbps</internet-evc-speed-units>
- </internet-evc-access-information>
- <vr-lan xmlns="com:att:sdnctl:l3api">
- <vr-lan-interface>
- <static-routes>
- <v6-static-routes>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
- <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
- </v6-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- <v6-static-routes>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
- <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
- </v6-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- <v4-static-routes>
- <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
- </v4-static-routes>
- </static-routes>
- <dhcp>
- <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled>
- <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled>
- <use-v6-default-pool>N</use-v6-default-pool>
- <excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-address>192.168.1.7</excluded-v4-address>
- </excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-dhcp-addresses-from-default-pool>
- <excluded-v4-address>192.168.1.8</excluded-v4-address>
- </excluded-v4-dhcp-addresses-from-default-pool>
- <v4-dhcp-pools>
- <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address>
- <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.5</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.6</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix>
- </v4-dhcp-pools>
- <v4-dhcp-pools>
- <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address>
- <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.6</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address>
- <excluded-v4-addresses>
- <excluded-v4-address>192.168.1.7</excluded-v4-address>
- </excluded-v4-addresses>
- <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix>
- </v4-dhcp-pools>
- <use-v4-default-pool>Y</use-v4-default-pool>
- <excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-address>1:5</excluded-v6-address>
- </excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-dhcp-addresses-from-default-pool>
- <excluded-v6-address>1:6</excluded-v6-address>
- </excluded-v6-dhcp-addresses-from-default-pool>
- <v6-dhcp-pools>
- <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
- <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
- <excluded-v6-addresses>
- <excluded-v6-address>1:1</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
- <excluded-v6-addresses>
- <excluded-v6-address>2:2</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
- </v6-dhcp-pools>
- <v6-dhcp-pools>
- <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
- <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
- <excluded-v6-addresses>
- <excluded-v6-address>1:1</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
- <excluded-v6-addresses>
- <excluded-v6-address>2:2</excluded-v6-address>
- </excluded-v6-addresses>
- <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
- </v6-dhcp-pools>
- </dhcp>
- <firewall-lite>
- <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled>
- <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled>
- <v4-firewall-packet-filters>
- <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix>
- <v4-firewall-prefix-length>1</v4-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>1</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>1</port-number>
- </tcp-ports>
- </v4-firewall-packet-filters>
- <v4-firewall-packet-filters>
- <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix>
- <v4-firewall-prefix-length>2</v4-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>2</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>2</port-number>
- </tcp-ports>
- </v4-firewall-packet-filters>
- <v6-firewall-packet-filters>
- <v6-firewall-prefix>:</v6-firewall-prefix>
- <v6-firewall-prefix-length>0</v6-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>3</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>3</port-number>
- </tcp-ports>
- </v6-firewall-packet-filters>
- <v6-firewall-packet-filters>
- <v6-firewall-prefix>:</v6-firewall-prefix>
- <v6-firewall-prefix-length>1</v6-firewall-prefix-length>
- <allow-icmp-ping>Y</allow-icmp-ping>
- <udp-ports>
- <port-number>4</port-number>
- </udp-ports>
- <tcp-ports>
- <port-number>4</port-number>
- </tcp-ports>
- </v6-firewall-packet-filters>
- </firewall-lite>
- <pat>
- <v4-pat-pools>
- <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix>
- <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address>
- <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length>
- </v4-pat-pools>
- <use-v4-default-pool>Y</use-v4-default-pool>
- <v4-pat-enabled>N</v4-pat-enabled>
- <v4-pat-pools>
- <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix>
- <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address>
- <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length>
- </v4-pat-pools>
- </pat>
- <nat>
- <v4-nat-enabled>Y</v4-nat-enabled>
- <v4-nat-mapping-entries>
- <v4-nat-internal>0.0.0.0</v4-nat-internal>
- <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address>
- <v4-nat-external>0.0.0.0</v4-nat-external>
- </v4-nat-mapping-entries>
- <v4-nat-mapping-entries>
- <v4-nat-internal>0.0.0.1</v4-nat-internal>
- <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address>
- <v4-nat-external>0.0.0.1</v4-nat-external>
- </v4-nat-mapping-entries>
- </nat>
- <vr-designation>primary</vr-designation>
- <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address>
- <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length>
- <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address>
- <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix>
- <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length>
- <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix>
- <v4-public-lan-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.2</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.72</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.68</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- </v4-public-lan-prefixes>
- <v6-public-lan-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- </v6-public-lan-prefixes>
- </vr-lan-interface>
- <routing-protocol>none</routing-protocol>
- </vr-lan>
-<ucpe-vms-service-information>
- <transport-service-information>
- <transport-service-type>AVPN</transport-service-type>
- <access-circuit-info>
- <access-circuit-id>1</access-circuit-id>
- <dual-mode>Active</dual-mode>
- </access-circuit-info>
- <access-circuit-info>
- <access-circuit-id>2</access-circuit-id>
- <dual-mode>Standby</dual-mode>
- </access-circuit-info>
- </transport-service-information>
- <ucpe-information>
- <ucpe-host-name>hostname</ucpe-host-name>
- <ucpe-activation-code>activecode</ucpe-activation-code>
- <out-of-band-management-modem>OOB</out-of-band-management-modem>
- </ucpe-information>
- <vnf-list>
- <vnf-information>
- <vnf-instance-id>1</vnf-instance-id>
- <vnf-sequence-number>1</vnf-sequence-number>
- <vnf-type>ZZ</vnf-type>
- <vnf-vendor>JUNIPER</vnf-vendor>
- <vnf-model>MODEL1</vnf-model>
- <vnf-id>1</vnf-id>
- <prov-status>1</prov-status>
- <operational-state>1</operational-state>
- <orchestration-status>1</orchestration-status>
- <equipment-role>1</equipment-role>
- </vnf-information>
- <vnf-information>
- <vnf-instance-id>2</vnf-instance-id>
- <vnf-sequence-number>2</vnf-sequence-number>
- <vnf-type>HY</vnf-type>
- <vnf-vendor>JUNIPER</vnf-vendor>
- <vnf-model>MODEL2</vnf-model>
- <vnf-id>2</vnf-id>
- <prov-status>2</prov-status>
- <operational-state>2</operational-state>
- <orchestration-status>2</orchestration-status>
- <equipment-role>2</equipment-role>
- </vnf-information>
- </vnf-list>
- </ucpe-vms-service-information>
- <request-information>
- <request-action>Layer3ServiceActivateRequest</request-action>
- <order-number>4281555</order-number>
- <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id>
- <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url>
- <source>OMX</source>
- <order-version>1</order-version>
- </request-information>
- <sdnc-request-header>
- <svc-action>activate</svc-action>
- <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify</svc-notification-url>
- <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id>
- </sdnc-request-header>
- <l2-homing-information>
- <topology>MultiPoint</topology>
- <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli>
- <evc-name>AS/VLXM/003717//SW</evc-name>
- </l2-homing-information>
- <service-information>
- <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
- <subscriber-name>FOUR SEASONS HEATING & COOLING_8310006378683</subscriber-name>
- <service-type>SDN-ETHERNET-INTERNET</service-type>
- </service-information>
- <internet-service-change-details>
- <internet-evc-speed-value>10</internet-evc-speed-value>
- <internet-evc-speed-units>Kbps</internet-evc-speed-units>
- <t-provided-v4-lan-public-prefixes>
- <request-index>1</request-index>
- <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v4-lan-public-prefixes>
- <request-index>2</request-index>
- <v4-next-hop-address>192.168.1.16</v4-next-hop-address>
- <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix>
- <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
- </t-provided-v4-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- <t-provided-v6-lan-public-prefixes>
- <request-index>1</request-index>
- <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
- <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
- <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
- </t-provided-v6-lan-public-prefixes>
- </internet-service-change-details>
- </service-data>
- </layer3-service-list>
-</RequestData>
-</SDNCAdapterCallbackRequest>
+<SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <CallbackHeader> + <RequestId>2f7d1b38-2b78-4ef2-8ad6-1552d88620fa</RequestId> + <ResponseCode>200</ResponseCode> + <ResponseMessage>OK</ResponseMessage> + </CallbackHeader> + <RequestData xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>FOUR SEASONS HEATING &amp; COOLING_8310006378683</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> +</RequestData> +</SDNCAdapterCallbackRequest> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml index aa481ea600..7873fd49d2 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml @@ -1,13 +1,13 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<SDNCAdapterCallbackRequest
- xmlns="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <CallbackHeader>
- <RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</RequestId>
- <ResponseCode>404</ResponseCode>
- <ResponseMessage>Error processing request to SDNC. Not Found.
- https://sdncodl.us.aic.cip.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout.
- 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.]</ResponseMessage>
- </CallbackHeader>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<SDNCAdapterCallbackRequest + xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <CallbackHeader> + <RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</RequestId> + <ResponseCode>404</ResponseCode> + <ResponseMessage>Error processing request to SDNC. Not Found. + https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + 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.]</ResponseMessage> + </CallbackHeader> </SDNCAdapterCallbackRequest>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_with_aic_version.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_with_aic_version.xml new file mode 100644 index 0000000000..7ce81f1caf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_with_aic_version.xml @@ -0,0 +1,345 @@ +<SDNCAdapterCallbackRequest xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <CallbackHeader> + <RequestId>2f7d1b38-2b78-4ef2-8ad6-1552d88620fa</RequestId> + <ResponseCode>200</ResponseCode> + <ResponseMessage>OK</ResponseMessage> + </CallbackHeader> + <RequestData xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <aic-version>2.5</aic-version> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>FOUR SEASONS HEATING &amp; COOLING_8310006378683</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <v4-vr-lan-address>10.10.7.14</v4-vr-lan-address> + <v4-vr-lan-prefix-length>10</v4-vr-lan-prefix-length> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> +</RequestData> +</SDNCAdapterCallbackRequest> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml index 231898adfa..77babba7f7 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp/mso/workflow/schema/v1" - xmlns:v11="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:v1="http://org.onap/so/workflow/schema/v1" + xmlns:v11="http://org.onap/workflow/sdnc/adapter/schema/v1"> <soapenv:Header/> <soapenv:Body> <v1:SDNCAdapterWorkflowRequest> @@ -13,7 +13,7 @@ </v11:RequestHeader> <v1:SDNCRequestData> <rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" contentType="text/xml"> - <tag0:service-request xmlns:tag0="http://org.openecomp/mso/request/details/schema/v1"> + <tag0:service-request xmlns:tag0="http://org.onap/so/request/details/schema/v1"> <tag0:request-information> <tag0:request-id>12570a36-7388-4c0a-bec4-189ce3kg9956</tag0:request-id> <tag0:request-action>Layer3ServiceActivate</tag0:request-action> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml index f71f529593..8cbcce138f 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp/mso/workflow/schema/v1" - xmlns:v11="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + xmlns:v1="http://org.onap/so/workflow/schema/v1" + xmlns:v11="http://org.onap/workflow/sdnc/adapter/schema/v1"> <soapenv:Header/> <soapenv:Body> <v1:SDNCAdapterWorkflowRequest> @@ -13,7 +13,7 @@ </v11:RequestHeader> <v1:SDNCRequestData> <rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" contentType="text/xml"> - <tag0:service-request xmlns:tag0="http://org.openecomp/mso/request/details/schema/v1"> + <tag0:service-request xmlns:tag0="http://org.onap/so/request/details/schema/v1"> <tag0:request-information> <tag0:request-id>12570a36-7388-4c0a-bec4-189ce3kg9956</tag0:request-id> <tag0:request-action>GetLayer3ServiceDetailsRequest</tag0:request-action> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn b/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn index e5498e4d2b..5f9a6f52af 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn +++ b/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn @@ -10,7 +10,7 @@ <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> <bpmn2:script><![CDATA[//import java.net.InetAddress; -import org.openecomp.mso.bpmn.common.workflow.service.* +import org.onap.so.bpmn.common.workflow.service.* //def hostname = InetAddress.getLocalHost().getCanonicalHostName() //println ("my host name =================" + hostname) diff --git a/bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml index 4e7c4ee687..6970aee8a0 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:v1="http://org.openecomp.mso/vnfNotify"> + xmlns:v1="http://org.onap.so/vnfNotify"> <soapenv:Header /> <soapenv:Body> -<ns2:updateVnfNotification xmlns:ns2="http://org.openecomp.mso/vnfNotify"> +<ns2:updateVnfNotification xmlns:ns2="http://org.onap.so/vnfNotify"> <messageId>testRequestId</messageId> <completed>true</completed> <rollback> |