aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2020-01-13 12:07:45 +0200
committerEylon Malin <eylon.malin@intl.att.com>2020-01-13 14:16:52 +0200
commit6876eba3d0b43b01eb303a0d530fe45712f33d74 (patch)
tree7f6808357cc2d89405f6003cd5bd8dbe78d6c741 /vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java
parent9d0eee5eee868aaee3cf169a4a6716dc1530e4e3 (diff)
clear isFailed and statusMessage when get it from frontend request
Issue-ID: VID-724 Change-Id: I1bc33513250b220a063742233592388c7a108958 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java
index cd4045b8d..fe6cfafb4 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java
@@ -59,6 +59,7 @@ import static org.onap.vid.job.Job.JobStatus.STOPPED;
import static org.onap.vid.job.impl.JobSchedulerInitializer.WORKERS_TOPICS;
import static org.onap.vid.model.JobAuditStatus.SourceStatus.VID;
import static org.onap.vid.testUtils.TestUtils.readJsonResourceFileAsObject;
+import static org.testng.Assert.assertNull;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;
@@ -119,6 +120,7 @@ import org.onap.vid.properties.Features;
import org.onap.vid.services.AsyncInstantiationBaseTest;
import org.onap.vid.services.AsyncInstantiationBusinessLogic;
import org.onap.vid.services.AuditService;
+import org.onap.vid.services.InstantiationTemplatesService;
import org.onap.vid.services.VersionService;
import org.onap.vid.testUtils.TestUtils;
import org.onap.vid.utils.DaoUtils;
@@ -172,6 +174,9 @@ public class AsyncInstantiationIntegrationTest extends AsyncInstantiationBaseTes
@Inject
private CommandUtils commandUtils;
+ @Inject
+ private InstantiationTemplatesService instantiationTemplates;
+
@BeforeClass
void initServicesInfoService() {
createInstanceParamsMaps();
@@ -1309,4 +1314,44 @@ public class AsyncInstantiationIntegrationTest extends AsyncInstantiationBaseTes
return readJsonResourceFileAsObject("/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json", ServiceInstantiation.class);
}
+ @Test
+ public void deployService_failIt_retryDeploy_getRetryAsTemplate_makeSureFalsyIsFailedInTemplate() {
+
+ final String SERVICE_REQUEST_ID = UUID.randomUUID().toString();
+ when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VNF)).thenReturn(true);
+ when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VFMODULE)).thenReturn(true);
+
+ //push alacarte with 1 vnf, verify STATUS pending
+ UUID uuid = pushALaCarteWithVnf();
+ singleServicesAndAssertStatus(JobStatus.PENDING, uuid);
+
+ reset(restMso);
+ //mock mso to answer 200 of create service instance request, verify STATUS in progress
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), endsWith("serviceInstances"), any())).thenReturn(
+ createResponse(200, SERVICE_INSTANCE_ID, SERVICE_REQUEST_ID));
+
+ //mock mso to answer FAILED for service instance create
+ final RestObject<AsyncRequestStatus> failedResponse = asyncRequestStatusResponseAsRestObject(FAILED_STR);
+ final String failureDescription = "Some deep failure";
+ failedResponse.get().request.requestStatus.setStatusMessage(failureDescription);
+ when(restMso.GetForObject(endsWith(SERVICE_REQUEST_ID), eq(AsyncRequestStatus.class))).
+ thenReturn(failedResponse);
+
+ //Wait till job failed
+ processJobsCountTimesAndAssertStatus(uuid, 3, FAILED);
+
+ //make sure retry request jas isFailed = true, and status message is with failureDescription
+ ServiceInstantiation retryRequest = asyncInstantiationBL.getBulkForRetry(uuid);
+ assertTrue(retryRequest.getIsFailed());
+ assertEquals(failureDescription, retryRequest.getStatusMessage());
+
+ //deploy retry job and it's template
+ UUID retryUuid = asyncInstantiationBL.pushBulkJob(retryRequest, USER_ID).get(0);
+ ServiceInstantiation templateOfRetry = instantiationTemplates.getJobRequestAsTemplate(retryUuid);
+
+ //make sure the template request has isFailed = false, and no status message
+ assertFalse(templateOfRetry.getIsFailed());
+ assertNull(templateOfRetry.getStatusMessage());
+ }
+
}