Search in sources :

Example 11 with DeleteResponseModel

use of bio.terra.model.DeleteResponseModel in project jade-data-repo by DataBiosphere.

the class DataRepoFixtures method assertGoodDeleteResponse.

private void assertGoodDeleteResponse(DataRepoResponse<DeleteResponseModel> deleteResponse) {
    assertThat("delete is successful", deleteResponse.getStatusCode(), equalTo(HttpStatus.OK));
    assertTrue("delete response is present", deleteResponse.getResponseObject().isPresent());
    DeleteResponseModel deleteModel = deleteResponse.getResponseObject().get();
    assertTrue("Valid delete response", (deleteModel.getObjectState() == DeleteResponseModel.ObjectStateEnum.DELETED || deleteModel.getObjectState() == DeleteResponseModel.ObjectStateEnum.NOT_FOUND));
}
Also used : DeleteResponseModel(bio.terra.model.DeleteResponseModel)

Example 12 with DeleteResponseModel

use of bio.terra.model.DeleteResponseModel in project jade-data-repo by DataBiosphere.

the class ConnectedOperations method checkDeleteResponse.

public void checkDeleteResponse(MockHttpServletResponse response) throws Exception {
    HttpStatus status = HttpStatus.valueOf(response.getStatus());
    if (status.is2xxSuccessful()) {
        DeleteResponseModel responseModel = TestUtils.mapFromJson(response.getContentAsString(), DeleteResponseModel.class);
        assertTrue("Valid delete response object state enumeration", (responseModel.getObjectState() == DeleteResponseModel.ObjectStateEnum.DELETED || responseModel.getObjectState() == DeleteResponseModel.ObjectStateEnum.NOT_FOUND));
    } else {
        ErrorModel errorModel = handleFailureCase(response, HttpStatus.NOT_FOUND);
        assertNotNull("error model returned", errorModel);
    }
}
Also used : HttpStatus(org.springframework.http.HttpStatus) ErrorModel(bio.terra.model.ErrorModel) DeleteResponseModel(bio.terra.model.DeleteResponseModel)

Aggregations

DeleteResponseModel (bio.terra.model.DeleteResponseModel)12 Test (org.junit.Test)6 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)6 MvcResult (org.springframework.test.web.servlet.MvcResult)6 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 ErrorModel (bio.terra.model.ErrorModel)3 SnapshotSummaryModel (bio.terra.model.SnapshotSummaryModel)3 DatasetSummaryModel (bio.terra.model.DatasetSummaryModel)2 FileLoadModel (bio.terra.model.FileLoadModel)2 FileModel (bio.terra.model.FileModel)2 URI (java.net.URI)2 UUID (java.util.UUID)2 DRSObject (bio.terra.model.DRSObject)1 DataDeletionGcsFileModel (bio.terra.model.DataDeletionGcsFileModel)1 DataDeletionRequest (bio.terra.model.DataDeletionRequest)1 DatasetModel (bio.terra.model.DatasetModel)1 EnumerateDatasetModel (bio.terra.model.EnumerateDatasetModel)1 EnumerateSnapshotModel (bio.terra.model.EnumerateSnapshotModel)1 IngestRequestModel (bio.terra.model.IngestRequestModel)1