@Test
public void testComponentCommandOrderPrefixes() throws Exception {

  ConfTreeOperations resources = new ConfTreeOperations(new ConfTree());
  resources.getOrAddComponent("a-A").put(ROLE_PREFIX, "a-");
  resources.getOrAddComponent("b-B1").put(ROLE_PREFIX, "b-");
  resources.getOrAddComponent("b-B2").put(ROLE_PREFIX, "b-");
  resources.getOrAddComponent("c-C").put(ROLE_PREFIX, "c-");
  CommandOrder co1 = new CommandOrder();
  co1.setCommand("b-START");
  co1.setRequires("a-STARTED");
  CommandOrder co2 = new CommandOrder();
  co2.setCommand("c-START");
  co2.setRequires("b-STARTED");
  ComponentCommandOrder cco = new ComponentCommandOrder(
      Arrays.asList(co1, co2), resources);
  ComponentInstanceState cisA = new ComponentInstanceState("a-A", containerId, "aid");
  ComponentInstanceState cisB1 = new ComponentInstanceState("b-B1", containerId, "aid");
  ComponentInstanceState cisB2 = new ComponentInstanceState("b-B2", containerId, "aid");
  ComponentInstanceState cisC = new ComponentInstanceState("c-C", containerId, "aid");
  cisA.setState(State.INSTALLED);
  cisB1.setState(State.INSTALLED);
  cisB2.setState(State.INSTALLED);
  cisC.setState(State.INSTALLED);
  List<ComponentInstanceState> states = Arrays.asList(cisA, cisB1, cisB2, cisC);
  Assert.assertTrue(cco.canExecute("a-A", Command.START, states));
  Assert.assertFalse(cco.canExecute("b-B1", Command.START, states));
  Assert.assertFalse(cco.canExecute("b-B2", Command.START, states));
  Assert.assertFalse(cco.canExecute("c-C", Command.START, states));
  cisA.setState(State.STARTED);
  Assert.assertTrue(cco.canExecute("b-B1", Command.START, states));
  Assert.assertTrue(cco.canExecute("b-B2", Command.START, states));
  Assert.assertFalse(cco.canExecute("c-C", Command.START, states));
  cisB1.setState(State.STARTED);
  Assert.assertFalse(cco.canExecute("c-C", Command.START, states));
  cisB2.setState(State.STARTED);
  Assert.assertTrue(cco.canExecute("c-C", Command.START, states));
}