Exemple #1
0
  @Test
  public void enable() {
    res = host.enable();
    assertTrue(res.getErrorMessage(), !res.isError());

    host.info();
    assertTrue(host.isEnabled());
  }
Exemple #2
0
  @Test
  public void info() {
    res = host.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    //        assertTrue( host.getId().equals("0") );
    assertTrue(host.id() >= 0);

    //        assertTrue( host.shortStateStr().equals("on") );
  }
Exemple #3
0
  /** @throws java.lang.Exception */
  @Before
  public void setUp() throws Exception {
    res = Host.allocate(client, name, "dummy", "dummy");

    int hid = !res.isError() ? Integer.parseInt(res.getMessage()) : -1;
    host = new Host(hid, client);
  }
Exemple #4
0
  @Test
  public void allocate() {
    String name = "allocate_test";

    res = Host.allocate(client, name, "im_dummy", "vmm_dummy");
    assertTrue(res.getErrorMessage(), !res.isError());
    //        assertTrue( res.getMessage().equals("0") );

    hostPool.info();

    boolean found = false;
    for (Host h : hostPool) {
      found = found || h.getName().equals(name);
    }

    assertTrue(found);
  }
Exemple #5
0
  @Test
  public void delete() {
    String name = host.getName();

    res = host.delete();
    assertTrue(res.getErrorMessage(), !res.isError());

    res = host.info();
    assertTrue(res.isError());

    res = hostPool.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    boolean found = false;
    for (Host h : hostPool) {
      found = found || h.getName().equals(name);
    }

    assertTrue(!found);
  }
Exemple #6
0
  @Test
  public void update() {
    res = host.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    assertTrue(host.xpath("TEMPLATE/ATT1").equals(""));
    assertTrue(host.xpath("TEMPLATE/ATT2").equals(""));

    String new_template = "ATT2 = NEW_VAL\n" + "ATT3 = VAL3";

    res = host.update(new_template);
    assertTrue(res.getErrorMessage(), !res.isError());

    res = host.info();
    assertTrue(res.getErrorMessage(), !res.isError());
    assertTrue(host.xpath("TEMPLATE/ATT1").equals(""));
    assertTrue(host.xpath("TEMPLATE/ATT2").equals("NEW_VAL"));
    assertTrue(host.xpath("TEMPLATE/ATT3").equals("VAL3"));
  }
Exemple #7
0
 /** @throws java.lang.Exception */
 @After
 public void tearDown() throws Exception {
   host.delete();
   Thread.sleep(2000);
 }