public void testUpdate() { enterprise.setName("Updated Enterprise"); enterprise.update(); // Recover the updated enterprise EnterpriseDto updated = env.enterpriseApi.getEnterprise(enterprise.getId()); assertEquals(updated.getName(), "Updated Enterprise"); }
public void testCreateRepeated() { Enterprise repeated = Builder.fromEnterprise(enterprise).build(); try { repeated.save(); fail("Should not be able to create enterprises with the same name"); } catch (AbiquoException ex) { assertHasError(ex, Status.CONFLICT, "ENTERPRISE-4"); } }
public void testAllowTwiceWorks() { // Allow the datacenter again and check that the configuration has not // changed Limits limits = enterprise.allowDatacenter(env.datacenter); assertNotNull(limits); DatacentersLimitsDto limitsDto = env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap()); assertNotNull(limitsDto); assertEquals(limitsDto.getCollection().size(), 1); }
@BeforeClass public void setupEnterprise() { enterprise = Enterprise.Builder.fromEnterprise(env.enterprise).build(); enterprise.setName(PREFIX + "-enterprise-test"); enterprise.save(); limits = enterprise.allowDatacenter(env.datacenter); assertNotNull(limits); DatacentersLimitsDto limitsDto = env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap()); assertNotNull(limitsDto); assertEquals(limitsDto.getCollection().size(), 1); }
public void testListAllowedDatacenters() { List<Datacenter> allowed = enterprise.listAllowedDatacenters(); assertNotNull(allowed); assertFalse(allowed.isEmpty()); assertEquals(allowed.get(0).getId(), env.datacenter.getId()); }
@AfterClass public void tearDownEnterprise() { enterprise.prohibitDatacenter(env.datacenter); try { // If a datacenter is not allowed, the limits for it can not be // retrieved env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap()); } catch (AbiquoException ex) { assertHasError(ex, Status.CONFLICT, "ENTERPRISE-10"); } List<Datacenter> allowed = enterprise.listAllowedDatacenters(); assertNotNull(allowed); assertTrue(allowed.isEmpty()); enterprise.delete(); }
public void testUpdateLimits() { limits.setCpuCountLimits(4, 5); limits.update(); DatacentersLimitsDto limitsDto = env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap()); assertNotNull(limitsDto); assertEquals(limitsDto.getCollection().size(), 1); assertEquals(limitsDto.getCollection().get(0).getCpuCountHardLimit(), 5); assertEquals(limitsDto.getCollection().get(0).getCpuCountSoftLimit(), 4); }
public void testListLimits() { List<Limits> allLimits = enterprise.listLimits(); assertNotNull(allLimits); assertEquals(allLimits.size(), 1); }
/** * @see API: <a href= * "http://community.abiquo.com/display/ABI20/User+resource#Userresource-Createanewuser" > * http://community.abiquo.com/display/ABI20/User+resource#Userresource -Createanewuser</a> */ public void save() { // set role link target.addLink(new RESTLink("role", role.unwrap().getEditLink().getHref())); target = context.getApi().getEnterpriseApi().createUser(enterprise.unwrap(), target); }