Skip to content

Commit

Permalink
MODINV-984: Properties changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
VRohach committed Jan 25, 2024
1 parent 5388856 commit 4694d7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/folio/inventory/resources/MoveApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public class MoveApi extends AbstractInventoryResource {
public static final String ITEMS_PROPERTY = "items";
public static final String HOLDINGS_RECORDS_PROPERTY = "holdingsRecords";
public static final String HOLDINGS_STORAGE = "/holdings-storage/holdings";
private static final String HOLDING_ITEMS_PROPERTY = "holdingItems";
private static final String BARE_HOLDING_ITEMS_PROPERTY = "bareHoldingItems";
private static final String HOLDINGS_ITEMS_PROPERTY = "holdingsItems";
private static final String BARE_HOLDINGS_ITEMS_PROPERTY = "bareHoldingsItems";

public MoveApi(final Storage storage, final HttpClient client) {
super(storage, client);
Expand Down Expand Up @@ -184,8 +184,8 @@ private List<HoldingsRecord> updateInstanceIdForHoldings(String toInstanceId, Li
}

private void removeExtraRedundantFields(JsonObject json) {
json.remove(HOLDING_ITEMS_PROPERTY);
json.remove(BARE_HOLDING_ITEMS_PROPERTY);
json.remove(HOLDINGS_ITEMS_PROPERTY);
json.remove(BARE_HOLDINGS_ITEMS_PROPERTY);
}

private void updateHoldings(RoutingContext routingContext, WebContext context, List<String> idsToUpdate,
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/api/holdings/HoldingsApiMoveExamples.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ public void canMoveHoldingsToDifferentInstanceWithExtraRedundantFields() throws

JsonObject firstJsonHoldingsAsRequest = new HoldingRequestBuilder().forInstance(oldInstanceId).create();
final UUID createHoldingsRecord1 = holdingsStorageClient.create(firstJsonHoldingsAsRequest
.put("holdingItems", new JsonArray().add(new JsonObject().put("id", UUID.randomUUID())).add(new JsonObject().put("id", UUID.randomUUID())))
.put("bareHoldingItems", new JsonArray().add(new JsonObject().put("id", UUID.randomUUID())).add(new JsonObject().put("id", UUID.randomUUID()))))
.put("holdingsItems", new JsonArray().add(new JsonObject().put("id", UUID.randomUUID())).add(new JsonObject().put("id", UUID.randomUUID())))
.put("bareHoldingsItems", new JsonArray().add(new JsonObject().put("id", UUID.randomUUID())).add(new JsonObject().put("id", UUID.randomUUID()))))
.getId();

JsonObject secondJsonHoldingsAsRequest = new HoldingRequestBuilder().forInstance(oldInstanceId).create();
final UUID createHoldingsRecord2 = holdingsStorageClient.create(secondJsonHoldingsAsRequest
.put("holdingItems", new JsonArray().add(new JsonObject().put("id", UUID.randomUUID())).add(new JsonObject().put("id", UUID.randomUUID())))
.put("bareHoldingItems", new JsonArray().add(new JsonObject().put("id", UUID.randomUUID())).add(new JsonObject().put("id", UUID.randomUUID()))))
.put("holdingsItems", new JsonArray().add(new JsonObject().put("id", UUID.randomUUID())).add(new JsonObject().put("id", UUID.randomUUID())))
.put("bareHoldingsItems", new JsonArray().add(new JsonObject().put("id", UUID.randomUUID())).add(new JsonObject().put("id", UUID.randomUUID()))))
.getId();

Assert.assertNotEquals(createHoldingsRecord1, createHoldingsRecord2);
Expand Down

0 comments on commit 4694d7a

Please sign in to comment.