use of org.folio.rest.jaxrs.model.RunBy in project mod-source-record-manager by folio-org.
the class MetadataProviderJobExecutionAPITest method shouldReturnSortedCollectionByMultipleFieldsOnGet.
@Test
public void shouldReturnSortedCollectionByMultipleFieldsOnGet() {
List<JobExecution> createdJobExecution = constructAndPostInitJobExecutionRqDto(4).getJobExecutions();
List<JobExecution> childJobsToUpdate = createdJobExecution.stream().filter(jobExecution -> jobExecution.getSubordinationType().equals(CHILD)).collect(Collectors.toList());
for (int i = 0; i < childJobsToUpdate.size(); i++) {
putJobExecution(createdJobExecution.get(i).withRunBy(new RunBy().withFirstName("John").withLastName("Doe-" + i)));
}
// We do not expect to get JobExecution with subordinationType=PARENT_MULTIPLE
int expectedJobExecutionsNumber = childJobsToUpdate.size();
JobExecutionDtoCollection jobExecutionCollection = RestAssured.given().spec(spec).when().queryParam("sortBy", "job_user_first_name,asc").queryParam("sortBy", "job_user_last_name,desc").get(GET_JOB_EXECUTIONS_PATH).then().statusCode(HttpStatus.SC_OK).extract().response().body().as(JobExecutionDtoCollection.class);
List<JobExecutionDto> jobExecutions = jobExecutionCollection.getJobExecutions();
Assert.assertEquals(expectedJobExecutionsNumber, jobExecutions.size());
assertThat(jobExecutions.get(0).getRunBy().getLastName(), greaterThan(jobExecutions.get(1).getRunBy().getLastName()));
assertThat(jobExecutions.get(1).getRunBy().getLastName(), greaterThan(jobExecutions.get(2).getRunBy().getLastName()));
assertThat(jobExecutions.get(2).getRunBy().getLastName(), greaterThan(jobExecutions.get(3).getRunBy().getLastName()));
}
use of org.folio.rest.jaxrs.model.RunBy in project mod-source-record-manager by folio-org.
the class JobExecutionServiceImpl method buildRunByFromUserInfo.
private RunBy buildRunByFromUserInfo(UserInfo info) {
RunBy result = new RunBy();
if (info != null) {
result.setFirstName(info.getFirstName());
result.setLastName(info.getLastName());
}
return result;
}
use of org.folio.rest.jaxrs.model.RunBy in project mod-source-record-manager by folio-org.
the class ChangeManagerAPITest method shouldProcessLastChunkOfRawRecords.
@Test
public void shouldProcessLastChunkOfRawRecords(TestContext testContext) {
InitJobExecutionsRsDto response = constructAndPostInitJobExecutionRqDto(1);
List<JobExecution> createdJobExecutions = response.getJobExecutions();
assertThat(createdJobExecutions.size(), is(1));
JobExecution jobExec = createdJobExecutions.get(0);
jobExec.setRunBy(new RunBy().withFirstName("DIKU").withLastName("ADMINISTRATOR"));
jobExec.setProgress(new Progress().withCurrent(1000).withTotal(1000));
jobExec.setStartedDate(new Date());
WireMock.stubFor(post(RECORDS_SERVICE_URL).willReturn(created().withTransformers(RequestToResponseTransformer.NAME)));
Async async = testContext.async();
RestAssured.given().spec(spec).body(jobExec).when().put(JOB_EXECUTION_PATH + jobExec.getId()).then().statusCode(HttpStatus.SC_OK).log().all();
async.complete();
async = testContext.async();
RestAssured.given().spec(spec).body(new JobProfileInfo().withName("MARC records").withId(DEFAULT_JOB_PROFILE_ID).withDataType(JobProfileInfo.DataType.MARC)).when().put(JOB_EXECUTION_PATH + jobExec.getId() + JOB_PROFILE_PATH).then().statusCode(HttpStatus.SC_OK);
async.complete();
rawRecordsDto.getRecordsMetadata().setLast(true);
async = testContext.async();
RestAssured.given().spec(spec).body(rawRecordsDto.withId(UUID.randomUUID().toString())).when().post(JOB_EXECUTION_PATH + jobExec.getId() + RECORDS_PATH).then().statusCode(HttpStatus.SC_NO_CONTENT);
async.complete();
async = testContext.async();
RestAssured.given().spec(spec).when().get(JOB_EXECUTION_PATH + jobExec.getId()).then().statusCode(HttpStatus.SC_OK);
async.complete();
}
Aggregations