controlDate1, controlDate2);
resultIter = rs.iterator();
assertEquals("Calls must be 2", rs.size(), 2);
CallRecord rec = (CallRecord)resultIter.next();
CallPeerRecord participant = rec.getPeerRecords().get(0);
assertTrue("Participant incorrect ",
participant.getPeerAddress().
equals(participantAddresses.get(2)));
rec = (CallRecord)resultIter.next();
participant = rec.getPeerRecords().get(0);
assertTrue("Participant incorrect ",
participant.getPeerAddress().
equals(participantAddresses.get(3)));
/**
* must find 1 record
*/
rs = metaHistoryService.findByStartDate(
new String[]{CallHistoryService.class.getName()},
null,
controlDate2);
resultIter = rs.iterator();
assertEquals("Calls must be 2", rs.size(), 2);
rec = (CallRecord)resultIter.next();
participant = rec.getPeerRecords().get(0);
assertTrue("Participant incorrect ",
participant.getPeerAddress().
equals(participantAddresses.get(4)));
rec = (CallRecord)resultIter.next();
participant = rec.getPeerRecords().get(0);
assertTrue("Participant incorrect ",
participant.getPeerAddress().
equals(participantAddresses.get(5)));
/**
* Must return exactly the last 3 calls
*/
rs = metaHistoryService.findLast(
new String[]{CallHistoryService.class.getName()},
null,
3);
resultIter = rs.iterator();
assertEquals("Calls must be 3", rs.size(), 3);
rec = (CallRecord)resultIter.next();
participant = rec.getPeerRecords().get(0);
assertTrue("Participant incorrect ",
participant.getPeerAddress().
equals(participantAddresses.get(3)));
rec = (CallRecord)resultIter.next();
participant = rec.getPeerRecords().get(0);
assertTrue("Participant incorrect ",
participant.getPeerAddress().
equals(participantAddresses.get(4)));
rec = (CallRecord)resultIter.next();
participant = rec.getPeerRecords().get(0);
assertTrue("Participant incorrect ",
participant.getPeerAddress().
equals(participantAddresses.get(5)));
}