diff --git a/src/main/java/org/folio/circulation/resources/SlipsResource.java b/src/main/java/org/folio/circulation/resources/SlipsResource.java index e0b93d71db..5590226cbd 100644 --- a/src/main/java/org/folio/circulation/resources/SlipsResource.java +++ b/src/main/java/org/folio/circulation/resources/SlipsResource.java @@ -124,21 +124,21 @@ private void getMany(RoutingContext routingContext) { return; } - fetchLocationsForServicePoint(servicePointId, clients) - .thenComposeAsync(r -> r.after(ctx -> fetchItemsForLocations(ctx, - itemRepository, LocationRepository.using(clients, servicePointRepository)))) - .thenComposeAsync(r -> r.after(ctx -> fetchRequests(ctx, clients))) - .thenComposeAsync(r -> r.after(ctx -> userRepository.findUsersForRequests( - ctx.getRequests()))) - .thenComposeAsync(result -> result.after(patronGroupRepository::findPatronGroupsForRequestsUsers)) - .thenComposeAsync(r -> r.after(departmentRepository::findDepartmentsForRequestUsers)) - .thenComposeAsync(r -> r.after(addressTypeRepository::findAddressTypesForRequests)) - .thenComposeAsync(r -> r.after(servicePointRepository::findServicePointsForRequests)) - .thenApply(flatMapResult(this::mapResultToJson)) - .thenComposeAsync(r -> r.combineAfter(() -> servicePointRepository.getServicePointById(servicePointId), - this::addPrimaryServicePointNameToStaffSlipContext)) - .thenApply(r -> r.map(JsonHttpResponse::ok)) - .thenAccept(context::writeResultToHttpResponse); + fetchLocationsForServicePoint(servicePointId, clients) + .thenComposeAsync(r -> r.after(ctx -> fetchItemsForLocations(ctx, + itemRepository, LocationRepository.using(clients, servicePointRepository)))) + .thenComposeAsync(r -> r.after(ctx -> fetchRequests(ctx, clients))) + .thenComposeAsync(r -> r.after(ctx -> userRepository.findUsersForRequests( + ctx.getRequests()))) + .thenComposeAsync(result -> result.after(patronGroupRepository::findPatronGroupsForRequestsUsers)) + .thenComposeAsync(r -> r.after(departmentRepository::findDepartmentsForRequestUsers)) + .thenComposeAsync(r -> r.after(addressTypeRepository::findAddressTypesForRequests)) + .thenComposeAsync(r -> r.after(servicePointRepository::findServicePointsForRequests)) + .thenApply(flatMapResult(this::mapResultToJson)) + .thenComposeAsync(r -> r.combineAfter(() -> servicePointRepository.getServicePointById(servicePointId), + this::addPrimaryServicePointNameToStaffSlipContext)) + .thenApply(r -> r.map(JsonHttpResponse::ok)) + .thenAccept(context::writeResultToHttpResponse); } private CompletableFuture> fetchTitleLevelRequests( diff --git a/src/test/java/api/support/APITestContext.java b/src/test/java/api/support/APITestContext.java index 45406e62d7..167f11e91e 100644 --- a/src/test/java/api/support/APITestContext.java +++ b/src/test/java/api/support/APITestContext.java @@ -180,7 +180,7 @@ private static void outputCQLQueryRequestsPerformedAgainstFakes() { static URL okapiUrl() { try { - if (false) { + if (useOkapiForStorage) { return new URL("http://localhost:9130"); } else { return new URL(FakeOkapi.getAddress());