+
+ final PfTimestampKey atKey0 = new PfTimestampKey("AT-KEY0", VERSION001, TIMESTAMP0);
+ final PfTimestampKey atKey1 = new PfTimestampKey("AT-KEY1", VERSION001, TIMESTAMP1);
+ final PfTimestampKey atKey2 = new PfTimestampKey("AT-KEY2", VERSION001, TIMESTAMP2);
+ final DummyTimestampEntity tkeyInfo0 = new DummyTimestampEntity(atKey0, 200.0);
+ final DummyTimestampEntity tkeyInfo1 = new DummyTimestampEntity(atKey1, 200.1);
+ final DummyTimestampEntity tkeyInfo2 = new DummyTimestampEntity(atKey2, 200.2);
+
+ pfDao.create(tkeyInfo0);
+
+ final DummyTimestampEntity tkeyInfoBack0 = pfDao.get(DummyTimestampEntity.class, atKey0);
+ assertEquals(tkeyInfo0, tkeyInfoBack0);
+
+ final DummyTimestampEntity tkeyInfoBackNull =
+ pfDao.get(DummyTimestampEntity.class, PfTimestampKey.getNullKey());
+ assertNull(tkeyInfoBackNull);
+
+
+
+ final Set<DummyTimestampEntity> tkeyInfoSetIn = new TreeSet<>();
+ tkeyInfoSetIn.add(tkeyInfo1);
+ tkeyInfoSetIn.add(tkeyInfo2);
+
+ pfDao.createCollection(tkeyInfoSetIn);
+
+ Set<DummyTimestampEntity> tkeyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyTimestampEntity.class));
+
+ tkeyInfoSetIn.add(tkeyInfo0);
+ assertEquals(tkeyInfoSetIn, tkeyInfoSetOut);
+
+ pfDao.delete(tkeyInfo1);
+ tkeyInfoSetIn.remove(tkeyInfo1);
+ tkeyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyTimestampEntity.class));
+ assertEquals(tkeyInfoSetIn, tkeyInfoSetOut);
+
+ pfDao.deleteCollection(tkeyInfoSetIn);
+ tkeyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyTimestampEntity.class));
+ assertEquals(0, tkeyInfoSetOut.size());
+
+ tkeyInfoSetIn.add(tkeyInfo2);
+ pfDao.createCollection(tkeyInfoSetIn);
+ tkeyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyTimestampEntity.class));
+ assertEquals(keyInfoSetIn, keyInfoSetOut);
+
+ pfDao.delete(DummyTimestampEntity.class, atKey2);
+ tkeyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyTimestampEntity.class));
+ assertEquals(3, keyInfoSetOut.size());
+ assertEquals(1, pfDao.size(DummyTimestampEntity.class));
+
+ pfDao.deleteAll(DummyTimestampEntity.class);
+ assertEquals(0, pfDao.size(DummyTimestampEntity.class));
+ }
+
+ private void testReferenceTimestamp() {
+ final PfConceptKey owner0Key = new PfConceptKey("Owner0", VERSION001);
+ final PfConceptKey owner1Key = new PfConceptKey("Owner1", VERSION001);
+ final PfConceptKey owner2Key = new PfConceptKey("Owner2", VERSION001);
+ final PfReferenceTimestampKey arKey0 = new PfReferenceTimestampKey(owner0Key, "AT-KEY0", TIMESTAMP0);
+ final PfReferenceTimestampKey arKey1 = new PfReferenceTimestampKey(owner1Key, "AT-KEY1", TIMESTAMP1);;
+ final PfReferenceTimestampKey arKey2 = new PfReferenceTimestampKey(owner2Key, "AT-KEY2", TIMESTAMP2);
+ final DummyReferenceTimestampEntity rkeyInfo0 = new DummyReferenceTimestampEntity(arKey0);
+ final DummyReferenceTimestampEntity rkeyInfo1 = new DummyReferenceTimestampEntity(arKey1);
+ final DummyReferenceTimestampEntity rkeyInfo2 = new DummyReferenceTimestampEntity(arKey2);
+
+ pfDao.create(rkeyInfo0);
+
+ final DummyReferenceTimestampEntity rkeyInfoBack0 = pfDao.get(DummyReferenceTimestampEntity.class, arKey0);
+ assertEquals(rkeyInfo0, rkeyInfoBack0);
+
+
+ final DummyReferenceTimestampEntity rkeyInfoBackNull =
+ pfDao.get(DummyReferenceTimestampEntity.class, PfReferenceTimestampKey.getNullKey());
+ assertNull(rkeyInfoBackNull);
+
+ final Set<DummyReferenceTimestampEntity> rkeyInfoSetIn = new TreeSet<>();
+ rkeyInfoSetIn.add(rkeyInfo1);
+ rkeyInfoSetIn.add(rkeyInfo2);
+
+ pfDao.createCollection(rkeyInfoSetIn);
+
+ Set<DummyReferenceTimestampEntity> rkeyInfoSetOut =
+ new TreeSet<>(pfDao.getAll(DummyReferenceTimestampEntity.class));
+
+ rkeyInfoSetIn.add(rkeyInfo0);
+ assertEquals(rkeyInfoSetIn, rkeyInfoSetOut);
+
+ pfDao.delete(rkeyInfo1);
+ rkeyInfoSetIn.remove(rkeyInfo1);
+ rkeyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyReferenceTimestampEntity.class));
+ assertEquals(rkeyInfoSetIn, rkeyInfoSetOut);
+
+ pfDao.deleteCollection(rkeyInfoSetIn);
+ rkeyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyReferenceTimestampEntity.class));
+ assertEquals(0, rkeyInfoSetOut.size());
+
+ rkeyInfoSetIn.add(rkeyInfo2);
+ pfDao.createCollection(rkeyInfoSetIn);
+ rkeyInfoSetOut = new TreeSet<>(pfDao.getAll(DummyReferenceTimestampEntity.class));
+ assertEquals(rkeyInfoSetIn, rkeyInfoSetOut);
+
+ pfDao.deleteAll(DummyReferenceTimestampEntity.class);
+ assertEquals(0, pfDao.size(DummyReferenceTimestampEntity.class));