use of cz.metacentrum.perun.core.api.Vo in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method removeVoAttributesWhenVoNotExists.
@Test(expected = VoNotExistsException.class)
public void removeVoAttributesWhenVoNotExists() throws Exception {
System.out.println(CLASS_NAME + "removeVoAttributesWhenVoNotExists");
attributes = setUpVoAttribute();
attributesManager.removeAttributes(sess, new Vo(), attributes);
// shouldn't find vo
}
use of cz.metacentrum.perun.core.api.Vo in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method getRichAttributesWithHoldersForAttributeDefinitionGetVosFromKey.
@Test
public void getRichAttributesWithHoldersForAttributeDefinitionGetVosFromKey() throws Exception {
System.out.println(CLASS_NAME + "getRichAttributesWithHoldersForAttributeDefinitionGetVosFromKey");
//Prepare attribute, create it and set it with testing value
Attribute attribute = setAttributeInNamespace(AttributesManager.NS_VO_ATTR);
perun.getAttributesManagerBl().setAttribute(sess, vo2, attribute);
//Prepare richAttribute with holders (attribute is not needed but holders are needed)
RichAttribute richAttr = new RichAttribute();
richAttr.setPrimaryHolder("String");
List<RichAttribute> listOfRichAttributes = perun.getAttributesManagerBl().getRichAttributesWithHoldersForAttributeDefinition(sess, new AttributeDefinition(attribute), richAttr);
//Return facilities Administrator too if exists
assertTrue("return at least 2 vos", listOfRichAttributes.size() > 1);
assertTrue("primary holder is type of vo", listOfRichAttributes.get(0).getPrimaryHolder() instanceof Vo);
assertTrue("secondary holder is null", listOfRichAttributes.get(0).getSecondaryHolder() == null);
List<Vo> returnedVos = new ArrayList<Vo>();
for (RichAttribute ra : listOfRichAttributes) {
returnedVos.add((Vo) ra.getPrimaryHolder());
}
assertTrue("returned vos contains vo2", returnedVos.contains(vo2));
assertTrue("returned vos contains vo1", returnedVos.contains(vo1));
}
use of cz.metacentrum.perun.core.api.Vo in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method removeAllVoAttributesWhenVoNotExists.
@Test(expected = VoNotExistsException.class)
public void removeAllVoAttributesWhenVoNotExists() throws Exception {
System.out.println(CLASS_NAME + "removeAllVoAttributesWhenVoNotExists");
attributesManager.removeAllAttributes(sess, new Vo());
// shouldn't find vo
}
use of cz.metacentrum.perun.core.api.Vo 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.Vo in project perun by CESNET.
the class FacilitiesManagerEntryIntegrationTest method setUpVo.
// PRIVATE METHODS -------------------------------------------------------
private Vo setUpVo() throws Exception {
Vo vo = new Vo();
vo.setName("FacilitiesMangerTestVo");
vo.setShortName("FMTVO");
assertNotNull("unable to create VO", perun.getVosManager().createVo(sess, vo));
//System.out.println(vo);
return vo;
}
Aggregations