This is an automated email from the git hooks/post-receive script. New commit to branch feature/jooq in repository wao. See https://gitlab.nuiton.org/None/wao.git commit 4c87fcd7abf399c7196b41da7dc0d845c2606b4e Author: Brendan Le Ny <bleny@codelutin.com> Date: Fri Apr 1 16:33:16 2016 +0200 Plus de tests --- wao-persistence-jooq/src/test/java/JooqTest.java | 42 +++++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/wao-persistence-jooq/src/test/java/JooqTest.java b/wao-persistence-jooq/src/test/java/JooqTest.java index 6066c50..43a098f 100644 --- a/wao-persistence-jooq/src/test/java/JooqTest.java +++ b/wao-persistence-jooq/src/test/java/JooqTest.java @@ -1,4 +1,5 @@ import fr.ifremer.wao.entity.Tables; +import fr.ifremer.wao.entity.tables.records.EssaiDeVueRecord; import org.jooq.DSLContext; import org.jooq.Record; import org.jooq.Record2; @@ -15,16 +16,18 @@ import java.sql.Timestamp; public class JooqTest { + public static final String USER_NAME = "obsmer"; + + public static final String PASSWORD = "obsmer"; + + public static final String URL = "jdbc:postgresql://localhost/obsmer"; + @Test public void test1() throws SQLException { - String userName = "obsmer"; - String password = "obsmer"; - String url = "jdbc:postgresql://localhost/obsmer"; - // Connection is the only JDBC resource that we need // PreparedStatement and ResultSet are handled by jOOQ, internally - try (Connection conn = DriverManager.getConnection(url, userName, password)) { + try (Connection conn = DriverManager.getConnection(URL, USER_NAME, PASSWORD)) { DSLContext create = DSL.using(conn, SQLDialect.POSTGRES_9_4); Result<Record> result = create.select().from(Tables.SAMPLEROW).fetch(); @@ -47,4 +50,33 @@ public class JooqTest { } + @Test + public void chargerLeContenuDepuisUneVue() throws SQLException { + + // Connection is the only JDBC resource that we need + // PreparedStatement and ResultSet are handled by jOOQ, internally + try (Connection conn = DriverManager.getConnection(URL, USER_NAME, PASSWORD)) { + DSLContext create = DSL.using(conn, SQLDialect.POSTGRES_9_4); + Result<EssaiDeVueRecord> result = create.selectFrom(Tables.ESSAI_DE_VUE).getResult(); + for (EssaiDeVueRecord essaiDeVueRecord : result) { + String dcf5code = essaiDeVueRecord.getDcf5code(); + System.out.println(dcf5code); + } + } + + } + + @Test + public void genererUnCsvLeContenuDepuisUneVue() throws SQLException { + + // Connection is the only JDBC resource that we need + // PreparedStatement and ResultSet are handled by jOOQ, internally + try (Connection conn = DriverManager.getConnection(URL, USER_NAME, PASSWORD)) { + DSLContext create = DSL.using(conn, SQLDialect.POSTGRES_9_4); + String csv = create.fetch(Tables.CONTACT).formatJSON(); + System.out.println(csv); + } + + } + } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.