use of com.mesosphere.sdk.scheduler.plan.TestStep in project dcos-commons by mesosphere.
the class ParallelStrategyTest method testProceedInterrupt.
@Test
public void testProceedInterrupt() {
TestStep step0 = new TestStep();
TestStep step1 = new TestStep();
List<Step> steps = Arrays.asList(step0, step1);
Collection<Step> candidates = getCandidates(strategy, steps);
Assert.assertEquals(2, candidates.size());
Assert.assertEquals(new HashSet<>(steps), new HashSet<>(candidates));
strategy.interrupt();
Assert.assertTrue(getCandidates(strategy, steps).isEmpty());
strategy.proceed();
candidates = getCandidates(strategy, steps);
Assert.assertEquals(2, candidates.size());
Assert.assertEquals(new HashSet<>(steps), new HashSet<>(candidates));
step0.setStatus(Status.COMPLETE);
Assert.assertEquals(step1, getCandidates(strategy, steps).iterator().next());
strategy.interrupt();
Assert.assertTrue(getCandidates(strategy, steps).isEmpty());
strategy.proceed();
Assert.assertEquals(step1, getCandidates(strategy, steps).iterator().next());
step1.setStatus(Status.COMPLETE);
Assert.assertTrue(getCandidates(strategy, steps).isEmpty());
strategy.interrupt();
Assert.assertTrue(getCandidates(strategy, steps).isEmpty());
}