// allow bundle creation in bg (has create perm)
Bundle b1 = createBundle(subject, "one", bundleGroup.getId());
assertNotNull(b1);
BundleVersion bv1 = createBundleVersion(subject, b1.getName() + "-1", null, b1);
assertNotNull(bv1);
ResourceGroup platformResourceGroup = createTestResourceGroup();
assertNotNull(platformResourceGroup);
// deny destination create (no view of resource group)
try {
BundleDestination dest1 = createDestination(subject, b1, "one", "/test", platformResourceGroup);
fail("Should have thrown IllegalArgumentException");
} catch (EJBException e) {
assert e.getCause() instanceof IllegalArgumentException
&& e.getCause().getMessage().contains("Invalid groupId") : "Should have not had group visibility";
// expected
}
// deny destination create (no deploy perm)
LookupUtil.getRoleManager().addResourceGroupsToRole(overlord, role.getId(),
new int[] { platformResourceGroup.getId() });
try {
BundleDestination dest1 = createDestination(subject, b1, "one", "/test", platformResourceGroup);
fail("Should have thrown PermissionException");
} catch (PermissionException e) {
// expected