diff options
24 files changed, 111 insertions, 100 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index 44ea2a25a2..02b1df79dd 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -978,7 +978,7 @@ public class ASDCController { String artifactContent = null; List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts(); Optional<IArtifactInfo> artifactOpt = serviceArtifacts.stream() - .filter(e -> e.getArtifactType().equalsIgnoreCase("OTHER")).findFirst(); + .filter(e -> e.getArtifactType().equalsIgnoreCase("WORKFLOW")).findFirst(); if (artifactOpt.isPresent()) { IArtifactInfo artifactInfo = artifactOpt.get(); logger.debug("Ready to parse this serviceArtifactUUID: " + artifactInfo.getArtifactUUID()); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java index bb7197b7a4..4205de3cab 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java @@ -44,7 +44,7 @@ import com.google.common.collect.ImmutableSet; public class EtsiResourcePackageProcessor { private final static Logger LOGGER = LoggerFactory.getLogger(EtsiResourcePackageProcessor.class); - private static final String ONBOARDED_PACKAGE_DIR_PATH = "Artifacts/Deployment/ONBOARDED_PACKAGE"; + private static final String ONBOARDED_PACKAGE_DIR_PATH = "Artifacts/Deployment/ETSI_PACKAGE"; private final SdcResourceProvider sdcResourceProvider; private final EtsiCatalogServiceProvider catalogServiceProvider; private static final int SLEEP_TIME_IN_SECONDS = 5; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 49fef1d3f0..d57b305902 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -2913,15 +2913,19 @@ public class ToscaResourceInstaller { } private void createServiceArtifact(Service service, VfResourceStructure vfResourceStruct, String artifactContent) { + if (null == vfResourceStruct) { + return; + } List<ServiceArtifact> serviceArtifactList = new ArrayList<>(); ServiceArtifact serviceArtifact; List<IArtifactInfo> artifactInfoList = vfResourceStruct.getNotification().getServiceArtifacts().stream() - .filter(artifact -> artifact.getArtifactType().equalsIgnoreCase("OTHER")).collect(Collectors.toList()); + .filter(artifact -> artifact.getArtifactType().equalsIgnoreCase("WORKFLOW")) + .collect(Collectors.toList()); for (IArtifactInfo artifactInfo : artifactInfoList) { serviceArtifact = new ServiceArtifact(); serviceArtifact.setArtifactUUID(artifactInfo.getArtifactUUID()); serviceArtifact.setName(artifactInfo.getArtifactName()); - serviceArtifact.setType(artifactInfo.getArtifactType()); + serviceArtifact.setType("OTHER"); serviceArtifact.setVersion(artifactInfo.getArtifactVersion()); serviceArtifact.setDescription(artifactInfo.getArtifactDescription()); serviceArtifact.setChecksum(artifactInfo.getArtifactChecksum()); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java index cb5bd0f51a..2e8da35f3e 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java @@ -345,7 +345,7 @@ public class SdcNotificationWithSol004PackageTest extends BaseTest { * Mock the AAI using wireshark. */ private void initMockAaiServer(final String serviceUuid, final String serviceInvariantUuid) { - final String modelEndpoint = "/aai/v19/service-design-and-creation/models/model/" + serviceInvariantUuid + final String modelEndpoint = "/aai/v21/service-design-and-creation/models/model/" + serviceInvariantUuid + "/model-vers/model-ver/" + serviceUuid + "?depth=0"; wireMockServer.stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok())); diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/ETSI_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml index 6499a58fab..6499a58fab 100644 --- a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml +++ b/asdc-controller/src/test/resources/resource-examples/vgw/ETSI_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/ETSI_PACKAGE/VF_LICENSE/vf-license-model.xml index 581a3acb7f..581a3acb7f 100644 --- a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml +++ b/asdc-controller/src/test/resources/resource-examples/vgw/ETSI_PACKAGE/VF_LICENSE/vf-license-model.xml diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar b/asdc-controller/src/test/resources/resource-examples/vgw/ETSI_PACKAGE/vgw6.csar Binary files differindex 56dbb2bce0..56dbb2bce0 100644 --- a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar +++ b/asdc-controller/src/test/resources/resource-examples/vgw/ETSI_PACKAGE/vgw6.csar diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar b/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar Binary files differindex 7ddfb6ef51..9eb240d9a7 100644 --- a/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar +++ b/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json b/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json index d936cd1144..8c42c9c3e9 100644 --- a/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json +++ b/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json @@ -29,8 +29,8 @@ }, { "artifactName": "vgw6.csar", - "artifactType": "ONBOARDED_PACKAGE", - "artifactURL": "/ONBOARDED_PACKAGE/vgw6.csar", + "artifactType": "ETSI_PACKAGE", + "artifactURL": "/ETSI_PACKAGE/vgw6.csar", "artifactChecksum": "NjdmNGU3ZDlkODQ0YTUzMTU5NjZmOThiYjMxNTJiNGI\u003d", "artifactDescription": "Artifact created from csar", "artifactTimeout": 120, diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar b/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar Binary files differindex 51a9e19466..eaed092b00 100644 --- a/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar +++ b/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java index 62a2e9370e..57b8c1387d 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java @@ -30,6 +30,7 @@ public abstract class Resource extends JsonWrapper implements Serializable { private static final long serialVersionUID = 1L; private String resourceId; // TODO name this field just id instead, should be the id of the object as it is in aai + private String originalResourceId; protected ResourceType resourceType; // Enum of vnf or network or allotted resource protected ModelInfo modelInfo; private long concurrencyCounter = 1L; @@ -52,6 +53,14 @@ public abstract class Resource extends JsonWrapper implements Serializable { this.resourceId = resourceId; } + public String getOriginalResourceId() { + return originalResourceId; + } + + public void setOriginalResourceId(String originalResourceId) { + this.originalResourceId = originalResourceId; + } + public ModelInfo getModelInfo() { return modelInfo; } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn index 94279b7fe8..bd759caffd 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn @@ -26,7 +26,7 @@ ex.processJavaException(execution)</bpmn:script> <bpmn:incoming>Flow_0ca4l8d</bpmn:incoming> </bpmn:endEvent> <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1jygjln</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new TnAllocateNssi() @@ -34,15 +34,6 @@ runScript.prepareUpdateJobStatus(execution,"finished","100","Deallocated TN NSSI </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" /> <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0rgeefb" /> - <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1jygjln</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -execution.setVariable("orchestrationStatus", "deallocated") -def runScript = new DoDeallocateTnNssi() -runScript.updateAAIOrchStatus(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" /> <bpmn:scriptTask id="Activity_1tw8eyy" name="PreProcess SDNC Deallocate TN NSSI Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming> <bpmn:outgoing>Flow_0cpctye</bpmn:outgoing> @@ -91,7 +82,7 @@ def runScript = new DoDeallocateTnNssi() runScript.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_1tw8eyy" /> - <bpmn:sequenceFlow id="SequenceFlow_1jygjln" sourceRef="Activity_013rjwc" targetRef="ScriptTask_19uxoi8" /> + <bpmn:sequenceFlow id="SequenceFlow_1jygjln" sourceRef="Activity_013rjwc" targetRef="ScriptTask_1ssh2l9" /> <bpmn:serviceTask id="Activity_0rgeefb" name="Update Resource Operation Status"> <bpmn:extensionElements> <camunda:connector> @@ -121,6 +112,10 @@ runScript.preProcessRequest(execution)</bpmn:script> <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateTransportNSSI"> + <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d"> + <di:waypoint x="840" y="350" /> + <di:waypoint x="1022" y="350" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jygjln_di" bpmnElement="SequenceFlow_1jygjln"> <di:waypoint x="360" y="350" /> <di:waypoint x="520" y="350" /> @@ -132,8 +127,8 @@ runScript.preProcessRequest(execution)</bpmn:script> <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq"> <di:waypoint x="1080" y="121" /> <di:waypoint x="1220" y="121" /> - <di:waypoint x="1220" y="210" /> - <di:waypoint x="310" y="210" /> + <di:waypoint x="1220" y="230" /> + <di:waypoint x="310" y="230" /> <di:waypoint x="310" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs"> @@ -144,30 +139,31 @@ runScript.preProcessRequest(execution)</bpmn:script> <di:waypoint x="630" y="121" /> <di:waypoint x="729" y="121" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj"> + <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1"> <di:waypoint x="620" y="350" /> <di:waypoint x="740" y="350" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1"> - <di:waypoint x="840" y="350" /> - <di:waypoint x="990" y="350" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c"> <di:waypoint x="214" y="121" /> <di:waypoint x="285" y="121" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d"> - <di:waypoint x="1090" y="350" /> - <di:waypoint x="1202" y="350" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd"> <dc:Bounds x="178" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="166" y="146" width="70" height="53" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9"> + <dc:Bounds x="520" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0rgeefb_di" bpmnElement="Activity_0rgeefb"> - <dc:Bounds x="990" y="310" width="100" height="80" /> + <dc:Bounds x="740" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx"> + <dc:Bounds x="1022" y="332" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1030" y="375" width="20" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true"> <dc:Bounds x="685" y="1080" width="781" height="196" /> @@ -189,18 +185,6 @@ runScript.preProcessRequest(execution)</bpmn:script> <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw"> <dc:Bounds x="979" y="1144" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx"> - <dc:Bounds x="1202" y="332" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1210" y="375" width="20" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9"> - <dc:Bounds x="740" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8"> - <dc:Bounds x="520" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy"> <dc:Bounds x="509" y="74" width="121" height="94" /> </bpmndi:BPMNShape> diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaDatabaseConfiguration.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaDatabaseConfiguration.java index c803808df1..770e91c1cb 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaDatabaseConfiguration.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaDatabaseConfiguration.java @@ -22,13 +22,17 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows; import static org.slf4j.LoggerFactory.getLogger; import javax.sql.DataSource; +import org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration; +import org.camunda.bpm.spring.boot.starter.util.SpringBootProcessEnginePlugin; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jmx.export.MBeanExporter; +import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; @@ -39,9 +43,10 @@ import com.zaxxer.hikari.HikariDataSource; */ @Configuration @EnableTransactionManagement -@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory", transactionManagerRef = "transactionManager") public class CamundaDatabaseConfiguration { + private static final String CAMUNDA_TRANSACTION_MANAGER_BEAN_NAME = "camundaTransactionManager"; + private static final String CAMUNDA_DATA_SOURCE_BEAN_NAME = "camundaBpmDataSource"; private static final Logger logger = getLogger(CamundaDatabaseConfiguration.class); @@ -66,4 +71,22 @@ public class CamundaDatabaseConfiguration { return new HikariDataSource(hikariConfig); } + @Bean(name = CAMUNDA_TRANSACTION_MANAGER_BEAN_NAME) + public PlatformTransactionManager camundaTransactionManager( + @Qualifier(CAMUNDA_DATA_SOURCE_BEAN_NAME) final DataSource dataSource) { + return new DataSourceTransactionManager(dataSource); + } + + @Bean + public SpringBootProcessEnginePlugin transactionManagerProcessEnginePlugin( + @Qualifier(CAMUNDA_TRANSACTION_MANAGER_BEAN_NAME) final PlatformTransactionManager camundaTransactionManager) { + return new SpringBootProcessEnginePlugin() { + @Override + public void preInit(final SpringProcessEngineConfiguration processEngineConfiguration) { + logger.info("Setting Camunda TransactionManager ..."); + processEngineConfiguration.setTransactionManager(camundaTransactionManager); + + } + }; + } } diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java index 49118494cf..14d4fa2f07 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java @@ -302,7 +302,7 @@ public class JobExecutorService { } private boolean isNotImmediateTerminateRequest(final TerminateNsRequest terminateNsRequest) { - return terminateNsRequest.getTerminationTime() != null; + return terminateNsRequest != null && terminateNsRequest.getTerminationTime() != null; } private boolean isNotInstantiated(final NfvoNsInst nfvoNsInst) { diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java index b6fd9e407a..1a89f75a70 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java @@ -67,7 +67,7 @@ public abstract class BaseTest { protected static final Logger logger = getLogger(BaseTest.class); - private static final long TIME_OUT_IN_SECONDS = 60; + private static final long TIME_OUT_IN_SECONDS = 120; private static final int SLEEP_TIME_IN_SECONDS = 5; @Autowired diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java index adb8a9e69b..017bdf6b70 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java @@ -19,7 +19,17 @@ */ package org.onap.so.etsi.nfvo.ns.workflow.engine.tasks; -import com.google.gson.Gson; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.okJson; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import java.time.LocalDateTime; +import java.util.Optional; +import java.util.UUID; import org.camunda.bpm.engine.history.HistoricProcessInstance; import org.junit.After; import org.junit.Before; @@ -27,24 +37,12 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.BaseTest; -import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.GsonProvider; import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.exceptions.NsRequestProcessingException; import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.service.JobExecutorService; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJob; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State; import org.springframework.beans.factory.annotation.Autowired; -import java.time.LocalDateTime; -import java.util.Optional; -import java.util.UUID; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; -import static com.github.tomakehurst.wiremock.client.WireMock.okJson; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; /** * @author Andrew Lamb (andrew.a.lamb@est.tech) @@ -55,18 +53,12 @@ public class DeleteNsTaskTest extends BaseTest { @Autowired private JobExecutorService objUnderTest; - @Autowired - private GsonProvider gsonProvider; - @Rule public ExpectedException expectedException = ExpectedException.none(); - private Gson gson; - @Before public void before() { wireMockServer.resetAll(); - gson = gsonProvider.getGson(); } @After diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java index b821c85edd..51460ec4c8 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java @@ -19,7 +19,25 @@ */ package org.onap.so.etsi.nfvo.ns.workflow.engine.tasks; -import com.google.gson.Gson; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.okJson; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm.Sol003AdapterConfiguration.SOL003_ADAPTER_REST_TEMPLATE_BEAN; +import static org.springframework.test.web.client.ExpectedCount.times; +import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; +import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; +import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Optional; +import java.util.UUID; import org.camunda.bpm.engine.history.HistoricProcessInstance; import org.hamcrest.text.MatchesPattern; import org.junit.After; @@ -47,26 +65,7 @@ import org.springframework.http.MediaType; import org.springframework.http.converter.json.GsonHttpMessageConverter; import org.springframework.test.web.client.MockRestServiceServer; import org.springframework.web.client.RestTemplate; -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Optional; -import java.util.UUID; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; -import static com.github.tomakehurst.wiremock.client.WireMock.okJson; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN; -import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm.Sol003AdapterConfiguration.SOL003_ADAPTER_REST_TEMPLATE_BEAN; -import static org.springframework.test.web.client.ExpectedCount.times; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; -import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; +import com.google.gson.Gson; /** * @author Andrew Lamb (andrew.a.lamb@est.tech) diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml index 1fabfbaac9..101e17a791 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml @@ -42,7 +42,7 @@ etsi-catalog-manager: endpoint: http://modeling-etsicatalog.onap:8806/api so-etsi-ns-lcm-workflow-engine: requesttimeout: - timeoutInSeconds: 60 + timeoutInSeconds: 120 logging: level: diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java index d52dcd6192..d7f2f4cefa 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NSLcmOpOccRepository.java @@ -22,16 +22,16 @@ package org.onap.so.etsi.nfvo.ns.lcm.database.repository; import java.util.Optional; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NsLcmOpOcc; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.OperationStateEnum; +import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; /** * @author Waqas Ikram (waqas.ikram@est.tech) * @author mukeshsharma(mukeshsharma@est.tech) */ -public interface NSLcmOpOccRepository extends CrudRepository<NsLcmOpOcc, String> { +public interface NSLcmOpOccRepository extends JpaRepository<NsLcmOpOcc, String> { Optional<NsLcmOpOcc> findById(final String id); diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java index 2d6d033689..220902c631 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoJobRepository.java @@ -21,13 +21,13 @@ package org.onap.so.etsi.nfvo.ns.lcm.database.repository; import java.util.Optional; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJob; -import org.springframework.data.repository.CrudRepository; +import org.springframework.data.jpa.repository.JpaRepository; /** * @author Waqas Ikram (waqas.ikram@est.tech) * */ -public interface NfvoJobRepository extends CrudRepository<NfvoJob, String>, RefreshableRepository<NfvoJob> { +public interface NfvoJobRepository extends JpaRepository<NfvoJob, String>, RefreshableRepository<NfvoJob> { Optional<NfvoJob> findByResourceId(final String resourceId); diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java index 5560ea7af3..f91a85f2e6 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNfInstRepository.java @@ -23,16 +23,16 @@ import java.util.List; import java.util.Optional; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNfInst; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State; +import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; /** * @author Waqas Ikram (waqas.ikram@est.tech) * @author mukeshsharma(mukeshsharma@est.tech) */ -public interface NfvoNfInstRepository extends CrudRepository<NfvoNfInst, String> { +public interface NfvoNfInstRepository extends JpaRepository<NfvoNfInst, String> { Optional<NfvoNfInst> findByNfInstId(final String nfInstId); diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java index 2a6abda558..a64cf9bdd5 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/repository/NfvoNsInstRepository.java @@ -22,16 +22,16 @@ package org.onap.so.etsi.nfvo.ns.lcm.database.repository; import java.util.Optional; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst; import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State; +import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; /** * @author Waqas Ikram (waqas.ikram@est.tech) * */ -public interface NfvoNsInstRepository extends CrudRepository<NfvoNsInst, String> { +public interface NfvoNsInstRepository extends JpaRepository<NfvoNsInst, String> { Optional<NfvoNsInst> findByName(final String name); diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java index 58ca76eec9..ec8777d0fa 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java @@ -68,7 +68,7 @@ public class DatabaseServiceProvider { public boolean addJob(final NfvoJob job) { logger.info("Adding NfvoJob: {} to database", job); - return nfvoJobRepository.save(job) != null; + return nfvoJobRepository.saveAndFlush(job) != null; } public Optional<NfvoJob> getJob(final String jobId) { @@ -104,7 +104,7 @@ public class DatabaseServiceProvider { public boolean saveNfvoNsInst(final NfvoNsInst nfvoNsInst) { logger.info("Saving NfvoNsInst: {} to database", nfvoNsInst); - return nfvoNsInstRepository.save(nfvoNsInst) != null; + return nfvoNsInstRepository.saveAndFlush(nfvoNsInst) != null; } @Transactional(propagation = Propagation.REQUIRES_NEW) @@ -125,7 +125,7 @@ public class DatabaseServiceProvider { public boolean saveNfvoNfInst(final NfvoNfInst nfvoNfInst) { logger.info("Saving NfvoNfInst: {} to database", nfvoNfInst); - return nfvoNfInstRepository.save(nfvoNfInst) != null; + return nfvoNfInstRepository.saveAndFlush(nfvoNfInst) != null; } @Transactional(propagation = Propagation.REQUIRES_NEW) @@ -162,7 +162,7 @@ public class DatabaseServiceProvider { public boolean addNSLcmOpOcc(final NsLcmOpOcc nsLcmOpOcc) { logger.info("Adding NSLcmOpOcc: {} to database", nsLcmOpOcc); - return nsLcmOpOccRepository.save(nsLcmOpOcc) != null; + return nsLcmOpOccRepository.saveAndFlush(nsLcmOpOcc) != null; } @Transactional(propagation = Propagation.REQUIRES_NEW) diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java index 2390cef564..4d6f92c373 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java @@ -145,7 +145,7 @@ public class NsLifecycleManagementController { produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public ResponseEntity<Void> terminateNs(@PathVariable("nsInstanceId") final String nsInstanceId, - @RequestBody final TerminateNsRequest terminateNsRequest) { + @RequestBody(required = false) final TerminateNsRequest terminateNsRequest) { logger.debug("Received terminate NS request: {}\n with nsInstanceId: {}", terminateNsRequest, nsInstanceId); final URI resourceUri = nsLifeCycleManager.terminateNs(nsInstanceId, terminateNsRequest); logger.info("{} Ns Terminate started successfully. Resource Operation Occurrence uri: {}", nsInstanceId, |