Search in sources :

Example 1 with DataItemActions

use of org.hisp.dhis.actions.dataitem.DataItemActions in project dhis2-core by dhis2.

the class DataItemQueryTests method before.

@BeforeAll
public void before() {
    dataItemActions = new DataItemActions();
    login();
}
Also used : DataItemActions(org.hisp.dhis.actions.dataitem.DataItemActions) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with DataItemActions

use of org.hisp.dhis.actions.dataitem.DataItemActions in project dhis2-core by dhis2.

the class OrgUnitProfileTests method shouldApplyDataItems.

@Test
public void shouldApplyDataItems() {
    List<String> datItems = new DataItemActions().get("", new QueryParamsBuilder().add("filter=dimensionItemType:in:[DATA_ELEMENT,PROGRAM_INDICATOR]")).extractList("dataItems.id");
    JsonArray array = new JsonArray();
    datItems.forEach(p -> array.add(p));
    orgUnitProfileActions.post(new JsonObjectBuilder().addArray("dataItems", array).build()).validate().statusCode(200);
    orgUnitProfileActions.get().validate().body("dataItems", hasSize(greaterThanOrEqualTo(1)));
// todo add validation for organisationUnitProfile/id/data
}
Also used : JsonArray(com.google.gson.JsonArray) DataItemActions(org.hisp.dhis.actions.dataitem.DataItemActions) QueryParamsBuilder(org.hisp.dhis.helpers.QueryParamsBuilder) JsonObjectBuilder(org.hisp.dhis.helpers.JsonObjectBuilder) Test(org.junit.jupiter.api.Test) ApiTest(org.hisp.dhis.ApiTest)

Aggregations

DataItemActions (org.hisp.dhis.actions.dataitem.DataItemActions)2 JsonArray (com.google.gson.JsonArray)1 ApiTest (org.hisp.dhis.ApiTest)1 JsonObjectBuilder (org.hisp.dhis.helpers.JsonObjectBuilder)1 QueryParamsBuilder (org.hisp.dhis.helpers.QueryParamsBuilder)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1 Test (org.junit.jupiter.api.Test)1