diff --git a/src/main/java/org/openepics/names/repository/DeviceGroupRepository.java b/src/main/java/org/openepics/names/repository/DeviceGroupRepository.java index e5524fdd10a334e5526b32c4f01502590e29b8f8..aa3cc4425114762b3f102292828f9252a8d00b7e 100644 --- a/src/main/java/org/openepics/names/repository/DeviceGroupRepository.java +++ b/src/main/java/org/openepics/names/repository/DeviceGroupRepository.java @@ -209,13 +209,20 @@ public class DeviceGroupRepository { // make sure to not exclude present and future values (latest approved and pending) // // condition(s) - // exclude content (with latest) before latest - considered history + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) + // <--> // select * from structure s // where ( - // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // and not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id > (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) // ) // <--> - // not (exists (subquery id) and s.id < (subquery id)) + // not (exists (subquery id) and s.id < (subquery id)) + // and not (exists (subquery id) and s.id > (subquery id) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (subquery id) and s.status in ('CANCELLED', 'REJECTED')) // // note // persistence libraries may optimize query @@ -229,9 +236,22 @@ public class DeviceGroupRepository { sub.select(fromSub.get(Persistable.FIELD_ID)); Predicate predicateExclude = - cb.and(cb.not(cb.and( - cb.exists(sub), - cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub)))); + cb.and( + cb.not(cb.and( + cb.exists(sub), + cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub))), + cb.not(cb.and( + cb.exists(sub), + cb.greaterThan(from.get(Persistable.FIELD_ID).as(Long.class), sub), + cb.or( + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + // cb.not(cb.and( + // cb.not(cb.exists(sub)), + // cb.or( + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + ); predicates.add(predicateExclude); } diff --git a/src/main/java/org/openepics/names/repository/DeviceTypeRepository.java b/src/main/java/org/openepics/names/repository/DeviceTypeRepository.java index b1543e1a909e91685005045e08d6d810743b35d6..da3d50b95df6ea6a124cf74ca84d0cc59a688657 100644 --- a/src/main/java/org/openepics/names/repository/DeviceTypeRepository.java +++ b/src/main/java/org/openepics/names/repository/DeviceTypeRepository.java @@ -209,13 +209,20 @@ public class DeviceTypeRepository { // make sure to not exclude present and future values (latest approved and pending) // // condition(s) - // exclude content (with latest) before latest - considered history + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) + // <--> // select * from structure s // where ( - // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // and not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id > (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) // ) // <--> - // not (exists (subquery id) and s.id < (subquery id)) + // not (exists (subquery id) and s.id < (subquery id)) + // and not (exists (subquery id) and s.id > (subquery id) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (subquery id) and s.status in ('CANCELLED', 'REJECTED')) // // note // persistence libraries may optimize query @@ -229,9 +236,22 @@ public class DeviceTypeRepository { sub.select(fromSub.get(Persistable.FIELD_ID)); Predicate predicateExclude = - cb.and(cb.not(cb.and( - cb.exists(sub), - cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub)))); + cb.and( + cb.not(cb.and( + cb.exists(sub), + cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub))), + cb.not(cb.and( + cb.exists(sub), + cb.greaterThan(from.get(Persistable.FIELD_ID).as(Long.class), sub), + cb.or( + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + // cb.not(cb.and( + // cb.not(cb.exists(sub)), + // cb.or( + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + ); predicates.add(predicateExclude); } diff --git a/src/main/java/org/openepics/names/repository/DisciplineRepository.java b/src/main/java/org/openepics/names/repository/DisciplineRepository.java index ad07c283e898b471ee399327f65480967e3338fd..cdeafd2ff5a68834617153d653884e8628d48b09 100644 --- a/src/main/java/org/openepics/names/repository/DisciplineRepository.java +++ b/src/main/java/org/openepics/names/repository/DisciplineRepository.java @@ -205,13 +205,20 @@ public class DisciplineRepository { // make sure to not exclude present and future values (latest approved and pending) // // condition(s) - // exclude content (with latest) before latest - considered history + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) + // <--> // select * from structure s // where ( - // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // and not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id > (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) // ) // <--> - // not (exists (subquery id) and s.id < (subquery id)) + // not (exists (subquery id) and s.id < (subquery id)) + // and not (exists (subquery id) and s.id > (subquery id) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (subquery id) and s.status in ('CANCELLED', 'REJECTED')) // // note // persistence libraries may optimize query @@ -225,9 +232,22 @@ public class DisciplineRepository { sub.select(fromSub.get(Persistable.FIELD_ID)); Predicate predicateExclude = - cb.and(cb.not(cb.and( - cb.exists(sub), - cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub)))); + cb.and( + cb.not(cb.and( + cb.exists(sub), + cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub))), + cb.not(cb.and( + cb.exists(sub), + cb.greaterThan(from.get(Persistable.FIELD_ID).as(Long.class), sub), + cb.or( + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + // cb.not(cb.and( + // cb.not(cb.exists(sub)), + // cb.or( + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + ); predicates.add(predicateExclude); } diff --git a/src/main/java/org/openepics/names/repository/SubsystemRepository.java b/src/main/java/org/openepics/names/repository/SubsystemRepository.java index 9fc3d7d1e90cc20ef1634745b9e547521f391e85..b2f6f540399972a0306e58bdb8d4970242155bdb 100644 --- a/src/main/java/org/openepics/names/repository/SubsystemRepository.java +++ b/src/main/java/org/openepics/names/repository/SubsystemRepository.java @@ -209,13 +209,20 @@ public class SubsystemRepository { // make sure to not exclude present and future values (latest approved and pending) // // condition(s) - // exclude content (with latest) before latest - considered history + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) + // <--> // select * from structure s // where ( - // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // and not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id > (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) // ) // <--> - // not (exists (subquery id) and s.id < (subquery id)) + // not (exists (subquery id) and s.id < (subquery id)) + // and not (exists (subquery id) and s.id > (subquery id) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (subquery id) and s.status in ('CANCELLED', 'REJECTED')) // // note // persistence libraries may optimize query @@ -229,9 +236,22 @@ public class SubsystemRepository { sub.select(fromSub.get(Persistable.FIELD_ID)); Predicate predicateExclude = - cb.and(cb.not(cb.and( - cb.exists(sub), - cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub)))); + cb.and( + cb.not(cb.and( + cb.exists(sub), + cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub))), + cb.not(cb.and( + cb.exists(sub), + cb.greaterThan(from.get(Persistable.FIELD_ID).as(Long.class), sub), + cb.or( + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + // cb.not(cb.and( + // cb.not(cb.exists(sub)), + // cb.or( + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + ); predicates.add(predicateExclude); } diff --git a/src/main/java/org/openepics/names/repository/SystemGroupRepository.java b/src/main/java/org/openepics/names/repository/SystemGroupRepository.java index f9f3b06c8e83310319796e80cc01660a486519d6..ab6ac1fb5b8a96888069f570ad210bc4c5f7727c 100644 --- a/src/main/java/org/openepics/names/repository/SystemGroupRepository.java +++ b/src/main/java/org/openepics/names/repository/SystemGroupRepository.java @@ -197,17 +197,24 @@ public class SystemGroupRepository { if (!Boolean.TRUE.equals(includeHistory)) { // purpose of Naming to show valid entries // therefore - // exclude some values unless history requested + // exclude obsolete values unless history requested // make sure to not exclude present and future values (latest approved and pending) // // condition(s) - // exclude content (with latest) before latest - considered history + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) + // <--> // select * from structure s // where ( - // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // and not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id > (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) // ) // <--> - // not (exists (subquery id) and s.id < (subquery id)) + // not (exists (subquery id) and s.id < (subquery id)) + // and not (exists (subquery id) and s.id > (subquery id) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (subquery id) and s.status in ('CANCELLED', 'REJECTED')) // // note // persistence libraries may optimize query @@ -221,9 +228,22 @@ public class SystemGroupRepository { sub.select(fromSub.get(Persistable.FIELD_ID)); Predicate predicateExclude = - cb.and(cb.not(cb.and( - cb.exists(sub), - cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub)))); + cb.and( + cb.not(cb.and( + cb.exists(sub), + cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub))), + cb.not(cb.and( + cb.exists(sub), + cb.greaterThan(from.get(Persistable.FIELD_ID).as(Long.class), sub), + cb.or( + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + // cb.not(cb.and( + // cb.not(cb.exists(sub)), + // cb.or( + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + ); predicates.add(predicateExclude); } diff --git a/src/main/java/org/openepics/names/repository/SystemRepository.java b/src/main/java/org/openepics/names/repository/SystemRepository.java index 75c8107b3b7a7a8a60847457be1dd2aba67f730e..991f9c11e225f638881e9024e4638fb793623585 100644 --- a/src/main/java/org/openepics/names/repository/SystemRepository.java +++ b/src/main/java/org/openepics/names/repository/SystemRepository.java @@ -209,13 +209,20 @@ public class SystemRepository { // make sure to not exclude present and future values (latest approved and pending) // // condition(s) - // exclude content (with latest) before latest - considered history + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) + // <--> // select * from structure s // where ( - // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id < (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true)) + // and not (exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.id > (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (select s2.id from structure s2 where s2."uuid" = s."uuid" and s2.latest=true) and s.status in ('CANCELLED', 'REJECTED')) // ) // <--> - // not (exists (subquery id) and s.id < (subquery id)) + // not (exists (subquery id) and s.id < (subquery id)) + // and not (exists (subquery id) and s.id > (subquery id) and s.status in ('CANCELLED', 'REJECTED')) + // NOT and not (not exists (subquery id) and s.status in ('CANCELLED', 'REJECTED')) // // note // persistence libraries may optimize query @@ -229,9 +236,22 @@ public class SystemRepository { sub.select(fromSub.get(Persistable.FIELD_ID)); Predicate predicateExclude = - cb.and(cb.not(cb.and( - cb.exists(sub), - cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub)))); + cb.and( + cb.not(cb.and( + cb.exists(sub), + cb.lessThan(from.get(Persistable.FIELD_ID).as(Long.class), sub))), + cb.not(cb.and( + cb.exists(sub), + cb.greaterThan(from.get(Persistable.FIELD_ID).as(Long.class), sub), + cb.or( + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + // cb.not(cb.and( + // cb.not(cb.exists(sub)), + // cb.or( + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.CANCELLED), + // cb.equal(from.get(NameStructure.FIELD_STATUS), Status.REJECTED)))) + ); predicates.add(predicateExclude); } diff --git a/src/main/resources/static/images/naming_backend_lifecycle.png b/src/main/resources/static/images/naming_backend_lifecycle.png index 826ee3bcf2ff033a8ae0c5c1a31ac74513a598d6..3e490aaa37e3cbea6c98d6e51e46f4fef9ea64ac 100644 Binary files a/src/main/resources/static/images/naming_backend_lifecycle.png and b/src/main/resources/static/images/naming_backend_lifecycle.png differ diff --git a/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java b/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java index 8e64b62c53e42fdcd953a96994f2cba092f38ad1..95ced9837f56ba4f8fc581bd75bcce459fe61f17 100644 --- a/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java @@ -1376,16 +1376,10 @@ class StructuresDeviceGroupIT { // in particular different statuses for last entry in lines of uuid // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // - // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElement createdStructureElement = null; @@ -1427,11 +1421,6 @@ class StructuresDeviceGroupIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/DEVICEGROUP/" + uuid.toString()); ITUtilStructures.assertFind("/DEVICEGROUP/" + uuid2.toString()); ITUtilStructures.assertFind("/DEVICEGROUP/" + uuid3.toString()); @@ -1480,16 +1469,10 @@ class StructuresDeviceGroupIT { // in particular different statuses for last entry in lines of uuid // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // - // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElementCommandUpdate structureElementCommandUpdate = null; @@ -1604,11 +1587,6 @@ class StructuresDeviceGroupIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/DEVICEGROUP/" + uuid.toString()); ITUtilStructures.assertFind("/DEVICEGROUP/" + uuid2.toString()); ITUtilStructures.assertFind("/DEVICEGROUP/" + uuid3.toString()); @@ -1654,6 +1632,11 @@ class StructuresDeviceGroupIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved // multiple commands at same time may have effects on order by (when) + // + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate[] structureElementCommandsCreate = null; StructureElementCommandUpdate[] structureElementCommandsUpdate = null; @@ -1817,11 +1800,11 @@ class StructuresDeviceGroupIT { // content for field in first and last items - always possible // first and last items - not always possible - ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2", 45); + ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2", 35); ITUtilStructures.assertRead("/DEVICEGROUP?statuses=PENDING&mnemonicPath=Di2", 10); ITUtilStructures.assertRead("/DEVICEGROUP?statuses=APPROVED&mnemonicPath=Di2", 25); ITUtilStructures.assertRead("/DEVICEGROUP?statuses=CANCELLED&mnemonicPath=Di2", 0); - ITUtilStructures.assertRead("/DEVICEGROUP?statuses=REJECTED&mnemonicPath=Di2", 10); + ITUtilStructures.assertRead("/DEVICEGROUP?statuses=REJECTED&mnemonicPath=Di2", 0); ITUtilStructures.assertRead("/DEVICEGROUP?statuses=PENDING&statuses=APPROVED&mnemonicPath=Di2", 35); ITUtilStructures.assertRead("/DEVICEGROUP?deleted=false&mnemonicPath=Di2", 20); @@ -1831,11 +1814,11 @@ class StructuresDeviceGroupIT { ITUtilStructures.assertRead("/DEVICEGROUP?deleted=false&statuses=REJECTED&mnemonicPath=Di2", 0); ITUtilStructures.assertRead("/DEVICEGROUP?deleted=false&statuses=PENDING&statuses=APPROVED&mnemonicPath=Di2", 20); - ITUtilStructures.assertRead("/DEVICEGROUP?deleted=true&mnemonicPath=Di2", 25); + ITUtilStructures.assertRead("/DEVICEGROUP?deleted=true&mnemonicPath=Di2", 15); ITUtilStructures.assertRead("/DEVICEGROUP?deleted=true&statuses=PENDING&mnemonicPath=Di2", 10); ITUtilStructures.assertRead("/DEVICEGROUP?deleted=true&statuses=APPROVED&mnemonicPath=Di2", 5); ITUtilStructures.assertRead("/DEVICEGROUP?deleted=true&statuses=CANCELLED&mnemonicPath=Di2", 0); - ITUtilStructures.assertRead("/DEVICEGROUP?deleted=true&statuses=REJECTED&mnemonicPath=Di2", 10); + ITUtilStructures.assertRead("/DEVICEGROUP?deleted=true&statuses=REJECTED&mnemonicPath=Di2", 0); ITUtilStructures.assertRead("/DEVICEGROUP?deleted=true&statuses=PENDING&statuses=APPROVED&mnemonicPath=Di2", 15); ITUtilStructures.assertRead("/DEVICEGROUP?parent=" + discipline2Uuid.toString(), 45, -1); @@ -1925,14 +1908,14 @@ class StructuresDeviceGroupIT { || value2 != null && (StringUtils.equals(value2, value0) || StringUtils.equals(value2, value1))); // pagination - ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=0&pageSize=100", 45); + ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=0&pageSize=100", 35); ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=1&pageSize=100", 0); - ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=0&pageSize=45", 45); - ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=1&pageSize=45", 0); - ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=0&pageSize=20", 20); - ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=1&pageSize=20", 20); - ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=2&pageSize=20", 5); - ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=3&pageSize=20", 0); + ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=0&pageSize=35", 35); + ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=1&pageSize=35", 0); + ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=0&pageSize=15", 15); + ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=1&pageSize=15", 15); + ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=2&pageSize=15", 5); + ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&page=3&pageSize=15", 0); // pagination ITUtilStructures.assertRead("/DEVICEGROUP?statuses=PENDING&statuses=APPROVED&mnemonicPath=Di2&page=0&pageSize=15", 15); @@ -1941,11 +1924,11 @@ class StructuresDeviceGroupIT { ITUtilStructures.assertRead("/DEVICEGROUP?statuses=PENDING&statuses=APPROVED&mnemonicPath=Di2&page=3&pageSize=15", 0); // order by, pagination - response = ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&orderBy=WHEN&isAsc=true&page=0&pageSize=20", 20); - response2 = ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&orderBy=WHEN&isAsc=false&page=2&pageSize=20", 5); + response = ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&orderBy=WHEN&isAsc=true&page=0&pageSize=15", 15); + response2 = ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&orderBy=WHEN&isAsc=false&page=2&pageSize=15", 5); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); - response = ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&orderBy=WHEN&isAsc=false&page=0&pageSize=20", 20); - response2 = ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&orderBy=WHEN&isAsc=true&page=2&pageSize=20", 5); + response = ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&orderBy=WHEN&isAsc=false&page=0&pageSize=15", 15); + response2 = ITUtilStructures.assertRead("/DEVICEGROUP?mnemonicPath=Di2&orderBy=WHEN&isAsc=true&page=2&pageSize=15", 5); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); // type and uuid @@ -1989,7 +1972,7 @@ class StructuresDeviceGroupIT { ITUtilStructures.assertRead("/mnemonicPath/D%", 17, -1); ITUtilStructures.assertRead("/mnemonicPath/D__", 16, -1); ITUtilStructures.assertRead("/mnemonicPath/Di_", 16, -1); - ITUtilStructures.assertRead("/mnemonicPath/Di2", 46); + ITUtilStructures.assertRead("/mnemonicPath/Di2", 36); ITUtilStructures.assertRead("/mnemonicPath/D?statuses=APPROVED&deleted=false", 0); ITUtilStructures.assertRead("/mnemonicPath/D%?statuses=APPROVED&deleted=false", 22, -1); ITUtilStructures.assertRead("/mnemonicPath/D__?statuses=APPROVED&deleted=false", 21, -1); diff --git a/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java b/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java index 316d188c859b342613940e1b4de6c06f233bb410..4dcf86326cdf8952afd31321508eea04fb2dc505 100644 --- a/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java @@ -1378,16 +1378,10 @@ class StructuresDeviceTypeIT { // in particular different statuses for last entry in lines of uuid // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // - // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElement createdStructureElement = null; @@ -1429,11 +1423,6 @@ class StructuresDeviceTypeIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/DEVICETYPE/" + uuid.toString()); ITUtilStructures.assertFind("/DEVICETYPE/" + uuid2.toString()); ITUtilStructures.assertFind("/DEVICETYPE/" + uuid3.toString()); @@ -1485,16 +1474,10 @@ class StructuresDeviceTypeIT { // in particular different statuses for last entry in lines of uuid // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // - // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElementCommandUpdate structureElementCommandUpdate = null; @@ -1609,19 +1592,14 @@ class StructuresDeviceTypeIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/DEVICETYPE/" + uuid.toString()); ITUtilStructures.assertFind("/DEVICETYPE/" + uuid2.toString()); ITUtilStructures.assertFind("/DEVICETYPE/" + uuid3.toString()); ITUtilStructures.assertFind("/DEVICETYPE/" + uuid4.toString()); ITUtilStructures.assertRead("/mnemonic/P9", 2); - ITUtilStructures.assertRead("/mnemonic/C9", 2); - ITUtilStructures.assertRead("/mnemonic/R9", 2); + ITUtilStructures.assertRead("/mnemonic/C9", 1); + ITUtilStructures.assertRead("/mnemonic/R9", 1); ITUtilStructures.assertRead("/mnemonic/A9", 1); ITUtilStructures.assertRead("/mnemonic/P9?statuses=APPROVED&deleted=false", 1); ITUtilStructures.assertRead("/mnemonic/C9?statuses=APPROVED&deleted=false", 1); @@ -1662,6 +1640,11 @@ class StructuresDeviceTypeIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved // multiple commands at same time may have effects on order by (when) + // + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate[] structureElementCommandsCreate = null; StructureElementCommandUpdate[] structureElementCommandsUpdate = null; @@ -1825,11 +1808,11 @@ class StructuresDeviceTypeIT { // content for field in first and last items - always possible // first and last items - not always possible - ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__", 60); + ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__", 50); ITUtilStructures.assertRead("/DEVICETYPE?statuses=PENDING&mnemonic=A__", 15); ITUtilStructures.assertRead("/DEVICETYPE?statuses=APPROVED&mnemonic=A__", 25); ITUtilStructures.assertRead("/DEVICETYPE?statuses=CANCELLED&mnemonic=A__", 5); - ITUtilStructures.assertRead("/DEVICETYPE?statuses=REJECTED&mnemonic=A__", 15); + ITUtilStructures.assertRead("/DEVICETYPE?statuses=REJECTED&mnemonic=A__", 5); ITUtilStructures.assertRead("/DEVICETYPE?statuses=PENDING&statuses=APPROVED&mnemonic=A__", 40); ITUtilStructures.assertRead("/DEVICETYPE?deleted=false&mnemonic=A__", 35); @@ -1839,11 +1822,11 @@ class StructuresDeviceTypeIT { ITUtilStructures.assertRead("/DEVICETYPE?deleted=false&statuses=REJECTED&mnemonic=A__", 5); ITUtilStructures.assertRead("/DEVICETYPE?deleted=false&statuses=PENDING&statuses=APPROVED&mnemonic=A__", 25); - ITUtilStructures.assertRead("/DEVICETYPE?deleted=true&mnemonic=A__", 25); + ITUtilStructures.assertRead("/DEVICETYPE?deleted=true&mnemonic=A__", 15); ITUtilStructures.assertRead("/DEVICETYPE?deleted=true&statuses=PENDING&mnemonic=A__", 10); ITUtilStructures.assertRead("/DEVICETYPE?deleted=true&statuses=APPROVED&mnemonic=A__", 5); ITUtilStructures.assertRead("/DEVICETYPE?deleted=true&statuses=CANCELLED&mnemonic=A__", 0); - ITUtilStructures.assertRead("/DEVICETYPE?deleted=true&statuses=REJECTED&mnemonic=A__", 10); + ITUtilStructures.assertRead("/DEVICETYPE?deleted=true&statuses=REJECTED&mnemonic=A__", 0); ITUtilStructures.assertRead("/DEVICETYPE?deleted=true&statuses=PENDING&statuses=APPROVED&mnemonic=A__", 15); ITUtilStructures.assertRead("/DEVICETYPE?parent=" + disciplineUuid.toString(), 0); @@ -1934,14 +1917,14 @@ class StructuresDeviceTypeIT { || value2 != null && (StringUtils.equals(value2, value0) || StringUtils.equals(value2, value1))); // pagination - ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=0&pageSize=100", 60); + ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=0&pageSize=100", 50); ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=1&pageSize=100", 0); - ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=0&pageSize=60", 60); - ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=1&pageSize=60", 0); - ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=0&pageSize=25", 25); - ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=1&pageSize=25", 25); - ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=2&pageSize=25", 10); - ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=3&pageSize=25", 0); + ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=0&pageSize=50", 50); + ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=1&pageSize=50", 0); + ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=0&pageSize=20", 20); + ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=1&pageSize=20", 20); + ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=2&pageSize=20", 10); + ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&page=3&pageSize=20", 0); // pagination ITUtilStructures.assertRead("/DEVICETYPE?statuses=PENDING&statuses=APPROVED&mnemonic=A__&page=0&pageSize=15", 15); @@ -1950,11 +1933,11 @@ class StructuresDeviceTypeIT { ITUtilStructures.assertRead("/DEVICETYPE?statuses=PENDING&statuses=APPROVED&mnemonic=A__&page=3&pageSize=15", 0); // order by, pagination - response = ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&orderBy=WHEN&isAsc=true&page=0&pageSize=25", 25); - response2 = ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&orderBy=WHEN&isAsc=false&page=2&pageSize=25", 10); + response = ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&orderBy=WHEN&isAsc=true&page=0&pageSize=20", 20); + response2 = ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&orderBy=WHEN&isAsc=false&page=2&pageSize=20", 10); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); - response = ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&orderBy=WHEN&isAsc=false&page=0&pageSize=25", 25); - response2 = ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&orderBy=WHEN&isAsc=true&page=2&pageSize=25", 10); + response = ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&orderBy=WHEN&isAsc=false&page=0&pageSize=20", 20); + response2 = ITUtilStructures.assertRead("/DEVICETYPE?mnemonic=A__&orderBy=WHEN&isAsc=true&page=2&pageSize=20", 10); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); // type and uuid diff --git a/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java b/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java index 1cf6033942740c451fbd067957ba21eea9ff7b04..32d9f350033d3a75e7621ef81a63dda2c8b9cebf 100644 --- a/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java @@ -1259,16 +1259,10 @@ class StructuresDisciplineIT { // in particular different statuses for last entry in lines of uuid // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // - // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElement createdStructureElement = null; @@ -1310,11 +1304,6 @@ class StructuresDisciplineIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/DISCIPLINE/" + uuid.toString()); ITUtilStructures.assertFind("/DISCIPLINE/" + uuid2.toString()); ITUtilStructures.assertFind("/DISCIPLINE/" + uuid3.toString()); @@ -1362,16 +1351,10 @@ class StructuresDisciplineIT { // in particular different statuses for last entry in lines of uuid // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // - // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElementCommandUpdate structureElementCommandUpdate = null; @@ -1486,19 +1469,14 @@ class StructuresDisciplineIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/DISCIPLINE/" + uuid.toString()); ITUtilStructures.assertFind("/DISCIPLINE/" + uuid2.toString()); ITUtilStructures.assertFind("/DISCIPLINE/" + uuid3.toString()); ITUtilStructures.assertFind("/DISCIPLINE/" + uuid4.toString()); ITUtilStructures.assertRead("/mnemonic/P9", 2); - ITUtilStructures.assertRead("/mnemonic/C9", 2); - ITUtilStructures.assertRead("/mnemonic/R9", 2); + ITUtilStructures.assertRead("/mnemonic/C9", 1); + ITUtilStructures.assertRead("/mnemonic/R9", 1); ITUtilStructures.assertRead("/mnemonic/A9", 1); ITUtilStructures.assertRead("/mnemonic/P9?statuses=APPROVED&deleted=false", 1); ITUtilStructures.assertRead("/mnemonic/C9?statuses=APPROVED&deleted=false", 1); @@ -1535,6 +1513,11 @@ class StructuresDisciplineIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved // multiple commands at same time may have effects on order by (when) + // + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate[] structureElementCommandsCreate = null; StructureElementCommandUpdate[] structureElementCommandsUpdate = null; @@ -1699,11 +1682,11 @@ class StructuresDisciplineIT { // content for field in first and last items - always possible // first and last items - not always possible - ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__", 60); + ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__", 50); ITUtilStructures.assertRead("/DISCIPLINE?statuses=PENDING&mnemonic=A__", 15); ITUtilStructures.assertRead("/DISCIPLINE?statuses=APPROVED&mnemonic=A__", 25); ITUtilStructures.assertRead("/DISCIPLINE?statuses=CANCELLED&mnemonic=A__", 5); - ITUtilStructures.assertRead("/DISCIPLINE?statuses=REJECTED&mnemonic=A__", 15); + ITUtilStructures.assertRead("/DISCIPLINE?statuses=REJECTED&mnemonic=A__", 5); ITUtilStructures.assertRead("/DISCIPLINE?statuses=PENDING&statuses=APPROVED&mnemonic=A__", 40); ITUtilStructures.assertRead("/DISCIPLINE?deleted=false&mnemonic=A__", 35); @@ -1713,11 +1696,11 @@ class StructuresDisciplineIT { ITUtilStructures.assertRead("/DISCIPLINE?deleted=false&statuses=REJECTED&mnemonic=A__", 5); ITUtilStructures.assertRead("/DISCIPLINE?deleted=false&statuses=PENDING&statuses=APPROVED&mnemonic=A__", 25); - ITUtilStructures.assertRead("/DISCIPLINE?deleted=true&mnemonic=A__", 25); + ITUtilStructures.assertRead("/DISCIPLINE?deleted=true&mnemonic=A__", 15); ITUtilStructures.assertRead("/DISCIPLINE?deleted=true&statuses=PENDING&mnemonic=A__", 10); ITUtilStructures.assertRead("/DISCIPLINE?deleted=true&statuses=APPROVED&mnemonic=A__", 5); ITUtilStructures.assertRead("/DISCIPLINE?deleted=true&statuses=CANCELLED&mnemonic=A__", 0); - ITUtilStructures.assertRead("/DISCIPLINE?deleted=true&statuses=REJECTED&mnemonic=A__", 10); + ITUtilStructures.assertRead("/DISCIPLINE?deleted=true&statuses=REJECTED&mnemonic=A__", 0); ITUtilStructures.assertRead("/DISCIPLINE?deleted=true&statuses=PENDING&statuses=APPROVED&mnemonic=A__", 15); ITUtilStructures.assertRead("/DISCIPLINE?parent=" + uuid.toString(), 0); @@ -1806,14 +1789,14 @@ class StructuresDisciplineIT { || value2 != null && (StringUtils.equals(value2, value0) || StringUtils.equals(value2, value1))); // pagination - ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=0&pageSize=100", 60); + ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=0&pageSize=100", 50); ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=1&pageSize=100", 0); - ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=0&pageSize=60", 60); - ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=1&pageSize=60", 0); - ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=0&pageSize=25", 25); - ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=1&pageSize=25", 25); - ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=2&pageSize=25", 10); - ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=3&pageSize=25", 0); + ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=0&pageSize=50", 50); + ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=1&pageSize=50", 0); + ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=0&pageSize=20", 20); + ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=1&pageSize=20", 20); + ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=2&pageSize=20", 10); + ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&page=3&pageSize=20", 0); // pagination ITUtilStructures.assertRead("/DISCIPLINE?statuses=PENDING&statuses=APPROVED&mnemonic=A__&page=0&pageSize=15", 15); @@ -1822,11 +1805,11 @@ class StructuresDisciplineIT { ITUtilStructures.assertRead("/DISCIPLINE?statuses=PENDING&statuses=APPROVED&mnemonic=A__&page=3&pageSize=15", 0); // order by, pagination - response = ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&orderBy=WHEN&isAsc=true&page=0&pageSize=25", 25); - response2 = ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&orderBy=WHEN&isAsc=false&page=2&pageSize=25", 10); + response = ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&orderBy=WHEN&isAsc=true&page=0&pageSize=20", 20); + response2 = ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&orderBy=WHEN&isAsc=false&page=2&pageSize=20", 10); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); - response = ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&orderBy=WHEN&isAsc=false&page=0&pageSize=25", 25); - response2 = ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&orderBy=WHEN&isAsc=true&page=2&pageSize=25", 10); + response = ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&orderBy=WHEN&isAsc=false&page=0&pageSize=20", 20); + response2 = ITUtilStructures.assertRead("/DISCIPLINE?mnemonic=A__&orderBy=WHEN&isAsc=true&page=2&pageSize=20", 10); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); // type and uuid diff --git a/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java b/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java index 54cea670e118e798222fd9b1bd898f8655a3c201..0c8ee707135824cb1c2b1895aa1562df6ff96dea 100644 --- a/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java @@ -1454,16 +1454,10 @@ class StructuresSubsystemIT { // in particular different statuses for last entry in lines of uuid // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // - // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElement createdStructureElement = null; @@ -1505,11 +1499,6 @@ class StructuresSubsystemIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/SUBSYSTEM/" + uuid.toString()); ITUtilStructures.assertFind("/SUBSYSTEM/" + uuid2.toString()); ITUtilStructures.assertFind("/SUBSYSTEM/" + uuid3.toString()); @@ -1565,16 +1554,10 @@ class StructuresSubsystemIT { // in particular different statuses for last entry in lines of uuid // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // - // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElementCommandUpdate structureElementCommandUpdate = null; @@ -1689,19 +1672,14 @@ class StructuresSubsystemIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/SUBSYSTEM/" + uuid.toString()); ITUtilStructures.assertFind("/SUBSYSTEM/" + uuid2.toString()); ITUtilStructures.assertFind("/SUBSYSTEM/" + uuid3.toString()); ITUtilStructures.assertFind("/SUBSYSTEM/" + uuid4.toString()); ITUtilStructures.assertRead("/mnemonic/P9", 2); - ITUtilStructures.assertRead("/mnemonic/C9", 2); - ITUtilStructures.assertRead("/mnemonic/R9", 2); + ITUtilStructures.assertRead("/mnemonic/C9", 1); + ITUtilStructures.assertRead("/mnemonic/R9", 1); ITUtilStructures.assertRead("/mnemonic/A9", 1); ITUtilStructures.assertRead("/mnemonic/P9?statuses=APPROVED&deleted=false", 1); ITUtilStructures.assertRead("/mnemonic/C9?statuses=APPROVED&deleted=false", 1); @@ -1746,6 +1724,11 @@ class StructuresSubsystemIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved // multiple commands at same time may have effects on order by (when) + // + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate[] structureElementCommandsCreate = null; StructureElementCommandUpdate[] structureElementCommandsUpdate = null; @@ -1909,11 +1892,11 @@ class StructuresSubsystemIT { // content for field in first and last items - always possible // first and last items - not always possible - ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__", 60); + ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__", 50); ITUtilStructures.assertRead("/SUBSYSTEM?statuses=PENDING&mnemonic=A__", 15); ITUtilStructures.assertRead("/SUBSYSTEM?statuses=APPROVED&mnemonic=A__", 25); ITUtilStructures.assertRead("/SUBSYSTEM?statuses=CANCELLED&mnemonic=A__", 5); - ITUtilStructures.assertRead("/SUBSYSTEM?statuses=REJECTED&mnemonic=A__", 15); + ITUtilStructures.assertRead("/SUBSYSTEM?statuses=REJECTED&mnemonic=A__", 5); ITUtilStructures.assertRead("/SUBSYSTEM?statuses=PENDING&statuses=APPROVED&mnemonic=A__", 40); ITUtilStructures.assertRead("/SUBSYSTEM?deleted=false&mnemonic=A__", 35); @@ -1923,11 +1906,11 @@ class StructuresSubsystemIT { ITUtilStructures.assertRead("/SUBSYSTEM?deleted=false&statuses=REJECTED&mnemonic=A__", 5); ITUtilStructures.assertRead("/SUBSYSTEM?deleted=false&statuses=PENDING&statuses=APPROVED&mnemonic=A__", 25); - ITUtilStructures.assertRead("/SUBSYSTEM?deleted=true&mnemonic=A__", 25); + ITUtilStructures.assertRead("/SUBSYSTEM?deleted=true&mnemonic=A__", 15); ITUtilStructures.assertRead("/SUBSYSTEM?deleted=true&statuses=PENDING&mnemonic=A__", 10); ITUtilStructures.assertRead("/SUBSYSTEM?deleted=true&statuses=APPROVED&mnemonic=A__", 5); ITUtilStructures.assertRead("/SUBSYSTEM?deleted=true&statuses=CANCELLED&mnemonic=A__", 0); - ITUtilStructures.assertRead("/SUBSYSTEM?deleted=true&statuses=REJECTED&mnemonic=A__", 10); + ITUtilStructures.assertRead("/SUBSYSTEM?deleted=true&statuses=REJECTED&mnemonic=A__", 0); ITUtilStructures.assertRead("/SUBSYSTEM?deleted=true&statuses=PENDING&statuses=APPROVED&mnemonic=A__", 15); ITUtilStructures.assertRead("/SUBSYSTEM?parent=" + systemGroupUuid.toString(), 0); @@ -2018,14 +2001,14 @@ class StructuresSubsystemIT { || value2 != null && (StringUtils.equals(value2, value0) || StringUtils.equals(value2, value1))); // pagination - ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=0&pageSize=100", 60); + ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=0&pageSize=100", 50); ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=1&pageSize=100", 0); - ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=0&pageSize=60", 60); - ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=1&pageSize=60", 0); - ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=0&pageSize=25", 25); - ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=1&pageSize=25", 25); - ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=2&pageSize=25", 10); - ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=3&pageSize=25", 0); + ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=0&pageSize=50", 50); + ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=1&pageSize=50", 0); + ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=0&pageSize=20", 20); + ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=1&pageSize=20", 20); + ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=2&pageSize=20", 10); + ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&page=3&pageSize=20", 0); // pagination ITUtilStructures.assertRead("/SUBSYSTEM?statuses=PENDING&statuses=APPROVED&mnemonic=A__&page=0&pageSize=15", 15); @@ -2034,11 +2017,11 @@ class StructuresSubsystemIT { ITUtilStructures.assertRead("/SUBSYSTEM?statuses=PENDING&statuses=APPROVED&mnemonic=A__&page=3&pageSize=15", 0); // order by, pagination - response = ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=true&page=0&pageSize=25", 25); - response2 = ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=false&page=2&pageSize=25", 10); + response = ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=true&page=0&pageSize=20", 20); + response2 = ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=false&page=2&pageSize=20", 10); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); - response = ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=false&page=0&pageSize=25", 25); - response2 = ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=true&page=2&pageSize=25", 10); + response = ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=false&page=0&pageSize=20", 20); + response2 = ITUtilStructures.assertRead("/SUBSYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=true&page=2&pageSize=20", 10); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); // type and uuid diff --git a/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java b/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java index e612c07ac5a47b9e868f5b22b225be7c083bb825..d9f7a96d011072c5bc295118d7f84e07239d0cb5 100644 --- a/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java @@ -1322,15 +1322,9 @@ class StructuresSystemGroupIT { // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElement createdStructureElement = null; @@ -1372,11 +1366,6 @@ class StructuresSystemGroupIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/SYSTEMGROUP/" + uuid.toString()); ITUtilStructures.assertFind("/SYSTEMGROUP/" + uuid2.toString()); ITUtilStructures.assertFind("/SYSTEMGROUP/" + uuid3.toString()); @@ -1425,15 +1414,9 @@ class StructuresSystemGroupIT { // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElementCommandUpdate structureElementCommandUpdate = null; @@ -1548,19 +1531,14 @@ class StructuresSystemGroupIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/SYSTEMGROUP/" + uuid.toString()); ITUtilStructures.assertFind("/SYSTEMGROUP/" + uuid2.toString()); ITUtilStructures.assertFind("/SYSTEMGROUP/" + uuid3.toString()); ITUtilStructures.assertFind("/SYSTEMGROUP/" + uuid4.toString()); ITUtilStructures.assertRead("/mnemonic/P9", 2); - ITUtilStructures.assertRead("/mnemonic/C9", 2); - ITUtilStructures.assertRead("/mnemonic/R9", 2); + ITUtilStructures.assertRead("/mnemonic/C9", 1); + ITUtilStructures.assertRead("/mnemonic/R9", 1); ITUtilStructures.assertRead("/mnemonic/A9", 1); ITUtilStructures.assertRead("/mnemonic/P9?statuses=APPROVED&deleted=false", 1); ITUtilStructures.assertRead("/mnemonic/C9?statuses=APPROVED&deleted=false", 1); @@ -1597,6 +1575,11 @@ class StructuresSystemGroupIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved // multiple commands at same time may have effects on order by (when) + // + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate[] structureElementCommandsCreate = null; StructureElementCommandUpdate[] structureElementCommandsUpdate = null; @@ -1761,11 +1744,11 @@ class StructuresSystemGroupIT { // content for field in first and last items - always possible // first and last items - not always possible - ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__", 60); + ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__", 50); ITUtilStructures.assertRead("/SYSTEMGROUP?statuses=PENDING&mnemonic=A__", 15); ITUtilStructures.assertRead("/SYSTEMGROUP?statuses=APPROVED&mnemonic=A__", 25); ITUtilStructures.assertRead("/SYSTEMGROUP?statuses=CANCELLED&mnemonic=A__", 5); - ITUtilStructures.assertRead("/SYSTEMGROUP?statuses=REJECTED&mnemonic=A__", 15); + ITUtilStructures.assertRead("/SYSTEMGROUP?statuses=REJECTED&mnemonic=A__", 5); ITUtilStructures.assertRead("/SYSTEMGROUP?statuses=PENDING&statuses=APPROVED&mnemonic=A__", 40); ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=false&mnemonic=A__", 35); @@ -1775,11 +1758,11 @@ class StructuresSystemGroupIT { ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=false&statuses=REJECTED&mnemonic=A__", 5); ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=false&statuses=PENDING&statuses=APPROVED&mnemonic=A__", 25); - ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=true&mnemonic=A__", 25); + ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=true&mnemonic=A__", 15); ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=true&statuses=PENDING&mnemonic=A__", 10); ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=true&statuses=APPROVED&mnemonic=A__", 5); ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=true&statuses=CANCELLED&mnemonic=A__", 0); - ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=true&statuses=REJECTED&mnemonic=A__", 10); + ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=true&statuses=REJECTED&mnemonic=A__", 0); ITUtilStructures.assertRead("/SYSTEMGROUP?deleted=true&statuses=PENDING&statuses=APPROVED&mnemonic=A__", 15); ITUtilStructures.assertRead("/SYSTEMGROUP?parent=" + uuid.toString(), 0); @@ -1869,14 +1852,14 @@ class StructuresSystemGroupIT { || value2 != null && (StringUtils.equals(value2, value0) || StringUtils.equals(value2, value1))); // pagination - ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=0&pageSize=100", 60); + ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=0&pageSize=100", 50); ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=1&pageSize=100", 0); - ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=0&pageSize=60", 60); - ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=1&pageSize=60", 0); - ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=0&pageSize=25", 25); - ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=1&pageSize=25", 25); - ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=2&pageSize=25", 10); - ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=3&pageSize=25", 0); + ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=0&pageSize=50", 50); + ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=1&pageSize=50", 0); + ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=0&pageSize=20", 20); + ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=1&pageSize=20", 20); + ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=2&pageSize=20", 10); + ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&page=3&pageSize=20", 0); // pagination ITUtilStructures.assertRead("/SYSTEMGROUP?statuses=PENDING&statuses=APPROVED&mnemonic=A__&page=0&pageSize=15", 15); @@ -1885,11 +1868,11 @@ class StructuresSystemGroupIT { ITUtilStructures.assertRead("/SYSTEMGROUP?statuses=PENDING&statuses=APPROVED&mnemonic=A__&page=3&pageSize=15", 0); // order by, pagination - response = ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&orderBy=WHEN&isAsc=true&page=0&pageSize=25", 25); - response2 = ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&orderBy=WHEN&isAsc=false&page=2&pageSize=25", 10); + response = ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&orderBy=WHEN&isAsc=true&page=0&pageSize=20", 20); + response2 = ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&orderBy=WHEN&isAsc=false&page=2&pageSize=20", 10); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); - response = ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&orderBy=WHEN&isAsc=false&page=0&pageSize=25", 25); - response2 = ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&orderBy=WHEN&isAsc=true&page=2&pageSize=25", 10); + response = ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&orderBy=WHEN&isAsc=false&page=0&pageSize=20", 20); + response2 = ITUtilStructures.assertRead("/SYSTEMGROUP?mnemonic=A__&orderBy=WHEN&isAsc=true&page=2&pageSize=20", 10); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); // type and uuid diff --git a/src/test/java/org/openepics/names/docker/StructuresSystemIT.java b/src/test/java/org/openepics/names/docker/StructuresSystemIT.java index 356da03306fc6e31691f96bed5abc34bb818cb97..3f5bd00c6b93aa4e285e7073c8ab9f628395437e 100644 --- a/src/test/java/org/openepics/names/docker/StructuresSystemIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresSystemIT.java @@ -1359,16 +1359,10 @@ class StructuresSystemIT { // in particular different statuses for last entry in lines of uuid // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // - // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElement createdStructureElement = null; @@ -1410,11 +1404,6 @@ class StructuresSystemIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/SYSTEM/" + uuid.toString()); ITUtilStructures.assertFind("/SYSTEM/" + uuid2.toString()); ITUtilStructures.assertFind("/SYSTEM/" + uuid3.toString()); @@ -1466,16 +1455,10 @@ class StructuresSystemIT { // in particular different statuses for last entry in lines of uuid // mnemonic - P, C, R, A (pending, cancelled, rejected, approved) // - // note! - // not only - // exclude APPROVED and not latest - // not only - // exclude earlier than APPROVED and latest (considered history) - // include PENDING and not latest (considered future) - // instead - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate structureElementCommandCreate = null; StructureElementCommandUpdate structureElementCommandUpdate = null; @@ -1590,19 +1573,14 @@ class StructuresSystemIT { // from first structure element assertNotNull(uuid); - // note - // exclude earlier than APPROVED and latest (considered history) - // ( include if latest ) - // include if latest not exists (considered present + future) - ITUtilStructures.assertFind("/SYSTEM/" + uuid.toString()); ITUtilStructures.assertFind("/SYSTEM/" + uuid2.toString()); ITUtilStructures.assertFind("/SYSTEM/" + uuid3.toString()); ITUtilStructures.assertFind("/SYSTEM/" + uuid4.toString()); ITUtilStructures.assertRead("/mnemonic/P9", 2); - ITUtilStructures.assertRead("/mnemonic/C9", 2); - ITUtilStructures.assertRead("/mnemonic/R9", 2); + ITUtilStructures.assertRead("/mnemonic/C9", 1); + ITUtilStructures.assertRead("/mnemonic/R9", 1); ITUtilStructures.assertRead("/mnemonic/A9", 1); ITUtilStructures.assertRead("/mnemonic/P9?statuses=APPROVED&deleted=false", 1); ITUtilStructures.assertRead("/mnemonic/C9?statuses=APPROVED&deleted=false", 1); @@ -1643,6 +1621,11 @@ class StructuresSystemIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved // multiple commands at same time may have effects on order by (when) + // + // note + // exclude content (with latest) before latest + // exclude content (with latest) after latest (cancelled, rejected) + // keep content (without latest) (to have line of uuid) StructureElementCommandCreate[] structureElementCommandsCreate = null; StructureElementCommandUpdate[] structureElementCommandsUpdate = null; @@ -1806,11 +1789,11 @@ class StructuresSystemIT { // content for field in first and last items - always possible // first and last items - not always possible - ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__", 60); + ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__", 50); ITUtilStructures.assertRead("/SYSTEM?statuses=PENDING&mnemonic=A__", 15); ITUtilStructures.assertRead("/SYSTEM?statuses=APPROVED&mnemonic=A__", 25); ITUtilStructures.assertRead("/SYSTEM?statuses=CANCELLED&mnemonic=A__", 5); - ITUtilStructures.assertRead("/SYSTEM?statuses=REJECTED&mnemonic=A__", 15); + ITUtilStructures.assertRead("/SYSTEM?statuses=REJECTED&mnemonic=A__", 5); ITUtilStructures.assertRead("/SYSTEM?statuses=PENDING&statuses=APPROVED&mnemonic=A__", 40); ITUtilStructures.assertRead("/SYSTEM?deleted=false&mnemonic=A__", 35); @@ -1820,11 +1803,11 @@ class StructuresSystemIT { ITUtilStructures.assertRead("/SYSTEM?deleted=false&statuses=REJECTED&mnemonic=A__", 5); ITUtilStructures.assertRead("/SYSTEM?deleted=false&statuses=PENDING&statuses=APPROVED&mnemonic=A__", 25); - ITUtilStructures.assertRead("/SYSTEM?deleted=true&mnemonic=A__", 25); + ITUtilStructures.assertRead("/SYSTEM?deleted=true&mnemonic=A__", 15); ITUtilStructures.assertRead("/SYSTEM?deleted=true&statuses=PENDING&mnemonic=A__", 10); ITUtilStructures.assertRead("/SYSTEM?deleted=true&statuses=APPROVED&mnemonic=A__", 5); ITUtilStructures.assertRead("/SYSTEM?deleted=true&statuses=CANCELLED&mnemonic=A__", 0); - ITUtilStructures.assertRead("/SYSTEM?deleted=true&statuses=REJECTED&mnemonic=A__", 10); + ITUtilStructures.assertRead("/SYSTEM?deleted=true&statuses=REJECTED&mnemonic=A__", 0); ITUtilStructures.assertRead("/SYSTEM?deleted=true&statuses=PENDING&statuses=APPROVED&mnemonic=A__", 15); ITUtilStructures.assertRead("/SYSTEM?parent=" + systemGroupUuid.toString(), 45, -1); @@ -1838,7 +1821,7 @@ class StructuresSystemIT { ITUtilStructures.assertRead("/SYSTEM?name=na%", 45, -1); ITUtilStructures.assertRead("/SYSTEM?name=name", 45, -1); - ITUtilStructures.assertRead("/SYSTEM?mnemonicPath=A__", 45); + ITUtilStructures.assertRead("/SYSTEM?mnemonicPath=A__", 35); ITUtilStructures.assertRead("/SYSTEM?description=desc", 0); ITUtilStructures.assertRead("/SYSTEM?description=desc%", 35, -1); @@ -1914,14 +1897,14 @@ class StructuresSystemIT { || value2 != null && (StringUtils.equals(value2, value0) || StringUtils.equals(value2, value1))); // pagination - ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=0&pageSize=100", 60); + ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=0&pageSize=100", 50); ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=1&pageSize=100", 0); - ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=0&pageSize=60", 60); - ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=1&pageSize=60", 0); - ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=0&pageSize=25", 25); - ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=1&pageSize=25", 25); - ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=2&pageSize=25", 10); - ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=3&pageSize=25", 0); + ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=0&pageSize=50", 50); + ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=1&pageSize=50", 0); + ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=0&pageSize=20", 20); + ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=1&pageSize=20", 20); + ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=2&pageSize=20", 10); + ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&page=3&pageSize=20", 0); // pagination ITUtilStructures.assertRead("/SYSTEM?statuses=PENDING&statuses=APPROVED&mnemonic=A__&page=0&pageSize=15", 15); @@ -1930,11 +1913,11 @@ class StructuresSystemIT { ITUtilStructures.assertRead("/SYSTEM?statuses=PENDING&statuses=APPROVED&mnemonic=A__&page=3&pageSize=15", 0); // order by, pagination - response = ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=true&page=0&pageSize=25", 25); - response2 = ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=false&page=2&pageSize=25", 10); + response = ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=true&page=0&pageSize=20", 20); + response2 = ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=false&page=2&pageSize=20", 10); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); - response = ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=false&page=0&pageSize=25", 25); - response2 = ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=true&page=2&pageSize=25", 10); + response = ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=false&page=0&pageSize=20", 20); + response2 = ITUtilStructures.assertRead("/SYSTEM?mnemonic=A__&orderBy=WHEN&isAsc=true&page=2&pageSize=20", 10); assertEquals(response.getList().get(0).getWhen(), response2.getList().get(response2.getList().size()-1).getWhen()); // type and uuid