assertEquals(1, changeSets.size());
DriftChangeSet<?> changeSet = changeSets.get(0);
assertEquals(0, changeSet.getVersion());
assertEquals("Expected to find one entry in change set", 1, changeSet.getDrifts().size());
DriftFile driftFile = jpaDriftServer.getDriftFile(overlord, file1Hash);
assertNotNull(driftFile);
assertEquals(DriftFileStatus.REQUESTED, driftFile.getStatus());
// the second change set should report drift
String modifiedFile1Hash = sha256("test-2-file-1-modified");
headers.setType(DRIFT);
headers.setVersion(1);
File changeSet2 = new File(changeSetsDir, "changeset-2.txt");
writer = new ChangeSetWriterImpl(changeSet2, headers);
writer.write(changedFileEntry("test/file-1", file1Hash, modifiedFile1Hash, 56789L, 1024L));
writer.close();
File changeSet2Zip = new File(changeSetsDir, "changeset-2.zip");
ZipUtil.zipFileOrDirectory(changeSet2, changeSet2Zip);
assertTrue("Expected to find change set file: " + changeSet2Zip.getPath(), changeSet2Zip.exists());
jpaDriftServer.storeChangeSet(overlord, newResource.getId(), changeSet2Zip);
c.addSortVersion(PageOrdering.ASC);
c.addFilterCategory(DRIFT);
changeSets = jpaDriftServer.findDriftChangeSetsByCriteria(overlord, c);
assertEquals(1, changeSets.size());
changeSet = changeSets.get(0);
assertEquals("The change set version is wrong", 1, changeSet.getVersion());
assertEquals("Expected to find one entry in change set", 1, changeSet.getDrifts().size());
changeSet = changeSets.get(0);
assertEquals(1, changeSet.getVersion());
assertEquals(1, changeSet.getDrifts().size());
Drift<?, ?> drift = changeSet.getDrifts().iterator().next();
assertEquals("test/file-1", drift.getPath());
assertEquals(file1Hash, drift.getOldDriftFile().getHashId());
assertEquals(modifiedFile1Hash, drift.getNewDriftFile().getHashId());
assertEquals(DriftCategory.FILE_CHANGED, drift.getCategory());
driftFile = jpaDriftServer.getDriftFile(overlord, modifiedFile1Hash);
assertNotNull(driftFile);
assertEquals(DriftFileStatus.REQUESTED, driftFile.getStatus());
}