From b2ee1e9c0b43722b3a573b08a0f60dd35cd2ef3f Mon Sep 17 00:00:00 2001 From: Enbo Wang Date: Thu, 19 Mar 2020 23:27:16 +0800 Subject: Fix PNF software upgrade workflow Fix the issue that API can not return when the workflow has ended. Issue-ID: SO-2751 Signed-off-by: Enbo Wang Change-Id: I7d140b2286ce3003a6efcd2c3891fc8142982477 --- .../infrastructure/process/PNFSoftwareUpgradeTest.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-flows/src/test') diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java index a9bf4352bf..2993ed6724 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,6 +61,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { private static final String TEST_PROCESSINSTANCE_KEY = "PNFSoftwareUpgrade"; private static final AAIVersion VERSION = AAIVersion.LATEST; private static final Map executionVariables = new HashMap(); + private static final String REQUEST_ID = "50ae41ad-049c-4fe2-9950-539f111120f5"; private final String[] actionNames = new String[4]; private String requestObject; private String responseObject; @@ -80,6 +82,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { responseObject = FileUtil.readResourceFile("response/" + getClass().getSimpleName() + ".json"); executionVariables.put("bpmnRequest", requestObject); + executionVariables.put("requestId", REQUEST_ID); /** * This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}. @@ -99,6 +102,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { public void workflow_validInput_expectedOutput() throws InterruptedException { mockCatalogDb(); + mockRequestDb(); mockAai(); final String msoRequestId = UUID.randomUUID().toString(); @@ -118,9 +122,9 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { // Layout is to reflect the bpmn visual layout assertThat(pi).isEnded().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", - "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv", - "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z", - "softwareUpgrade_endEvent"); + "ScriptTask_10klpg8", "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", + "ExclusiveGateway_0v3l3wv", "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", + "ExclusiveGateway_1ny9b1z", "ScriptTask_1igtc83", "CallActivity_0o1mi8u", "softwareUpgrade_endEvent"); List detailedMessages = grpcNettyServer.getDetailedMessages(); assertThat(detailedMessages.size() == 4); @@ -202,6 +206,14 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo"))); } + private void mockRequestDb() { + /** + * Update Request DB + */ + wireMockServer.stubFor(put(urlEqualTo("/infraActiveRequests/" + REQUEST_ID))); + + } + /** * Mock the catalobdb rest interface. */ -- cgit 1.2.3-korg