summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test/groovy
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/groovy')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy471
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessorTest.groovy182
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy98
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy)24
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy130
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy125
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy104
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy72
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy218
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtilTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy)164
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy)622
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy125
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy124
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy180
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutServiceTest.groovy)449
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy)2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy)70
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/NetworkUtilsTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtilsTest.groovy)12
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy171
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1Test.groovy151
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2Test.groovy151
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy)1897
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtilsTest.groovy)404
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy196
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtilTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtilTest.groovy)402
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy172
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy175
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VidUtilsTest.groovy (renamed from bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy)9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy118
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/IgnoreNamedElementsDifferenceListener.groovy51
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/XmlComparator.groovy41
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy385
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1Test.groovy44
33 files changed, 5129 insertions, 2410 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("&", "&amp;")
- 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&amp;T</b></a>"
+ String noChangeInput = "<a><b>AT&amp;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">&lt;b&gt;AT&amp;amp;T&lt;/b&gt;</a></top>'
+ String decodeWithNamespacesInput = '<a xsi:type="xs:string">&lt;b&gt;AT&amp;amp;T&lt;/b&gt;</a>'
+ String decodeWithNamespacesOutput = '<a xsi:type="xs:string"><b>AT&amp;T</b></a>'
+ String decodeWithoutNamespacesInput = '<a type="string">&lt;b&gt;AT&amp;amp;T&lt;/b&gt;</a>'
+ String decodeWithoutNamespacesOutput = '<a type="string"><b>AT&amp;T</b></a>'
+ String normalString = "<a>AT&amp;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&amp;T"))
+ }
+ @Test
+ public void testXmlEncode() {
+
+ String expected = "&amp;amp;";
+
+ assertEquals("is double encoded", expected, MsoUtils.xmlEscape("&amp;"))
+
+ }
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"> &lt;layer3-service-list xmlns="com:att:sdnctl:l3api"&gt;
- &lt;service-instance-id&gt;FK/VLXM/003717//SW_INTERNET&lt;/service-instance-id&gt;
- &lt;service-status&gt;
- &lt;rpc-name&gt;service-configuration-operation&lt;/rpc-name&gt;
- &lt;rpc-action&gt;activate&lt;/rpc-action&gt;
- &lt;request-status&gt;synccomplete&lt;/request-status&gt;
- &lt;final-indicator&gt;N&lt;/final-indicator&gt;
- &lt;l3sdn-action&gt;Layer3ServiceActivateRequest&lt;/l3sdn-action&gt;
- &lt;l3sdn-subaction&gt;SUPP&lt;/l3sdn-subaction&gt;
- &lt;response-timestamp&gt;2015-04-28T21:32:11.386Z&lt;/response-timestamp&gt;
- &lt;/service-status&gt;
- &lt;service-data&gt;
- &lt;internet-evc-access-information&gt;
- &lt;ip-version&gt;ds&lt;/ip-version&gt;
- &lt;internet-evc-speed-value&gt;8&lt;/internet-evc-speed-value&gt;
- &lt;internet-evc-speed-units&gt;Mbps&lt;/internet-evc-speed-units&gt;
- &lt;/internet-evc-access-information&gt;
- &lt;vr-lan xmlns="com:att:sdnctl:l3api"&gt;
- &lt;vr-lan-interface&gt;
- &lt;static-routes&gt;
- &lt;v6-static-routes&gt;
- &lt;v6-next-hop-address&gt;2001:1890:12e3:2da::&lt;/v6-next-hop-address&gt;
- &lt;v6-static-route-prefix&gt;2001:1890:12e3:2da::&lt;/v6-static-route-prefix&gt;
- &lt;v6-static-route-prefix-length&gt;28&lt;/v6-static-route-prefix-length&gt;
- &lt;/v6-static-routes&gt;
- &lt;v4-static-routes&gt;
- &lt;v4-static-route-prefix&gt;255.255.252.1&lt;/v4-static-route-prefix&gt;
- &lt;v4-next-hop-address&gt;192.168.1.15&lt;/v4-next-hop-address&gt;
- &lt;v4-static-route-prefix-length&gt;28&lt;/v4-static-route-prefix-length&gt;
- &lt;/v4-static-routes&gt;
- &lt;v6-static-routes&gt;
- &lt;v6-next-hop-address&gt;2001:1890:12e3:2da::&lt;/v6-next-hop-address&gt;
- &lt;v6-static-route-prefix&gt;2001:1890:12e3:2da::&lt;/v6-static-route-prefix&gt;
- &lt;v6-static-route-prefix-length&gt;28&lt;/v6-static-route-prefix-length&gt;
- &lt;/v6-static-routes&gt;
- &lt;v4-static-routes&gt;
- &lt;v4-static-route-prefix&gt;255.255.252.2&lt;/v4-static-route-prefix&gt;
- &lt;v4-next-hop-address&gt;192.168.1.15&lt;/v4-next-hop-address&gt;
- &lt;v4-static-route-prefix-length&gt;28&lt;/v4-static-route-prefix-length&gt;
- &lt;/v4-static-routes&gt;
- &lt;v4-static-routes&gt;
- &lt;v4-static-route-prefix&gt;255.255.252.3&lt;/v4-static-route-prefix&gt;
- &lt;v4-next-hop-address&gt;192.168.1.15&lt;/v4-next-hop-address&gt;
- &lt;v4-static-route-prefix-length&gt;28&lt;/v4-static-route-prefix-length&gt;
- &lt;/v4-static-routes&gt;
- &lt;/static-routes&gt;
- &lt;dhcp&gt;
- &lt;v6-dhcp-server-enabled&gt;N&lt;/v6-dhcp-server-enabled&gt;
- &lt;v4-dhcp-server-enabled&gt;Y&lt;/v4-dhcp-server-enabled&gt;
- &lt;use-v6-default-pool&gt;N&lt;/use-v6-default-pool&gt;
- &lt;excluded-v4-dhcp-addresses-from-default-pool&gt;
- &lt;excluded-v4-address&gt;192.168.1.7&lt;/excluded-v4-address&gt;
- &lt;/excluded-v4-dhcp-addresses-from-default-pool&gt;
- &lt;excluded-v4-dhcp-addresses-from-default-pool&gt;
- &lt;excluded-v4-address&gt;192.168.1.8&lt;/excluded-v4-address&gt;
- &lt;/excluded-v4-dhcp-addresses-from-default-pool&gt;
- &lt;v4-dhcp-pools&gt;
- &lt;v4-dhcp-relay-next-hop-address&gt;1.1.1.1&lt;/v4-dhcp-relay-next-hop-address&gt;
- &lt;v4-dhcp-pool-prefix-length&gt;28&lt;/v4-dhcp-pool-prefix-length&gt;
- &lt;excluded-v4-addresses&gt;
- &lt;excluded-v4-address&gt;192.168.1.5&lt;/excluded-v4-address&gt;
- &lt;/excluded-v4-addresses&gt;
- &lt;v4-dhcp-relay-gateway-address&gt;2.2.2.1&lt;/v4-dhcp-relay-gateway-address&gt;
- &lt;excluded-v4-addresses&gt;
- &lt;excluded-v4-address&gt;192.168.1.6&lt;/excluded-v4-address&gt;
- &lt;/excluded-v4-addresses&gt;
- &lt;v4-dhcp-pool-prefix&gt;192.155.2.3&lt;/v4-dhcp-pool-prefix&gt;
- &lt;/v4-dhcp-pools&gt;
- &lt;v4-dhcp-pools&gt;
- &lt;v4-dhcp-relay-next-hop-address&gt;1.1.1.2&lt;/v4-dhcp-relay-next-hop-address&gt;
- &lt;v4-dhcp-pool-prefix-length&gt;28&lt;/v4-dhcp-pool-prefix-length&gt;
- &lt;excluded-v4-addresses&gt;
- &lt;excluded-v4-address&gt;192.168.1.6&lt;/excluded-v4-address&gt;
- &lt;/excluded-v4-addresses&gt;
- &lt;v4-dhcp-relay-gateway-address&gt;2.2.2.2&lt;/v4-dhcp-relay-gateway-address&gt;
- &lt;excluded-v4-addresses&gt;
- &lt;excluded-v4-address&gt;192.168.1.7&lt;/excluded-v4-address&gt;
- &lt;/excluded-v4-addresses&gt;
- &lt;v4-dhcp-pool-prefix&gt;192.155.2.4&lt;/v4-dhcp-pool-prefix&gt;
- &lt;/v4-dhcp-pools&gt;
- &lt;use-v4-default-pool&gt;Y&lt;/use-v4-default-pool&gt;
- &lt;excluded-v6-dhcp-addresses-from-default-pool&gt;
- &lt;excluded-v6-address&gt;1:5&lt;/excluded-v6-address&gt;
- &lt;/excluded-v6-dhcp-addresses-from-default-pool&gt;
- &lt;excluded-v6-dhcp-addresses-from-default-pool&gt;
- &lt;excluded-v6-address&gt;1:6&lt;/excluded-v6-address&gt;
- &lt;/excluded-v6-dhcp-addresses-from-default-pool&gt;
- &lt;v6-dhcp-pools&gt;
- &lt;v6-dhcp-relay-next-hop-address&gt;4:4&lt;/v6-dhcp-relay-next-hop-address&gt;
- &lt;v6-dhcp-pool-prefix-length&gt;28&lt;/v6-dhcp-pool-prefix-length&gt;
- &lt;excluded-v6-addresses&gt;
- &lt;excluded-v6-address&gt;1:1&lt;/excluded-v6-address&gt;
- &lt;/excluded-v6-addresses&gt;
- &lt;v6-dhcp-relay-gateway-address&gt;3:3&lt;/v6-dhcp-relay-gateway-address&gt;
- &lt;excluded-v6-addresses&gt;
- &lt;excluded-v6-address&gt;2:2&lt;/excluded-v6-address&gt;
- &lt;/excluded-v6-addresses&gt;
- &lt;v6-dhcp-pool-prefix&gt;0:0&lt;/v6-dhcp-pool-prefix&gt;
- &lt;/v6-dhcp-pools&gt;
- &lt;v6-dhcp-pools&gt;
- &lt;v6-dhcp-relay-next-hop-address&gt;4:4&lt;/v6-dhcp-relay-next-hop-address&gt;
- &lt;v6-dhcp-pool-prefix-length&gt;28&lt;/v6-dhcp-pool-prefix-length&gt;
- &lt;excluded-v6-addresses&gt;
- &lt;excluded-v6-address&gt;1:1&lt;/excluded-v6-address&gt;
- &lt;/excluded-v6-addresses&gt;
- &lt;v6-dhcp-relay-gateway-address&gt;3:3&lt;/v6-dhcp-relay-gateway-address&gt;
- &lt;excluded-v6-addresses&gt;
- &lt;excluded-v6-address&gt;2:2&lt;/excluded-v6-address&gt;
- &lt;/excluded-v6-addresses&gt;
- &lt;v6-dhcp-pool-prefix&gt;0:0&lt;/v6-dhcp-pool-prefix&gt;
- &lt;/v6-dhcp-pools&gt;
- &lt;/dhcp&gt;
- &lt;firewall-lite&gt;
- &lt;stateful-firewall-lite-v6-enabled&gt;N&lt;/stateful-firewall-lite-v6-enabled&gt;
- &lt;stateful-firewall-lite-v4-enabled&gt;Y&lt;/stateful-firewall-lite-v4-enabled&gt;
- &lt;v4-firewall-packet-filters&gt;
- &lt;v4-firewall-prefix&gt;0.0.0.1&lt;/v4-firewall-prefix&gt;
- &lt;v4-firewall-prefix-length&gt;1&lt;/v4-firewall-prefix-length&gt;
- &lt;allow-icmp-ping&gt;Y&lt;/allow-icmp-ping&gt;
- &lt;udp-ports&gt;
- &lt;port-number&gt;1&lt;/port-number&gt;
- &lt;/udp-ports&gt;
- &lt;tcp-ports&gt;
- &lt;port-number&gt;1&lt;/port-number&gt;
- &lt;/tcp-ports&gt;
- &lt;/v4-firewall-packet-filters&gt;
- &lt;v4-firewall-packet-filters&gt;
- &lt;v4-firewall-prefix&gt;0.0.0.2&lt;/v4-firewall-prefix&gt;
- &lt;v4-firewall-prefix-length&gt;2&lt;/v4-firewall-prefix-length&gt;
- &lt;allow-icmp-ping&gt;Y&lt;/allow-icmp-ping&gt;
- &lt;udp-ports&gt;
- &lt;port-number&gt;2&lt;/port-number&gt;
- &lt;/udp-ports&gt;
- &lt;tcp-ports&gt;
- &lt;port-number&gt;2&lt;/port-number&gt;
- &lt;/tcp-ports&gt;
- &lt;/v4-firewall-packet-filters&gt;
- &lt;v6-firewall-packet-filters&gt;
- &lt;v6-firewall-prefix&gt;:&lt;/v6-firewall-prefix&gt;
- &lt;v6-firewall-prefix-length&gt;0&lt;/v6-firewall-prefix-length&gt;
- &lt;allow-icmp-ping&gt;Y&lt;/allow-icmp-ping&gt;
- &lt;udp-ports&gt;
- &lt;port-number&gt;3&lt;/port-number&gt;
- &lt;/udp-ports&gt;
- &lt;tcp-ports&gt;
- &lt;port-number&gt;3&lt;/port-number&gt;
- &lt;/tcp-ports&gt;
- &lt;/v6-firewall-packet-filters&gt;
- &lt;v6-firewall-packet-filters&gt;
- &lt;v6-firewall-prefix&gt;:&lt;/v6-firewall-prefix&gt;
- &lt;v6-firewall-prefix-length&gt;1&lt;/v6-firewall-prefix-length&gt;
- &lt;allow-icmp-ping&gt;Y&lt;/allow-icmp-ping&gt;
- &lt;udp-ports&gt;
- &lt;port-number&gt;4&lt;/port-number&gt;
- &lt;/udp-ports&gt;
- &lt;tcp-ports&gt;
- &lt;port-number&gt;4&lt;/port-number&gt;
- &lt;/tcp-ports&gt;
- &lt;/v6-firewall-packet-filters&gt;
- &lt;/firewall-lite&gt;
- &lt;pat&gt;
- &lt;v4-pat-pools&gt;
- &lt;v4-pat-pool-prefix&gt;192.168.1.44&lt;/v4-pat-pool-prefix&gt;
- &lt;v4-pat-pool-next-hop-address&gt;192.168.1.5&lt;/v4-pat-pool-next-hop-address&gt;
- &lt;v4-pat-pool-prefix-length&gt;0&lt;/v4-pat-pool-prefix-length&gt;
- &lt;/v4-pat-pools&gt;
- &lt;use-v4-default-pool&gt;Y&lt;/use-v4-default-pool&gt;
- &lt;v4-pat-enabled&gt;N&lt;/v4-pat-enabled&gt;
- &lt;v4-pat-pools&gt;
- &lt;v4-pat-pool-prefix&gt;192.168.1.45&lt;/v4-pat-pool-prefix&gt;
- &lt;v4-pat-pool-next-hop-address&gt;192.168.1.6&lt;/v4-pat-pool-next-hop-address&gt;
- &lt;v4-pat-pool-prefix-length&gt;28&lt;/v4-pat-pool-prefix-length&gt;
- &lt;/v4-pat-pools&gt;
- &lt;/pat&gt;
- &lt;nat&gt;
- &lt;v4-nat-enabled&gt;Y&lt;/v4-nat-enabled&gt;
- &lt;v4-nat-mapping-entries&gt;
- &lt;v4-nat-internal&gt;0.0.0.0&lt;/v4-nat-internal&gt;
- &lt;v4-nat-next-hop-address&gt;0.0.0.0&lt;/v4-nat-next-hop-address&gt;
- &lt;v4-nat-external&gt;0.0.0.0&lt;/v4-nat-external&gt;
- &lt;/v4-nat-mapping-entries&gt;
- &lt;v4-nat-mapping-entries&gt;
- &lt;v4-nat-internal&gt;0.0.0.1&lt;/v4-nat-internal&gt;
- &lt;v4-nat-next-hop-address&gt;0.0.0.1&lt;/v4-nat-next-hop-address&gt;
- &lt;v4-nat-external&gt;0.0.0.1&lt;/v4-nat-external&gt;
- &lt;/v4-nat-mapping-entries&gt;
- &lt;/nat&gt;
- &lt;vr-designation&gt;primary&lt;/vr-designation&gt;
- &lt;v4-vce-loopback-address&gt;162.200.3.144&lt;/v4-vce-loopback-address&gt;
- &lt;v6-vr-lan-prefix-length&gt;64&lt;/v6-vr-lan-prefix-length&gt;
- &lt;v6-vce-wan-address&gt;2001:1890:12e3:2da::&lt;/v6-vce-wan-address&gt;
- &lt;v6-vr-lan-prefix&gt;2620:0:10d0:f:ffff:ffff:ffff:fffe&lt;/v6-vr-lan-prefix&gt;
- &lt;v4-vr-lan-prefix-length&gt;24&lt;/v4-vr-lan-prefix-length&gt;
- &lt;v4-vr-lan-prefix&gt;10.192.27.254&lt;/v4-vr-lan-prefix&gt;
- &lt;v4-public-lan-prefixes&gt;
- &lt;t-provided-v4-lan-public-prefixes&gt;
- &lt;request-index&gt;1&lt;/request-index&gt;
- &lt;v4-next-hop-address&gt;192.168.1.2&lt;/v4-next-hop-address&gt;
- &lt;v4-lan-public-prefix&gt;192.168.1.1&lt;/v4-lan-public-prefix&gt;
- &lt;v4-lan-public-prefix-length&gt;28&lt;/v4-lan-public-prefix-length&gt;
- &lt;/t-provided-v4-lan-public-prefixes&gt;
- &lt;t-provided-v4-lan-public-prefixes&gt;
- &lt;request-index&gt;1&lt;/request-index&gt;
- &lt;v4-next-hop-address&gt;192.168.1.72&lt;/v4-next-hop-address&gt;
- &lt;v4-lan-public-prefix&gt;192.168.1.71&lt;/v4-lan-public-prefix&gt;
- &lt;v4-lan-public-prefix-length&gt;28&lt;/v4-lan-public-prefix-length&gt;
- &lt;/t-provided-v4-lan-public-prefixes&gt;
- &lt;t-provided-v4-lan-public-prefixes&gt;
- &lt;request-index&gt;1&lt;/request-index&gt;
- &lt;v4-next-hop-address&gt;192.168.1.68&lt;/v4-next-hop-address&gt;
- &lt;v4-lan-public-prefix&gt;192.168.1.67&lt;/v4-lan-public-prefix&gt;
- &lt;v4-lan-public-prefix-length&gt;28&lt;/v4-lan-public-prefix-length&gt;
- &lt;/t-provided-v4-lan-public-prefixes&gt;
- &lt;/v4-public-lan-prefixes&gt;
- &lt;v6-public-lan-prefixes&gt;
- &lt;t-provided-v6-lan-public-prefixes&gt;
- &lt;request-index&gt;1&lt;/request-index&gt;
- &lt;v6-next-hop-address&gt;2001:1890:12e3:2da::&lt;/v6-next-hop-address&gt;
- &lt;v6-lan-public-prefix&gt;2001:1890:12e3:2da::&lt;/v6-lan-public-prefix&gt;
- &lt;v6-lan-public-prefix-length&gt;28&lt;/v6-lan-public-prefix-length&gt;
- &lt;/t-provided-v6-lan-public-prefixes&gt;
- &lt;t-provided-v6-lan-public-prefixes&gt;
- &lt;request-index&gt;1&lt;/request-index&gt;
- &lt;v6-next-hop-address&gt;2001:1890:12e3:2da::&lt;/v6-next-hop-address&gt;
- &lt;v6-lan-public-prefix&gt;2001:1890:12e3:3da::&lt;/v6-lan-public-prefix&gt;
- &lt;v6-lan-public-prefix-length&gt;28&lt;/v6-lan-public-prefix-length&gt;
- &lt;/t-provided-v6-lan-public-prefixes&gt;
- &lt;t-provided-v6-lan-public-prefixes&gt;
- &lt;request-index&gt;1&lt;/request-index&gt;
- &lt;v6-next-hop-address&gt;2001:1890:12e3:2da::&lt;/v6-next-hop-address&gt;
- &lt;v6-lan-public-prefix&gt;2001:1890:12e3:4da::&lt;/v6-lan-public-prefix&gt;
- &lt;v6-lan-public-prefix-length&gt;28&lt;/v6-lan-public-prefix-length&gt;
- &lt;/t-provided-v6-lan-public-prefixes&gt;
- &lt;/v6-public-lan-prefixes&gt;
- &lt;/vr-lan-interface&gt;
- &lt;routing-protocol&gt;none&lt;/routing-protocol&gt;
- &lt;/vr-lan&gt;
-&lt;ucpe-vms-service-information&gt;
- &lt;transport-service-information&gt;
- &lt;transport-service-type&gt;AVPN&lt;/transport-service-type&gt;
- &lt;access-circuit-info&gt;
- &lt;access-circuit-id&gt;1&lt;/access-circuit-id&gt;
- &lt;dual-mode&gt;Active&lt;/dual-mode&gt;
- &lt;/access-circuit-info&gt;
- &lt;access-circuit-info&gt;
- &lt;access-circuit-id&gt;2&lt;/access-circuit-id&gt;
- &lt;dual-mode&gt;Standby&lt;/dual-mode&gt;
- &lt;/access-circuit-info&gt;
- &lt;/transport-service-information&gt;
- &lt;ucpe-information&gt;
- &lt;ucpe-host-name&gt;hostname&lt;/ucpe-host-name&gt;
- &lt;ucpe-activation-code&gt;activecode&lt;/ucpe-activation-code&gt;
- &lt;out-of-band-management-modem&gt;OOB&lt;/out-of-band-management-modem&gt;
- &lt;/ucpe-information&gt;
- &lt;vnf-list&gt;
- &lt;vnf-information&gt;
- &lt;vnf-instance-id&gt;1&lt;/vnf-instance-id&gt;
- &lt;vnf-sequence-number&gt;1&lt;/vnf-sequence-number&gt;
- &lt;vnf-type&gt;ZZ&lt;/vnf-type&gt;
- &lt;vnf-vendor&gt;JUNIPER&lt;/vnf-vendor&gt;
- &lt;vnf-model&gt;MODEL1&lt;/vnf-model&gt;
- &lt;vnf-id&gt;1&lt;/vnf-id&gt;
- &lt;prov-status&gt;1&lt;/prov-status&gt;
- &lt;operational-state&gt;1&lt;/operational-state&gt;
- &lt;orchestration-status&gt;1&lt;/orchestration-status&gt;
- &lt;equipment-role&gt;1&lt;/equipment-role&gt;
- &lt;/vnf-information&gt;
- &lt;vnf-information&gt;
- &lt;vnf-instance-id&gt;2&lt;/vnf-instance-id&gt;
- &lt;vnf-sequence-number&gt;2&lt;/vnf-sequence-number&gt;
- &lt;vnf-type&gt;HY&lt;/vnf-type&gt;
- &lt;vnf-vendor&gt;JUNIPER&lt;/vnf-vendor&gt;
- &lt;vnf-model&gt;MODEL2&lt;/vnf-model&gt;
- &lt;vnf-id&gt;2&lt;/vnf-id&gt;
- &lt;prov-status&gt;2&lt;/prov-status&gt;
- &lt;operational-state&gt;2&lt;/operational-state&gt;
- &lt;orchestration-status&gt;2&lt;/orchestration-status&gt;
- &lt;equipment-role&gt;2&lt;/equipment-role&gt;
- &lt;/vnf-information&gt;
- &lt;/vnf-list&gt;
- &lt;/ucpe-vms-service-information&gt;
- &lt;request-information&gt;
- &lt;request-action&gt;Layer3ServiceActivateRequest&lt;/request-action&gt;
- &lt;order-number&gt;4281555&lt;/order-number&gt;
- &lt;request-id&gt;155415ab-b4a7-4382-b4c6-d17d9sm42855&lt;/request-id&gt;
- &lt;notification-url&gt;https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws&lt;/notification-url&gt;
- &lt;source&gt;OMX&lt;/source&gt;
- &lt;order-version&gt;1&lt;/order-version&gt;
- &lt;/request-information&gt;
- &lt;sdnc-request-header&gt;
- &lt;svc-action&gt;activate&lt;/svc-action&gt;
- &lt;svc-notification-url&gt;https://msojra.mtsnjdcp1.aic.cip.com:8443/adapters/rest/SDNCNotify&lt;/svc-notification-url&gt;
- &lt;svc-request-id&gt;5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760&lt;/svc-request-id&gt;
- &lt;/sdnc-request-header&gt;
- &lt;l2-homing-information&gt;
- &lt;topology&gt;MultiPoint&lt;/topology&gt;
- &lt;preferred-aic-clli&gt;MTSNJA4LCP1&lt;/preferred-aic-clli&gt;
- &lt;evc-name&gt;AS/VLXM/003717//SW&lt;/evc-name&gt;
- &lt;/l2-homing-information&gt;
- &lt;service-information&gt;
- &lt;service-instance-id&gt;FK/VLXM/003717//SW_INTERNET&lt;/service-instance-id&gt;
- &lt;subscriber-name&gt;ST E2E Test42855_1300004281555&lt;/subscriber-name&gt;
- &lt;service-type&gt;SDN-ETHERNET-INTERNET&lt;/service-type&gt;
- &lt;/service-information&gt;
- &lt;internet-service-change-details&gt;
- &lt;internet-evc-speed-value&gt;10&lt;/internet-evc-speed-value&gt;
- &lt;internet-evc-speed-units&gt;Kbps&lt;/internet-evc-speed-units&gt;
- &lt;t-provided-v4-lan-public-prefixes&gt;
- &lt;request-index&gt;1&lt;/request-index&gt;
- &lt;v4-next-hop-address&gt;192.168.1.15&lt;/v4-next-hop-address&gt;
- &lt;v4-lan-public-prefix&gt;192.168.1.15&lt;/v4-lan-public-prefix&gt;
- &lt;v4-lan-public-prefix-length&gt;28&lt;/v4-lan-public-prefix-length&gt;
- &lt;/t-provided-v4-lan-public-prefixes&gt;
- &lt;t-provided-v4-lan-public-prefixes&gt;
- &lt;request-index&gt;2&lt;/request-index&gt;
- &lt;v4-next-hop-address&gt;192.168.1.16&lt;/v4-next-hop-address&gt;
- &lt;v4-lan-public-prefix&gt;192.168.1.16&lt;/v4-lan-public-prefix&gt;
- &lt;v4-lan-public-prefix-length&gt;28&lt;/v4-lan-public-prefix-length&gt;
- &lt;/t-provided-v4-lan-public-prefixes&gt;
- &lt;t-provided-v6-lan-public-prefixes&gt;
- &lt;request-index&gt;1&lt;/request-index&gt;
- &lt;v6-next-hop-address&gt;2001:1890:12e3:2da::&lt;/v6-next-hop-address&gt;
- &lt;v6-lan-public-prefix&gt;2001:1890:12e3:2da::&lt;/v6-lan-public-prefix&gt;
- &lt;v6-lan-public-prefix-length&gt;28&lt;/v6-lan-public-prefix-length&gt;
- &lt;/t-provided-v6-lan-public-prefixes&gt;
- &lt;t-provided-v6-lan-public-prefixes&gt;
- &lt;request-index&gt;1&lt;/request-index&gt;
- &lt;v6-next-hop-address&gt;2001:1890:12e3:2da::&lt;/v6-next-hop-address&gt;
- &lt;v6-lan-public-prefix&gt;2001:1890:12e3:2da::&lt;/v6-lan-public-prefix&gt;
- &lt;v6-lan-public-prefix-length&gt;28&lt;/v6-lan-public-prefix-length&gt;
- &lt;/t-provided-v6-lan-public-prefixes&gt;
- &lt;/internet-service-change-details&gt;
- &lt;/service-data&gt;
- &lt;/layer3-service-list&gt;
-</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("&", "&amp;").replace("<", "&lt;")
- }
-}
+/*-
+ * ============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/groovy/org/onap/so/bpmn/common/scripts/utils/XmlComparator.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/XmlComparator.groovy
new file mode 100644
index 0000000000..e1c86edd90
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/utils/XmlComparator.groovy
@@ -0,0 +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.onap.so.bpmn.common.scripts.utils
+
+import org.custommonkey.xmlunit.DetailedDiff
+import org.custommonkey.xmlunit.XMLUnit
+import org.junit.Assert
+
+
+class XmlComparator {
+
+ 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());
+ }
+}
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)
- }
-}