use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method removeUserExtSourceAttributesWhenUserExtSourceNotExists.
@Test(expected = UserExtSourceNotExistsException.class)
public void removeUserExtSourceAttributesWhenUserExtSourceNotExists() throws Exception {
System.out.println(CLASS_NAME + "removeUserExtSourceAttributesWhenUserExtSourceNotExists");
attributes = setUpUserExtSourceAttribute();
UserExtSource ues = setUpUserExtSource();
attributesManager.removeAttributes(sess, ues, attributes);
// shouldn't find user external source
}
use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class VosManagerEntryIntegrationTest method getAdmins.
@Test
public void getAdmins() throws Exception {
System.out.println(CLASS_NAME + "getAdmins");
final Vo createdVo = vosManagerEntry.createVo(sess, myVo);
// set up first user
final Member member = createMemberFromExtSource(createdVo);
User user = perun.getUsersManagerBl().getUserByMember(sess, member);
vosManagerEntry.addAdmin(sess, createdVo, user);
// set up authorized group
Group authorizedGroup = new Group("authorizedGroup", "testovaciGroup");
Group returnedGroup = perun.getGroupsManager().createGroup(sess, createdVo, authorizedGroup);
vosManagerEntry.addAdmin(sess, createdVo, returnedGroup);
// set up second user
//Mockito.mock(Candidate.class);
Candidate candidate = new Candidate();
candidate.setFirstName("Josef");
candidate.setId(4);
candidate.setMiddleName("");
candidate.setLastName("Novak");
candidate.setTitleBefore("");
candidate.setTitleAfter("");
UserExtSource userExtSource = new UserExtSource(new ExtSource(0, "testExtSource", "cz.metacentrum.perun.core.impl.ExtSourceInternal"), Long.toHexString(Double.doubleToLongBits(Math.random())));
candidate.setUserExtSource(userExtSource);
candidate.setAttributes(new HashMap<String, String>());
Member member2 = perun.getMembersManagerBl().createMemberSync(sess, createdVo, candidate);
User user2 = perun.getUsersManagerBl().getUserByMember(sess, member2);
perun.getGroupsManager().addMember(sess, returnedGroup, member2);
// test
List<User> admins = vosManagerEntry.getAdmins(sess, createdVo);
assertTrue("should have 2 admins", admins.size() == 2);
assertTrue("our member as direct user should be admin", admins.contains(user));
assertTrue("our member as member of admin group should be admin", admins.contains(user2));
}
use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class UsersManagerEntryIntegrationTest method setUpCandidateForSpecificUser1.
private Candidate setUpCandidateForSpecificUser1() {
//Mockito.mock(Candidate.class);
Candidate candidate = new Candidate();
candidate.setFirstName("(Service)");
candidate.setId(0);
candidate.setMiddleName("");
candidate.setLastName("testingServiceUser01");
candidate.setTitleBefore("");
candidate.setTitleAfter("");
candidate.setServiceUser(true);
final UserExtSource userExtSource = new UserExtSource(extSource, Long.toHexString(Double.doubleToLongBits(Math.random())));
candidate.setUserExtSource(userExtSource);
candidate.setAttributes(new HashMap<String, String>());
return candidate;
}
use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class UsersManagerEntryIntegrationTest method setUpCandidateForSpecificUser2.
private Candidate setUpCandidateForSpecificUser2() {
//Mockito.mock(Candidate.class);
Candidate candidate = new Candidate();
candidate.setFirstName("(Service)");
candidate.setId(0);
candidate.setMiddleName("");
candidate.setLastName("testingServiceUser02");
candidate.setTitleBefore("");
candidate.setTitleAfter("");
candidate.setServiceUser(true);
final UserExtSource userExtSource = new UserExtSource(extSource, Long.toHexString(Double.doubleToLongBits(Math.random())));
candidate.setUserExtSource(userExtSource);
candidate.setAttributes(new HashMap<String, String>());
return candidate;
}
use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class UsersManagerEntryIntegrationTest method addIDPExtSourcesWithSameLogin.
@Test(expected = InternalErrorException.class)
public void addIDPExtSourcesWithSameLogin() throws Exception {
System.out.println(CLASS_NAME + "addIDPExtSourcesWithSameLogin");
ExtSource ext1 = new ExtSource("test1", ExtSourcesManagerEntry.EXTSOURCE_IDP);
ExtSource ext2 = new ExtSource("test2", ExtSourcesManagerEntry.EXTSOURCE_IDP);
ext1 = perun.getExtSourcesManagerBl().createExtSource(sess, ext1, null);
ext2 = perun.getExtSourcesManagerBl().createExtSource(sess, ext2, null);
UserExtSource ues1 = new UserExtSource(ext1, 1, "testExtLogin@test");
UserExtSource ues2 = new UserExtSource(ext2, 1, "testExtLogin@test");
ues1 = usersManager.addUserExtSource(sess, user, ues1);
ues2 = usersManager.addUserExtSource(sess, user, ues2);
}
Aggregations