CswHarvesterIntegrationTest.addCswSpecificParams(csw);
final String id = _harvestManager.addHarvesterReturnId(csw, context.getUserSession().getUserId());
final Element harvesterConfig = _harvestManager.get(id, context, null);
final String harvesterName = "Name";
final String harvesterUuid = Xml.selectString(harvesterConfig, "*//uuid");
final HarvestHistory history = createHistory(harvesterName, harvesterUuid, new ISODate("1980-01-01T10:00:00"));
final HarvestHistory history2 = createHistory(harvesterName, harvesterUuid, new ISODate("1980-02-01T10:00:00"));
final HarvestHistory history3 = createHistory(harvesterName, harvesterUuid, new ISODate("1979-02-01T10:00:00"));
final History historyService = new History();
Element params = Xml.loadString("<request><id>"+id+"</id><uuid>"+harvesterUuid+"</uuid></request>", false);
final Element results = historyService.exec(params, context);
assertEquals(1, results.getChildren("harvesthistory").size());
final List<Element> harvestHistory = results.getChild("harvesthistory").getChildren();
assertEquals(3, harvestHistory.size());
assertEquals(history2.getHarvestDate(), new ISODate(harvestHistory.get(0).getChildText("harvestdate")));
assertEquals(history2.getId(), Integer.parseInt(harvestHistory.get(0).getChildText("id")));
assertEquals(history.getHarvestDate(), new ISODate(harvestHistory.get(1).getChildText("harvestdate")));
assertEquals(history.getId(), Integer.parseInt(harvestHistory.get(1).getChildText("id")));
assertEquals(history3.getHarvestDate(), new ISODate(harvestHistory.get(2).getChildText("harvestdate")));
assertEquals(history3.getId(), Integer.parseInt(harvestHistory.get(2).getChildText("id")));
}