use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class ItemEffectiveCallNumberComponentsTest method canCalculateEffectiveCallNumberPropertyOnCreate.
@Test
@Parameters(source = ItemEffectiveCallNumberComponentsTestData.class, method = "createPropertiesParams")
@TestCaseName("[{index}]: {params}")
public void canCalculateEffectiveCallNumberPropertyOnCreate(CallNumberComponentPropertyNames callNumberProperties, String holdingsPropertyValue, String itemPropertyValue) {
final String effectiveValue = StringUtils.firstNonBlank(itemPropertyValue, holdingsPropertyValue);
IndividualResource holdings = createHoldingsWithPropertySetAndInstance(callNumberProperties.holdingsPropertyName, holdingsPropertyValue);
IndividualResource createdItem = itemsClient.create(nodWithNoBarcode(holdings.getId()).put(callNumberProperties.itemPropertyName, itemPropertyValue));
assertThat(createdItem.getJson().getString(callNumberProperties.itemPropertyName), is(itemPropertyValue));
Response getResponse = itemsClient.getById(createdItem.getId());
assertThat(getResponse.getStatusCode(), is(HttpURLConnection.HTTP_OK));
JsonObject effectiveCallNumberComponents = getResponse.getJson().getJsonObject("effectiveCallNumberComponents");
assertNotNull(effectiveCallNumberComponents);
assertThat(effectiveCallNumberComponents.getString(callNumberProperties.effectivePropertyName), is(effectiveValue));
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class ItemEffectiveCallNumberComponentsTest method createHoldingsWithPropertySetAndInstance.
private IndividualResource createHoldingsWithPropertySetAndInstance(String propertyName, String propertyValue) {
IndividualResource instance = instancesClient.create(instance(UUID.randomUUID()));
IndividualResource holdings = holdingsClient.create(new HoldingRequestBuilder().withId(UUID.randomUUID()).forInstance(instance.getId()).withPermanentLocation(mainLibraryLocationId).create().put(propertyName, propertyValue));
assertThat(holdings.getJson().getString(propertyName), is(propertyValue));
return holdings;
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class HoldingsSourceTest method canNotRemoveSpecialHoldingsSources.
@Test
public void canNotRemoveSpecialHoldingsSources() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
IndividualResource holdingsSource = holdingsSourceClient.create(new JsonObject().put("name", "source with folio source").put("source", "folio"));
UUID folioHoldingsSourceId = holdingsSource.getId();
Response folioDeleteResponse = holdingsSourceClient.attemptToDelete(folioHoldingsSourceId);
// it should not have been deleted:
assertThat(folioDeleteResponse.getStatusCode(), is(HttpURLConnection.HTTP_BAD_REQUEST));
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class HoldingsSourceTest method canReplaceAHoldingsSource.
@Test
public void canReplaceAHoldingsSource() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
IndividualResource sourceResponse = holdingsSourceClient.create(new JsonObject().put("name", "replaceable source"));
JsonObject source = sourceResponse.getJson();
assertThat(source.getString("id"), is(notNullValue()));
assertThat(source.getString("name"), is("replaceable source"));
sourceResponse = holdingsSourceClient.create(new JsonObject().put("name", "replacement source"));
source = sourceResponse.getJson();
assertThat(source.getString("id"), is(notNullValue()));
assertThat(source.getString("name"), is("replacement source"));
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class InstanceDiscoverySuppressMigrationScriptTest method verifySuppressed.
private void verifySuppressed(List<IndividualResource> instances) throws InterruptedException, MalformedURLException, TimeoutException, ExecutionException {
for (IndividualResource instance : instances) {
Instance instanceInStorage = instancesClient.getById(instance.getId()).getJson().mapTo(Instance.class);
assertThat(instanceInStorage.getDiscoverySuppress(), is(true));
}
}
Aggregations