use of api.support.builders.HoldingRequestBuilder in project mod-inventory by folio-org.
the class MarkItemIntellectualItemApiTests method createInstanceAndHoldingsRecord.
@Before
public void createInstanceAndHoldingsRecord() throws Exception {
final IndividualResource instance = instancesClient.create(smallAngryPlanet(UUID.randomUUID()));
holdingsRecord = holdingsStorageClient.create(new HoldingRequestBuilder().forInstance(instance.getId()));
}
use of api.support.builders.HoldingRequestBuilder in project mod-inventory by folio-org.
the class HoldingApiExample method cannotUpdateAHoldingWithOptimisticLockingFailure.
@Test
public void cannotUpdateAHoldingWithOptimisticLockingFailure() throws Exception {
JsonObject instance = createInstance(smallAngryPlanet(UUID.randomUUID()));
JsonObject holding = new HoldingRequestBuilder().forInstance(UUID.fromString(instance.getString("id"))).permanentlyInMainLibrary().create().put("id", ApiTestSuite.ID_FOR_OPTIMISTIC_LOCKING_FAILURE);
assertThat(createHolding(holding).getStatusCode(), is(201));
assertThat(updateHolding(holding).getStatusCode(), is(409));
}
use of api.support.builders.HoldingRequestBuilder in project mod-inventory by folio-org.
the class HoldingApiExample method canCreateAHolding.
@Test
public void canCreateAHolding() throws InterruptedException, MalformedURLException, TimeoutException, ExecutionException {
JsonObject createdInstance = createInstance(smallAngryPlanet(UUID.randomUUID()));
IndividualResource postResponse = holdingsStorageClient.create(new HoldingRequestBuilder().forInstance(UUID.fromString(createdInstance.getString("id"))).permanentlyInMainLibrary());
JsonObject createdHolding = holdingsStorageClient.getById(postResponse.getId()).getJson();
assertTrue(createdHolding.containsKey("id"));
assertEquals(createdInstance.getString("id"), createdHolding.getString("instanceId"));
assertTrue(createdHolding.containsKey("permanentLocationId"));
}
use of api.support.builders.HoldingRequestBuilder in project mod-inventory by folio-org.
the class HoldingApiExample method cannotCreateAHoldingWithoutInstanceId.
@Test
public void cannotCreateAHoldingWithoutInstanceId() throws InterruptedException, MalformedURLException, TimeoutException, ExecutionException {
JsonObject createdInstance = createInstance(smallAngryPlanet(UUID.randomUUID()));
JsonObject holdingAsJson = new HoldingRequestBuilder().forInstance(UUID.fromString(createdInstance.getString("id"))).permanentlyInMainLibrary().create();
holdingAsJson.remove("instanceId");
assertThat(createHolding(holdingAsJson).getStatusCode(), is(422));
}
use of api.support.builders.HoldingRequestBuilder in project mod-inventory by folio-org.
the class MarkItemUnknownApiTests method createInstanceAndHoldingsRecord.
@Before
public void createInstanceAndHoldingsRecord() throws Exception {
final IndividualResource instance = instancesClient.create(smallAngryPlanet(UUID.randomUUID()));
holdingsRecord = holdingsStorageClient.create(new HoldingRequestBuilder().forInstance(instance.getId()));
}
Aggregations