// wait for one second to be sure to capture MySQL cutting milliseconds
mysqlSleep();
Version version1 = new Version();
version1.setCommitTime(new Date());
version1.addTriple(triple1);
connection.storeVersion(version1);
connection.commit();
// wait for one second to be sure to capture MySQL cutting milliseconds
mysqlSleep();
Date date2 = new Date();
// wait for one second to be sure to capture MySQL cutting milliseconds
mysqlSleep();
Version version2 = new Version();
version2.setCommitTime(new Date());
version2.addTriple(triple2);
version2.removeTriple(triple1);
connection.storeVersion(version2);
connection.commit();
// wait for one second to be sure to capture MySQL cutting milliseconds
mysqlSleep();
Date date3 = new Date();
// now we test different ways of listing versions between dates
List<Version> list1 = Iterations.asList(connection.listVersions(date1,date2));
Assert.assertEquals("there should be exactly one version from "+date1+" to "+date2,1,list1.size());
Assert.assertEquals("contents of version differ", version1, list1.get(0));
// check if getLatestVersion at date2 works
Version latest2 = connection.getLatestVersion(subject,date2);
Assert.assertNotNull("latest version for subject was not found",latest2);
Assert.assertEquals("latest version is not the expected version", version1,latest2);
// check if listVersions with subject1 now gives exactly one version
List<Version> listr1 = Iterations.asList(connection.listVersions(subject,date1,date2));