use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class WorkflowActionBBFailureTest method updateRequestStatusToRolledbackToCreated.
@Test
public void updateRequestStatusToRolledbackToCreated() {
execution.setVariable("mso-request-id", "123");
execution.setVariable("isRollbackComplete", true);
execution.setVariable("isRollback", true);
execution.setVariable("rollbackTargetState", "ROLLED_BACK_TO_CREATED");
InfraActiveRequests req = new InfraActiveRequests();
doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
workflowActionBBFailure.updateRequestStatusToFailed(execution);
String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
assertEquals("Rollback has been completed successfully.", errorMsg);
assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), req.getRequestStatus());
}
use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class WorkflowActionBBFailureTest method updateRequestStatusToFailed.
@Test
public void updateRequestStatusToFailed() {
execution.setVariable("mso-request-id", "123");
execution.setVariable("isRollbackComplete", false);
execution.setVariable("isRollback", false);
InfraActiveRequests req = new InfraActiveRequests();
WorkflowException wfe = new WorkflowException("processKey123", 1, "error in test case");
execution.setVariable("WorkflowException", wfe);
doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
workflowActionBBFailure.updateRequestStatusToFailed(execution);
String errorMsg = (String) execution.getVariable("ErrorMessage");
assertEquals("error in test case", errorMsg);
assertEquals(Status.FAILED.toString(), req.getRequestStatus());
}
use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class WorkflowActionBBTasksTest method setConfigurationNameTest.
@Test
public void setConfigurationNameTest() {
String resourceId = "40bc4ebd-11df-4610-8055-059f7441ec1c";
WorkflowType resourceType = WorkflowType.CONFIGURATION;
InfraActiveRequests request = new InfraActiveRequests();
Configuration configuration = new Configuration();
configuration.setConfigurationName("configurationName");
doReturn(configuration).when(bbSetupUtils).getAAIConfiguration(resourceId);
workflowActionBBTasks.setInstanceName(resourceId, resourceType, request);
assertEquals("configurationName", request.getConfigurationName());
}
use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class WorkflowActionBBTasksTest method checkRetryStatusTest.
@Test
public void checkRetryStatusTest() {
String reqId = "reqId123";
execution.setVariable("mso-request-id", reqId);
doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
execution.setVariable("handlingCode", "Retry");
execution.setVariable("retryCount", 1);
execution.setVariable("gCurrentSequence", 1);
InfraActiveRequests req = new InfraActiveRequests();
doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
workflowActionBBTasks.checkRetryStatus(execution);
assertEquals(0, execution.getVariable("gCurrentSequence"));
}
use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class WorkflowActionBBTasksTest method updateRequestStatusToCompleteTest.
@Test
public void updateRequestStatusToCompleteTest() {
String reqId = "reqId123";
execution.setVariable("mso-request-id", reqId);
execution.setVariable("requestAction", "createInstance");
execution.setVariable("resourceName", "Service");
execution.setVariable("aLaCarte", true);
InfraActiveRequests req = new InfraActiveRequests();
doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
workflowActionBBTasks.updateRequestStatusToComplete(execution);
assertEquals("ALaCarte-Service-createInstance request was executed correctly.", execution.getVariable("finalStatusMessage"));
}
Aggregations