package io.vertx.ext.jdbc;

import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.RunTestOnContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import io.vertx.jdbcclient.JDBCConnectOptions;
import io.vertx.jdbcclient.JDBCPool;
import io.vertx.sqlclient.PoolOptions;
import io.vertx.sqlclient.Tuple;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(VertxUnitRunner.class)
public class OracleTest {

  @Rule
  public final RunTestOnContext rule = new RunTestOnContext();

  @Test
  @Ignore("Cannot run this in CI as we can't install Oracle")
  public void testSimple(TestContext should) {
    final Async test = should.async();

    final JDBCPool pool = JDBCPool.pool(
      rule.vertx(),
      new JDBCConnectOptions()
        .setJdbcUrl("jdbc:oracle:thin:@127.0.0.1:1521:xe")
        .setUser("sys as sysdba")
        .setPassword("vertx"),
      new PoolOptions());

    pool.preparedQuery("DELETE FROM product WHERE id = ?")
      .execute(Tuple.of("missing-id"))
      .onFailure(should::fail)
      .onSuccess(rowSet -> {
        test.complete();
      });
  }
}

@@ -1176,11 +1176,879 @@
  %7D);%0A  %7D
+%0A%0A  @Test%0A  @Ignore(%22Cannot run this in CI as we can't install Oracle%22)%0A  public void testBlocking(TestContext should) %7B%0A//    CREATE OR REPLACE FUNCTION MYSCHEMA.TEST_SLEEP%0A//      (%0A//        TIME_  IN  NUMBER%0A//      )%0A//    RETURN INTEGER IS%0A//      BEGIN%0A//    DBMS_LOCK.sleep(seconds =%3E TIME_);%0A//    RETURN 1;%0A//    EXCEPTION%0A//    WHEN OTHERS THEN%0A//      RAISE;%0A//    RETURN 1;%0A//    END TEST_SLEEP;%0A%0A    final Async test = should.async();%0A%0A    final JDBCPool pool = JDBCPool.pool(%0A      rule.vertx(),%0A      new JDBCConnectOptions()%0A        .setJdbcUrl(%22jdbc:oracle:thin:@127.0.0.1:1521:xe%22)%0A        .setUser(%22sys as sysdba%22)%0A        .setPassword(%22vertx%22),%0A      new PoolOptions());%0A%0A    pool.preparedQuery(%22SELECT TEST_SLEEP(10.5) FROM DUAL%22)%0A      .execute()%0A      .onFailure(should::fail)%0A      .onSuccess(rowSet -%3E %7B%0A        test.complete();%0A      %7D);%0A  %7D
 %0A%7D%0A

Fix #169: Please upgrade to the new sql-client API