Search in sources :

Example 6 with MetadataActions

use of org.hisp.dhis.actions.metadata.MetadataActions in project dhis2-core by dhis2.

the class MetadataExportTests method beforeAll.

@BeforeAll
public void beforeAll() {
    metadataActions = new MetadataActions();
    loginActions = new LoginActions();
    userActions = new UserActions();
    userActions.addUser(userWithoutAccessUsername, userWithoutAccessPassword);
}
Also used : UserActions(org.hisp.dhis.actions.UserActions) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) LoginActions(org.hisp.dhis.actions.LoginActions) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 7 with MetadataActions

use of org.hisp.dhis.actions.metadata.MetadataActions in project dhis2-core by dhis2.

the class MetadataImportImportStrategyTests method before.

@BeforeAll
public void before() {
    metadataActions = new MetadataActions();
    new LoginActions().loginAsAdmin();
}
Also used : MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) LoginActions(org.hisp.dhis.actions.LoginActions) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 8 with MetadataActions

use of org.hisp.dhis.actions.metadata.MetadataActions in project dhis2-core by dhis2.

the class EventImportDataValueValidationTests method setupData.

private void setupData() throws Exception {
    programId = new IdGenerator().generateUniqueId();
    programStageId = new IdGenerator().generateUniqueId();
    JsonObject jsonObject = new JsonObjectBuilder(new FileReaderUtils().readJsonAndGenerateData(new File("src/test/resources/tracker/eventProgram.json"))).addPropertyByJsonPath("programStages[0].program.id", programId).addPropertyByJsonPath("programs[0].id", programId).addPropertyByJsonPath("programs[0].programStages[0].id", programStageId).addPropertyByJsonPath("programStages[0].id", programStageId).addPropertyByJsonPath("programStages[0].programStageDataElements", null).build();
    new MetadataActions().importAndValidateMetadata(jsonObject);
    String dataElementId = dataElementActions.get("?fields=id&filter=domainType:eq:TRACKER&filter=valueType:eq:TEXT&pageSize=1").extractString("dataElements.id[0]");
    assertNotNull(dataElementId, "Failed to create data elements");
    mandatoryDataElementId = dataElementId;
    programActions.addDataElement(programStageId, dataElementId, true).validate().statusCode(200);
}
Also used : FileReaderUtils(org.hisp.dhis.helpers.file.FileReaderUtils) JsonObject(com.google.gson.JsonObject) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) IdGenerator(org.hisp.dhis.actions.IdGenerator) JsonObjectBuilder(org.hisp.dhis.helpers.JsonObjectBuilder) File(java.io.File)

Example 9 with MetadataActions

use of org.hisp.dhis.actions.metadata.MetadataActions in project dhis2-core by dhis2.

the class OrgUnitsRemovalTest method beforeAll.

@BeforeEach
public void beforeAll() {
    orgUnitActions = new OrgUnitActions();
    orgUnitGroupActions = new RestApiActions("/organisationUnitGroups");
    orgUnitSetActions = new RestApiActions("/organisationUnitGroupSets");
    metadataActions = new MetadataActions();
    new LoginActions().loginAsSuperUser();
    metadataActions.importAndValidateMetadata(new File("src/test/resources/metadata/orgunits/ou_with_group_and_set.json"));
}
Also used : OrgUnitActions(org.hisp.dhis.actions.metadata.OrgUnitActions) RestApiActions(org.hisp.dhis.actions.RestApiActions) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) LoginActions(org.hisp.dhis.actions.LoginActions) File(java.io.File) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 10 with MetadataActions

use of org.hisp.dhis.actions.metadata.MetadataActions in project dhis2-core by dhis2.

the class RelationshipsTest method before.

@BeforeAll
public void before() throws Exception {
    relationshipActions = new RelationshipActions();
    trackedEntityInstanceActions = new RestApiActions("/trackedEntityInstances");
    metadataActions = new MetadataActions();
    eventActions = new EventActions();
    new LoginActions().loginAsSuperUser();
    metadataActions.importAndValidateMetadata(new File("src/test/resources/tracker/relationshipTypes.json"));
    JsonObject teiObject = new FileReaderUtils().read(new File("src/test/resources/tracker/teis/teis.json")).replacePropertyValuesWithIds("trackedEntityInstance").get(JsonObject.class);
    teis = trackedEntityInstanceActions.post(teiObject).extractUids();
    JsonObject eventObject = new FileReaderUtils().read(new File("src/test/resources/tracker/events/events.json")).replacePropertyValuesWithIds("event").get(JsonObject.class);
    ApiResponse response = eventActions.post(eventObject).validateStatus(200);
    events = response.extractUids();
}
Also used : RestApiActions(org.hisp.dhis.actions.RestApiActions) FileReaderUtils(org.hisp.dhis.helpers.file.FileReaderUtils) JsonObject(com.google.gson.JsonObject) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) LoginActions(org.hisp.dhis.actions.LoginActions) RelationshipActions(org.hisp.dhis.actions.tracker.RelationshipActions) EventActions(org.hisp.dhis.actions.tracker.EventActions) File(java.io.File) ApiResponse(org.hisp.dhis.dto.ApiResponse) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

MetadataActions (org.hisp.dhis.actions.metadata.MetadataActions)15 File (java.io.File)12 BeforeAll (org.junit.jupiter.api.BeforeAll)11 LoginActions (org.hisp.dhis.actions.LoginActions)10 JsonObject (com.google.gson.JsonObject)3 RestApiActions (org.hisp.dhis.actions.RestApiActions)3 UserActions (org.hisp.dhis.actions.UserActions)3 EventActions (org.hisp.dhis.actions.tracker.EventActions)3 SystemActions (org.hisp.dhis.actions.SystemActions)2 ProgramActions (org.hisp.dhis.actions.metadata.ProgramActions)2 TEIActions (org.hisp.dhis.actions.tracker.TEIActions)2 JsonObjectBuilder (org.hisp.dhis.helpers.JsonObjectBuilder)2 FileReaderUtils (org.hisp.dhis.helpers.file.FileReaderUtils)2 JsonArray (com.google.gson.JsonArray)1 ApiTest (org.hisp.dhis.ApiTest)1 IdGenerator (org.hisp.dhis.actions.IdGenerator)1 MessageConversationsActions (org.hisp.dhis.actions.MessageConversationsActions)1 DataValueActions (org.hisp.dhis.actions.aggregate.DataValueActions)1 DataValueSetActions (org.hisp.dhis.actions.aggregate.DataValueSetActions)1 OrgUnitActions (org.hisp.dhis.actions.metadata.OrgUnitActions)1