@Test
public void testModifyPerson() {
MpiTest.logger.fine("testModifyPerson");
int requestTypeId;
PersonRequest requestData = new PersonRequest();
Person p;
List<Person> pList;
int pCount;
Object result;
PersonResponse pr;
// Find the person to modify.
p = new Person();
requestData.setPerson(p);
p.setVillageName("Eden");
pr = callFindPerson(requestData);
pList = pr.getPersonList();
assertNotNull(pList);
pCount = pList.size();
assertEquals(1, pCount);
Person p0 = pList.get(0);
assertEquals("Cain", p0.getFirstName());
assertEquals("Human", p0.getMiddleName());
assertEquals("One", p0.getLastName());
MpiTest.logger.fine("Modify the village name.");
requestTypeId = RequestTypeId.MODIFY_PERSON_MPI;
p0.setVillageName("OutOfEden");
requestData.setPerson(p0);
result = mpi.getData(requestTypeId, requestData);
assertNull(result); // MODIFY PERSON returns no result object.
MpiTest.logger.fine("Search for residents of village Eden -- should find none at 100%.");
p = new Person();
p.setVillageName("Eden");
requestData.setPerson(p);
pr = callFindPerson(requestData);
pList = pr.getPersonList();
if (pList != null) {
for (Person per : pList) {
assertTrue(per.getMatchScore() < 100);
}
}
MpiTest.logger.fine("Search for residents of village OutOfEden -- should find one at 100%.");
p = new Person();
p.setVillageName("OutOfEden");
requestData.setPerson(p);
pr = callFindPerson(requestData);
pList = pr.getPersonList();
assertNotNull(pList);
pCount = 0;
for (Person per : pList) {
if (per.getMatchScore() >= 80) {
pCount++;
}
}
assertEquals(1, pCount);
MpiTest.logger.fine("Set marital status to single.");
p0.setMaritalStatus(Person.MaritalStatus.single);
requestData.setPerson(p0);
result = mpi.getData(RequestTypeId.MODIFY_PERSON_MPI, requestData);
}