use of cz.metacentrum.perun.core.api.VosManager in project perun by CESNET.
the class ExtSourcesManagerEntryIntegrationTest method removeExtSourceWhenExtSourceNotAssigned.
@Test(expected = ExtSourceNotAssignedException.class)
public void removeExtSourceWhenExtSourceNotAssigned() throws Exception {
System.out.println(CLASS_NAME + "removeExtSourceWhenExtSourceNotAssigned");
VosManager vosManager = perun.getVosManager();
Vo createdVo = vosManager.createVo(sess, new Vo(0, "sjk", "kljlk"));
extSourcesManagerEntry.removeExtSource(sess, createdVo, extSource);
// shouldn't find not assigned ext source
}
use of cz.metacentrum.perun.core.api.VosManager in project perun by CESNET.
the class ExtSourcesManagerEntryIntegrationTest method removeExtSourceWhenExtSourceNotExist.
@Test(expected = ExtSourceNotExistsException.class)
public void removeExtSourceWhenExtSourceNotExist() throws Exception {
System.out.println(CLASS_NAME + "removeExtSourceWhenExtSourceNotExist");
VosManager vosManager = perun.getVosManager();
Vo createdVo = vosManager.createVo(sess, new Vo(0, "sjk", "kljlk"));
ExtSource source = new ExtSource(0, "Fake", ExtSourcesManager.EXTSOURCE_INTERNAL);
extSourcesManagerEntry.removeExtSource(sess, createdVo, source);
// shouldn't find invalid ext source
}
use of cz.metacentrum.perun.core.api.VosManager in project perun by CESNET.
the class MembersManagerEntryIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
extSource = perun.getExtSourcesManager().createExtSource(sess, extSource, null);
usersManagerEntry = perun.getUsersManager();
attributesManagerEntry = perun.getAttributesManager();
membersManagerEntry = perun.getMembersManager();
final Vo vo = new Vo(0, "m3mb3r r00m", "m3mber-room");
VosManager vosManagerEntry = perun.getVosManager();
createdVo = vosManagerEntry.createVo(sess, vo);
assertNotNull(createdVo);
groupsManagerEntry = perun.getGroupsManager();
final Group group = new Group("Test_Group_123456", "TestGroupDescr");
createdGroup = groupsManagerEntry.createGroup(sess, createdVo, group);
String userFirstName = Long.toHexString(Double.doubleToLongBits(Math.random()));
String userLastName = Long.toHexString(Double.doubleToLongBits(Math.random()));
// his login in external source
String extLogin = Long.toHexString(Double.doubleToLongBits(Math.random()));
// Mockito.mock(Candidate.class);
candidate = new Candidate();
candidate.setFirstName(userFirstName);
candidate.setId(0);
candidate.setMiddleName("");
candidate.setLastName(userLastName);
candidate.setTitleBefore("");
candidate.setTitleAfter("");
ues = new UserExtSource(extSource, extLogin);
candidate.setUserExtSource(ues);
candidate.setAttributes(new HashMap<>());
createdMember = perun.getMembersManagerBl().createMemberSync(sess, createdVo, candidate);
assertNotNull("No member created", createdMember);
usersForDeletion.add(perun.getUsersManager().getUserByMember(sess, createdMember));
// save user for deletion after test
// need for testing creating members
g1 = perun.getGroupsManagerBl().createGroup(sess, createdVo, new Group("TESTINGGROUP1", "TESTINGGROUP1"));
g2 = perun.getGroupsManagerBl().createGroup(sess, createdVo, new Group("TESTINGGROUP2", "TESTINGGROUP2"));
g3ing1 = perun.getGroupsManagerBl().createGroup(sess, g1, new Group("TESTINGGROUP3", "TESTINGGROUP3"));
}
use of cz.metacentrum.perun.core.api.VosManager in project perun by CESNET.
the class ExtSourcesManagerEntryIntegrationTest method addExtSourceWhenExtSourceAlreadyAssigned.
@Test(expected = ExtSourceAlreadyAssignedException.class)
public void addExtSourceWhenExtSourceAlreadyAssigned() throws Exception {
System.out.println(CLASS_NAME + "addExtSourceWhenExtSourceAlreadyAssigned");
VosManager vosManager = perun.getVosManager();
Vo createdVo = vosManager.createVo(sess, new Vo(0, "sjk", "kljlk"));
extSourcesManagerEntry.addExtSource(sess, createdVo, extSource);
extSourcesManagerEntry.addExtSource(sess, createdVo, extSource);
// shouldn't add same ext source twice
}
Aggregations