-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CIRCSTORE-526] Add ILR support for publishing batch request update events #489
Changes from all commits
f37a288
a0cc208
fdd1045
de0f3c6
d6b9f8d
d352bfd
da06cac
b07064d
8fd6128
ae54dde
4e6b19e
be69600
62c66cc
ee6a702
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import static org.folio.rest.api.RequestsApiTest.requestStorageUrl; | ||
import static org.folio.rest.api.StorageTestSuite.TENANT_ID; | ||
import static org.folio.rest.api.StorageTestSuite.storageUrl; | ||
import static org.folio.rest.jaxrs.model.RequestQueueReordering.RequestLevel.TITLE; | ||
import static org.folio.rest.support.kafka.FakeKafkaConsumer.removeAllEvents; | ||
import static org.folio.rest.support.matchers.DomainEventAssertions.assertRequestQueueReorderingEvent; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
@@ -22,6 +23,7 @@ | |
|
||
import org.folio.rest.impl.RequestsBatchAPI; | ||
import org.folio.rest.jaxrs.model.Request; | ||
import org.folio.rest.jaxrs.model.RequestQueueReordering; | ||
import org.folio.rest.support.ApiTests; | ||
import org.folio.rest.support.JsonResponse; | ||
import org.folio.rest.support.Response; | ||
|
@@ -245,13 +247,15 @@ public void shouldPublishKafkaEventWhenUpdateRequestPositionsInBatchForTheInstan | |
.map(JsonObject.class::cast) | ||
.sorted(Comparator.comparingInt(obj -> obj.getInteger("position"))) | ||
.toList(); | ||
String firstRequestId = firstRequest.getString("id"); | ||
String secondRequestId = secondRequest.getString("id"); | ||
assertThat(requestsSorted.get(0).getInteger("position"), is(1)); | ||
assertThat(requestsSorted.get(1).getInteger("position"), is(2)); | ||
assertThat(requestsSorted.get(0).getString("id"), is(secondRequest.getString("id"))); | ||
assertThat(requestsSorted.get(1).getString("id"), is(firstRequest.getString("id"))); | ||
assertThat(requestsSorted.get(0).getString("id"), is(secondRequestId)); | ||
assertThat(requestsSorted.get(1).getString("id"), is(firstRequestId)); | ||
|
||
assertRequestQueueReorderingEvent(instanceId.toString(), List.of( | ||
firstRequest.getString("id"), secondRequest.getString("id"))); | ||
assertRequestQueueReorderingEvent(instanceId.toString(), | ||
requestsSorted.get(1).getString("itemId"), List.of(firstRequestId, secondRequestId), TITLE); | ||
Comment on lines
+257
to
+258
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. m.b. it's a good idea to extract constants ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assertRequestQueueReorderingEvent is a universal method that is also applicable to queues with ITEM requestLevel requests |
||
} | ||
|
||
private JsonObject getAllRequestsForItem(UUID itemId) throws Exception { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we work with List in this method (not Collection), accessing an element by index will be more efficient for array-based implementation with constant time complexity O(1)