use of cz.metacentrum.perun.core.api.ExtSource in project perun by CESNET.
the class UsersManagerEntryIntegrationTest method getActiveUserExtSources.
@Test
public void getActiveUserExtSources() throws Exception {
System.out.println(CLASS_NAME + "getActiveUserExtSources");
ExtSource externalSource = perun.getExtSourcesManager().getExtSourceByName(sess, extSourceName);
UserExtSource userExtSource = usersManager.getUserExtSourceByExtLogin(sess, externalSource, extLogin);
List<UserExtSource> ues = perun.getUsersManagerBl().getActiveUserExtSources(sess, user);
assertTrue(ues.contains(userExtSource));
}
use of cz.metacentrum.perun.core.api.ExtSource in project perun by CESNET.
the class UsersManagerEntryIntegrationTest method getUserExtSourceByExtLoginWhenExtLoginNotExists.
//TODO: for this test is needed to add creating login in registrar database
/*
@Test (expected=AlreadyReservedLoginException.class)
public void isAlreadyReservedLogin() throws Exception {
System.out.println(CLASS_NAME + "isAlreadyReservedLogin");
String namespace = "einfra";
String login = "martin_svehla";
perun.getUsersManagerBl().checkReservedLogins(sess, namespace, login);
}
*/
@Test(expected = UserExtSourceNotExistsException.class)
public void getUserExtSourceByExtLoginWhenExtLoginNotExists() throws Exception {
System.out.println(CLASS_NAME + "getUserExtSourceByExtLoginWhenExtLoginNotExists");
ExtSource externalSource = perun.getExtSourcesManager().getExtSourceByName(sess, extSourceName);
usersManager.getUserExtSourceByExtLogin(sess, externalSource, "");
// shouldn't find UserExtSource (based on valid ext source and invalid login)
}
use of cz.metacentrum.perun.core.api.ExtSource 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.ExtSource 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.ExtSource 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