use of org.hisp.dhis.dto.MetadataApiResponse in project dhis2-core by dhis2.
the class MetadataActions method importMetadata.
public MetadataApiResponse importMetadata(JsonObject object, String... queryParams) {
QueryParamsBuilder queryParamsBuilder = new QueryParamsBuilder();
queryParamsBuilder.addAll(queryParams);
queryParamsBuilder.addAll("atomicMode=OBJECT", "importReportMode=FULL");
ApiResponse response = post(object, queryParamsBuilder);
response.validate().statusCode(200);
return new MetadataApiResponse(response);
}
use of org.hisp.dhis.dto.MetadataApiResponse in project dhis2-core by dhis2.
the class MetadataActions method importMetadata.
public MetadataApiResponse importMetadata(File file, String... queryParams) {
QueryParamsBuilder queryParamsBuilder = new QueryParamsBuilder();
queryParamsBuilder.addAll(queryParams);
queryParamsBuilder.addAll("importReportMode=FULL");
ApiResponse response = postFile(file, queryParamsBuilder);
response.validate().statusCode(200);
return new MetadataApiResponse(response);
}
use of org.hisp.dhis.dto.MetadataApiResponse in project dhis2-core by dhis2.
the class MetadataActions method importAndValidateMetadata.
public MetadataApiResponse importAndValidateMetadata(JsonObject object, String... queryParams) {
ApiResponse response = importMetadata(object, queryParams);
response.validate().body("response.stats.ignored", not(equalTo(response.extract("response.stats.total"))));
return new MetadataApiResponse(response);
}
use of org.hisp.dhis.dto.MetadataApiResponse in project dhis2-core by dhis2.
the class MetadataActions method importAndValidateMetadata.
public MetadataApiResponse importAndValidateMetadata(File file, String... queryParams) {
ApiResponse response = importMetadata(file, queryParams);
response.validate().body("response.stats.ignored", not(equalTo(response.extract("response.stats.total"))));
return new MetadataApiResponse(response);
}
use of org.hisp.dhis.dto.MetadataApiResponse in project dhis2-core by dhis2.
the class OrgUnitProfileTests method shouldApplyGroupSets.
@Test
public void shouldApplyGroupSets() {
// arrange
MetadataApiResponse response = new MetadataActions().importAndValidateMetadata(new File("src/test/resources/metadata/orgunits/ou_with_group_and_set.json"));
String groupSet = response.extractObjectUid("OrganisationUnitGroupSet").get(0);
String ou = response.extractObjectUid("OrganisationUnit").get(0);
JsonArray array = new JsonArray();
array.add(groupSet);
JsonObject profileBody = new JsonObjectBuilder().addArray("groupSets", array).build();
// act
orgUnitProfileActions.post(profileBody).validate().statusCode(200);
// assert
orgUnitProfileActions.get().validate().body("groupSets", hasSize(greaterThanOrEqualTo(1)));
orgUnitProfileActions.get("/" + ou + "/data").validate().statusCode(200).body("groupSets", hasSize(1)).rootPath("groupSets[0]").body("id", equalTo(groupSet)).body("label", notNullValue()).body("value", notNullValue());
}
Aggregations