use of io.vertx.mutiny.sqlclient.Row in project smallrye-mutiny-vertx-bindings by smallrye.
the class PostGreSQLClientTest method testSequence.
@Test
public void testSequence() {
PgConnectOptions options = new PgConnectOptions().setPort(container.getMappedPort(5432)).setHost(container.getContainerIpAddress()).setDatabase(container.getDatabaseName()).setUser(container.getUsername()).setPassword(container.getPassword());
Pool client = PgPool.pool(vertx, options, new PoolOptions().setMaxSize(5));
Uni<Tuple2<RowSet<Row>, RowSet<Row>>> uni = client.getConnection().flatMap(c -> Uni.combine().all().unis(c.preparedQuery("SELECT 1").execute(), c.preparedQuery("SELECT 1").execute()).asTuple());
Tuple2<RowSet<Row>, RowSet<Row>> results = uni.await().indefinitely();
assertThat(results).isNotNull();
assertThat(results.size()).isEqualTo(2);
assertThat(results.getItem1()).isNotNull();
assertThat(results.getItem2()).isNotNull();
}
use of io.vertx.mutiny.sqlclient.Row in project smallrye-mutiny-vertx-bindings by smallrye.
the class DB2ClientTest method testSequence.
@Test
public void testSequence() {
DB2ConnectOptions options = new DB2ConnectOptions().setPort(container.getMappedPort(50000)).setHost(container.getContainerIpAddress()).setDatabase(container.getDatabaseName()).setUser(container.getUsername()).setPassword(container.getPassword());
Pool client = DB2Pool.pool(vertx, options, new PoolOptions().setMaxSize(5));
Uni<Tuple2<RowSet<Row>, RowSet<Row>>> uni = client.getConnection().flatMap(c -> Uni.combine().all().unis(c.preparedQuery("SELECT 1 FROM SYSIBM.SYSDUMMY1").execute(), c.preparedQuery("SELECT 1 FROM SYSIBM.SYSDUMMY1").execute()).asTuple());
Tuple2<RowSet<Row>, RowSet<Row>> results = uni.await().indefinitely();
assertThat(results).isNotNull();
assertThat(results.size()).isEqualTo(2);
assertThat(results.getItem1()).isNotNull();
assertThat(results.getItem2()).isNotNull();
}
use of io.vertx.mutiny.sqlclient.Row in project kogito-apps by kiegroup.
the class PostgreSqlJobRepositoryTest method from.
@Test
void from() {
PointInTimeTrigger trigger = new PointInTimeTrigger(time.toInstant().getEpochSecond(), null, null);
Recipient recipient = new Recipient.HTTPRecipient("test");
Row row = mock(Row.class);
when(row.getString("id")).thenReturn("test");
when(row.getString("correlation_id")).thenReturn("test");
when(row.getString("status")).thenReturn("SCHEDULED");
when(row.getOffsetDateTime("last_update")).thenReturn(time.toOffsetDateTime());
when(row.getInteger("retries")).thenReturn(1);
when(row.getInteger("execution_counter")).thenReturn(1);
when(row.getString("scheduled_id")).thenReturn("test");
when(row.get(JsonObject.class, 7)).thenReturn(new JsonObject("{\"payload\": \"test\"}"));
when(row.getString("type")).thenReturn("HTTP");
when(row.getInteger("priority")).thenReturn(1);
when(row.get(JsonObject.class, 10)).thenReturn(new JsonObject().put("recipientMarshaller", "test"));
when(row.get(JsonObject.class, 11)).thenReturn(new JsonObject().put("triggerMarshaller", "test"));
JobDetails jobDetails = repository.from(row);
JobDetails expected = JobDetails.builder().id("test").correlationId("test").status(JobStatus.SCHEDULED).lastUpdate(time).retries(1).executionCounter(1).scheduledId("test").payload("{\"payload\": \"test\"}").type(JobDetails.Type.HTTP).priority(1).recipient(recipient).trigger(trigger).build();
assertEquals(expected, jobDetails);
}
Aggregations