aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java23
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java9
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java18
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java14
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java31
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java6
-rw-r--r--adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java42
-rw-r--r--aria/aria-rest-server/VERSION1
-rw-r--r--aria/aria-rest-server/setup.py8
-rw-r--r--aria/aria-rest-server/tox.ini2
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml13
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy14
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy142
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy122
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy65
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy55
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java131
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java83
22 files changed, 516 insertions, 298 deletions
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java
index 5e3f79add6..c3949a6a79 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java
@@ -20,6 +20,11 @@
package org.openecomp.mso.adapters.sdnc;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
@@ -74,14 +79,14 @@ public class ObjectFactoryTest {
fail ();
}
String marshalled = writer.toString ();
- assert(marshalled.contains ("<RequestId>reqid</RequestId>"));
+ assertThat(marshalled, containsString("<RequestId>reqid</RequestId>"));
InputStream inputStream = new ByteArrayInputStream(marshalled.getBytes(Charset.forName("UTF-8")));
try {
RequestHeader res2 = (RequestHeader) jaxbUnmarshaller.unmarshal (inputStream);
- assert(res2.getCallbackUrl ().equals ("callback"));
- assert(res2.getMsoAction ().equals ("action"));
- assert(res2.getSvcOperation ().equals ("op"));
+ assertEquals("callback", res2.getCallbackUrl ());
+ assertEquals("action", res2.getMsoAction ());
+ assertEquals("op", res2.getSvcOperation ());
} catch (JAXBException e) {
e.printStackTrace();
fail();
@@ -95,6 +100,14 @@ public class ObjectFactoryTest {
public final void testCreateSDNCAdapterResponse () {
ObjectFactory of = new ObjectFactory ();
SDNCAdapterResponse ar = of.createSDNCAdapterResponse ();
- assert (ar != null);
+ assertNotNull(ar);
}
+
+ @Test
+ public final void testCreateSDNCAdapterRequest () {
+ ObjectFactory of = new ObjectFactory ();
+ SDNCAdapterRequest ar = of.createSDNCAdapterRequest ();
+ assertNotNull(ar);
+ }
+
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java
index fa96b7983e..b9d88406f9 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java
@@ -21,6 +21,9 @@
package org.openecomp.mso.adapters.sdnc;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.BeforeClass;
import org.junit.Test;
import org.openecomp.mso.adapters.sdnc.SDNCAdapterRequest;
@@ -46,9 +49,9 @@ public class SDNCAdapterRequestTest {
public final void testtoString(){
((SDNCAdapterRequest) sd).setRequestData("data");
((SDNCAdapterRequest) sd).setRequestHeader(rh);
- assert (((SDNCAdapterRequest) sd).getRequestData()!= null) ;
- assert(((SDNCAdapterRequest) sd).getRequestData().equals("data"));
- assert(((SDNCAdapterRequest) sd).getRequestHeader().equals(rh));
+ assertNotNull(((SDNCAdapterRequest) sd).getRequestData()) ;
+ assertEquals("data", ((SDNCAdapterRequest) sd).getRequestData());
+ assertEquals(rh, ((SDNCAdapterRequest) sd).getRequestHeader());
}
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java
index 88d2b950b9..39518e2081 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java
@@ -20,8 +20,10 @@
package org.openecomp.mso.adapters.sdnc.client;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Test;
-import org.openecomp.mso.adapters.sdnc.client.CallbackHeader;
public class CallbackHeaderTest {
@@ -32,16 +34,16 @@ public class CallbackHeaderTest {
cb.setRequestId("413658f4-7f42-482e-b834-23a5c15657da-1474471336781");
cb.setResponseCode("200");
cb.setResponseMessage("OK");
- assert (cb.getRequestId() != null);
- assert (cb.getResponseCode() != null);
- assert (cb.getResponseMessage() != null);
- assert (cb.getRequestId().equals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781"));
- assert (cb.getResponseCode().equals("200"));
- assert (cb.getResponseMessage().equals("OK"));
+ assertNotNull(cb.getRequestId());
+ assertNotNull(cb.getResponseCode());
+ assertNotNull(cb.getResponseMessage());
+ assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", cb.getRequestId());
+ assertEquals("200", cb.getResponseCode());
+ assertEquals("OK", cb.getResponseMessage());
}
@Test
public void testtoString() {
- assert (cb.toString() != null);
+ assertNotNull(cb.toString());
}
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java
index 63aa49cf54..ecffd1c5ad 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java
@@ -21,6 +21,9 @@
package org.openecomp.mso.adapters.sdnc.client;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Test;
import org.openecomp.mso.adapters.sdnc.client.CallbackHeader;
import org.openecomp.mso.adapters.sdnc.client.SDNCAdapterCallbackRequest;
@@ -35,17 +38,18 @@ public class SDNCAdapterCallbackRequestTest {
{
sdc.setCallbackHeader(ch);
sdc.setRequestData("data");
- assert(sdc.getCallbackHeader()!=null);
- assert(sdc.getRequestData()!=null);
- assert(sdc.getCallbackHeader().equals(ch));
- assert(sdc.getRequestData().equals("data"));
+ assertNotNull(sdc.getCallbackHeader());
+ assertNotNull(sdc.getRequestData());
+ assertEquals(ch, sdc.getCallbackHeader());
+ assertEquals("data", sdc.getRequestData());
}
@Test
public void testtoString()
{
- assert(ch.toString()!=null);
+ assertNotNull(ch.toString());
+ assertNotNull(sdc.toString());
}
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java
index 17ba0d22f8..72b11708e6 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java
@@ -20,6 +20,8 @@
package org.openecomp.mso.adapters.sdnc.impl;
+import static org.junit.Assert.*;
+
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
@@ -54,18 +56,31 @@ public class RequestTunablesTest {
@Test
public final void testRequestTunables () {
RequestTunables rt = new RequestTunables (null, null, "op", null,msoPropertiesFactory);
- assert(rt.getReqId ().length ()==0);
+ assertEquals(0, rt.getReqId ().length ());
rt = new RequestTunables ("reqId", "msoAction", null, "query",msoPropertiesFactory);
rt.setTunables ();
System.out.println(rt.toString ());
// assert (rt.getReqMethod ().equals ("toto"));
- assert (rt.getTimeout () != null);
- assert (rt.getAction ().equals ("query"));
- assert (rt.getMsoAction ().equals ("msoAction"));
- assert (rt.getHeaderName ().equals ("sdnc-request-header"));
- assert (rt.getOperation ().length () == 0);
- assert (rt.getAsyncInd ().equals ("N"));
- assert (rt.getReqId ().equals ("reqId"));
+ assertNotNull(rt.getTimeout ());
+ assertEquals("query", rt.getAction ());
+ assertEquals("msoAction", rt.getMsoAction ());
+ assertEquals("sdnc-request-header", rt.getHeaderName ());
+ assertEquals(0, rt.getOperation ().length ());
+ assertEquals("N", rt.getAsyncInd ());
+ assertEquals("reqId", rt.getReqId ());
+ }
+
+ @Test
+ public final void testRequestTunablesSet() {
+ RequestTunables rt = new RequestTunables("reqId", "gammainternet", "service-configuration-operation", "changeactivate", msoPropertiesFactory);
+ rt.setTunables ();
+ assertNotNull(rt.getTimeout ());
+ assertEquals("changeactivate", rt.getAction ());
+ assertEquals("gammainternet", rt.getMsoAction ());
+ assertEquals("sdnc-request-header", rt.getHeaderName ());
+ assertEquals("service-configuration-operation", rt.getOperation ());
+ assertEquals("N", rt.getAsyncInd ());
+ assertEquals("reqId", rt.getReqId ());
}
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java
index f8867ae4f8..f9c885f0eb 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java
@@ -43,7 +43,7 @@ public class SDNCResponseTest {
@Test
public void testtoString()
{
- assert(sdncresponse.toString()!=null);
+ assertNotNull(sdncresponse.toString());
}
}
\ No newline at end of file
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java
index 275c2acd14..77d22e44df 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java
@@ -20,6 +20,8 @@
package org.openecomp.mso.adapters.sdnc.util;
+import static org.junit.Assert.assertEquals;
+
import java.util.UUID;
import org.junit.Test;
@@ -35,8 +37,8 @@ public class SDNCRequestIdUtilTest {
String postfixedRequestId = originalRequestId + "-1466203712068";
String postfixedRequestId2 = originalRequestId + "-1466203712068-2";
- assert(SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId).equals(originalRequestId));
- assert(SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId2).equals(postfixedRequestId2));
+ assertEquals(originalRequestId, SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId));
+ assertEquals(postfixedRequestId2, SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId2));
}
diff --git a/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java b/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java
new file mode 100644
index 0000000000..8d2c938c09
--- /dev/null
+++ b/adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * 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.adapters.workflowmessage;
+
+import org.apache.http.entity.ContentType;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import static junit.framework.Assert.assertFalse;
+
+public class BPRestCallbackTest {
+
+ @Mock
+ ContentType contentType;
+
+ @Test
+ public void testSendExceptionCase() {
+
+ BPRestCallback test = new BPRestCallback();
+ test.send("workflowMessageUrl/", "messageType", "correlator", contentType,"message");
+ assertFalse(test.send("workflowMessageUrl/", "messageType", "correlator", contentType,"message"));
+
+ }
+ }
diff --git a/aria/aria-rest-server/VERSION b/aria/aria-rest-server/VERSION
deleted file mode 100644
index 51f7e73a94..0000000000
--- a/aria/aria-rest-server/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-1.0.1-SNAPSHOT
diff --git a/aria/aria-rest-server/setup.py b/aria/aria-rest-server/setup.py
index 799fe46021..eca497c1d4 100644
--- a/aria/aria-rest-server/setup.py
+++ b/aria/aria-rest-server/setup.py
@@ -19,15 +19,9 @@
from setuptools import setup, find_packages
-try:
- with open('VERSION') as v_file:
- version = v_file.read().strip()
-except IOError:
- print "There was a problem parsing the VERSION file."
-
setup(
name='aria-rest-server',
- version=version,
+ version='0.1.0',
packages=find_packages(),
author = '',
author_email = '',
diff --git a/aria/aria-rest-server/tox.ini b/aria/aria-rest-server/tox.ini
index e74b672b26..435de03638 100644
--- a/aria/aria-rest-server/tox.ini
+++ b/aria/aria-rest-server/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py27,py35
+envlist = py27
[testenv]
deps=
pytest
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index 6553e2ba53..32e7d4a6ac 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -15,7 +15,7 @@
<properties>
<camunda.version>7.8.0</camunda.version>
<spring.version>4.3.2.RELEASE</spring.version>
- <httpclient.version>3.1</httpclient.version>
+ <httpclient.version>4.5.5</httpclient.version>
<jax.ws.rs>2.0.1</jax.ws.rs>
<jackson.version>1.1.1</jackson.version>
<maven.compiler.target>1.8</maven.compiler.target>
@@ -386,8 +386,8 @@
<version>1.6.12</version>
</dependency>
<dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
@@ -417,13 +417,6 @@
<version>${spring.version}</version>
</dependency>
-->
- <!-- bwj: duplicated
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>${httpclient.version}</version>
- </dependency>
- -->
<!-- bwj: added -->
<dependency>
<groupId>com.googlecode.libphonenumber</groupId>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
index 6d5249e4d6..a49a0664e8 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
@@ -136,7 +136,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
}
- public void prepareDecomposeService_Target(Execution execution) {
+ public void prepareDecomposeService_Target(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
@@ -160,7 +160,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
}
}
- public void processDecomposition_Target(Execution execution) {
+ public void processDecomposition_Target(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ", isDebugEnabled)
@@ -174,7 +174,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
}
}
- public void prepareDecomposeService_Original(Execution execution) {
+ public void prepareDecomposeService_Original(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
@@ -198,7 +198,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
}
}
- public void processDecomposition_Original(Execution execution) {
+ public void processDecomposition_Original(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ", isDebugEnabled)
@@ -212,7 +212,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
}
}
- public void doCompareModelVersions(execution){
+ public void doCompareModelVersions(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start doCompareModelVersions Process ======== ", isDebugEnabled)
@@ -222,8 +222,8 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
List<Resource> allSR_target = serviceDecomposition_Target.getServiceResources();
List<Resource> allSR_original = serviceDecomposition_Original.getServiceResources();
- List<Resource> addedResource = new ArrayList<String>()
- List<Resource> delResource = new ArrayList<String>()
+ List<Resource> addResourceList = new ArrayList<String>()
+ List<Resource> delResourceList = new ArrayList<String>()
addResourceList.addAll(allSR_target)
delResourceList.addAll(allSR_original)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index a58ab9b756..4ad58fb669 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -444,135 +444,23 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
}
-
- /**
- * sequence resource. we should analyze resource sequence from service template
- * Here we make VF first, and then network for E2E service.
- */
- public void sequenceResoure(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start sequenceResoure Process ======== ", isDebugEnabled)
- String serviceModelUUID = execution.getVariable("modelUuid")
- JSONArray networks = cutils.getAllNetworksByServiceModelUuid(execution, serviceModelUUID)
- utils.log("DEBUG", "obtained Network list: " + networks, isDebugEnabled)
- if (networks == null) {
- utils.log("INFO", "No matching networks in Catalog DB for serviceModelUUID=" + serviceModelUUID, isDebugEnabled)
- }
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- //we use VF to define a network service
- List<VnfResource> vnfResourceList= serviceDecomposition.getServiceVnfs()
-
- //here wan is defined as a network resource
- List<NetworkResource> networkResourceList = serviceDecomposition.getServiceNetworks()
-
- //allotted resource
- List<AllottedResource> arResourceList= serviceDecomposition.getServiceAllottedResources()
- //define sequenced resource list, we deploy vf first and then network and then ar
- //this is defaule sequence
- List<Resource> sequencedResourceList = new ArrayList<Resource>();
- if(null != vnfResourceList){
- sequencedResourceList.addAll(vnfResourceList)
- }
- if(null != networkResourceList){
- sequencedResourceList.addAll(networkResourceList)
- }
- if(null != arResourceList){
- sequencedResourceList.addAll(arResourceList)
- }
-
- String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true"
- execution.setVariable("isContainsWanResource", isContainsWanResource)
- execution.setVariable("currentResourceIndex", 0)
- execution.setVariable("sequencedResourceList", sequencedResourceList)
- utils.log("INFO", "sequencedResourceList: " + sequencedResourceList, isDebugEnabled)
- utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled)
+ // prepare input param for using DoCreateResources.bpmn
+ public void preProcessForAddResource(DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", " ======== STARTED preProcessForAddResource Process ======== ", isDebugEnabled)
+
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ List<Resource> addResourceList = serviceDecomposition.getServiceResources()
+ execution.setVariable("addResourceList", addResourceList)
+
+ utils.log("INFO", "======== COMPLETED preProcessForAddResource Process ======== ", isDebugEnabled)
}
+
+ public void postProcessForAddResource(DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ // do nothing now
- public void getCurrentResoure(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled)
- def currentIndex = execution.getVariable("currentResourceIndex")
- List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
- Resource currentResource = sequencedResourceList.get(currentIndex)
- utils.log("INFO", "Now we deal with resouce:" + currentResource.getModelInfo().getModelName(), isDebugEnabled)
- utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled)
- }
+ }
- /**
- * sequence resource
- */
- public void parseNextResource(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled)
- def currentIndex = execution.getVariable("currentResourceIndex")
- def nextIndex = currentIndex + 1
- execution.setVariable("currentResourceIndex", nextIndex)
- List<String> sequencedResourceList = execution.getVariable("sequencedResourceList")
- if(nextIndex >= sequencedResourceList.size()){
- execution.setVariable("allResourceFinished", "true")
- }else{
- execution.setVariable("allResourceFinished", "false")
- }
- utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled)
- }
-
- /**
- * post config request.
- */
- public void postConfigRequest(DelegateExecution execution){
- //now do noting
- }
-
- public void prepareResourceRecipeRequest(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
- ResourceInput resourceInput = new ResourceInput()
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
- String resourceInstanceName = resourceType + "_" + serviceInstanceName
- resourceInput.setResourceInstanceName(resourceInstanceName)
- utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled)
- String globalSubscriberId = execution.getVariable("globalSubscriberId")
- String serviceType = execution.getVariable("serviceType")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String operationId = execution.getVariable("operationId")
- String operationType = execution.getVariable("operationType")
- resourceInput.setGlobalSubscriberId(globalSubscriberId)
- resourceInput.setServiceType(serviceType)
- resourceInput.setServiceInstanceId(serviceInstanceId)
- resourceInput.setOperationId(operationId)
- resourceInput.setOperationType(operationType);
- def currentIndex = execution.getVariable("currentResourceIndex")
- List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
- Resource currentResource = sequencedResourceList.get(currentIndex)
- resourceInput.setResourceModelInfo(currentResource.getModelInfo());
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo());
-
- String incomingRequest = execution.getVariable("uuiRequest")
- //set the requestInputs from tempalte To Be Done
- String serviceModelUuid = execution.getVariable("modelUuid")
- String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
- String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
- resourceInput.setResourceParameters(resourceParameters)
- execution.setVariable("resourceInput", resourceInput)
- utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
- }
-
- public void executeResourceRecipe(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled)
- String requestId = execution.getVariable("msoRequestId")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String serviceType = execution.getVariable("serviceType")
- ResourceInput resourceInput = execution.getVariable("resourceInput")
- String requestAction = resourceInput.getOperationType()
- JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceUuid(), requestAction)
- String recipeUri = resourceRecipe.getString("orchestrationUri")
- String recipeTimeOut = resourceRecipe.getString("recipeTimeout")
- String recipeParamXsd = resourceRecipe.get("paramXSD")
- HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
-
- }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 07f13767ba..a53540ac89 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -23,7 +23,6 @@ package org.openecomp.mso.bpmn.infrastructure.scripts
import java.util.ArrayList
import java.util.Iterator
import java.util.List
-import javax.mail.Quota.Resource
import org.apache.commons.lang3.StringUtils
import org.apache.http.HttpResponse
import org.camunda.bpm.engine.delegate.DelegateExecution
@@ -41,8 +40,11 @@ import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.core.domain.AllottedResource
import org.openecomp.mso.bpmn.core.domain.NetworkResource
+import org.openecomp.mso.bpmn.core.domain.Resource
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.VnfResource
import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder
/**
* This groovy class supports the <class>DoCreateResources.bpmn</class> process.
@@ -66,6 +68,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
{
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+ CatalogDbUtils cutils = new CatalogDbUtils()
public void preProcessRequest(DelegateExecution execution)
{
@@ -88,7 +91,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
utils.log("INFO", " ***** Exit preProcessRequest *****", isDebugEnabled)
}
- public void sequenceResoure(Object execution)
+ public void sequenceResoure(DelegateExecution execution)
{
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start sequenceResoure Process ======== ", isDebugEnabled)
@@ -111,9 +114,9 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
if (rc instanceof VnfResource) {
vnfResourceList.add(rc)
} else if (rc instanceof NetworkResource) {
- NetworkResource.add(rc)
+ networkResourceList.add(rc)
} else if (rc instanceof AllottedResource) {
- AllottedResource.add(rc)
+ arResourceList.add(rc)
}
}
sequencedResourceList.addAll(vnfResourceList)
@@ -128,7 +131,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled)
}
- public void getCurrentResoure(execution){
+ public void getCurrentResoure(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled)
def currentIndex = execution.getVariable("currentResourceIndex")
@@ -138,7 +141,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled)
}
- public void parseNextResource(execution){
+ public void parseNextResource(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled)
def currentIndex = execution.getVariable("currentResourceIndex")
@@ -152,62 +155,59 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
}
utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled)
}
+
+ public void prepareResourceRecipeRequest(DelegateExecution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
+ ResourceInput resourceInput = new ResourceInput()
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String resourceInstanceName = resourceType + "_" + serviceInstanceName
+ resourceInput.setResourceInstanceName(resourceInstanceName)
+ utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled)
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String operationType = execution.getVariable("operationType")
+ resourceInput.setGlobalSubscriberId(globalSubscriberId)
+ resourceInput.setServiceType(serviceType)
+ resourceInput.setServiceInstanceId(serviceInstanceId)
+ resourceInput.setOperationId(operationId)
+ resourceInput.setOperationType(operationType);
+ def currentIndex = execution.getVariable("currentResourceIndex")
+ List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
+ Resource currentResource = sequencedResourceList.get(currentIndex)
+ resourceInput.setResourceModelInfo(currentResource.getModelInfo());
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo());
+
+ String incomingRequest = execution.getVariable("uuiRequest")
+ //set the requestInputs from tempalte To Be Done
+ String serviceModelUuid = execution.getVariable("modelUuid")
+ String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
+ String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
+ resourceInput.setResourceParameters(resourceParameters)
+ execution.setVariable("resourceInput", resourceInput)
+ utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
+ }
+
+ public void executeResourceRecipe(DelegateExecution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled)
+ String requestId = execution.getVariable("msoRequestId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String serviceType = execution.getVariable("serviceType")
+ ResourceInput resourceInput = execution.getVariable("resourceInput")
+ String requestAction = resourceInput.getOperationType()
+ JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction)
+ String recipeUri = resourceRecipe.getString("orchestrationUri")
+ String recipeTimeOut = resourceRecipe.getString("recipeTimeout")
+ String recipeParamXsd = resourceRecipe.get("paramXSD")
+ HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
+
+ }
- public void prepareResourceRecipeRequest(execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
- ResourceInput resourceInput = new ResourceInput()
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
- String resourceInstanceName = resourceType + "_" + serviceInstanceName
- resourceInput.setResourceInstanceName(resourceInstanceName)
- utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled)
- String globalSubscriberId = execution.getVariable("globalSubscriberId")
- String serviceType = execution.getVariable("serviceType")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String operationId = execution.getVariable("operationId")
- String operationType = execution.getVariable("operationType")
- resourceInput.setGlobalSubscriberId(globalSubscriberId)
- resourceInput.setServiceType(serviceType)
- resourceInput.setServiceInstanceId(serviceInstanceId)
- resourceInput.setOperationId(operationId)
- resourceInput.setOperationType(operationType);
- def currentIndex = execution.getVariable("currentResourceIndex")
- List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
- Resource currentResource = sequencedResourceList.get(currentIndex)
- String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid()
- resourceInput.setResourceCustomizationUuid(resourceCustomizationUuid);
- String resourceInvariantUuid = currentResource.getModelInfo().getModelInvariantUuid()
- resourceInput.setResourceInvariantUuid(resourceInvariantUuid)
- String resourceUuid = currentResource.getModelInfo().getModelUuid()
- resourceInput.setResourceUuid(resourceUuid)
-
- String incomingRequest = execution.getVariable("uuiRequest")
- //set the requestInputs from tempalte To Be Done
- String serviceModelUuid = execution.getVariable("modelUuid")
- String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
- String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
- resourceInput.setResourceParameters(resourceParameters)
- execution.setVariable("resourceInput", resourceInput)
- utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
- }
-
- public void executeResourceRecipe(execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled)
- String requestId = execution.getVariable("msoRequestId")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String serviceType = execution.getVariable("serviceType")
- ResourceInput resourceInput = execution.getVariable("resourceInput")
- String requestAction = resourceInput.getOperationType()
- JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceUuid(), requestAction)
- String recipeUri = resourceRecipe.getString("orchestrationUri")
- String recipeTimeOut = resourceRecipe.getString("recipeTimeout")
- String recipeParamXsd = resourceRecipe.get("paramXSD")
- HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
-
- }
-
- public void postConfigRequest(execution){
+ public void postConfigRequest(DelegateExecution execution){
//now do noting
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
index bf2d6bcc36..44e3b73697 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
@@ -26,6 +26,7 @@ import groovy.json.*
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.ServiceInstance
import org.openecomp.mso.bpmn.core.domain.ModelInfo
+import org.openecomp.mso.bpmn.core.domain.Resource
import org.openecomp.mso.bpmn.core.json.JsonUtils
import org.openecomp.mso.bpmn.common.scripts.AaiUtil
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -172,7 +173,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("modelInvariantUuid", modelInvariantUuid)
execution.setVariable("model-invariant-id-target", modelInvariantUuid)
execution.setVariable("modelUuid", modelUuid)
- execution.setVariable("model-version-id-target", modelUuid_target)
+ execution.setVariable("model-version-id-target", modelUuid)
//AAI PUT
String oStatus = execution.getVariable("initialStatus") ?: ""
@@ -388,7 +389,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
String operationType = execution.getVariable("operationType")
String resourceTemplateUUIDs = ""
String result = "processing"
- String progress = "0"
+ String progress = "10"
String reason = ""
String operationContent = "Prepare service updating"
utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
@@ -396,38 +397,38 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
execution.setVariable("operationType", operationType)
-
- String serviceRelationShip = execution.getVariable("serviceRelationShip")
-
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
- List relationShipList = jsonSlurper.parseText(serviceRelationShip)
-
- if (relationShipList != null) {
- relationShipList.each {
- resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":"
- }
- }
- execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
- String payload =
- """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ List<Resource> resourceList = new ArrayList<String>()
+ List<Resource> addResourceList = execution.getVariable("addResourceList")
+ List<Resource> delResourceList = execution.setVariable("delResourceList")
+ resourceList.addAll(addResourceList)
+ resourceList.addAll(delResourceList)
+ for(Resource resource : resourceList){
+ resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
+ }
+
+ def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://org.openecomp.mso/requestsdb">
<soapenv:Header/>
<soapenv:Body>
<ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
- <serviceId>${serviceId}</serviceId>
- <operationId>${operationId}</operationId>
- <operationType>${operationType}</operationType>
- <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
- </ns:initResourceOperationStatus>
- </soapenv:Body>
- </soapenv:Envelope>"""
-
- payload = utils.formatXml(payload)
- execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
- utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
+ </ns:initResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_initResOperStatusRequest", payload)
+ utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
+ utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
@@ -447,6 +448,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
+ String operationType = execution.getVariable("operationType")
String serviceName = execution.getVariable("serviceInstanceName")
String userId = ""
String result = "processing"
@@ -523,7 +525,12 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
public void postProcessForAddResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled)
+
+ ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target")
+ execution.setVariable("serviceDecomposition", serviceDecomposition_Target)
+ utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled)
}
public void preProcessForDeleteResource(DelegateExecution execution) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
index 1c87c11ff3..240b8d089b 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
@@ -138,6 +138,61 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
}
utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
}
+
+ /**
+ * Init the service Operation Status
+ */
+ public void prepareInitServiceOperationStatus(DelegateExecution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = UUID.randomUUID().toString()
+ String operationType = execution.getVariable("operationType")
+ String userId = ""
+ String result = "processing"
+ String progress = "0"
+ String reason = ""
+ String operationContent = "Prepare service updating"
+ utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ execution.setVariable("serviceInstanceId", serviceId)
+ execution.setVariable("operationId", operationId)
+ execution.setVariable("operationType", operationType)
+
+ def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <userId>${userId}</userId>
+ <result>${result}</result>
+ <operationContent>${operationContent}</operationContent>
+ <progress>${progress}</progress>
+ <reason>${reason}</reason>
+ </ns:updateServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
+ utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
+ utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload)
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
+ }
+ utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+ }
public void sendSyncResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn
index b681e2f3b4..d6dbf58594 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn
@@ -180,10 +180,6 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script>
<bpmn2:linkEventDefinition name="StartService" />
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1i7t9hq" sourceRef="IntermediateCatchEvent_0jrb3xu" targetRef="CustomE2EGetService" />
- <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0f2w7aj" name="GoTo ResourceLoop">
- <bpmn2:incoming>SequenceFlow_032s0yi</bpmn2:incoming>
- <bpmn2:linkEventDefinition name="ResourceLoop" />
- </bpmn2:intermediateThrowEvent>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource">
<bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing>
<bpmn2:linkEventDefinition name="StartPrepareResource" />
@@ -222,7 +218,7 @@ csi.preProcessForAddResource(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_1y7jr4t" name="PostProcess for Add Resource" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0d0c20n</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_032s0yi</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_0a6vgsu</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
def csi = new DoCreateE2EServiceInstance()
csi.postProcessForAddResource(execution)]]></bpmn2:script>
@@ -230,7 +226,10 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
<bpmn2:sequenceFlow id="SequenceFlow_13xfsff" sourceRef="Task_0raqlqc" targetRef="ScriptTask_04b21gb" />
<bpmn2:sequenceFlow id="SequenceFlow_0bf6bzp" sourceRef="ScriptTask_04b21gb" targetRef="CallActivity_1ojtwas" />
<bpmn2:sequenceFlow id="SequenceFlow_0d0c20n" sourceRef="CallActivity_1ojtwas" targetRef="ScriptTask_1y7jr4t" />
- <bpmn2:sequenceFlow id="SequenceFlow_032s0yi" sourceRef="ScriptTask_1y7jr4t" targetRef="IntermediateThrowEvent_0f2w7aj" />
+ <bpmn2:endEvent id="EndEvent_0hzmoug">
+ <bpmn2:incoming>SequenceFlow_0a6vgsu</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_0a6vgsu" sourceRef="ScriptTask_1y7jr4t" targetRef="EndEvent_0hzmoug" />
</bpmn2:process>
<bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
@@ -450,12 +449,6 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
<dc:Bounds x="125" y="76" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="IntermediateThrowEvent_0f2w7aj_di" bpmnElement="IntermediateThrowEvent_0f2w7aj">
- <dc:Bounds x="1315" y="282" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1299" y="323" width="73" height="24" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b">
<dc:Bounds x="18" y="282" width="36" height="36" />
<bpmndi:BPMNLabel>
@@ -513,11 +506,19 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
<dc:Bounds x="1024" y="294" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_032s0yi_di" bpmnElement="SequenceFlow_032s0yi">
+ <bpmndi:BPMNShape id="EndEvent_0hzmoug_di" bpmnElement="EndEvent_0hzmoug">
+ <dc:Bounds x="1315" y="282.4076655052265" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1333" y="322.4076655052265" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0a6vgsu_di" bpmnElement="SequenceFlow_0a6vgsu">
<di:waypoint xsi:type="dc:Point" x="1168" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="1242" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="1242" y="300" />
<di:waypoint xsi:type="dc:Point" x="1315" y="300" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1241.5" y="279" width="0" height="12" />
+ <dc:Bounds x="1257" y="294" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
index 2d0e9ee621..5f74cb9ddd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -705,7 +705,7 @@ public class E2EServiceInstances {
return response;
}
- if (curStatus != null && !curStatus.getProgress().equals("100")) {
+ if (curStatus != null && curStatus.getResult() != null && curStatus.getResult().equalsIgnoreCase("processing")) {
String chkMessage = "Error: Locked instance - This " + requestScope + " (" + requestId + ") "
+ "now being worked with a status of " + curStatus.getProgress() + " (ServiceName - "
+ curStatus.getServiceName()
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
index 590ac7cbed..c0f6ccc730 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
@@ -719,6 +719,7 @@ public class E2EServiceInstancesTest {
String serviceID) {
OperationStatus operationStatus = new OperationStatus();
operationStatus.setProgress("100");
+ operationStatus.setResult("finish");
return operationStatus;
}
};
@@ -790,6 +791,7 @@ public class E2EServiceInstancesTest {
public OperationStatus getOperationStatusByServiceId(
String serviceID) {
OperationStatus operationStatus = new OperationStatus();
+ operationStatus.setResult("processing");
return operationStatus;
}
};
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
index 3c35fed516..b182192257 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
@@ -22,6 +22,9 @@ package org.openecomp.mso.apihandlerinfra;
import static org.junit.Assert.assertTrue;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.lang.reflect.Field;
import java.net.URI;
import java.sql.Timestamp;
@@ -34,20 +37,38 @@ import javax.ws.rs.core.UriInfo;
import mockit.Mock;
import mockit.MockUp;
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.entity.BasicHttpEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
+import org.openecomp.mso.apihandler.common.CamundaClient;
import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkRequest;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.NetworkRecipe;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.InfraRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
public class NetworkRequestHandlerTest {
+ private static final String REQ_XML = "<network-request xmlns=\"http://org.openecomp/mso/infra/network-request/v1\"> <request-info> <request-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</request-id><action>CREATE</action> <source>VID</source> <service-instance-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</service-instance-id></request-info> <network-inputs> <network-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</network-id> <network-name>nwInstanceName</network-name> <network-type>nwModelName</network-type><modelCustomizationId>e1fc3ed3-31e5-48a8-913b-23184c1e9443</modelCustomizationId> <aic-cloud-region>e1fc3ed3-31e5-48a8-913b-23184c1e9443</aic-cloud-region> <tenant-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</tenant-id><service-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</service-id> <backout-on-failure>false</backout-on-failure><sdncVersion>1802</sdncVersion><service-instance-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</service-instance-id></network-inputs> <network-params></network-params> </network-request>";
+
+ private static MockUp<RequestsDatabase> mockRDB;
+ private static MockUp<NetworkMsoInfraRequest> mockMsoRequest;
+ private static MockUp<CatalogDatabase> mockCDB;
+ private static MockUp<CamundaClient> mockCamundaClient;
NetworkRequestHandler handler = null;
-
-UriInfo uriInfo = null;
+ UriInfo uriInfo = null;
@Before
public void setup() throws Exception{
@@ -63,31 +84,127 @@ UriInfo uriInfo = null;
f1.set(handler, uriInfo);
}
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties");
+
+ mockRDB = new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkDuplicateByVnfName (String vnfName, String action, String requestType) {
+ return null;
+ }
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 1;
+ }
+
+ @Mock
+ public int updateInfraFinalStatus (String requestId, String requestStatus, String statusMessage, long progress, String responseBody, String lastModifiedBy) {
+ return 1;
+ }
+ };
+
+ mockMsoRequest = new MockUp<NetworkMsoInfraRequest>() {
+ @Mock
+ public void createRequestRecord (Status status) {
+ return;
+ }
+ };
+
+ mockCDB = new MockUp<CatalogDatabase>() {
+ @Mock
+ public NetworkRecipe getNetworkRecipe (String networkType, String action, String serviceType) {
+ final NetworkRecipe networkRecipe = new NetworkRecipe();
+ networkRecipe.setOrchestrationUri("test/vnf");
+ networkRecipe.setRecipeTimeout(180);
+ return networkRecipe;
+ }
+
+ @Mock
+ public VfModule getVfModuleType(String type, String version) {
+ final VfModule vfModule = new VfModule();
+ return vfModule;
+ }
+
+ @Mock
+ public VnfResource getVnfResource (String vnfType, String serviceVersion) {
+ final VnfResource vnfResource = new VnfResource();
+ return vnfResource;
+ }
+ };
+
+ mockCamundaClient = new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String camundaReqXML, String requestId,
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
+ throws ClientProtocolException, IOException {
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ mockRDB.tearDown();
+ mockMsoRequest.tearDown();
+ mockCDB.tearDown();
+ mockCamundaClient.tearDown();
+ }
@Test
public void manageVnfRequestTest(){
Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test"));
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v2");
assertTrue(null != resp);
}
@Test
public void manageVnfRequestTestV1(){
Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test"));
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v1");
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v1");
assertTrue(null != resp);
}
@Test
public void manageVnfRequestTestV3(){
Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test"));
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v3");
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v3");
assertTrue(null != resp);
}
+
+ /*@Test
+ public void manageNetworkRequestTestV3Duplicate(){
+
+ MockUp<RequestsDatabase> mockDuplicate = new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkDuplicateByVnfName(String vnfName, String action, String requestType) {
+ return new InfraActiveRequests();
+ }
+ };
+
+ try {
+ Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test"));
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v3");
+ assertTrue(null != resp);
+ } finally {
+ mockDuplicate.tearDown();
+ }
+ }*/
@Test
public void manageVnfRequestTestInvalidVersion(){
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v249");
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v249");
assertTrue(null != resp);
}
@@ -102,7 +219,7 @@ UriInfo uriInfo = null;
return false;
}
};
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v2");
assertTrue(null != resp);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java
index 78ed076b55..ffdf5d40b4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java
@@ -22,14 +22,78 @@ package org.openecomp.mso.apihandlerinfra;
import static org.junit.Assert.assertTrue;
+import mockit.Mock;
+import mockit.MockUp;
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.entity.BasicHttpEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
+import org.openecomp.mso.apihandler.common.CamundaClient;
+import org.openecomp.mso.apihandlerinfra.volumebeans.ActionType;
+import org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType;
import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequest;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.NetworkRecipe;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.InfraRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+import javax.ws.rs.core.Response;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.Collections;
+import java.util.List;
public class VolumeInfoHandlerTest {
VolumeInfoHandler handler = new VolumeInfoHandler();
-
+
+ private static MockUp<RequestsDatabase> mockRDB;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties");
+
+ mockRDB = new MockUp<RequestsDatabase>() {
+ @Mock
+ public List<InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ final InfraActiveRequests requests = new InfraActiveRequests();
+ requests.setAction(ActionType.CREATE.name());
+ requests.setRequestStatus(RequestStatusType.IN_PROGRESS.name());
+ requests.setStartTime(Timestamp.valueOf(LocalDateTime.now()));
+ return Collections.singletonList(requests);
+ }
+ @Mock
+ public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
+ final InfraActiveRequests requests = new InfraActiveRequests();
+ requests.setAction(ActionType.CREATE.name());
+ requests.setRequestStatus(RequestStatusType.IN_PROGRESS.name());
+ requests.setStartTime(Timestamp.valueOf(LocalDateTime.now()));
+ return requests;
+ }
+ };
+
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ mockRDB.tearDown();
+ }
+
@Test
public void fillVnfRequestTestV3(){
VolumeRequest qr = new VolumeRequest();
@@ -51,4 +115,21 @@ public class VolumeInfoHandlerTest {
String vnfid = (String)qr.getVolumeParams();
assertTrue(vnfid.equals("test"));
}
+
+ @Test
+ public void queryFilters() {
+ final Response response = handler.queryFilters("vnf-type", "svc-type", "aicNode", "tenant-id",
+ "vg-id", "vg-name", "v3");
+ }
+
+ @Test
+ public void queryFilters2() {
+ final Response response = handler.queryFilters(null, "svc-type", "aicNode", "tenant-id",
+ "vg-id", "vg-name", "v3");
+ }
+
+ @Test
+ public void getRequest() {
+ final Response response = handler.getRequest("request-id", "v3");
+ }
}