Skip to content

Commit

Permalink
fix checkstyle problems
Browse files Browse the repository at this point in the history
  • Loading branch information
hgschmie committed Jun 6, 2023
1 parent 38ac324 commit f8513a5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@
* This test uses an oracle instance in a testcontainer.
*/
@Testcontainers
@EnabledOnOs(architectures = { "x86_64", "amd64"} )
@EnabledOnOs(architectures = {"x86_64", "amd64"})
public class TestGetGeneratedKeysOracle {

@Container
public static OracleContainer oc = new OracleContainer("gvenzl/oracle-xe:slim-faststart");

@RegisterExtension
public JdbiExtension oracleExtension = JdbiTestcontainersExtension.instance(oc)
.withPlugin(new SqlObjectPlugin());
.withPlugin(new SqlObjectPlugin());

@BeforeEach
public void beforeEach() {
Handle handle = oracleExtension.getSharedHandle();
handle.execute(
"create sequence something_id_sequence INCREMENT BY 1 START WITH 100");
"create sequence something_id_sequence INCREMENT BY 1 START WITH 100");
handle.execute(
"create table something (name varchar(200), id int, constraint something_id primary key (id))");
"create table something (name varchar(200), id int, constraint something_id primary key (id))");
}

/**
Expand Down
30 changes: 15 additions & 15 deletions src/test/java/org/jdbi/v3/oracle12/TestOracleReturning.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@
* This test uses an oracle instance in a testcontainer.
*/
@Testcontainers
@EnabledOnOs(architectures = { "x86_64", "amd64"} )
@EnabledOnOs(architectures = {"x86_64", "amd64"})
public class TestOracleReturning {

@Container
public static OracleContainer oc = new OracleContainer("gvenzl/oracle-xe:slim-faststart");

@RegisterExtension
public JdbiExtension oracleExtension = JdbiTestcontainersExtension.instance(oc)
.withPlugin(new SqlObjectPlugin());
.withPlugin(new SqlObjectPlugin());

@BeforeEach
public void beforeEach() {
Handle handle = oracleExtension.getSharedHandle();
handle.execute(
"create sequence something_id_sequence INCREMENT BY 1 START WITH 100");
"create sequence something_id_sequence INCREMENT BY 1 START WITH 100");
handle.execute(
"create table something (name varchar(200), id int, constraint something_id primary key (id))");
"create table something (name varchar(200), id int, constraint something_id primary key (id))");
}

@Test
Expand All @@ -63,12 +63,12 @@ public void testReturningDmlPositionalParams() {

try (Update update = h.createUpdate("insert into something(id, name) values (?, ?) returning id into ?")) {
List<Integer> ids = update
.bind(0, 17)
.bind(1, "Brian")
.addCustomizer(returnParameters().register(2, OracleTypes.INTEGER))
.execute(returningDml())
.mapTo(int.class)
.list();
.bind(0, 17)
.bind(1, "Brian")
.addCustomizer(returnParameters().register(2, OracleTypes.INTEGER))
.execute(returningDml())
.mapTo(int.class)
.list();

assertThat(ids).containsExactly(17);
}
Expand All @@ -80,11 +80,11 @@ public void testReturningDmlNamedParams() {

try (Update update = h.createUpdate("insert into something(id, name) values (:id, :name) returning id into :result")) {
List<Integer> ids = update
.bindBean(new Something(20, "Brian"))
.addCustomizer(returnParameters().register("result", OracleTypes.INTEGER))
.execute(returningDml())
.mapTo(int.class)
.list();
.bindBean(new Something(20, "Brian"))
.addCustomizer(returnParameters().register("result", OracleTypes.INTEGER))
.execute(returningDml())
.mapTo(int.class)
.list();

assertThat(ids).containsExactly(20);
}
Expand Down
32 changes: 16 additions & 16 deletions src/test/java/org/jdbi/v3/oracle12/TestOutparameterCursor.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,35 @@
import static org.assertj.core.api.Assertions.assertThat;

@Testcontainers
@EnabledOnOs(architectures = { "x86_64", "amd64"} )
@EnabledOnOs(architectures = {"x86_64", "amd64"})
public class TestOutparameterCursor {

@Container
static OracleContainer oc = new OracleContainer("gvenzl/oracle-xe:slim-faststart");

@RegisterExtension
JdbiExtension oracleExtension = JdbiTestcontainersExtension.instance(oc)
.withInitializer((ds, h) -> {
h.execute("CREATE TABLE USERS (ID INTEGER, NAME VARCHAR(255))");
h.execute("INSERT INTO USERS VALUES (1, 'Alice')");
h.execute("INSERT INTO USERS VALUES (2, 'Bob')");
h.execute("CREATE OR REPLACE PROCEDURE get_user_by_name(\n"
+ "p_name IN USERS.NAME%TYPE,\n"
+ "o_c_dbuser OUT SYS_REFCURSOR) "
+ "AS\n"
+ "BEGIN\n"
+ "OPEN o_c_dbuser FOR\n"
+ "SELECT * FROM USERS WHERE NAME LIKE p_name || '%';\n"
+ "END;");
});
.withInitializer((ds, h) -> {
h.execute("CREATE TABLE USERS (ID INTEGER, NAME VARCHAR(255))");
h.execute("INSERT INTO USERS VALUES (1, 'Alice')");
h.execute("INSERT INTO USERS VALUES (2, 'Bob')");
h.execute("CREATE OR REPLACE PROCEDURE get_user_by_name(\n"
+ "p_name IN USERS.NAME%TYPE,\n"
+ "o_c_dbuser OUT SYS_REFCURSOR) "
+ "AS\n"
+ "BEGIN\n"
+ "OPEN o_c_dbuser FOR\n"
+ "SELECT * FROM USERS WHERE NAME LIKE p_name || '%';\n"
+ "END;");
});

@Test
public void someTest() throws Exception {
RowMapper<User> userMapper = ConstructorMapper.of(User.class);

try (Call call = oracleExtension.getSharedHandle().createCall("call get_user_by_name(:a,:b)")
.bind("a", "Alice")
.registerOutParameter("b", Types.REF_CURSOR)) {
.bind("a", "Alice")
.registerOutParameter("b", Types.REF_CURSOR)) {
List<User> result = call.invoke(outParameters -> {
return outParameters.getRowSet("b").map(userMapper).list();
});
Expand Down

0 comments on commit f8513a5

Please sign in to comment.