new String[]{FileHistoryService.class.getName()},
testMetaContact, 2));
assertEquals("Filetransfers must be 2", rs.size(), 2);
it = rs.iterator();
FileRecord fr = it.next();
assertTrue("Filetransfers not found",
fr.getFile().getName().
equals(files[4].getName()));
assertTrue("Filetransfers status wrong",
fr.getStatus().
equals("refused"));
assertTrue("Filetransfers direction wrong",
fr.getDirection().
equalsIgnoreCase("out"));
fr = it.next();
assertTrue("Filetransfers not found",
fr.getFile().getName().
equals(files[5].getName()));
assertTrue("Filetransfers status wrong",
fr.getStatus().
equals("completed"));
assertTrue("Filetransfers direction wrong",
fr.getDirection().
equalsIgnoreCase("in"));
rs = getFileRecords(
metaHistoryService.findByKeyword(
new String[]{FileHistoryService.class.getName()},
testMetaContact,
"t3"));
assertTrue("Filetransfers must be atleast 1", rs.size() > 0);
it = rs.iterator();
assertTrue("Filetransfers not found",
it.next().getFile().getName().
equals(files[2].getName()));
rs = getFileRecords(
metaHistoryService.findByKeyword(
new String[]{FileHistoryService.class.getName()},
testMetaContact,
"T3", true));
assertEquals("Filetransfers must be 0", rs.size(), 0);
rs = getFileRecords(
metaHistoryService.findByKeywords(
new String[]{FileHistoryService.class.getName()},
testMetaContact,
new String[]{"t3"}));
assertTrue("Filetransfers must be atleast 1", rs.size() > 0);
it = rs.iterator();
assertTrue("Filetransfers not found",
it.next().getFile().getName().
equals(files[2].getName()));
rs = getFileRecords(
metaHistoryService.findByKeywords(
new String[]{FileHistoryService.class.getName()},
testMetaContact,
new String[]{"T3"}, true));
assertEquals("Filetransfers must be 0", rs.size(), 0);
rs = getFileRecords(
metaHistoryService.findFirstMessagesAfter(
new String[]{FileHistoryService.class.getName()},
testMetaContact,
controlDate1,
2));
assertEquals("Filetransfers must be 2", rs.size(), 2);
it = rs.iterator();
fr = it.next();
assertTrue("Filetransfers not found",
fr.getFile().getName().
equals(files[2].getName()));
assertTrue("Filetransfers status wrong",
fr.getStatus().
equals("completed"));
assertTrue("Filetransfers direction wrong",
fr.getDirection().
equalsIgnoreCase("out"));
fr = it.next();
assertTrue("Filetransfers not found",
fr.getFile().getName().
equals(files[3].getName()));
assertTrue("Filetransfers status wrong",
fr.getStatus().
equals("active"));
assertTrue("Filetransfers direction wrong",
fr.getDirection().
equalsIgnoreCase("in"));
rs = getFileRecords(
metaHistoryService.findLastMessagesBefore(
new String[]{FileHistoryService.class.getName()},
testMetaContact,
controlDate1,
2));
assertEquals("Filetransfers must be 2", rs.size(), 2);
it = rs.iterator();
fr = it.next();
assertTrue("Filetransfers not found",
fr.getFile().getName().
equals(files[0].getName()));
assertTrue("Filetransfers status wrong",
fr.getStatus().
equals("canceled"));
assertTrue("Filetransfers direction wrong",
fr.getDirection().
equalsIgnoreCase("out"));
fr = it.next();
assertTrue("Filetransfers not found",
fr.getFile().getName().
equals(files[1].getName()));
assertTrue("Filetransfers status wrong",
fr.getStatus().
equals("completed"));
assertTrue("Filetransfers direction wrong",
fr.getDirection().
equalsIgnoreCase("in"));
}