use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class MetadataPaginationTest method checkPaginationResultsForcingInMemoryPagination.
@Test
public void checkPaginationResultsForcingInMemoryPagination() {
// this test forces the metadata query engine to execute an "in memory"
// sorting and pagination
// since the sort ("order") value is set to 'displayName' that is a
// "virtual" field (that is, not a database column)
// The metadata query engine can not execute a sql query using this
// field, since it does not exist
// on the table. Therefore, the engine loads the entire content of the
// table in memory and
// executes a sort + pagination "in memory"
ApiResponse response = paginationActions.getPaginated(startPage, pageSize);
response.validate().statusCode(200);
paginationActions.assertPagination(response, 100, 100 / pageSize, pageSize, startPage);
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class MetadataPaginationTest method checkPaginationResultsForcingDatabaseOnlyPagination.
@Test
public void checkPaginationResultsForcingDatabaseOnlyPagination() {
// this test forces the metadata query engine to execute the query
// (including pagination) on the database only.
// The sort ("order") value is set to 'id' that is mapped to a DB
// column.
ApiResponse response = paginationActions.getPaginated(Arrays.asList(DEFAULT_METADATA_FILTER.split(",")), Arrays.asList(DEFAULT_METADATA_FIELDS.split(",")), Collections.singletonList("id:ASC"), startPage, pageSize);
response.validate().statusCode(200);
paginationActions.assertPagination(response, 100, 100 / pageSize, pageSize, startPage);
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class OptionSetTests method shouldBeAbleToReferenceWithOption.
@Test
public void shouldBeAbleToReferenceWithOption() {
// arrange
String optionId = createOption(createdOptionSet);
// act
ApiResponse response = optionActions.optionSetActions.get(createdOptionSet);
// assert
response.validate().statusCode(200).body("options.id[0]", equalTo(optionId));
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class OptionSetTests method shouldAddOptions.
@Test
public void shouldAddOptions() {
String option1 = createOption(createdOptionSet);
String option2 = createOption(createdOptionSet);
ApiResponse response = optionActions.optionSetActions.get(createdOptionSet);
response.validate().statusCode(200).body("options", not(emptyArray())).body("options.id", not(emptyArray())).rootPath("options").body("id[0]", equalTo(option1)).body("id[1]", equalTo(option2));
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class OptionSetTests method shouldNotBeRemovedWithAssociatedData.
@Test
public void shouldNotBeRemovedWithAssociatedData() {
// arrange
createOption(createdOptionSet);
// act
ApiResponse response = optionActions.optionSetActions.delete(createdOptionSet);
// assert
ResponseValidationHelper.validateObjectRemoval(response, "Option set was not deleted");
optionActions.optionSetActions.get(createdOptionSet).validate().statusCode(404);
}
Aggregations