use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class UsersManagerEntryIntegrationTest method removeUserExtSourcePersistent.
@Test(expected = InternalErrorException.class)
public void removeUserExtSourcePersistent() throws Exception {
System.out.println(CLASS_NAME + "removeUserExtSourcePersistent");
// Assuming ExtSource PERUN is persistent (set as property)
ExtSource extSource = perun.getExtSourcesManagerBl().getExtSourceByName(sess, "PERUN");
List<UserExtSource> userExtSources = usersManager.getUserExtSources(sess, user);
for (UserExtSource ues : userExtSources) {
if (ues.getExtSource().equals(extSource)) {
usersManager.removeUserExtSource(sess, user, ues);
break;
}
}
}
use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class UsersManagerEntryIntegrationTest method setUpCandidateForSponsoredUser.
private Candidate setUpCandidateForSponsoredUser() {
Candidate candidate = new Candidate();
candidate.setFirstName("Sponsored");
candidate.setId(0);
candidate.setMiddleName("");
candidate.setLastName("User01");
candidate.setTitleBefore("");
candidate.setTitleAfter("");
candidate.setServiceUser(false);
candidate.setSponsoredUser(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 getActiveUserExtSourcesIfEmpty.
@Test
public void getActiveUserExtSourcesIfEmpty() throws Exception {
System.out.println(CLASS_NAME + "getActiveUserExtSources");
User emptyUser = setUpEmptyUser();
List<UserExtSource> ues = perun.getUsersManagerBl().getUserExtSources(sess, emptyUser);
for (UserExtSource uExtSource : ues) {
perun.getUsersManagerBl().removeUserExtSource(sess, emptyUser, uExtSource);
}
ues = perun.getUsersManagerBl().getActiveUserExtSources(sess, emptyUser);
assertTrue(ues.isEmpty());
}
use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class urn_perun_group_resource_attribute_def_def_isUnixGroupIntegrationtest method setUpCandidate.
private Candidate setUpCandidate() {
//Mockito.mock(Candidate.class);
Candidate candidate = new Candidate();
candidate.setFirstName(userFirstName);
candidate.setId(0);
candidate.setMiddleName("");
candidate.setLastName(userLastName);
candidate.setTitleBefore("");
candidate.setTitleAfter("");
final UserExtSource userExtSource = new UserExtSource(extSource, extLogin);
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 urn_perun_group_resource_attribute_def_def_isUnixGroupIntegrationtest method setUpUserExtSource.
private void setUpUserExtSource() throws Exception {
ExtSource externalSource = perun.getExtSourcesManager().getExtSourceByName(sess, extSourceName);
// gets real external source object from database
userExtSource.setExtSource(externalSource);
// put real external source into user's external source
userExtSource.setLogin(extLogin);
// set users login in his ext source
assertNotNull(usersManager.addUserExtSource(sess, user, userExtSource));
// create new user ext source in database
}
Aggregations