Package org.apache.slider.providers.agent.application.metadata

Examples of org.apache.slider.providers.agent.application.metadata.CommandOrder


  protected static final Logger log =
      LoggerFactory.getLogger(TestComponentCommandOrder.class);

  @Test
  public void testComponentCommandOrder() throws Exception {
    CommandOrder co1 = new CommandOrder();
    co1.setCommand("A-START");
    co1.setRequires("B-STARTED");
    CommandOrder co2 = new CommandOrder();
    co2.setCommand("A-START");
    co2.setRequires("C-STARTED");
    CommandOrder co3 = new CommandOrder();
    co3.setCommand("B-START");
    co3.setRequires("C-STARTED,D-STARTED,E-INSTALLED");

    ComponentCommandOrder cco = new ComponentCommandOrder(Arrays.asList(co1, co2, co3));
    ComponentInstanceState cisB = new ComponentInstanceState("B", "cid", "aid");
    ComponentInstanceState cisC = new ComponentInstanceState("C", "cid", "aid");
    ComponentInstanceState cisD = new ComponentInstanceState("D", "cid", "aid");
View Full Code Here


    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());
View Full Code Here

TOP

Related Classes of org.apache.slider.providers.agent.application.metadata.CommandOrder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.