use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class UsersManagerEntryIntegrationTest method getUserExtSourceByExtLogin.
@Test
public void getUserExtSourceByExtLogin() throws Exception {
System.out.println(CLASS_NAME + "getUserExtSourceByExtLogin");
ExtSource externalSource = perun.getExtSourcesManager().getExtSourceByName(sess, extSourceName);
UserExtSource returnedUserExtSource = usersManager.getUserExtSourceByExtLogin(sess, externalSource, extLogin);
assertEquals("both ext source should be the same", userExtSource, returnedUserExtSource);
// check if both user ext sources are the same.
}
use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class UsersManagerEntryIntegrationTest method getUserExtSourceById.
@Test
public void getUserExtSourceById() throws Exception {
System.out.println(CLASS_NAME + "getUserExtSourceById");
int id = userExtSource.getId();
UserExtSource retUserExtSource = usersManager.getUserExtSourceById(sess, id);
// get user ext source base on our user ext source ID
assertNotNull("unable to get ext source by its ID", retUserExtSource);
assertEquals("both user ext sources should be the same", userExtSource, retUserExtSource);
}
use of cz.metacentrum.perun.core.api.UserExtSource in project perun by CESNET.
the class VosManagerEntryIntegrationTest method prepareCandidate.
private Candidate prepareCandidate() {
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);
final Candidate candidate = new Candidate();
candidate.setFirstName(userFirstName);
candidate.setId(0);
candidate.setMiddleName("");
candidate.setLastName(userLastName);
candidate.setTitleBefore("");
candidate.setTitleAfter("");
final ExtSource extSource = new ExtSource(0, "testExtSource", "cz.metacentrum.perun.core.impl.ExtSourceInternal");
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 UsersManagerEntryIntegrationTest 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 UsersManagerEntryIntegrationTest method addUserExtSource.
@Test
public void addUserExtSource() throws Exception {
System.out.println(CLASS_NAME + "addUserExtSource");
ExtSource externalSource = perun.getExtSourcesManager().getExtSourceByName(sess, extSourceName);
UserExtSource userExtSource2 = new UserExtSource();
userExtSource2.setLogin(extLogin2);
userExtSource2.setExtSource(externalSource);
UserExtSource returnedUserExtSource = usersManager.addUserExtSource(sess, user, userExtSource2);
assertNotNull(returnedUserExtSource);
assertTrue(returnedUserExtSource.getId() > 0);
assertEquals("Both User Ext Sources should be the same", userExtSource2, returnedUserExtSource);
}
Aggregations