Search in sources :

Example 6 with File

use of org.folio.rest.jaxrs.model.File in project mod-source-record-manager by folio-org.

the class ChangeManagerAPITest method shouldReturnErrorOnPostJobExecutionWhenFailedPostSnapshotToStorage.

@Test
public void shouldReturnErrorOnPostJobExecutionWhenFailedPostSnapshotToStorage() throws IOException {
    WireMock.stubFor(post(SNAPSHOT_SERVICE_URL).willReturn(WireMock.serverError()));
    InitJobExecutionsRqDto requestDto = new InitJobExecutionsRqDto();
    String jsonFiles = TestUtil.readFileFromPath(FILES_PATH);
    List<File> filesList = new ObjectMapper().readValue(jsonFiles, new TypeReference<>() {
    });
    requestDto.getFiles().addAll(filesList.stream().limit(1).collect(Collectors.toList()));
    requestDto.setUserId(okapiUserIdHeader);
    requestDto.setSourceType(InitJobExecutionsRqDto.SourceType.FILES);
    RestAssured.given().spec(spec).body(JsonObject.mapFrom(requestDto).toString()).when().post(JOB_EXECUTION_PATH).then().statusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
}
Also used : InitJobExecutionsRqDto(org.folio.rest.jaxrs.model.InitJobExecutionsRqDto) Matchers.containsString(org.hamcrest.Matchers.containsString) File(org.folio.rest.jaxrs.model.File) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) AbstractRestTest(org.folio.rest.impl.AbstractRestTest) Test(org.junit.Test)

Aggregations

File (org.folio.rest.jaxrs.model.File)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 InitJobExecutionsRqDto (org.folio.rest.jaxrs.model.InitJobExecutionsRqDto)5 TypeReference (com.fasterxml.jackson.core.type.TypeReference)4 IOException (java.io.IOException)4 AbstractRestTest (org.folio.rest.impl.AbstractRestTest)4 Matchers.containsString (org.hamcrest.Matchers.containsString)4 Test (org.junit.Test)4 DeleteJobExecutionsReq (org.folio.rest.jaxrs.model.DeleteJobExecutionsReq)2 JsonObject (io.vertx.core.json.JsonObject)1 ArrayList (java.util.ArrayList)1 JobExecution (org.folio.rest.jaxrs.model.JobExecution)1 JobProfileInfo (org.folio.rest.jaxrs.model.JobProfileInfo)1