Search in sources :

Example 1 with CqlQuery

use of api.support.http.CqlQuery in project mod-circulation by folio-org.

the class CheckInByBarcodeTests method verifyCheckInOperationRecorded.

private void verifyCheckInOperationRecorded(UUID itemId, UUID servicePoint) {
    final CqlQuery query = CqlQuery.queryFromTemplate("itemId=%s", itemId);
    final MultipleJsonRecords recordedOperations = checkInOperationClient.getMany(query);
    assertThat(recordedOperations.totalRecords(), is(1));
    recordedOperations.forEach(checkInOperation -> {
        assertThat(checkInOperation.getString("occurredDateTime"), withinSecondsBeforeNow(2));
        assertThat(checkInOperation.getString("itemId"), is(itemId.toString()));
        assertThat(checkInOperation.getString("servicePointId"), is(servicePoint.toString()));
        assertThat(checkInOperation.getString("performedByUserId"), is(getUserId()));
    });
}
Also used : MultipleJsonRecords(api.support.MultipleJsonRecords) CqlQuery(api.support.http.CqlQuery)

Example 2 with CqlQuery

use of api.support.http.CqlQuery in project mod-circulation by folio-org.

the class InHouseUseCheckInTest method verifyLastCheckInWasRecorded.

private void verifyLastCheckInWasRecorded(UUID itemId, UUID servicePoint) {
    final CqlQuery query = queryFromTemplate("itemId=%s and itemStatusPriorToCheckIn=Available", itemId);
    final MultipleJsonRecords recordedOperations = checkInOperationClient.getMany(query);
    assertThat(recordedOperations.totalRecords(), greaterThan(0));
    final String itemEffectiveLocationId = itemsClient.getById(itemId).getJson().getString("effectiveLocationId");
    final JsonObject lastOperation = recordedOperations.getFirst();
    assertThat(lastOperation.getString("occurredDateTime"), withinSecondsBeforeNow(2));
    assertThat(lastOperation.getString("itemId"), is(itemId.toString()));
    assertThat(lastOperation.getString("servicePointId"), is(servicePoint.toString()));
    assertThat(lastOperation.getString("performedByUserId"), is(getUserId()));
    assertThat(lastOperation.getString("itemStatusPriorToCheckIn"), is("Available"));
    assertThat(lastOperation.getString("itemLocationId"), is(itemEffectiveLocationId));
    assertThat(lastOperation.getInteger("requestQueueSize"), is(0));
    assertTrue(isServedByServicePoint(UUID.fromString(itemEffectiveLocationId), servicePoint));
}
Also used : MultipleJsonRecords(api.support.MultipleJsonRecords) JsonObject(io.vertx.core.json.JsonObject) CqlQuery(api.support.http.CqlQuery)

Aggregations

MultipleJsonRecords (api.support.MultipleJsonRecords)2 CqlQuery (api.support.http.CqlQuery)2 JsonObject (io.vertx.core.json.JsonObject)1