use of org.folio.rest.support.HridManager in project mod-inventory-storage by folio-org.
the class HridSettingsStorageTest method canGetNextHoldingHrid.
@Test
public void canGetNextHoldingHrid(TestContext testContext) {
log.info("Starting canGetNextHoldingHrid()");
final Vertx vertx = StorageTestSuite.getVertx();
final PostgresClient postgresClient = PostgresClient.getInstance(vertx, TENANT_ID);
final HridManager hridManager = new HridManager(vertx.getOrCreateContext(), postgresClient);
hridManager.getNextHoldingsHrid().compose(hrid -> validateHrid(hrid, "ho00000000001", testContext)).onComplete(testContext.asyncAssertSuccess(v -> log.info("Finished canGetNextHoldingHrid()")));
}
use of org.folio.rest.support.HridManager in project mod-inventory-storage by folio-org.
the class HridSettingsStorageTest method canGetNextItemHrid.
@Test
public void canGetNextItemHrid(TestContext testContext) {
log.info("Starting canGetNextItemHrid()");
final Vertx vertx = StorageTestSuite.getVertx();
final PostgresClient postgresClient = PostgresClient.getInstance(vertx, TENANT_ID);
final HridManager hridManager = new HridManager(vertx.getOrCreateContext(), postgresClient);
hridManager.getNextItemHrid().compose(hrid -> validateHrid(hrid, "it00000000001", testContext)).onComplete(testContext.asyncAssertSuccess(v -> log.info("Finished canGetNextItemHrid()")));
}
use of org.folio.rest.support.HridManager in project mod-inventory-storage by folio-org.
the class HridSettingsStorageTest method canGetNextInstanceHrid.
@Test
public void canGetNextInstanceHrid(TestContext testContext) {
log.info("Starting canGetNextInstanceHrid()");
final Vertx vertx = StorageTestSuite.getVertx();
final PostgresClient postgresClient = PostgresClient.getInstance(vertx, TENANT_ID);
final HridManager hridManager = new HridManager(vertx.getOrCreateContext(), postgresClient);
hridManager.getNextInstanceHrid().compose(hrid -> validateHrid(hrid, "in00000000001", testContext)).onComplete(testContext.asyncAssertSuccess(v -> log.info("Finished canGetNextInstanceHrid()")));
}
use of org.folio.rest.support.HridManager in project mod-inventory-storage by folio-org.
the class HridSettingsStorageAPI method putHridSettingsStorageHridSettings.
@Validate
@Override
public void putHridSettingsStorageHridSettings(HridSettings hridSettings, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
try {
vertxContext.runOnContext(v -> {
try {
final PostgresClient postgresClient = PostgresClient.getInstance(vertxContext.owner(), TenantTool.tenantId(okapiHeaders));
final HridManager hridManager = new HridManager(vertxContext, postgresClient);
hridManager.updateHridSettings(hridSettings).map(success -> successPut(asyncResultHandler)).otherwise(error -> internalErrorPut(asyncResultHandler, error));
} catch (Exception e) {
internalErrorPut(asyncResultHandler, e);
}
});
} catch (Exception e) {
internalErrorPut(asyncResultHandler, e);
}
}
use of org.folio.rest.support.HridManager in project mod-inventory-storage by folio-org.
the class HridSettingsStorageAPI method getHridSettingsStorageHridSettings.
@Validate
@Override
public void getHridSettingsStorageHridSettings(Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
try {
vertxContext.runOnContext(v -> {
try {
final PostgresClient postgresClient = PostgresClient.getInstance(vertxContext.owner(), TenantTool.tenantId(okapiHeaders));
final HridManager hridManager = new HridManager(vertxContext, postgresClient);
hridManager.getHridSettings().map(hridSettings -> successGet(asyncResultHandler, hridSettings)).otherwise(error -> internalErrorGet(asyncResultHandler, error));
} catch (Exception e) {
internalErrorGet(asyncResultHandler, e);
}
});
} catch (Exception e) {
internalErrorGet(asyncResultHandler, e);
}
}
Aggregations