use of cz.metacentrum.perun.core.api.Candidate in project perun by CESNET.
the class VosManagerEntryIntegrationTest method findCandidatesWithOneResult.
@Test
@Ignore
public void findCandidatesWithOneResult() throws Exception {
System.out.println(CLASS_NAME + "findCandidatesWithOneResult");
final Vo createdVo = vosManagerEntry.createVo(sess, myVo);
addExtSourceDelegate(createdVo);
final List<Candidate> candidates = vosManagerEntry.findCandidates(sess, createdVo, "kouril", 1);
assertEquals(1, candidates.size());
removeExtSourceDelegate(createdVo);
}
use of cz.metacentrum.perun.core.api.Candidate 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<>());
return candidate;
}
use of cz.metacentrum.perun.core.api.Candidate in project perun by CESNET.
the class VosManagerEntryIntegrationTest method prepareCandidateWithExtSource.
private Candidate prepareCandidateWithExtSource(String name, ExtSource es) {
String userLastName = Long.toHexString(Double.doubleToLongBits(Math.random()));
String extLogin = Long.toHexString(Double.doubleToLongBits(Math.random()));
final Candidate candidate = new Candidate();
candidate.setFirstName(name);
candidate.setId(0);
candidate.setMiddleName("");
candidate.setLastName(userLastName);
candidate.setTitleBefore("");
candidate.setTitleAfter("");
final UserExtSource userExtSource = new UserExtSource(es, extLogin);
candidate.setUserExtSource(userExtSource);
candidate.setAttributes(new HashMap<>());
return candidate;
}
use of cz.metacentrum.perun.core.api.Candidate in project perun by CESNET.
the class RegistrarManagerImplUnitTest method testDisplayNameWithOnlyLastNameAndFedInfo.
@Test
public void testDisplayNameWithOnlyLastNameAndFedInfo() {
Candidate candidate = new Candidate();
Map<String, String> attributes = new HashMap<>();
attributes.put(URN_USER_DISPLAY_NAME, "Sassmann");
Map<String, String> fedData = new HashMap<>();
fedData.put("sn", "Sassmann");
fedData.put("givenName", "Vojtech");
registrarManager.parseNamesFromDisplayNameAndFedInfo(candidate, attributes, fedData);
assertThat(candidate.getTitleBefore()).isEqualTo(null);
assertThat(candidate.getTitleAfter()).isEqualTo(null);
assertThat(candidate.getFirstName()).isEqualTo("Vojtech");
assertThat(candidate.getLastName()).isEqualTo("Sassmann");
}
use of cz.metacentrum.perun.core.api.Candidate in project perun by CESNET.
the class RegistrarManagerImplUnitTest method testParseNamesIfTheMiddleNameEqualsFirstName.
@Test
public void testParseNamesIfTheMiddleNameEqualsFirstName() {
Candidate candidate = new Candidate();
Map<String, String> attributes = new HashMap<>();
attributes.put(URN_USER_DISPLAY_NAME, "Bc. Jakub Jakub Hejda Dis.");
Map<String, String> fedData = new HashMap<>();
fedData.put("givenName", "Jakub");
fedData.put("sn", "Hejda");
Candidate candidate2 = new Candidate();
Map<String, String> attributes2 = new HashMap<>();
attributes2.put(URN_USER_DISPLAY_NAME, "Sir doc. John Paolo John Paolo Van Horn Phd.");
Map<String, String> fedData2 = new HashMap<>();
fedData2.put("givenName", "John Paolo");
fedData2.put("sn", "Van Horn");
registrarManager.parseNamesFromDisplayNameAndFedInfo(candidate, attributes, fedData);
registrarManager.parseNamesFromDisplayNameAndFedInfo(candidate2, attributes2, fedData2);
assertThat(candidate.getTitleBefore()).isEqualTo("Bc.");
assertThat(candidate.getFirstName()).isEqualTo("Jakub");
assertThat(candidate.getMiddleName()).isEqualTo("Jakub");
assertThat(candidate.getLastName()).isEqualTo("Hejda");
assertThat(candidate.getTitleAfter()).isEqualTo("Dis.");
assertThat(candidate2.getTitleBefore()).isEqualTo("Sir doc.");
assertThat(candidate2.getFirstName()).isEqualTo("John Paolo");
assertThat(candidate2.getMiddleName()).isEqualTo("John Paolo");
assertThat(candidate2.getLastName()).isEqualTo("Van Horn");
assertThat(candidate2.getTitleAfter()).isEqualTo("Phd.");
}
Aggregations