use of org.folio.rest.jaxrs.model.UserdataCollection in project raml-module-builder by folio-org.
the class PgUtilIT method deleteByCQLOK.
@Test
public void deleteByCQLOK(TestContext testContext) {
PostgresClient pg = PostgresClient.getInstance(vertx, "testtenant");
insert(testContext, pg, "delete_a", 1);
insert(testContext, pg, "delete_b1", 1);
insert(testContext, pg, "delete_b2", 1);
// delete two
{
Async async = testContext.async();
PgUtil.delete("users", "username=delete_b*", okapiHeaders, vertx.getOrCreateContext(), Users.DeleteUsersByUserIdResponse.class, testContext.asyncAssertSuccess(res -> {
assertThat(res.getStatus(), is(204));
async.complete();
}));
async.await();
}
// and check 1 left
{
Async async = testContext.async();
PgUtil.get("users", User.class, UserdataCollection.class, "username=delete*", 0, 0, okapiHeaders, vertx.getOrCreateContext(), ResponseImpl.class, testContext.asyncAssertSuccess(response -> {
if (response.getStatus() != 200) {
testContext.fail("Expected status 200, got " + response.getStatus() + " " + response.getStatusInfo().getReasonPhrase());
async.complete();
return;
}
UserdataCollection c = (UserdataCollection) response.getEntity();
assertThat(c.getTotalRecords(), is(1));
async.complete();
}));
async.awaitSuccess(10000);
}
}
use of org.folio.rest.jaxrs.model.UserdataCollection in project raml-module-builder by folio-org.
the class PgUtilIT method searchForDataUnoptimizedNoClass.
private UserdataCollection searchForDataUnoptimizedNoClass(String cql, int offset, int limit, TestContext testContext) {
UserdataCollection userdataCollection = new UserdataCollection();
Async async = testContext.async();
PgUtil.get("users", User.class, Object.class, cql, offset, limit, okapiHeaders, vertx.getOrCreateContext(), ResponseImpl.class, testContext.asyncAssertSuccess(response -> {
if (response.getStatus() != 500) {
testContext.fail("Expected status 500, got " + response.getStatus() + " " + response.getStatusInfo().getReasonPhrase());
async.complete();
return;
}
UserdataCollection c = (UserdataCollection) response.getEntity();
userdataCollection.setTotalRecords(c.getTotalRecords());
userdataCollection.setUsers(c.getUsers());
async.complete();
}));
async.awaitSuccess(10000);
return userdataCollection;
}
use of org.folio.rest.jaxrs.model.UserdataCollection in project raml-module-builder by folio-org.
the class PgUtilIT method searchForDataWithNo500.
private UserdataCollection searchForDataWithNo500(String cql, int offset, int limit, TestContext testContext) {
UserdataCollection userdataCollection = new UserdataCollection();
Async async = testContext.async();
PgUtil.getWithOptimizedSql("users", User.class, UserdataCollection.class, "username", cql, offset, limit, QUERY_TIMEOUT, okapiHeaders, vertx.getOrCreateContext(), ResponseWithout500.class, testContext.asyncAssertSuccess(response -> {
if (response.getStatus() != 500) {
testContext.fail("Expected status 500, got " + response.getStatus() + " " + response.getStatusInfo().getReasonPhrase());
async.complete();
return;
}
async.complete();
}));
async.awaitSuccess(10000);
return userdataCollection;
}
use of org.folio.rest.jaxrs.model.UserdataCollection in project raml-module-builder by folio-org.
the class PgUtilIT method searchForDataUnoptimized.
private UserdataCollection searchForDataUnoptimized(String cql, int offset, int limit, TestContext testContext) {
UserdataCollection userdataCollection = new UserdataCollection();
Async async = testContext.async();
PgUtil.get("users", User.class, UserdataCollection.class, cql, offset, limit, okapiHeaders, vertx.getOrCreateContext(), ResponseImpl.class, testContext.asyncAssertSuccess(response -> {
if (response.getStatus() != 200) {
testContext.fail("Expected status 200, got " + response.getStatus() + " " + response.getStatusInfo().getReasonPhrase());
async.complete();
return;
}
UserdataCollection c = (UserdataCollection) response.getEntity();
userdataCollection.setTotalRecords(c.getTotalRecords());
userdataCollection.setUsers(c.getUsers());
async.complete();
}));
async.awaitSuccess(10000);
return userdataCollection;
}
use of org.folio.rest.jaxrs.model.UserdataCollection in project raml-module-builder by folio-org.
the class PgUtilIT method searchForData.
private UserdataCollection searchForData(String cql, int offset, int limit, TestContext testContext) {
UserdataCollection userdataCollection = new UserdataCollection();
Async async = testContext.async();
PgUtil.getWithOptimizedSql("users", User.class, UserdataCollection.class, "username", cql, offset, limit, QUERY_TIMEOUT, okapiHeaders, vertx.getOrCreateContext(), ResponseImpl.class, testContext.asyncAssertSuccess(response -> {
if (response.getStatus() != 200) {
testContext.fail("Expected status 200, got " + response.getStatus() + " " + response.getStatusInfo().getReasonPhrase());
async.complete();
return;
}
UserdataCollection c = (UserdataCollection) response.getEntity();
userdataCollection.setTotalRecords(c.getTotalRecords());
userdataCollection.setUsers(c.getUsers());
async.complete();
}));
async.awaitSuccess(10000);
return userdataCollection;
}
Aggregations