aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java15
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn51
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java10
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java8
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java20
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/SubType.java11
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.spec.ts22
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.ts2
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts11
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts81
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts2
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts115
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts49
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.spec.ts11
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.spec.ts22
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/toastr-notification-service.service.spec.ts10
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.spec.ts8
27 files changed, 438 insertions, 86 deletions
diff --git a/.gitignore b/.gitignore
index 51723ae248..8eeea7a8cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,4 @@ packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/M
packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/MySQL-Requests-schema.sql
**/bin/
/tattletale/
+/.metadata/
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
index 178b4d1695..6da1f6d6ff 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
@@ -132,7 +132,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
def responseData = ""
try {
String vnfId = execution.getVariable("DAAIVfMod_vnfId")
- String vfModuleId = execution.setVariable("DAAIVfMod_vfModuleId")
+ String vfModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
String resourceVersion = execution.getVariable("DAAIVfMod_vfModRsrcVer")
AaiUtil aaiUriUtil = new AaiUtil(this)
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
index 78f3e96978..af93c1bfc0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
@@ -20,11 +20,15 @@
package org.onap.so.bpmn.common.baseclient;
+import java.util.ArrayList;
+import java.util.List;
+
import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
@@ -40,6 +44,17 @@ public class BaseClient<I,O> {
public HttpHeaders getHttpHeader() {
return httpHeader;
}
+
+ public HttpHeaders setDefaultHttpHeaders(String auth) {
+ httpHeader = new HttpHeaders();
+ httpHeader.set("Authorization", auth);
+ httpHeader.setContentType(MediaType.APPLICATION_JSON);
+ List<MediaType> acceptMediaTypes = new ArrayList<MediaType>();
+ acceptMediaTypes.add(MediaType.APPLICATION_JSON);
+ acceptMediaTypes.add(MediaType.TEXT_PLAIN);
+ httpHeader.setAccept(acceptMediaTypes);
+ return httpHeader;
+ }
public void setHttpHeader(HttpHeaders httpHeader) {
this.httpHeader = httpHeader;
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn
index fb2bfae01a..293ba5db9b 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="CreateNetworkCollectionBB" name="CreateNetworkCollectionBB" isExecutable="true">
<bpmn2:startEvent id="createNetworkCollection_startEvent">
<bpmn2:outgoing>SequenceFlow_1maepy7</bpmn2:outgoing>
@@ -23,41 +23,46 @@
</bpmn2:serviceTask>
<bpmn2:serviceTask id="ServiceTask_Connect_Collection_to_InstanceGroup" name="&#10;AAI&#10;Connect&#10;(net collection)&#10;" camunda:expression="${CreateNetworkCollection.connectCollectionToInstanceGroup(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))} ">
<bpmn2:incoming>SequenceFlow_0z4c30j</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1hij1px</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_0904jyg</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_05yxpu5" sourceRef="ServiceTask_create_NetworkCollection" targetRef="ServiceTask_create_NetworkCollectionInstanceGroup" />
<bpmn2:sequenceFlow id="SequenceFlow_0z4c30j" sourceRef="ServiceTask_create_NetworkCollectionInstanceGroup" targetRef="ServiceTask_Connect_Collection_to_InstanceGroup" />
<bpmn2:serviceTask id="ServiceTask_Connect_Collection_to_ServiceInstance" name="&#10;AAI&#10;Connect&#10;(svc instance)&#10;" camunda:expression="${CreateNetworkCollection.connectCollectionToServiceInstance(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))} ">
- <bpmn2:incoming>SequenceFlow_1hij1px</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_0gkrvg6</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0hhklb4</bpmn2:outgoing>
</bpmn2:serviceTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1hij1px" sourceRef="ServiceTask_Connect_Collection_to_InstanceGroup" targetRef="ServiceTask_Connect_Collection_to_ServiceInstance" />
<bpmn2:sequenceFlow id="SequenceFlow_0hhklb4" sourceRef="ServiceTask_Connect_Collection_to_ServiceInstance" targetRef="createNetworkCollection_EndEvent" />
+ <bpmn2:serviceTask id="ServiceTask_Connect_InstanceGroup_to_CloudRegion" name="&#10;AAI&#10;Connect&#10;(group to cloud)&#10;" camunda:expression="${CreateNetworkCollection.connectInstanceGroupToCloudRegion(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))} ">
+ <bpmn2:incoming>SequenceFlow_0904jyg</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0gkrvg6</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_0904jyg" sourceRef="ServiceTask_Connect_Collection_to_InstanceGroup" targetRef="ServiceTask_Connect_InstanceGroup_to_CloudRegion" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0gkrvg6" sourceRef="ServiceTask_Connect_InstanceGroup_to_CloudRegion" targetRef="ServiceTask_Connect_Collection_to_ServiceInstance" />
</bpmn2:process>
<bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateNetworkCollectionBB">
<bpmndi:BPMNShape id="StartEvent_0lbwmd1_di" bpmnElement="createNetworkCollection_startEvent">
- <dc:Bounds x="236" y="-55" width="36" height="36" />
+ <dc:Bounds x="255" y="-55" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="229" y="-14" width="50" height="12" />
+ <dc:Bounds x="228" y="-14" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_10l9a3s_di" bpmnElement="createNetworkCollection_EndEvent">
- <dc:Bounds x="1132" y="-55" width="36" height="36" />
+ <dc:Bounds x="1280" y="-55" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1128" y="-19" width="46" height="12" />
+ <dc:Bounds x="1254" y="-19" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_08q9eo4_di" bpmnElement="BuildName_ServiceTask">
<dc:Bounds x="346" y="-77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1maepy7_di" bpmnElement="SequenceFlow_1maepy7">
- <di:waypoint xsi:type="dc:Point" x="272" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="291" y="-37" />
<di:waypoint xsi:type="dc:Point" x="346" y="-37" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="309" y="-52" width="0" height="0" />
+ <dc:Bounds x="273.5" y="-52" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_02qnccl_di" bpmnElement="ServiceTask_create_NetworkCollection">
@@ -91,20 +96,30 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_15u6tzt_di" bpmnElement="ServiceTask_Connect_Collection_to_ServiceInstance">
- <dc:Bounds x="982" y="-77" width="100" height="80" />
+ <dc:Bounds x="1124" y="-77" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1hij1px_di" bpmnElement="SequenceFlow_1hij1px">
+ <bpmndi:BPMNEdge id="SequenceFlow_0hhklb4_di" bpmnElement="SequenceFlow_0hhklb4">
+ <di:waypoint xsi:type="dc:Point" x="1224" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1280" y="-37" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1207" y="-52" width="90" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0kpj3lv_di" bpmnElement="ServiceTask_Connect_InstanceGroup_to_CloudRegion">
+ <dc:Bounds x="971" y="-77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0904jyg_di" bpmnElement="SequenceFlow_0904jyg">
<di:waypoint xsi:type="dc:Point" x="917" y="-37" />
- <di:waypoint xsi:type="dc:Point" x="982" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="971" y="-37" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="950" y="-62" width="0" height="0" />
+ <dc:Bounds x="944" y="-58" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0hhklb4_di" bpmnElement="SequenceFlow_0hhklb4">
- <di:waypoint xsi:type="dc:Point" x="1082" y="-37" />
- <di:waypoint xsi:type="dc:Point" x="1132" y="-37" />
+ <bpmndi:BPMNEdge id="SequenceFlow_0gkrvg6_di" bpmnElement="SequenceFlow_0gkrvg6">
+ <di:waypoint xsi:type="dc:Point" x="1071" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1124" y="-37" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1107" y="-62" width="0" height="0" />
+ <dc:Bounds x="1097.5" y="-58" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java
index bd285f11e1..421e09c9cf 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java
@@ -35,7 +35,7 @@ public class CreateNetworkCollectionBBTest extends BaseBPMNTest{
public void sunnyDayCreateNetworkCollection_Test() throws InterruptedException {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkCollectionBB",variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("createNetworkCollection_startEvent", "BuildName_ServiceTask", "ServiceTask_create_NetworkCollection", "ServiceTask_create_NetworkCollectionInstanceGroup", "ServiceTask_Connect_Collection_to_InstanceGroup", "ServiceTask_Connect_Collection_to_ServiceInstance", "createNetworkCollection_EndEvent");
+ assertThat(pi).isStarted().hasPassedInOrder("createNetworkCollection_startEvent", "BuildName_ServiceTask", "ServiceTask_create_NetworkCollection", "ServiceTask_create_NetworkCollectionInstanceGroup", "ServiceTask_Connect_Collection_to_InstanceGroup", "ServiceTask_Connect_InstanceGroup_to_CloudRegion", "ServiceTask_Connect_Collection_to_ServiceInstance", "createNetworkCollection_EndEvent");
assertThat(pi).isEnded();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
index 1a3e8aa4e6..85e67c51a7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
@@ -217,8 +217,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
// Get vfModuleName from AAI response if it was not specified on the request
if (vfModuleName == null || vfModuleName.isEmpty()) {
if (execution.getVariable("vfModuleFromAAI") != null) {
- VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI")
- vfModuleName = vfModuleFromAAI.getElementText("vf-module-name")
+ org.onap.aai.domain.yang.VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI")
+ vfModuleName = vfModuleFromAAI.getVfModuleName()
}
}
String vfModuleModelName = execution.getVariable("vfModuleModelName")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy
index 456a9cfabf..47a4d55e0c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy
@@ -118,8 +118,12 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor {
}
Optional<GenericVnf> vnf = wrapper.asBean(GenericVnf.class)
- if(!vnf.get().getVfModules().getVfModule().isEmpty()){
- execution.setVariable("DoDVNF_vnfInUse", true)
+ if (vnf.get() != null) {
+ if (vnf.get().getVfModules() != null) {
+ if((vnf.get().getVfModules().getVfModule() != null) && !vnf.get().getVfModules().getVfModule().isEmpty()){
+ execution.setVariable("DoDVNF_vnfInUse", true)
+ }
+ }
}
}else{
execution.setVariable("GENGV_FoundIndicator", false)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
index bce19795ac..33cb6d4760 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
@@ -458,8 +458,11 @@ public class DoUpdateVfModule extends VfModuleBase {
def vnfType = execution.getVariable('DOUPVfMod_vnfType')
def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId')
def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName')
- def VfModule vfModule = (VfModule) execution.getVariable('DOUPVfMod_vfModule')
- def vfModuleName = vfModule.getElementText('vf-module-name')
+ def vfModuleName = ""
+ if (execution.getVariable('DOUPVfMod_vfModule') != null) {
+ org.onap.aai.domain.yang.VfModule vfModule = execution.getVariable('DOUPVfMod_vfModule')
+ vfModuleName = vfModule.getVfModuleName()
+ }
def tenantId = execution.getVariable('DOUPVfMod_tenantId')
def aicCloudRegion = execution.getVariable('DOUPVfMod_aicCloudRegion')
boolean usePreload = execution.getVariable("DOUPVfMod_usePreload")
@@ -616,8 +619,11 @@ public class DoUpdateVfModule extends VfModuleBase {
def tenantId = execution.getVariable('DOUPVfMod_tenantId')
def volumeGroupId = execution.getVariable('DOUPVfMod_volumeGroupId')
def volumeGroupStackId = execution.getVariable('DOUPVfMod_volumeGroupStackId')
- def VfModule vfModule = (VfModule) execution.getVariable('DOUPVfMod_vfModule')
- def heatStackId = vfModule.getElementText('heat-stack-id')
+ def heatStackId = ""
+ if (execution.getVariable('DOUPVfMod_vfModule') != null) {
+ org.onap.aai.domain.yang.VfModule vfModule = execution.getVariable('DOUPVfMod_vfModule')
+ heatStackId = vfModule.getHeatStackId()
+ }
def cloudId = execution.getVariable('DOUPVfMod_aicCloudRegion')
def vnfType = execution.getVariable('DOUPVfMod_vnfType')
def vnfName = execution.getVariable('DOUPVfMod_vnfName')
@@ -836,8 +842,11 @@ public class DoUpdateVfModule extends VfModuleBase {
def vnfType = execution.getVariable('DOUPVfMod_vnfType')
def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId')
def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName')
- def VfModule vfModule = (VfModule) execution.getVariable('DOUPVfMod_vfModule')
- def vfModuleName = vfModule.getElementText('vf-module-name')
+ def vfModuleName = ""
+ if (execution.getVariable('DOUPVfMod_vfModule') != null) {
+ org.onap.aai.domain.yang.VfModule vfModule = execution.getVariable('DOUPVfMod_vfModule')
+ vfModuleName = vfModule.getVfModuleName()
+ }
def tenantId = execution.getVariable('DOUPVfMod_tenantId')
def aicCloudRegion = execution.getVariable('DOUPVfMod_aicCloudRegion')
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
index 222a5482c5..c8c4d439bd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
@@ -91,6 +91,23 @@ public class CreateNetworkCollection {
}
/**
+ * BPMN access method to connect Instance Group to Cloud Region
+ * @param execution
+ * @throws Exception
+ */
+ public void connectInstanceGroupToCloudRegion(BuildingBlockExecution execution) throws Exception {
+ execution.setVariable("connectInstanceGroupToCloudRegionRollback", false);
+ try{
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Collection networkCollection = serviceInstance.getCollection();
+ aaiNetworkResources.connectInstanceGroupToCloudRegion(networkCollection.getInstanceGroup(), execution.getGeneralBuildingBlock().getCloudRegion());
+ execution.setVariable("connectInstanceGroupToCloudRegionRollback", true);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
* BPMN access method to connect Network Collection
* @param execution
* @throws Exception
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
index dc5ba64d2d..a4c705b0c7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
@@ -33,6 +33,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
@@ -144,6 +145,13 @@ public class AAINetworkResources {
injectionHelper.getAaiClient().connect(networkCollectionUri, netwrokCollectionInstanceGroupURI);
}
+ public void connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) {
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+ AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES);
+ }
+
public void connectNetworkCollectionToServiceInstance(Collection networkCollection, ServiceInstance networkCollectionServiceInstance) {
AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java
index cde7797ed0..207447ae35 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java
@@ -30,6 +30,7 @@ import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
@@ -43,11 +44,13 @@ public class CreateNetworkCollectionTest extends BaseTaskTest{
private L3Network network;
private ServiceInstance serviceInstance;
private OrchestrationContext orchestrationContext;
+ private CloudRegion cloudRegion;
@Before
public void before() {
serviceInstance = setServiceInstance();
network = setL3Network();
+ cloudRegion = setCloudRegion();
List<L3Network> l3NetworkList = new ArrayList<L3Network>();
l3NetworkList.add(network);
@@ -92,4 +95,11 @@ public class CreateNetworkCollectionTest extends BaseTaskTest{
createNetworkCollection.connectCollectionToServiceInstance(execution);
verify(aaiNetworkResources, times(1)).connectNetworkCollectionToServiceInstance(serviceInstance.getCollection(), serviceInstance);
}
+
+ @Test
+ public void connectInstanceGroupToCloudRegionTest() throws Exception {
+ doNothing().when(aaiNetworkResources).connectInstanceGroupToCloudRegion(serviceInstance.getCollection().getInstanceGroup(), cloudRegion);
+ createNetworkCollection.connectInstanceGroupToCloudRegion(execution);
+ verify(aaiNetworkResources, times(1)).connectInstanceGroupToCloudRegion(serviceInstance.getCollection().getInstanceGroup(), cloudRegion);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index d86453b87c..db01399b82 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -280,7 +280,6 @@ public class AAIObjectMapperTest {
instanceGroup.setInstanceGroupName("test-instanceGroupName");
instanceGroup.setResourceVersion("test-resourceVersion");
-
ModelInfoInstanceGroup model = new ModelInfoInstanceGroup();
model.setFunction("test-function");
model.setInstanceGroupRole("SUB-INTERFACE");
@@ -288,6 +287,7 @@ public class AAIObjectMapperTest {
model.setModelInvariantUUID("modelInvariantUUID-000");
model.setModelUUID("modelUUID-000");
model.setDescription("test-description");
+ model.setInstanceGroupRole("SUB-INTERFACE");
instanceGroup.setModelInfoInstanceGroup(model);
@@ -311,6 +311,7 @@ public class AAIObjectMapperTest {
assertEquals(aaiInstanceGroup.getModelVersionId(), instanceGroup.getModelInfoInstanceGroup().getModelUUID());
assertEquals(aaiInstanceGroup.getResourceVersion(), instanceGroup.getResourceVersion());
assertEquals(aaiInstanceGroup.getInstanceGroupType(), instanceGroup.getModelInfoInstanceGroup().getType());
+ assertEquals(aaiInstanceGroup.getInstanceGroupRole(), instanceGroup.getModelInfoInstanceGroup().getInstanceGroupRole());
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
index cf270c21a7..bd61424a45 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
@@ -58,6 +58,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -330,4 +331,13 @@ public class AAINetworkResourcesTest extends TestDataSetup{
verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Subnet.class));
}
+
+ @Test
+ public void connectInstanceGroupToCloudRegionTest() throws Exception {
+ aaiNetworkResources.connectInstanceGroupToCloudRegion(instanceGroup, cloudRegion);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
+ eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())),
+ eq(AAIEdgeLabel.USES));
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
index e91dc43af9..87951d516b 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
@@ -269,18 +269,18 @@ public class AAIResourcesClient extends AAIClient {
return e;
}
- private Relationship buildRelationship(AAIResourceUri uri) {
+ protected Relationship buildRelationship(AAIResourceUri uri) {
return buildRelationship(uri, Optional.empty());
}
- private Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) {
+ protected Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) {
return buildRelationship(uri, Optional.of(label));
}
- private Relationship buildRelationship(AAIResourceUri uri, Optional<AAIEdgeLabel> label) {
+ protected Relationship buildRelationship(AAIResourceUri uri, Optional<AAIEdgeLabel> label) {
final Relationship result = new Relationship();
result.setRelatedLink(uri.build().toString());
if (label.isPresent()) {
- result.setRelationshipLabel(label.toString());
+ result.setRelationshipLabel(label.get().toString());
}
return result;
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
index 63f8f652ce..22dc1cac30 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
@@ -28,15 +28,18 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
@@ -183,6 +186,21 @@ public class AAIResourcesClientTest {
AAIResultWrapper result = client.get(path, NotFoundException.class);
}
+ @Test
+ public void buildRelationshipTest() {
+ AAIResourcesClient client = createClient();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
+ Relationship relationship = new Relationship();
+ relationship.setRelatedLink(uri.build().toString());
+ Relationship actual = client.buildRelationship(uri);
+ assertThat("expect equal no label", actual, sameBeanAs(relationship));
+
+ relationship.setRelationshipLabel(AAIEdgeLabel.USES.toString());
+ actual = client.buildRelationship(uri, AAIEdgeLabel.USES);
+ assertThat("expect equal has label", actual, sameBeanAs(relationship));
+
+ }
+
private AAIResourcesClient createClient() {
AAIResourcesClient client = spy(new AAIResourcesClient());
doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/SubType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/SubType.java
index bc4f07b54b..3230d8427b 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/SubType.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/SubType.java
@@ -21,5 +21,14 @@
package org.onap.so.db.catalog.beans;
public enum SubType {
- SUB_INTERFACE
+ SUB_INTERFACE("SUB-INTERFACE");
+
+ private final String value;
+ SubType(String value){
+ this.value = value;
+ }
+ @Override
+ public String toString() {
+ return this.value;
+ }
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.spec.ts
index 076be174fb..cb5f53b7d4 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.spec.ts
@@ -23,6 +23,8 @@ SPDX-License-Identifier: Apache-2.0
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -32,22 +34,24 @@ describe('AppComponent', () => {
declarations: [
AppComponent
],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ],
}).compileComponents();
}));
- it('should create the app', async(() => {
+
+ // Ensure creation of SO Monitoring application
+ it('application should be created', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
- it(`should have as title 'app'`, async(() => {
+
+
+ // Ensure application title is "SO Monitor"
+ it(`should have title 'SO Monitor'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
- expect(app.title).toEqual('app');
- }));
- it('should render title in a h1 tag', async(() => {
- const fixture = TestBed.createComponent(AppComponent);
- fixture.detectChanges();
- const compiled = fixture.debugElement.nativeElement;
- expect(compiled.querySelector('h1').textContent).toContain('Welcome to ONAP-SO-Monitor!');
+ expect(app.title).toEqual('SO Monitor');
}));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.ts
index 2750e4780f..bac6643783 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.ts
@@ -29,5 +29,5 @@ import { Component } from '@angular/core';
})
export class AppComponent {
- title = 'app';
+ title = 'SO Monitor';
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
index b9437ccb75..3d736edb95 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
@@ -21,7 +21,7 @@ SPDX-License-Identifier: Apache-2.0
*/
import { BrowserModule } from '@angular/platform-browser';
-import { NgModule } from '@angular/core';
+import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@@ -41,6 +41,8 @@ import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material';
import { MatCardModule } from '@angular/material/card';
import { NgxSpinnerModule } from 'ngx-spinner';
+import { RouterModule, Routes } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
@NgModule({
declarations: [
@@ -64,7 +66,12 @@ import { NgxSpinnerModule } from 'ngx-spinner';
MatDatepickerModule,
MatNativeDateModule,
MatCardModule,
- NgxSpinnerModule
+ NgxSpinnerModule,
+ RouterModule,
+ RouterModule.forRoot([])
+ ],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
],
providers: [ToastrNotificationService],
bootstrap: [AppComponent]
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
index 987d29d548..834b8c34ea 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
@@ -23,15 +23,88 @@ SPDX-License-Identifier: Apache-2.0
import { TestBed, inject } from '@angular/core/testing';
import { DataService } from './data.service';
+import { HttpClient } from '@angular/common/http';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { async } from '@angular/core/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { ToastrNotificationService } from './toastr-notification-service.service';
+import { environment } from '../environments/environment';
+
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
describe('DataService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- providers: [DataService]
+ providers: [DataService, { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
+ imports: [HttpClientTestingModule]
});
});
- it('should be created', inject([DataService], (service: DataService) => {
- expect(service).toBeTruthy();
- }));
+ // Ensure creation of DataService component
+ it('component should be created', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ expect(service).toBeTruthy();
+ })));
+
+ // Test retrieveInstance function making POST call
+ it('test retrieveInstance POST request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.retrieveInstance({}, 1, 2).subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'v1/search?from=1&to=2';
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('POST');
+ mockReq.flush({});
+ })));
+
+ // Test getProcessInstanceId function making GET request to retrieve processInstanceID
+ it('test getProcessInstanceId GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getProcessInstanceId("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'process-instance-id/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
+
+ // Test getActivityInstance function making GET request to retrieve activityInstance
+ it('test getActivityInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getActivityInstance("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'activity-instance/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
+
+ // Test getProcessInstance function making GET request to retrieve processInstance
+ it('test getProcessInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getProcessInstance("");
+ var url = environment.soMonitoringBackendURL + 'process-instance/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ })));
+
+ // Test getProcessDefinition function making GET request to retrieve processDefinition
+ it('test getProcessDefinition GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getProcessDefinition("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'process-definition/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
+
+ // Test getVariableInstance function making GET request to retrieve variableInstance
+ it('test getVariableInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getVariableInstance("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'variable-instance/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
index 8913eaa86f..796739077c 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
@@ -52,7 +52,6 @@ export class DataService {
getProcessInstanceId(requestId): Observable<HttpResponse<ProcessInstanceId>> {
var url = environment.soMonitoringBackendURL + 'process-instance-id/' + requestId;
console.log(requestId);
- console.log(url);
return this.http.get<ProcessInstanceId>(url, { observe: 'response' })
.pipe(
catchError(this.httpErrorHandlerService.handleError("GET", url))
@@ -92,5 +91,4 @@ export class DataService {
catchError(this.httpErrorHandlerService.handleError("GET", url))
);
}
-
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
index 690c143b5f..8205226f9e 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
@@ -23,25 +23,116 @@ SPDX-License-Identifier: Apache-2.0
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DetailsComponent } from './details.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { RouterTestingModule } from '@angular/router/testing';
+import { MatTableModule } from '@angular/material';
+import { inject } from '@angular/core/testing';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
+import { RouterModule } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+import { ToastrNotificationService } from '../toastr-notification-service.service';
+import { DataService } from '../data.service';
+import { Observable, of } from 'rxjs';
+import { ACTINST } from '../model/activityInstance.model';
+import { PDI } from '../model/processDefinition.model';
+import { PII } from '../model/processInstance.model';
+import { VarInstance } from '../model/variableInstance.model';
-describe('DetailsComponent', () => {
- let component: DetailsComponent;
- let fixture: ComponentFixture<DetailsComponent>;
+// Generate stub for toastr popup notifications
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
+
+// Create SPY Object for Jasmine tests to mock DataService
+let spyDataService: jasmine.SpyObj<DataService>;
+describe('DetailsComponent', () => {
beforeEach(async(() => {
+ spyDataService = jasmine.createSpyObj('DataService', ['getActivityInstance', 'getVariableInstance']);
+
TestBed.configureTestingModule({
- declarations: [DetailsComponent]
+ providers: [DetailsComponent, HttpClient, HttpTestingController,
+ { provide: APP_BASE_HREF, useValue: '/' },
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService },
+ { provide: DataService, useValue: spyDataService }],
+ imports: [RouterTestingModule, MatTableModule, HttpClientModule, RouterModule.forRoot([])],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
})
.compileComponents();
}));
- beforeEach(() => {
- fixture = TestBed.createComponent(DetailsComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
+ // Ensure creation of DetailsComponent component
+ it('component should be created', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ expect(detailsComponent).toBeTruthy();
+ }));
+
+
+ // Mock an activityInstance and ensure array is populated
+ it('activityInstance should be defined if data service returns activities', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ const activity: ACTINST = {
+ activityId: "",
+ processInstanceId: "",
+ calledProcessInstanceId: "",
+ activityName: "",
+ activityType: "",
+ durationInMillis: "1",
+ endTime: "",
+ startTime: ""
+ };
+ spyDataService.getActivityInstance.and.returnValue(of([activity]));
+ detailsComponent.getActInst("");
+ expect(detailsComponent.activityInstance.length).toEqual(1);
+ }));
+
+
+ // Create a processDefinition and ensure it is defined
+ it('processDefinition should be defined if PDI populated', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ const activity: PDI = {
+ processDefinitionId: "1",
+ processDefinitionXml: ""
+ };
+ detailsComponent.getProcessDefinition("");
+ detailsComponent.processDefinition = activity;
+ expect(detailsComponent.processDefinition).toBeDefined();
+ }));
+
+
+ // Create a processInstance and ensure it is defined
+ it('processInstance should be defined if PII populated', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ const testVals: PII = {
+ processInstancId: "1",
+ processDefinitionId: "1",
+ processDefinitionName: "test",
+ superProcessInstanceId: "1"
+ };
+ detailsComponent.getProcInstance("");
+ detailsComponent.processInstance = testVals;
+ expect(detailsComponent.processInstance).toBeDefined();
+ }));
+
+
+ // displayCamundaflow test
+ // TODO
- it('should create', () => {
- expect(component).toBeTruthy();
- });
+ // Mock an variableInstance and ensure array is populated
+ it('variableInstance should be defined if data service returns activities', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ const activity2: VarInstance = {
+ name: "a",
+ type: "a",
+ value: "1"
+ };
+ spyDataService.getVariableInstance.and.returnValue(of([activity2]));
+ detailsComponent.getVarInst("");
+ expect(detailsComponent.variableInstance.length).toEqual(1);
+ }));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
index 9da8ba93f1..1e1485eaca 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
@@ -23,6 +23,23 @@ SPDX-License-Identifier: Apache-2.0
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { MatTableModule } from '@angular/material';
+import { FormsModule } from '@angular/forms';
+import { MatDatepickerModule } from '@angular/material/datepicker';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
+import { inject } from '@angular/core/testing';
+import { RouterModule } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+import { ToastrNotificationService } from '../toastr-notification-service.service';
+import { environment } from '../../environments/environment.prod';
+
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
describe('HomeComponent', () => {
let component: HomeComponent;
@@ -30,18 +47,32 @@ describe('HomeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [HomeComponent]
+ providers: [HomeComponent, HttpClient, HttpTestingController,
+ { provide: APP_BASE_HREF, useValue: '/' },
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
+ imports: [MatTableModule, FormsModule, MatDatepickerModule, HttpClientModule, RouterModule.forRoot([])],
+ declarations: [HomeComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
})
.compileComponents();
}));
- beforeEach(() => {
- fixture = TestBed.createComponent(HomeComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
+ // Ensure creation of HomeComponent component
+ it('component should be created', inject([HttpTestingController, HomeComponent],
+ (httpClient: HttpTestingController, service: HomeComponent) => {
+ expect(service).toBeTruthy();
+ }));
- it('should create', () => {
- expect(component).toBeTruthy();
- });
+ // Ensure all statistic variables are initialised to zero
+ it('ensure statistic variables are defaulted at zero', async(inject([HttpTestingController, HomeComponent],
+ (httpClient: HttpTestingController, service: HomeComponent) => {
+ expect(service.totalVal === 0 && service.completeVal === 0 &&
+ service.inProgressVal === 0 && service.failedVal === 0 &&
+ service.pendingVal === 0 && service.unlockedVal === 0 &&
+ service.percentageComplete === 0 && service.percentageFailed === 0 &&
+ service.percentageInProg === 0 && service.percentagePending === 0 &&
+ service.percentageUnlocked === 0).toBeTruthy();
+ })));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.spec.ts
index 0ecdf15d9e..9be827a69d 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.spec.ts
@@ -23,15 +23,22 @@ SPDX-License-Identifier: Apache-2.0
import { TestBed, inject } from '@angular/core/testing';
import { HttpErrorHandlerService } from './http-error-handler.service';
+import { ToastrNotificationService } from './toastr-notification-service.service';
+
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
describe('HttpErrorHandlerService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- providers: [HttpErrorHandlerService]
+ providers: [HttpErrorHandlerService,
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
});
});
- it('should be created', inject([HttpErrorHandlerService], (service: HttpErrorHandlerService) => {
+ it('ErrorHandler should be created', inject([HttpErrorHandlerService], (service: HttpErrorHandlerService) => {
expect(service).toBeTruthy();
}));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.spec.ts
index df51723f98..5068c2593e 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.spec.ts
@@ -23,6 +23,13 @@ SPDX-License-Identifier: Apache-2.0
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SidebarComponent } from './sidebar.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpTestingController } from '@angular/common/http/testing';
+import { HttpClient } from '@angular/common/http';
+import { inject } from '@angular/core/testing';
+import { RouterModule } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
describe('SidebarComponent', () => {
let component: SidebarComponent;
@@ -30,7 +37,12 @@ describe('SidebarComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [SidebarComponent]
+ providers: [SidebarComponent, HttpClient, HttpTestingController, { provide: APP_BASE_HREF, useValue: '/' }],
+ imports: [HttpClientModule, RouterModule.forRoot([])],
+ declarations: [SidebarComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
})
.compileComponents();
}));
@@ -41,7 +53,9 @@ describe('SidebarComponent', () => {
fixture.detectChanges();
});
- it('should create', () => {
- expect(component).toBeTruthy();
- });
+ it('component should be created', async(inject([HttpTestingController, SidebarComponent],
+ (httpClient: HttpTestingController, sideComponent: SidebarComponent) => {
+ expect(sideComponent).toBeTruthy();
+ })));
+
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/toastr-notification-service.service.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/toastr-notification-service.service.spec.ts
index 062cc905a4..cb685c9e98 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/toastr-notification-service.service.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/toastr-notification-service.service.spec.ts
@@ -24,14 +24,20 @@ import { TestBed, inject } from '@angular/core/testing';
import { ToastrNotificationService } from './toastr-notification-service.service';
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
+
describe('ToasterNotificationService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- providers: [ToastrNotificationService]
+ providers: [ToastrNotificationService,
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }]
});
});
- it('should be created', inject([ToastrNotificationService], (service: ToastrNotificationService) => {
+ it('component should be created', inject([ToastrNotificationService], (service: ToastrNotificationService) => {
expect(service).toBeTruthy();
}));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.spec.ts
index 0bc691ca7e..3d402bf1e9 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.spec.ts
@@ -23,6 +23,7 @@ SPDX-License-Identifier: Apache-2.0
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TopbarComponent } from './topbar.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
describe('TopbarComponent', () => {
let component: TopbarComponent;
@@ -30,7 +31,10 @@ describe('TopbarComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [TopbarComponent]
+ declarations: [TopbarComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
})
.compileComponents();
}));
@@ -41,7 +45,7 @@ describe('TopbarComponent', () => {
fixture.detectChanges();
});
- it('should create', () => {
+ it('component should be created', () => {
expect(component).toBeTruthy();
});
});