use of cz.metacentrum.perun.core.api.Resource in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method setGroupResourceAttributesWhenResourceNotExists.
@Test(expected = ResourceNotExistsException.class)
public void setGroupResourceAttributesWhenResourceNotExists() throws Exception {
System.out.println(CLASS_NAME + "setGroupResourceAttributesWhenResourceNotExists");
vo = setUpVo();
group = setUpGroup();
attributes = setUpGroupResourceAttribute();
attributesManager.setAttributes(sess, new Resource(), group, attributes);
// shouldn't find resource
}
use of cz.metacentrum.perun.core.api.Resource in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method removeMemberResourceAttributeWhenResourceNotExists.
@Test(expected = ResourceNotExistsException.class)
public void removeMemberResourceAttributeWhenResourceNotExists() throws Exception {
System.out.println(CLASS_NAME + "removeMemberResourceAttributeWhenResourceNotExists");
attributes = setUpMemberResourceAttribute();
vo = setUpVo();
member = setUpMember();
attributesManager.removeAttribute(sess, new Resource(), member, attributes.get(0));
// shouldn't find resource
}
use of cz.metacentrum.perun.core.api.Resource in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method removeGroupResourceAttributeWhenResourceNotExists.
@Test(expected = ResourceNotExistsException.class)
public void removeGroupResourceAttributeWhenResourceNotExists() throws Exception {
System.out.println(CLASS_NAME + "removeGroupResourceAttributeWhenResourceNotExists");
attributes = setUpGroupResourceAttribute();
vo = setUpVo();
group = setUpGroup();
attributesManager.removeAttribute(sess, new Resource(), group, attributes.get(0));
// shouldn't find resource
}
use of cz.metacentrum.perun.core.api.Resource in project perun by CESNET.
the class FacilitiesManagerEntryIntegrationTest method getAllowedUsersCheckUniqueness.
@Test
public void getAllowedUsersCheckUniqueness() throws Exception {
System.out.println(CLASS_NAME + "getAllowedUsersCheckUniqueness");
Vo vo = setUpVo();
Resource resource1 = setUpResource(vo);
Resource resource2 = setUpResource2(vo);
Member member = setUpMember(vo);
User user = perun.getUsersManagerBl().getUserByMember(sess, member);
Group group = setUpGroup(vo, member);
Group group2 = setUpGroup2(vo, member);
perun.getResourcesManagerBl().assignGroupToResource(sess, group, resource1);
perun.getResourcesManagerBl().assignGroupToResource(sess, group2, resource2);
List<User> users = perun.getFacilitiesManager().getAllowedUsers(sess, facility);
assertTrue("our facility should have 1 allowed user", users.size() == 1);
assertTrue("our user should be between allowed on facility", users.contains(user));
}
use of cz.metacentrum.perun.core.api.Resource in project perun by CESNET.
the class FacilitiesManagerEntryIntegrationTest method removeExpiredBansIfNotExist.
@Test
public void removeExpiredBansIfNotExist() throws Exception {
System.out.println(CLASS_NAME + "removeExpiredBansIfNotExist");
Vo vo = setUpVo();
Resource resource = setUpResource(vo);
Member member = setUpMember(vo);
User user = perun.getUsersManagerBl().getUserByMember(sess, member);
Group group = setUpGroup(vo, member);
perun.getResourcesManagerBl().assignGroupToResource(sess, group, resource);
BanOnFacility banOnFacility = new BanOnFacility();
banOnFacility.setUserId(user.getId());
banOnFacility.setFacilityId(facility.getId());
banOnFacility.setDescription("Popisek");
Date now = new Date();
Date tommorow = new Date(now.getTime() + (1000 * 60 * 60 * 24));
banOnFacility.setValidityTo(tommorow);
banOnFacility = facilitiesManagerEntry.setBan(sess, banOnFacility);
List<BanOnFacility> bansOnFacility = facilitiesManagerEntry.getBansForFacility(sess, banOnFacility.getFacilityId());
assertTrue(bansOnFacility.size() == 1);
perun.getFacilitiesManagerBl().removeAllExpiredBansOnFacilities(sess);
bansOnFacility = facilitiesManagerEntry.getBansForFacility(sess, banOnFacility.getFacilityId());
assertTrue(bansOnFacility.size() == 1);
}
Aggregations