use of org.folio.rest.persist.Criteria.UpdateSection in project raml-module-builder by folio-org.
the class PostgresClientIT method updateSectionFailure.
@Test
public void updateSectionFailure(TestContext context) {
UpdateSection updateSection = new UpdateSection();
updateSection.addField("key").setValue("x");
createFoo(context).update("nonexistingTable", updateSection, (Criterion) null, false, context.asyncAssertFailure());
}
use of org.folio.rest.persist.Criteria.UpdateSection in project raml-module-builder by folio-org.
the class PostgresClientIT method updateNullConnection2.
@Test
public void updateNullConnection2(TestContext context) {
UpdateSection updateSection = new UpdateSection();
updateSection.addField("key").setValue("x");
postgresClientNullConnection().update(FOO, updateSection, (Criterion) null, false, context.asyncAssertFailure());
}
use of org.folio.rest.persist.Criteria.UpdateSection in project raml-module-builder by folio-org.
the class PostgresClientIT method updateGetConnectionFails2.
@Test
public void updateGetConnectionFails2(TestContext context) {
UpdateSection updateSection = new UpdateSection();
updateSection.addField("key").setValue("x");
postgresClientGetConnectionFails().update(FOO, updateSection, (Criterion) null, false, context.asyncAssertFailure());
}
use of org.folio.rest.persist.Criteria.UpdateSection in project raml-module-builder by folio-org.
the class PostgresClientIT method updateSectionCriterion.
@Test
public void updateSectionCriterion(TestContext context) {
// update key=z where key='
Criterion criterion = new Criterion().addCriterion(new Criteria().addField("'key'").setOperation("=").setVal("'"));
UpdateSection updateSection = new UpdateSection();
updateSection.addField("key").setValue("z");
String id = randomUuid();
postgresClient = insertXAndSingleQuotePojo(context, new JsonArray().add(randomUuid()).add(id));
postgresClient.update(FOO, updateSection, criterion, false, context.asyncAssertSuccess(update -> {
context.assertEquals(1, update.rowCount(), "number of records updated");
String sql = "SELECT jsonb->>'key' FROM " + FOO + " WHERE id='" + id + "'";
postgresClient.selectSingle(sql, context.asyncAssertSuccess(select -> {
context.assertEquals("z", select.getString(0), "single quote became z");
}));
}));
}
use of org.folio.rest.persist.Criteria.UpdateSection in project raml-module-builder by folio-org.
the class PostgresClientIT method updateSectionSingleQuote.
@Test
public void updateSectionSingleQuote(TestContext context) {
UpdateSection updateSection = new UpdateSection();
updateSection.addField("key").setValue("'");
postgresClient = createFoo(context);
postgresClient.save(FOO, xPojo, context.asyncAssertSuccess(save -> {
postgresClient.update(FOO, updateSection, (Criterion) null, true, context.asyncAssertSuccess(update -> {
context.assertEquals(1, update.rowCount(), "number of records updated");
postgresClient.selectSingle("SELECT jsonb->>'key' FROM " + FOO, context.asyncAssertSuccess(select -> {
context.assertEquals("'", select.getString(0), "single quote");
}));
}));
}));
}
Aggregations