use of org.folio.rest.jaxrs.model.JournalRecord in project mod-source-record-manager by folio-org.
the class MetaDataProviderJobLogEntriesAPITest method shouldReturnMarcBibUpdatedWhenMarcBibWasModified.
@Test
public void shouldReturnMarcBibUpdatedWhenMarcBibWasModified(TestContext context) {
Async async = context.async();
JobExecution createdJobExecution = constructAndPostInitJobExecutionRqDto(1).getJobExecutions().get(0);
String sourceRecordId = UUID.randomUUID().toString();
String recordTitle = "test title";
Future<JournalRecord> future = Future.succeededFuture().compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, null, recordTitle, 0, CREATE, MARC_BIBLIOGRAPHIC, COMPLETED, null)).compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, null, null, 0, MODIFY, MARC_BIBLIOGRAPHIC, COMPLETED, null)).onFailure(context::fail);
future.onComplete(ar -> context.verify(v -> {
RestAssured.given().spec(spec).when().get(GET_JOB_EXECUTION_JOURNAL_RECORDS_PATH + "/" + createdJobExecution.getId()).then().statusCode(HttpStatus.SC_OK).body("entries", hasSize(1)).body("totalRecords", is(1)).body("entries[0].jobExecutionId", is(createdJobExecution.getId())).body("entries[0].sourceRecordId", is(sourceRecordId)).body("entries[0].sourceRecordTitle", is(recordTitle)).body("entries[0].sourceRecordActionStatus", is(ActionStatus.UPDATED.value()));
async.complete();
}));
}
use of org.folio.rest.jaxrs.model.JournalRecord in project mod-source-record-manager by folio-org.
the class MetaDataProviderJobLogEntriesAPITest method shouldReturnHoldingsTitleWithHoldingsHrid.
@Test
public void shouldReturnHoldingsTitleWithHoldingsHrid(TestContext context) {
Async async = context.async();
JobExecution createdJobExecution = constructAndPostInitJobExecutionRqDto(1).getJobExecutions().get(0);
String sourceRecordId = UUID.randomUUID().toString();
Future<JournalRecord> future = Future.succeededFuture().compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, null, null, 0, CREATE, MARC_HOLDINGS, COMPLETED, null)).compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, "ho00000000001", null, 0, CREATE, HOLDINGS, COMPLETED, null)).onFailure(context::fail);
future.onComplete(ar -> context.verify(v -> {
RestAssured.given().spec(spec).when().get(GET_JOB_EXECUTION_JOURNAL_RECORDS_PATH + "/" + createdJobExecution.getId()).then().statusCode(HttpStatus.SC_OK).body("entries.size()", is(1)).body("totalRecords", is(1)).body("entries[0].sourceRecordId", is(sourceRecordId)).body("entries[0].sourceRecordTitle", is("Holdings ho00000000001")).body("entries[0].holdingsRecordHridList[0]", is("ho00000000001")).body("entries[0].sourceRecordType", is(MARC_HOLDINGS.value()));
async.complete();
}));
}
use of org.folio.rest.jaxrs.model.JournalRecord in project mod-source-record-manager by folio-org.
the class MetaDataProviderJobLogEntriesAPITest method shouldReturnEmptyMarcBibErrorAndInstanceDiscardedWhenInstanceCreationFailed.
@Test
public void shouldReturnEmptyMarcBibErrorAndInstanceDiscardedWhenInstanceCreationFailed(TestContext context) {
Async async = context.async();
JobExecution createdJobExecution = constructAndPostInitJobExecutionRqDto(1).getJobExecutions().get(0);
String sourceRecordId = UUID.randomUUID().toString();
String entityId = UUID.randomUUID().toString();
String entityHrid = "001";
String recordTitle = "test title";
Future<JournalRecord> future = Future.succeededFuture().compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, entityId, entityHrid, recordTitle, 0, CREATE, MARC_BIBLIOGRAPHIC, COMPLETED, null)).compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, entityId, entityHrid, null, 0, CREATE, INSTANCE, ERROR, "error msg")).onFailure(context::fail);
future.onComplete(ar -> context.verify(v -> {
RestAssured.given().spec(spec).when().get(GET_JOB_EXECUTION_JOURNAL_RECORDS_PATH + "/" + createdJobExecution.getId() + "/records/" + sourceRecordId).then().statusCode(HttpStatus.SC_OK).body("jobExecutionId", is(createdJobExecution.getId())).body("sourceRecordId", is(sourceRecordId)).body("sourceRecordTitle", is(recordTitle)).body("sourceRecordOrder", is(0)).body("error", emptyOrNullString()).body("relatedInstanceInfo.idList[0]", is(entityId)).body("relatedInstanceInfo.hridList[0]", is(entityHrid)).body("relatedInstanceInfo.error", is("error msg"));
async.complete();
}));
}
use of org.folio.rest.jaxrs.model.JournalRecord in project mod-source-record-manager by folio-org.
the class MetaDataProviderJobLogEntriesAPITest method shouldReturnHoldingsMultipleWhenMultipleHoldingsWereProcessed.
@Test
public void shouldReturnHoldingsMultipleWhenMultipleHoldingsWereProcessed(TestContext context) {
Async async = context.async();
JobExecution createdJobExecution = constructAndPostInitJobExecutionRqDto(1).getJobExecutions().get(0);
String sourceRecordId = UUID.randomUUID().toString();
String recordTitle = "test title";
Future<JournalRecord> future = Future.succeededFuture().compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, null, recordTitle, 0, CREATE, MARC_BIBLIOGRAPHIC, COMPLETED, null)).compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, null, null, 0, CREATE, HOLDINGS, COMPLETED, null)).compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, null, null, 0, UPDATE, HOLDINGS, COMPLETED, null)).onFailure(context::fail);
future.onComplete(ar -> context.verify(v -> {
RestAssured.given().spec(spec).when().get(GET_JOB_EXECUTION_JOURNAL_RECORDS_PATH + "/" + createdJobExecution.getId()).then().statusCode(HttpStatus.SC_OK).body("entries.size()", is(1)).body("totalRecords", is(1)).body("entries[0].sourceRecordId", is(sourceRecordId)).body("entries[0].sourceRecordTitle", is(recordTitle)).body("entries[0].holdingsActionStatus", is(ActionStatus.MULTIPLE.value()));
async.complete();
}));
}
use of org.folio.rest.jaxrs.model.JournalRecord in project mod-source-record-manager by folio-org.
the class MetaDataProviderJobLogEntriesAPITest method shouldReturnNotEmptyListWithInvoicesLines.
@Test
public void shouldReturnNotEmptyListWithInvoicesLines(TestContext context) {
Async async = context.async();
JobExecution createdJobExecution = constructAndPostInitJobExecutionRqDto(1).getJobExecutions().get(0);
String sourceRecordId = UUID.randomUUID().toString();
String invoiceLineDescription = "Some description";
String invoiceLineId = "0704159";
CompositeFuture future = GenericCompositeFuture.all(List.of(createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, "228D126", "INVOICE", 0, CREATE, INVOICE, COMPLETED, null).map(JournalRecord::getId), createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, invoiceLineId + "-1", invoiceLineDescription + "1", 1, CREATE, INVOICE, COMPLETED, null).map(JournalRecord::getId), createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, invoiceLineId + "-2", invoiceLineDescription + "2", 2, CREATE, INVOICE, COMPLETED, null).map(JournalRecord::getId), createJournalRecord(createdJobExecution.getId(), sourceRecordId, null, invoiceLineId + "-3", invoiceLineDescription + "3", 3, CREATE, INVOICE, COMPLETED, null).map(JournalRecord::getId))).onFailure(context::fail);
future.onComplete(ar -> context.verify(v -> {
RestAssured.given().spec(spec).when().get(GET_JOB_EXECUTION_JOURNAL_RECORDS_PATH + "/" + createdJobExecution.getId()).then().statusCode(HttpStatus.SC_OK).body("entries.size()", is(3)).body("totalRecords", is(3)).body("entries*.jobExecutionId", everyItem(is(createdJobExecution.getId()))).body("entries*.sourceRecordId", everyItem(is(sourceRecordId))).body("entries[0].sourceRecordTitle", is(invoiceLineDescription + "1")).body("entries[1].sourceRecordTitle", is(invoiceLineDescription + "2")).body("entries[2].sourceRecordTitle", is(invoiceLineDescription + "3")).body("entries[0].sourceRecordOrder", is(invoiceLineId + "-1")).body("entries[1].sourceRecordOrder", is(invoiceLineId + "-2")).body("entries[2].sourceRecordOrder", is(invoiceLineId + "-3")).body("entries[0].invoiceLineJournalRecordId", is(future.resultAt(1).toString())).body("entries[1].invoiceLineJournalRecordId", is(future.resultAt(2).toString())).body("entries[2].invoiceLineJournalRecordId", is(future.resultAt(3).toString()));
async.complete();
}));
}
Aggregations