Search in sources :

Example 1 with FlowExecutionList

use of org.jenkinsci.plugins.workflow.flow.FlowExecutionList in project workflow-cps-plugin by jenkinsci.

the class FlowDurabilityTest method verifyExecutionRemoved.

private static void verifyExecutionRemoved(WorkflowRun run) throws Exception {
    // Verify we've removed all FlowExcecutionList entries
    FlowExecutionList list = FlowExecutionList.get();
    for (FlowExecution fe : list) {
        if (fe == run.getExecution()) {
            Assert.fail("Run still has an execution in the list and should be removed!");
        }
    }
    Field f = list.getClass().getDeclaredField("runningTasks");
    f.setAccessible(true);
    CopyOnWriteList<FlowExecutionOwner> runningTasks = (CopyOnWriteList<FlowExecutionOwner>) (f.get(list));
    Assert.assertFalse(runningTasks.contains(run.asFlowExecutionOwner()));
}
Also used : FlowExecutionList(org.jenkinsci.plugins.workflow.flow.FlowExecutionList) Field(java.lang.reflect.Field) FlowExecutionOwner(org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner) FlowExecution(org.jenkinsci.plugins.workflow.flow.FlowExecution) CopyOnWriteList(hudson.util.CopyOnWriteList)

Aggregations

CopyOnWriteList (hudson.util.CopyOnWriteList)1 Field (java.lang.reflect.Field)1 FlowExecution (org.jenkinsci.plugins.workflow.flow.FlowExecution)1 FlowExecutionList (org.jenkinsci.plugins.workflow.flow.FlowExecutionList)1 FlowExecutionOwner (org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner)1