String destAreaName, String path1, String path2) throws PublicationException,
SiteException {
DocumentFactory factory = getFactory();
Publication pub = factory.getPublication("test");
SiteStructure sourceArea = pub.getArea(sourceAreaName).getSite();
SiteStructure destArea = pub.getArea(destAreaName).getSite();
if (destArea.contains(path1)) {
destArea.getNode(path1).delete();
}
if (destArea.contains(path2)) {
destArea.getNode(path2).delete();
}
assertFalse(destArea.contains(path1));
assertFalse(destArea.contains(path2));
// copy second node first to test correct ordering
doTestCopyToArea(docManager, path2, sourceAreaName, destAreaName);
doTestCopyToArea(docManager, path1, sourceAreaName, destAreaName);
List sourceNodes = Arrays.asList(sourceArea.getNodes());
SiteNode authoringNode1 = sourceArea.getNode(path1);
assertTrue(sourceNodes.contains(authoringNode1));
int sourcePos1 = sourceNodes.indexOf(authoringNode1);
SiteNode sourceNode2 = sourceArea.getNode(path2);
int sourcePos2 = sourceNodes.indexOf(sourceNode2);
assertTrue(sourcePos1 < sourcePos2);
assertTrue(destArea.contains(path1));
List liveNodes = Arrays.asList(destArea.getNodes());
SiteNode liveNode1 = destArea.getNode(path1);
assertTrue(liveNodes.contains(liveNode1));
int livePos1 = liveNodes.indexOf(liveNode1);
SiteNode liveNode2 = destArea.getNode(path2);
int livePos2 = liveNodes.indexOf(liveNode2);
assertTrue(livePos1 < livePos2);
}