use of org.folio.rest.jaxrs.model.Users in project raml-module-builder by folio-org.
the class PgUtilIT method deleteByIdForeignKeyViolation400.
@Test
public void deleteByIdForeignKeyViolation400(TestContext testContext) {
String userId = randomUuid();
String refId = randomUuid();
post(testContext, "Folio", userId, 201);
insertReferencing(testContext, refId, userId);
PgUtil.deleteById("users", userId, okapiHeaders, vertx.getOrCreateContext(), Users.DeleteUsersByUserIdResponse.class, asyncAssertSuccess(testContext, 400, "is still referenced from table referencing"));
}
use of org.folio.rest.jaxrs.model.Users 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.Users in project raml-module-builder by folio-org.
the class PgUtilIT method postResponseWithUser201MethodAndTrigger.
@Test
public void postResponseWithUser201MethodAndTrigger(TestContext testContext) {
String uuid = randomUuid();
PgUtil.post("users", new User().withUsername("dummy").withId(uuid), okapiHeaders, vertx.getOrCreateContext(), ResponseWithUserFor201Method.class, testContext.asyncAssertSuccess(result -> {
assertThat(result.getStatus(), is(201));
assertThat(((User) result.getEntity()).getDummy(), is(DUMMY_VAL));
}));
}
use of org.folio.rest.jaxrs.model.Users in project raml-module-builder by folio-org.
the class PgUtilIT method insert.
/**
* Insert n records into instance table where the title field is build using
* prefix and the number from 1 .. n.
*/
private void insert(TestContext testContext, PostgresClient pg, String prefix, int n) {
Async async = testContext.async();
String table = schema + ".users ";
String sql = "INSERT INTO " + table + " SELECT md5(username)::uuid, json_build_object('username', username, 'id', md5(username)::uuid)" + " FROM (SELECT '" + prefix + " ' || generate_series(1, " + n + ") AS username) AS subquery";
pg.execute(sql, testContext.asyncAssertSuccess(updated -> {
testContext.assertEquals(n, updated.rowCount());
async.complete();
}));
async.awaitSuccess(10000);
}
use of org.folio.rest.jaxrs.model.Users 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;
}
Aggregations