diff --git a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/merge/DataElementMergeTest.java b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/merge/DataElementMergeTest.java index d1d4f123c03..5421d97bd45 100644 --- a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/merge/DataElementMergeTest.java +++ b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/merge/DataElementMergeTest.java @@ -165,18 +165,14 @@ void dbConstraintMinMaxTest() { metadataApiActions.importMetadata(metadata()).validateStatus(200); // generate category option combos - String emptyParams = new QueryParamsBuilder().build(); maintenanceApiActions - .post("categoryOptionComboUpdate/categoryCombo/CatComUid01", emptyParams) - .validateStatus(200); - maintenanceApiActions - .post("categoryOptionComboUpdate/categoryCombo/CatComUid02", emptyParams) - .validateStatus(200); + .post("categoryOptionComboUpdate", new QueryParamsBuilder().build()) + .validateStatus(204); // get cat opt combo ID to use in min max data elements String cocId = categoryComboApiActions - .get("CatComUid01") + .get("CatCombUID1") .validateStatus(200) .validate() .extract() @@ -355,7 +351,7 @@ void deMergeDataValuesTest() { targetUid = setupDataElement("p", "TEXT", "AGGREGATE"); randomUid = setupDataElement("q", "TEXT", "AGGREGATE"); - addOrgUnitAccessForUser(loginActions.getLoggedInUserId(), "OrgUnitUid1"); + addOrgUnitAccessForUser(loginActions.getLoggedInUserId(), "OrgUnitUID1"); // Add data values addDataValues(); @@ -396,7 +392,7 @@ void deMergeDataValuesTest() { // And last updated duplicates are kept and earlier duplicates deleted ValidatableResponse postMergeState = dataValueSetActions - .get(getDataValueSetQueryParams("OrgUnitUid1", targetUid)) + .get(getDataValueSetQueryParams("OrgUnitUID1", targetUid)) .validateStatus(200) .validate(); @@ -417,7 +413,7 @@ void deMergeDataValuesTest() { // And sources and random DE have expected results dataValueSetActions - .get(getDataValueSetQueryParams("OrgUnitUid1", sourceUid1)) + .get(getDataValueSetQueryParams("OrgUnitUID1", sourceUid1)) .validateStatus(409) .validate() .body( @@ -425,7 +421,7 @@ void deMergeDataValuesTest() { equalTo("At least one data element, data set or data element group must be specified")); dataValueSetActions - .get(getDataValueSetQueryParams("OrgUnitUid1", sourceUid2)) + .get(getDataValueSetQueryParams("OrgUnitUID1", sourceUid2)) .validateStatus(409) .validate() .body( @@ -433,7 +429,7 @@ void deMergeDataValuesTest() { equalTo("At least one data element, data set or data element group must be specified")); dataValueSetActions - .get(getDataValueSetQueryParams("OrgUnitUid1", randomUid)) + .get(getDataValueSetQueryParams("OrgUnitUID1", randomUid)) .validateStatus(200) .validate() .body("dataValues", hasSize(2)); @@ -442,7 +438,7 @@ void deMergeDataValuesTest() { void checkDvState(String deUid, int expectedDvCount, int expectedDateCount) { ValidatableResponse preMergeState = dataValueSetActions - .get(getDataValueSetQueryParams("OrgUnitUid1", deUid)) + .get(getDataValueSetQueryParams("OrgUnitUID1", deUid)) .validateStatus(200) .validate(); @@ -521,7 +517,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202405", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "source 1, DV 1 - non duplicate earlier - KEEP", @@ -530,7 +526,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202408", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "source 1, DV 2 - duplicate earlier - REMOVE", @@ -539,7 +535,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202409", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "source 1, DV 3 - duplicate later - KEEP", @@ -548,7 +544,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202407", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "source 1, DV 4 - duplicate earlier - REMOVE", @@ -557,7 +553,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202410", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "source 2, DV 1 - non duplicate later - KEEP", @@ -566,7 +562,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202408", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "source 2, DV 2 - duplicate later - KEEP", @@ -575,7 +571,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202409", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "source 2, DV 3 - duplicate earlier - REMOVE", @@ -584,7 +580,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202407", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "source 2, DV 4 - duplicate earlier - REMOVE", @@ -593,7 +589,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202408", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "target DV 1 - duplicate earlier - REMOVE", @@ -602,7 +598,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202409", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "target DV 2 - duplicate earlier - REMOVE", @@ -611,7 +607,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202403", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "target DV 3 - not impacted - KEEP", @@ -620,7 +616,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202407", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "target DV 4 - duplicate later- KEEP", @@ -629,7 +625,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202408", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "random 1, DV 1 - not impacted", @@ -638,7 +634,7 @@ private JsonObject dataValueSetImport( { "dataElement": "%s", "period": "202409", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "random 2, DV 2 - not impacted", @@ -661,7 +657,7 @@ private JsonObject dataValueSetImportUpdateCoc( { "dataElement": "%s", "period": "202409", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "UPDATED source 1 DV 3 - duplicate later - KEEP", @@ -670,7 +666,7 @@ private JsonObject dataValueSetImportUpdateCoc( { "dataElement": "%s", "period": "202410", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "UPDATED source 2 DV 1 - non duplicate later - KEEP", @@ -679,7 +675,7 @@ private JsonObject dataValueSetImportUpdateCoc( { "dataElement": "%s", "period": "202408", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "UPDATED source 2 DV 2 - duplicate later - KEEP", @@ -688,7 +684,7 @@ private JsonObject dataValueSetImportUpdateCoc( { "dataElement": "%s", "period": "202407", - "orgUnit": "OrgUnitUid1", + "orgUnit": "OrgUnitUID1", "categoryOptionCombo": "HllvX50cXC0", "attributeOptionCombo": "HllvX50cXC0", "value": "UPDATED target DV 4 - duplicate later - KEEP", @@ -832,7 +828,7 @@ private String minMaxDataElements(String de, String coc) { "max": 11, "generated": false, "source": { - "id": "OrgUnitUid1" + "id": "OrgUnitUID1" }, "dataElement": { "id": "%s" @@ -892,264 +888,70 @@ private String metadata() { { "categoryOptions": [ { - "id": "CatOptUid1A", - "name": "cat opt 1A", - "shortName": "cat opt 1A", - "organisationUnits": [ - { - "id": "OrgUnitUid1" - } - ] - }, - { - "id": "CatOptUid1B", - "name": "cat opt 1B", - "shortName": "cat opt 1B", - "organisationUnits": [ - { - "id": "OrgUnitUid1" - } - ] - }, - { - "id": "CatOptUid2A", - "name": "cat opt 2A", - "shortName": "cat opt 2A", - "organisationUnits": [ - { - "id": "OrgUnitUid2" - } - ] - }, - { - "id": "CatOptUid2B", - "name": "cat opt 2B", - "shortName": "cat opt 2B", - "organisationUnits": [ - { - "id": "OrgUnitUid2" - } - ] - }, - { - "id": "CatOptUid3A", - "name": "cat opt 3A", - "shortName": "cat opt 3A", - "organisationUnits": [ - { - "id": "OrgUnitUid3" - } - ] - }, - { - "id": "CatOptUid3B", - "name": "cat opt 3B", - "shortName": "cat opt 3B", - "organisationUnits": [ - { - "id": "OrgUnitUid3" - } - ] - }, - { - "id": "CatOptUid4A", - "name": "cat opt 4A", - "shortName": "cat opt 4A", + "id": "CatOptUID1A", + "name": "cat option 1A", + "shortName": "cat option 1A", "organisationUnits": [ { - "id": "OrgUnitUid4" + "id": "OrgUnitUID1" } ] }, { - "id": "CatOptUid4B", - "name": "cat opt 4B", - "shortName": "cat opt 4B", + "id": "CatOptUID1B", + "name": "cat option 1B", + "shortName": "cat option 1B", "organisationUnits": [ { - "id": "OrgUnitUid4" + "id": "OrgUnitUID1" } ] } ], "categories": [ { - "id": "CategoUid01", - "name": "cat 1", - "shortName": "cat 1", - "dataDimensionType": "DISAGGREGATION", - "categoryOptions": [ - { - "id": "CatOptUid1A" - }, - { - "id": "CatOptUid1B" - } - ] - }, - { - "id": "CategoUid02", - "name": "cat 2", - "shortName": "cat 2", - "dataDimensionType": "DISAGGREGATION", - "categoryOptions": [ - { - "id": "CatOptUid2A" - }, - { - "id": "CatOptUid2B" - } - ] - }, - { - "id": "CategoUid03", - "name": "cat 3", - "shortName": "cat 3", - "dataDimensionType": "DISAGGREGATION", - "categoryOptions": [ - { - "id": "CatOptUid3A" - }, - { - "id": "CatOptUid3B" - } - ] - }, - { - "id": "CategoUid04", - "name": "cat 4", - "shortName": "cat 4", + "id": "CategoUID01", + "name": "category 1", + "shortName": "category 1", "dataDimensionType": "DISAGGREGATION", "categoryOptions": [ { - "id": "CatOptUid4A" + "id": "CatOptUID1A" }, { - "id": "CatOptUid4B" + "id": "CatOptUID1B" } ] } ], "organisationUnits": [ { - "id": "OrgUnitUid1", - "name": "org 1", - "shortName": "org 1", + "id": "OrgUnitUID1", + "name": "org u 1", + "shortName": "org u 1", "openingDate": "2023-06-15", "parent": { "id": "DiszpKrYNg8" } }, { - "id": "OrgUnitUid2", - "name": "org 2", - "shortName": "org 2", + "id": "OrgUnitUID2", + "name": "org u 2", + "shortName": "org u 2", "openingDate": "2024-06-15", "parent": { "id": "DiszpKrYNg8" } - }, - { - "id": "OrgUnitUid3", - "name": "org 3", - "shortName": "org 3", - "openingDate": "2023-09-15", - "parent": { - "id": "DiszpKrYNg8" - } - }, - { - "id": "OrgUnitUid4", - "name": "org 4", - "shortName": "org 4", - "openingDate": "2023-06-25", - "parent": { - "id": "DiszpKrYNg8" - } - } - ], - "categoryOptionGroups": [ - { - "id": "CatOptGrp01", - "name": "cog 1", - "shortName": "cog 1", - "dataDimensionType": "DISAGGREGATION", - "categoryOptions": [ - { - "id": "CatOptUid1A" - }, - { - "id": "CatOptUid1B" - } - ] - }, - { - "id": "CatOptGrp02", - "name": "cog 2", - "shortName": "cog 2", - "dataDimensionType": "DISAGGREGATION", - "categoryOptions": [ - { - "id": "CatOptUid2A" - }, - { - "id": "CatOptUid2B" - } - ] - }, - { - "id": "CatOptGrp03", - "name": "cog 3", - "shortName": "cog 3", - "dataDimensionType": "DISAGGREGATION", - "categoryOptions": [ - { - "id": "CatOptUid3A" - }, - { - "id": "CatOptUid3B" - } - ] - }, - { - "id": "CatOptGrp04", - "name": "cog 4", - "shortName": "cog 4", - "dataDimensionType": "DISAGGREGATION", - "categoryOptions": [ - { - "id": "CatOptUid4A" - }, - { - "id": "CatOptUid4B" - } - ] } ], "categoryCombos": [ { - "id": "CatComUid01", - "name": "cat combo 1", + "id": "CatCombUID1", + "name": "category combo 1", "dataDimensionType": "DISAGGREGATION", "categories": [ { - "id": "CategoUid01" - }, - { - "id": "CategoUid02" - } - ] - }, - { - "id": "CatComUid02", - "name": "cat combo 2", - "dataDimensionType": "DISAGGREGATION", - "categories": [ - { - "id": "CategoUid03" - }, - { - "id": "CategoUid04" + "id": "CategoUID01" } ] }