Assert.assertTrue(cco.canExecute("B", Command.START, Arrays.asList(cisE, cisE2)));
}
@Test
public void testComponentCommandOrderBadInput() throws Exception {
CommandOrder co = new CommandOrder();
co.setCommand(" A-START");
co.setRequires("B-STARTED , C-STARTED");
ComponentInstanceState cisB = new ComponentInstanceState("B", "cid", "aid");
ComponentInstanceState cisC = new ComponentInstanceState("C", "cid", "aid");
cisB.setState(State.STARTED);
cisC.setState(State.STARTED);
ComponentCommandOrder cco = new ComponentCommandOrder(Arrays.asList(co));
Assert.assertTrue(cco.canExecute("A", Command.START, Arrays.asList(cisB, cisC)));
co.setCommand(" A-STAR");
co.setRequires("B-STARTED , C-STARTED");
try {
cco = new ComponentCommandOrder(Arrays.asList(co));
Assert.fail("Instantiation should have failed.");
} catch (IllegalArgumentException ie) {
log.info(ie.getMessage());
}
co.setCommand(" -START");
co.setRequires("B-STARTED , C-STARTED");
try {
cco = new ComponentCommandOrder(Arrays.asList(co));
Assert.fail("Instantiation should have failed.");
} catch (IllegalArgumentException ie) {
log.info(ie.getMessage());
}
co.setCommand(" A-START");
co.setRequires("B-STRTED , C-STARTED");
try {
cco = new ComponentCommandOrder(Arrays.asList(co));
Assert.fail("Instantiation should have failed.");
} catch (IllegalArgumentException ie) {
log.info(ie.getMessage());
}
co.setCommand(" A-START");
co.setRequires("B-STARTED , C-");
try {
cco = new ComponentCommandOrder(Arrays.asList(co));
Assert.fail("Instantiation should have failed.");
} catch (IllegalArgumentException ie) {
log.info(ie.getMessage());
}
co.setCommand(" A-INSTALL");
co.setRequires("B-STARTED");
try {
cco = new ComponentCommandOrder(Arrays.asList(co));
Assert.fail("Instantiation should have failed.");
} catch (IllegalArgumentException ie) {
log.info(ie.getMessage());