public void testAddVirtualization() throws Exception { Org org1 = UserTestUtils.findNewOrg("testOrg" + this.getClass().getSimpleName()); org1.getEntitlements().add(OrgFactory.getEntitlementVirtualization()); TestUtils.saveAndFlush(org1); org1 = (Org) reload(org1); assertTrue(org1.hasEntitlement(OrgFactory.getEntitlementVirtualization())); }
public void testIllegalEntitlement() throws Exception { try { Org org1 = UserTestUtils.findNewOrg("testOrg" + this.getClass().getSimpleName()); OrgEntitlementType invalid = new OrgEntitlementType("invalid"); invalid.setLabel("ILLEGAL ENTITLEMENT"); invalid.setName("ILLEGAL ENTITLEMENT NAME"); org1.hasEntitlement(invalid); fail("Checked for illegal entitlement, should have received an exception"); } catch (IllegalArgumentException e) { // Expected exception } }
/** * Test the addition of an entitlement to an org This code should be refactored into a business * method of some sort if it becomes necessary to actually add entitlements progmatically from * within the Java code. For now we need this test because new Orgs don't have any entitlements. */ public void testAddEntitlement() throws Exception { // Create a new Org and add an Entitlement Org org1 = UserTestUtils.findNewOrg("testOrg" + this.getClass().getSimpleName()); Set entitlements = org1.getEntitlements(); OrgEntitlementType oet = OrgFactory.lookupEntitlementByLabel("sw_mgr_enterprise"); entitlements.add(oet); org1.setEntitlements(entitlements); org1 = OrgFactory.save(org1); Long orgId = org1.getId(); // Re-lookup the object and test it flushAndEvict(org1); Org org2 = OrgFactory.lookupById(orgId); assertTrue(org2.hasEntitlement(oet)); }
public void testHasEntitlementFalse() throws Exception { Org org1 = createTestOrg(); OrgEntitlementType oet = OrgFactory.lookupEntitlementByLabel("sw_mgr_enterprise"); assertFalse(org1.hasEntitlement(oet)); }
public void testImpliedEntitlement() throws Exception { Org org1 = createTestOrg(); assertTrue(org1.hasEntitlement(OrgFactory.getEntitlementSwMgrPersonal())); }