}
}
@Test
public void testCreateListEntries() throws Exception {
LDCachingKiWiPersistenceConnection connection = vpersistence.getConnection();
try {
KiWiUriResource subject1 = new KiWiUriResource("http://localhost/resource/"+ RandomStringUtils.randomAlphanumeric(8));
KiWiUriResource subject2 = new KiWiUriResource("http://localhost/resource/"+ RandomStringUtils.randomAlphanumeric(8));
connection.storeNode(subject1);
connection.storeNode(subject2);
KiWiCacheEntry entry1 = new KiWiCacheEntry();
entry1.setExpiryDate(new Date(System.currentTimeMillis()+1000*60));
entry1.setLastRetrieved(new Date());
entry1.setUpdateCount(1);
entry1.setResource(subject1);
connection.storeCacheEntry(entry1);
connection.commit();
Assert.assertEquals(1,asList(connection.listAll()).size());
Assert.assertEquals(0,asList(connection.listExpired()).size());
KiWiCacheEntry entry2 = new KiWiCacheEntry();
entry2.setExpiryDate(new Date(System.currentTimeMillis() + 1000 * 60));
entry2.setLastRetrieved(new Date());
entry2.setUpdateCount(1);
entry2.setResource(subject2);
connection.storeCacheEntry(entry2);
connection.commit();
Assert.assertEquals(2,asList(connection.listAll()).size());
Assert.assertEquals(0,asList(connection.listExpired()).size());
connection.commit();
connection.removeCacheEntry(entry1);
connection.commit();
Assert.assertEquals(1,asList(connection.listAll()).size());
Assert.assertEquals(0, asList(connection.listExpired()).size());
connection.removeCacheEntry(entry2.getResource().stringValue());
connection.commit();
Assert.assertEquals(0,asList(connection.listAll()).size());
Assert.assertEquals(0,asList(connection.listExpired()).size());
connection.commit();
} finally {
connection.close();
}
}