+ assertEquals(0, pfDao.getAllVersions(null, "AAA0").size());
+ assertEquals(0, pfDao.getAllVersions(DummyConceptEntity.class, null).size());
+ }
+
+ private void testgetFilteredOps() {
+ final PfConceptKey aKey0 = new PfConceptKey("AAA0", VERSION001);
+ final PfConceptKey aKey1 = new PfConceptKey("AAA0", VERSION002);
+ final PfConceptKey aKey2 = new PfConceptKey("AAA0", VERSION003);
+ final PfConceptKey bKey0 = new PfConceptKey("BBB0", VERSION001);
+ final PfConceptKey bKey1 = new PfConceptKey("BBB0", VERSION002);
+ final PfConceptKey bKey2 = new PfConceptKey("BBB0", VERSION003);
+ final DummyConceptEntity keyInfo0 = new DummyConceptEntity(aKey0,
+ UUID.fromString(UUID0), DESCRIPTION0);
+ final DummyConceptEntity keyInfo1 = new DummyConceptEntity(aKey1,
+ UUID.fromString(UUID1), DESCRIPTION1);
+ final DummyConceptEntity keyInfo2 = new DummyConceptEntity(aKey2,
+ UUID.fromString(UUID2), DESCRIPTION2);
+ final DummyConceptEntity keyInfo3 = new DummyConceptEntity(bKey0,
+ UUID.fromString(UUID0), DESCRIPTION0);
+ final DummyConceptEntity keyInfo4 = new DummyConceptEntity(bKey1,
+ UUID.fromString(UUID1), DESCRIPTION1);
+ final DummyConceptEntity keyInfo5 = new DummyConceptEntity(bKey2,
+ UUID.fromString(UUID2), DESCRIPTION2);
+
+ pfDao.create(keyInfo0);
+ pfDao.create(keyInfo1);
+ pfDao.create(keyInfo2);
+ pfDao.create(keyInfo3);
+ pfDao.create(keyInfo4);
+ pfDao.create(keyInfo5);
+
+ assertThat(pfDao.getFiltered(DummyConceptEntity.class, null, null)).hasSize(6);
+ assertThat(pfDao.getFiltered(DummyConceptEntity.class, "AAA0", null)).hasSize(3);
+ assertThat(pfDao.getFiltered(DummyConceptEntity.class, "BBB0", null)).hasSize(3);
+ assertThat(pfDao.getFiltered(DummyConceptEntity.class, "BBB0", VERSION003)).hasSize(1);
+ assertThat(pfDao.getFiltered(DummyConceptEntity.class, null, VERSION003)).hasSize(6);
+
+ 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);
+ pfDao.create(tkeyInfo1);
+ pfDao.create(tkeyInfo2);
+
+
+ assertThat(pfDao.getFiltered(DummyTimestampEntity.class,
+ PfFilterParameters.builder().name("AT-KEY0").version(VERSION001).build())).hasSize(1);
+ assertThat(pfDao.getFiltered(DummyTimestampEntity.class, PfFilterParameters.builder().name("AT-KEY0").build()))
+ .hasSize(1);
+ assertThat(pfDao.getFiltered(DummyTimestampEntity.class, PfFilterParameters.builder().version(VERSION001)
+ .startTime(TIMESTAMP0).endTime(TIMESTAMP2).build())).hasSize(3);
+ assertThat(pfDao.getFiltered(DummyTimestampEntity.class, PfFilterParameters.builder().name("AT-KEY0")
+ .version(VERSION001).startTime(TIMESTAMP0).endTime(TIMESTAMP2).build())).hasSize(1);
+ assertThat(pfDao.getFiltered(DummyTimestampEntity.class,
+ PfFilterParameters.builder().version(VERSION001).endTime(TIMESTAMP2).build())).hasSize(3);
+ assertThat(pfDao.getFiltered(DummyTimestampEntity.class,
+ PfFilterParameters.builder().version(VERSION001).startTime(TIMESTAMP0).build())).hasSize(3);
+ assertThat(pfDao.getFiltered(DummyTimestampEntity.class, PfFilterParameters.builder().version(VERSION001)
+ .startTime(TIMESTAMP0).endTime(TIMESTAMP2).sortOrder("DESC").recordNum(2).build())).hasSize(2);
+
+ Map<String, Object> filterMap = new HashMap<>();
+ filterMap.put("doubleValue", 200.1);
+ assertThat(pfDao.getFiltered(DummyTimestampEntity.class,
+ PfFilterParameters.builder().filterMap(filterMap).build())).hasSize(1);
+ }
+
+ private void testgetFilteredOps3() {
+ Map<String, Object> filterMap = new HashMap<>();
+ filterMap.put("localName", "AT-KEY0");
+
+ 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);
+ pfDao.create(rkeyInfo1);
+ pfDao.create(rkeyInfo2);
+
+
+ assertThat(pfDao.getFiltered(DummyReferenceTimestampEntity.class,
+ PfFilterParameters.builder().name("Owner0").version(VERSION001).build())).hasSize(1);
+ assertThat(pfDao.getFiltered(DummyReferenceTimestampEntity.class,
+ PfFilterParameters.builder().name("Owner0").build())).hasSize(1);
+ assertThat(pfDao.getFiltered(DummyReferenceTimestampEntity.class, PfFilterParameters.builder()
+ .version(VERSION001).startTime(TIMESTAMP0).endTime(TIMESTAMP2).build())).hasSize(3);
+ assertThat(pfDao.getFiltered(DummyReferenceTimestampEntity.class, PfFilterParameters.builder().name("Owner0")
+ .version(VERSION001).startTime(TIMESTAMP0).endTime(TIMESTAMP2).build())).hasSize(1);
+ assertThat(pfDao.getFiltered(DummyReferenceTimestampEntity.class,
+ PfFilterParameters.builder().version(VERSION001).endTime(TIMESTAMP2).build())).hasSize(3);
+ assertThat(pfDao.getFiltered(DummyReferenceTimestampEntity.class,
+ PfFilterParameters.builder().version(VERSION001).startTime(TIMESTAMP0).build())).hasSize(3);
+ assertThat(pfDao.getFiltered(DummyReferenceTimestampEntity.class,
+ PfFilterParameters.builder().version(VERSION001).startTime(TIMESTAMP0).endTime(TIMESTAMP2)
+ .sortOrder("DESC").recordNum(2).build())).hasSize(2);
+
+ assertThat(pfDao.getFiltered(DummyReferenceTimestampEntity.class,
+ PfFilterParameters.builder().filterMap(filterMap).build())).hasSize(1);