use of org.folio.rest.jaxrs.model.HridSettings in project mod-inventory-storage by folio-org.
the class HridSettingsStorageTest method cannotUpdateHridSettingsWithBadTenant.
@Test
public void cannotUpdateHridSettingsWithBadTenant() throws InterruptedException, ExecutionException, TimeoutException {
log.info("Starting cannotUpdateHridSettingsWithBadTenant()");
final CompletableFuture<Response> putCompleted = new CompletableFuture<>();
final HridSettings newHridSettings = new HridSettings().withInstances(new HridSetting().withPrefix("inst").withStartNumber(100L)).withHoldings(new HridSetting().withPrefix("hold").withStartNumber(200L)).withItems(new HridSetting().withPrefix("item").withStartNumber(500L));
client.put(InterfaceUrls.hridSettingsStorageUrl(""), newHridSettings, "BAD", text(putCompleted));
final Response putResponse = putCompleted.get(5, SECONDS);
assertThat(putResponse.getStatusCode(), is(500));
log.info("Finished canUpdateHridSettings()");
}
use of org.folio.rest.jaxrs.model.HridSettings in project mod-inventory-storage by folio-org.
the class HridSettingsStorageTest method canGetNextHoldingHridAfterSettingStartNumber.
@Test
public void canGetNextHoldingHridAfterSettingStartNumber(TestContext testContext) {
log.info("Starting canGetNextHoldingHridAfterSettingStartNumber()");
final HridSettings newHridSettings = new HridSettings().withInstances(new HridSetting().withPrefix("in").withStartNumber(1L)).withHoldings(new HridSetting().withPrefix("ho").withStartNumber(7890L)).withItems(new HridSetting().withPrefix("it").withStartNumber(1L));
hridManager.updateHridSettings(newHridSettings).onComplete(testContext.asyncAssertSuccess(hridSettings -> getNextHoldingsHrid().compose(hrid -> validateHrid(hrid, "ho00000007890", testContext)).onComplete(testContext.asyncAssertSuccess(v -> log.info("Finished canGetNextHoldingHridAfterSettingStartNumber()")))));
}
use of org.folio.rest.jaxrs.model.HridSettings in project mod-inventory-storage by folio-org.
the class HridSettingsStorageTest method cannotUpdateHridSettingsID.
@Test
public void cannotUpdateHridSettingsID() throws InterruptedException, ExecutionException, TimeoutException {
log.info("Starting cannotUpdateHridSettingsID()");
final CompletableFuture<Response> originalGetCompleted = new CompletableFuture<>();
client.get(InterfaceUrls.hridSettingsStorageUrl(""), TENANT_ID, json(originalGetCompleted));
final Response originalGetResponse = originalGetCompleted.get(5, SECONDS);
assertThat(originalGetResponse.getStatusCode(), is(200));
final HridSettings originalHridSettings = originalGetResponse.getJson().mapTo(HridSettings.class);
final String uuid = UUID.randomUUID().toString();
final HridSettings newHridSettings = new HridSettings().withId(uuid).withInstances(new HridSetting().withPrefix("inst").withStartNumber(100L)).withHoldings(new HridSetting().withPrefix("hold").withStartNumber(200L)).withItems(new HridSetting().withPrefix("item").withStartNumber(500L));
final CompletableFuture<Response> putCompleted = new CompletableFuture<>();
client.put(InterfaceUrls.hridSettingsStorageUrl(""), newHridSettings, TENANT_ID, empty(putCompleted));
final Response putResponse = putCompleted.get(5, SECONDS);
assertThat(putResponse.getStatusCode(), is(204));
final CompletableFuture<Response> getAfterUpdateCompleted = new CompletableFuture<>();
client.get(InterfaceUrls.hridSettingsStorageUrl(""), TENANT_ID, json(getAfterUpdateCompleted));
final Response getAfterUpdateResponse = getAfterUpdateCompleted.get(5, SECONDS);
final HridSettings actualHridSettings = getAfterUpdateResponse.getJson().mapTo(HridSettings.class);
assertThat(actualHridSettings.getId(), not(uuid));
assertThat(actualHridSettings.getId(), is(originalHridSettings.getId()));
assertThat(actualHridSettings.getInstances(), is(notNullValue()));
assertThat(actualHridSettings.getInstances().getPrefix(), is(newHridSettings.getInstances().getPrefix()));
assertThat(actualHridSettings.getInstances().getStartNumber(), is(newHridSettings.getInstances().getStartNumber()));
assertThat(actualHridSettings.getHoldings(), is(notNullValue()));
assertThat(actualHridSettings.getHoldings().getPrefix(), is(newHridSettings.getHoldings().getPrefix()));
assertThat(actualHridSettings.getHoldings().getStartNumber(), is(newHridSettings.getHoldings().getStartNumber()));
assertThat(actualHridSettings.getItems(), is(notNullValue()));
assertThat(actualHridSettings.getItems().getPrefix(), is(newHridSettings.getItems().getPrefix()));
assertThat(actualHridSettings.getItems().getStartNumber(), is(newHridSettings.getItems().getStartNumber()));
log.info("Finished cannotUpdateHridSettingsID()");
}
use of org.folio.rest.jaxrs.model.HridSettings in project mod-inventory-storage by folio-org.
the class HridSettingsStorageTest method canGetNextItemHridAfterSettingStartNumber.
@Test
public void canGetNextItemHridAfterSettingStartNumber(TestContext testContext) {
log.info("Starting canGetNextItemHridAfterSettingStartNumber()");
final HridSettings newHridSettings = new HridSettings().withInstances(new HridSetting().withPrefix("in").withStartNumber(1L)).withHoldings(new HridSetting().withPrefix("ho").withStartNumber(1L)).withItems(new HridSetting().withPrefix("it").withStartNumber(87654321L));
hridManager.updateHridSettings(newHridSettings).onComplete(testContext.asyncAssertSuccess(hridSettings -> getNextItemHrid().compose(hrid -> validateHrid(hrid, "it00087654321", testContext)).onComplete(testContext.asyncAssertSuccess(v -> log.info("Finished canGetNextItemHridAfterSettingStartNumber()")))));
}
use of org.folio.rest.jaxrs.model.HridSettings in project mod-inventory-storage by folio-org.
the class HridSettingsStorageTest method canUpdateHridSettings.
@Test
public void canUpdateHridSettings() throws InterruptedException, ExecutionException, TimeoutException {
log.info("Starting canUpdateHridSettings()");
final CompletableFuture<Response> putCompleted = new CompletableFuture<>();
final HridSettings newHridSettings = new HridSettings().withInstances(new HridSetting().withPrefix("inst").withStartNumber(100L)).withHoldings(new HridSetting().withPrefix("hold").withStartNumber(200L)).withItems(new HridSetting().withPrefix("item").withStartNumber(500L));
client.put(InterfaceUrls.hridSettingsStorageUrl(""), newHridSettings, TENANT_ID, empty(putCompleted));
final Response putResponse = putCompleted.get(5, SECONDS);
assertThat(putResponse.getStatusCode(), is(204));
final CompletableFuture<Response> getCompleted = new CompletableFuture<>();
client.get(InterfaceUrls.hridSettingsStorageUrl(""), TENANT_ID, json(getCompleted));
final Response getResponse = getCompleted.get(5, SECONDS);
final HridSettings actualHridSettings = getResponse.getJson().mapTo(HridSettings.class);
assertThat(actualHridSettings.getInstances(), is(notNullValue()));
assertThat(actualHridSettings.getInstances().getPrefix(), is(newHridSettings.getInstances().getPrefix()));
assertThat(actualHridSettings.getInstances().getStartNumber(), is(newHridSettings.getInstances().getStartNumber()));
assertThat(actualHridSettings.getHoldings(), is(notNullValue()));
assertThat(actualHridSettings.getHoldings().getPrefix(), is(newHridSettings.getHoldings().getPrefix()));
assertThat(actualHridSettings.getHoldings().getStartNumber(), is(newHridSettings.getHoldings().getStartNumber()));
assertThat(actualHridSettings.getItems(), is(notNullValue()));
assertThat(actualHridSettings.getItems().getPrefix(), is(newHridSettings.getItems().getPrefix()));
assertThat(actualHridSettings.getItems().getStartNumber(), is(newHridSettings.getItems().getStartNumber()));
log.info("Finished canUpdateHridSettings()");
}
Aggregations