@Test public void enable() { res = host.enable(); assertTrue(res.getErrorMessage(), !res.isError()); host.info(); assertTrue(host.isEnabled()); }
@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") ); }
/** @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); }
@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); }
@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); }
@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")); }
/** @throws java.lang.Exception */ @After public void tearDown() throws Exception { host.delete(); Thread.sleep(2000); }