use of org.folio.rest.jaxrs.model.JournalRecord.EntityType.ITEM in project mod-source-record-manager by folio-org.
the class MetaDataProviderJobLogEntriesAPITest method shouldReturnMarcBibAndAllEntitiesWithoutErrors.
@Test
public void shouldReturnMarcBibAndAllEntitiesWithoutErrors(TestContext context) {
Async async = context.async();
JobExecution createdJobExecution = constructAndPostInitJobExecutionRqDto(1).getJobExecutions().get(0);
String sourceRecordId = UUID.randomUUID().toString();
String recordTitle = "test title";
String instanceId = UUID.randomUUID().toString();
String instanceHrid = "i001";
String holdingsId = UUID.randomUUID().toString();
String holdingsHrid = "h001";
String itemId = UUID.randomUUID().toString();
String itemHrid = "it001";
String orderId = UUID.randomUUID().toString();
String orderHrid = "o001";
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, instanceId, instanceHrid, null, 0, CREATE, INSTANCE, COMPLETED, null)).compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, holdingsId, holdingsHrid, null, 0, CREATE, HOLDINGS, COMPLETED, null)).compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, itemId, itemHrid, null, 0, CREATE, ITEM, COMPLETED, null)).compose(v -> createJournalRecord(createdJobExecution.getId(), sourceRecordId, orderId, orderHrid, null, 0, CREATE, ORDER, 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() + "/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(instanceId)).body("relatedInstanceInfo.hridList[0]", is(instanceHrid)).body("relatedInstanceInfo.error", emptyOrNullString()).body("relatedHoldingsInfo.idList[0]", is(holdingsId)).body("relatedHoldingsInfo.hridList[0]", is(holdingsHrid)).body("relatedHoldingsInfo.error", emptyOrNullString()).body("relatedItemInfo.idList[0]", is(itemId)).body("relatedItemInfo.hridList[0]", is(itemHrid)).body("relatedItemInfo.error", emptyOrNullString()).body("relatedOrderInfo.idList[0]", is(orderId)).body("relatedOrderInfo.hridList[0]", is(orderHrid)).body("relatedOrderInfo.error", emptyOrNullString()).body("relatedInvoiceInfo.idList", empty()).body("relatedInvoiceInfo.hridList", empty()).body("relatedInvoiceInfo.error", emptyOrNullString());
async.complete();
}));
}
use of org.folio.rest.jaxrs.model.JournalRecord.EntityType.ITEM in project mod-source-record-manager by folio-org.
the class MetadataProviderJobExecutionAPITest method shouldReturnCreatedRecordInstanceHoldingItemSummary.
@Test
public void shouldReturnCreatedRecordInstanceHoldingItemSummary(TestContext context) {
Async async = context.async();
String jobExecutionId = constructAndPostInitJobExecutionRqDto(1).getJobExecutions().get(0).getId();
String sourceRecordId = UUID.randomUUID().toString();
String recordTitle = "test title";
Future<JournalRecord> future = Future.succeededFuture().compose(v -> createJournalRecord(jobExecutionId, sourceRecordId, null, null, recordTitle, 0, CREATE, MARC_BIBLIOGRAPHIC, COMPLETED, null)).compose(v -> createJournalRecord(jobExecutionId, sourceRecordId, null, null, recordTitle, 0, CREATE, INSTANCE, COMPLETED, null)).compose(v -> createJournalRecord(jobExecutionId, sourceRecordId, null, null, recordTitle, 0, CREATE, HOLDINGS, COMPLETED, null)).compose(v -> createJournalRecord(jobExecutionId, sourceRecordId, null, null, recordTitle, 0, CREATE, ITEM, COMPLETED, null)).onFailure(context::fail);
future.onComplete(ar -> context.verify(v -> {
RestAssured.given().spec(spec).when().get(GET_JOB_EXECUTION_SUMMARY_PATH + "/" + jobExecutionId).then().statusCode(HttpStatus.SC_OK).body("jobExecutionId", is(jobExecutionId)).body("sourceRecordSummary.totalCreatedEntities", is(1)).body("sourceRecordSummary.totalUpdatedEntities", is(0)).body("sourceRecordSummary.totalDiscardedEntities", is(0)).body("sourceRecordSummary.totalErrors", is(0)).body("instanceSummary.totalCreatedEntities", is(1)).body("instanceSummary.totalUpdatedEntities", is(0)).body("instanceSummary.totalDiscardedEntities", is(0)).body("instanceSummary.totalErrors", is(0)).body("holdingSummary.totalCreatedEntities", is(1)).body("holdingSummary.totalUpdatedEntities", is(0)).body("holdingSummary.totalDiscardedEntities", is(0)).body("holdingSummary.totalErrors", is(0)).body("itemSummary.totalCreatedEntities", is(1)).body("itemSummary.totalUpdatedEntities", is(0)).body("itemSummary.totalDiscardedEntities", is(0)).body("itemSummary.totalErrors", is(0)).body("authoritySummary", nullValue()).body("orderSummary", nullValue()).body("invoiceSummary", nullValue()).body("totalErrors", is(0)).extract().response().prettyPrint();
async.complete();
}));
}
Aggregations