use of org.folio.rest.jaxrs.model.Users in project raml-module-builder by folio-org.
the class PgUtilIT method postResponseWithUser201Method.
@Test
public void postResponseWithUser201Method(TestContext testContext) {
String uuid = randomUuid();
PgUtil.post("users", new User().withUsername("Susi").withId(uuid), okapiHeaders, vertx.getOrCreateContext(), ResponseWithUserFor201Method.class, testContext.asyncAssertSuccess(result -> {
assertThat(result.getStatus(), is(201));
assertGetById(testContext, uuid, "Susi");
}));
}
use of org.folio.rest.jaxrs.model.Users in project raml-module-builder by folio-org.
the class PgUtilIT method searchForDataNullHeadersExpectFailure.
private String searchForDataNullHeadersExpectFailure(String cql, int offset, int limit, TestContext testContext) {
String responseString = new String();
Async async = testContext.async();
PgUtil.getWithOptimizedSql("users", User.class, UserdataCollection.class, "username", cql, offset, limit, QUERY_TIMEOUT, null, 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;
}
String c = (String) response.getEntity();
responseString.concat(c);
async.complete();
}));
async.awaitSuccess(10000);
return responseString;
}
use of org.folio.rest.jaxrs.model.Users in project raml-module-builder by folio-org.
the class PgUtilIT method put409WhenOptimisticLockingVersionIsWrong.
@Test
public void put409WhenOptimisticLockingVersionIsWrong(TestContext testContext) {
String uuid = randomUuid();
post(testContext, "Pippilotta", uuid, 201);
getUser(uuid).compose(user -> PgUtil.put("users", user.withUsername("Momo").withVersion(5), uuid, okapiHeaders, vertx.getOrCreateContext(), Users.PutUsersByUserIdResponse.class)).onComplete(asyncAssertSuccess(testContext, 409, put -> assertGetById(testContext, uuid, "Pippilotta")));
}
use of org.folio.rest.jaxrs.model.Users in project raml-module-builder by folio-org.
the class PgUtilIT method searchForDataExpectFailure.
private String searchForDataExpectFailure(String cql, int offset, int limit, TestContext testContext) {
StringBuilder responseString = new StringBuilder();
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() != 400) {
testContext.fail("Expected status 400, got " + response.getStatus() + " " + response.getStatusInfo().getReasonPhrase());
async.complete();
return;
}
String c = (String) response.getEntity();
responseString.append(c);
async.complete();
}));
async.awaitSuccess(10000);
return responseString.toString();
}
use of org.folio.rest.jaxrs.model.Users in project raml-module-builder by folio-org.
the class PgUtilIT method putNonexistingId.
@Test
public void putNonexistingId(TestContext testContext) {
String uuid = randomUuid();
PgUtil.put("users", new User().withUsername("Rosamunde"), uuid, okapiHeaders, vertx.getOrCreateContext(), Users.PutUsersByUserIdResponse.class, asyncAssertSuccess(testContext, 404, put -> {
// make sure that a record with this uuid really hasn't been inserted
PgUtil.getById("users", User.class, uuid, okapiHeaders, vertx.getOrCreateContext(), Users.GetUsersByUserIdResponse.class, asyncAssertSuccess(testContext, 404, "Not found"));
}));
}
Aggregations