// TODO insufficient permissions to test @Test(description = "PUT /admin/vdc/{id}", enabled = false) public void testEditVdc() throws Exception { String origName = lazyGetVdc().getName(); String newName = name("a"); Exception exception = null; AdminVdc vdc = AdminVdc.builder().name(newName).build(); try { Task task = vdcApi.edit(vdcUrn, vdc); assertTaskSucceeds(task); AdminVdc modified = vdcApi.get(vdcUrn); assertEquals(modified.getName(), newName); // parent type Checks.checkAdminVdc(vdc); } catch (Exception e) { exception = e; } finally { try { AdminVdc restorableVdc = AdminVdc.builder().name(origName).build(); Task task = vdcApi.edit(vdcUrn, restorableVdc); assertTaskSucceeds(task); } catch (Exception e) { if (exception != null) { logger.warn(e, "Error resetting adminVdc.name; rethrowing original test exception..."); throw exception; } else { throw e; } } } }
// TODO insufficient permissions to test @Test(description = "DELETE /admin/vdc/{id}", enabled = false) public void testRemoveVdc() throws Exception { // TODO Need to have a VDC that we're happy to remove! Task task = vdcApi.remove(vdcUrn); assertTaskSucceeds(task); try { vdcApi.get(vdcUrn); } catch (VCloudDirectorException e) { // success; unreachable because it has been removed // TODO: ^^ wrong. this should return null } }
@Test(description = "GET /admin/vdc/{id}") public void testGetVdc() { AdminVdc vdc = vdcApi.get(vdcUrn); assertNotNull(vdc, String.format(OBJ_REQ_LIVE, VDC)); // parent type Checks.checkAdminVdc(vdc); }
// TODO insufficient permissions to test @Test(description = "DISABLE/ENABLE /admin/vdc/{id}", enabled = false) public void testDisableAndEnableVdc() throws Exception { // TODO Need to have a VDC that we're happy to remove! Exception exception = null; try { vdcApi.disable(vdcUrn); } catch (Exception e) { exception = e; } finally { try { vdcApi.enable(vdcUrn); } catch (Exception e) { if (exception != null) { logger.warn(e, "Error resetting adminVdc.name; rethrowing original test exception..."); throw exception; } else { throw e; } } } }