use of com.emc.sa.engine.service.ExecutionService in project coprhd-controller by CoprHD.
the class ExecutionEngineImpl method executeOrder.
@Override
public void executeOrder(Order order) {
LOG.info(String.format("Executing order: %s [%s]", order.getOrderNumber(), order.getId()));
initContext(order);
try {
updateOrderStatus(order, OrderStatus.EXECUTING);
ExecutionService service = createService(order);
runService(service);
orderCompleted(order, service.getCompletedOrderStatus());
} catch (ExecutionException e) {
orderFailed(order, e);
} catch (RuntimeException e) {
LOG.error("Unexpected error executing order: " + order.getId());
orderFailed(order, new ExecutionException(e));
} finally {
destroyContext(order);
}
}
use of com.emc.sa.engine.service.ExecutionService in project coprhd-controller by CoprHD.
the class ExecutionEngineImplTest method testFailDuringRollback.
@Test
public void testFailDuringRollback() {
final FailureTask rollbackTask = new FailureTask("Fail During Rollback", "Fail during rollback");
final EmptyTask skippedTask = new EmptyTask("Skipped Rollback");
ExecutionService rollbackService = new EmptyService() {
@Override
public void execute() throws Exception {
addRollback(skippedTask);
addRollback(rollbackTask);
throw new Exception("Trigger rollback");
}
};
Order order = executeOrder(rollbackService, "FailDuringRollback");
Assert.assertEquals(OrderStatus.ERROR.name(), order.getOrderStatus());
Assert.assertEquals(true, rollbackTask.wasRun);
Assert.assertEquals(false, skippedTask.wasRun);
}
Aggregations