[#2289] Added jOOQ-flyway-example to Travis-CI
This commit is contained in:
parent
b45b24ce32
commit
59d996dbb9
@ -6,11 +6,13 @@ jdk:
|
||||
install:
|
||||
- sh -c 'mvn install -DskipTests=true'
|
||||
- sh -c 'echo $JAVA_HOME | grep -q 8 && cd jOOQ-examples/jOOQ-spring-example && mvn install -DskipTests=true' || echo "Skipping for JDK6 and 7"
|
||||
- sh -c 'echo $JAVA_HOME | grep -q 8 && cd jOOQ-examples/jOOQ-flyway-example && mvn install -DskipTests=true' || echo "Skipping for JDK6 and 7"
|
||||
- sh -c 'cd jOOQ-examples/jOOQ-spring-guice-example && mvn install -DskipTests=true'
|
||||
- sh -c 'echo $JAVA_HOME | grep -q 8 && cd jOOQ-test-utils && mvn install -DskipTest=true' || echo "Skipping for JDK6 and 7"
|
||||
- sh -c 'echo $JAVA_HOME | grep -q 8 && cd jOOQ-test && mvn install -DskipTests=true' || echo "Skipping for JDK6 and 7"
|
||||
script:
|
||||
- sh -c 'mvn test'
|
||||
- sh -c 'echo $JAVA_HOME | grep -q 8 && cd jOOQ-examples/jOOQ-spring-example && mvn test' || echo "Skipping for JDK6 and 7"
|
||||
- sh -c 'echo $JAVA_HOME | grep -q 8 && cd jOOQ-examples/jOOQ-flyway-example && mvn test' || echo "Skipping for JDK6 and 7"
|
||||
- sh -c 'cd jOOQ-examples/jOOQ-spring-guice-example && mvn test'
|
||||
- sh -c 'echo $JAVA_HOME | grep -q 8 && cd jOOQ-test && mvn test -Dorg.jooq.test-dialects=h2 -Dorg.jooq.test.pretty-printer=false -Dlog4j.configuration=log4j-quiet.xml' || echo "Skipping for JDK6 and 7"
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
Thanks for downloading jOOQ.
|
||||
Please visit http://www.jooq.org for more information.
|
||||
|
||||
This example was inspired by Petri Kainulainen's excellent blog post:
|
||||
http://www.petrikainulainen.net/programming/jooq/using-jooq-with-spring-configuration/
|
||||
|
||||
To install and run this example, please check out the complete jOOQ repository first, and use Maven to install the latest SNAPSHOT version of jOOQ:
|
||||
|
||||
```
|
||||
@ -13,7 +10,7 @@ $ ls
|
||||
jOOQ jOOQ-meta jOOQ-codegen ...
|
||||
$ mvn clean install
|
||||
...
|
||||
$ cd jOOQ-examples/jOOQ-spring-example
|
||||
$ cd jOOQ-examples/jOOQ-flyway-example
|
||||
...
|
||||
$ mvn clean install
|
||||
```
|
||||
|
||||
@ -62,6 +62,22 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
<maxmem>1024m</maxmem>
|
||||
<meminitial>256m</meminitial>
|
||||
<encoding>UTF-8</encoding>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<debug>true</debug>
|
||||
<debuglevel>lines,vars,source</debuglevel>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-maven-plugin</artifactId>
|
||||
@ -94,24 +110,25 @@
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<jdbc>
|
||||
<url>${db.url}</url>
|
||||
<user>${db.username}</user>
|
||||
</jdbc>
|
||||
<generator>
|
||||
<database>
|
||||
<includes>.*</includes>
|
||||
<inputSchema>FLYWAY_TEST</inputSchema>
|
||||
</database>
|
||||
<target>
|
||||
<packageName>org.jooq.example.flyway.db.h2</packageName>
|
||||
<directory>target/generated-sources/jooq-h2</directory>
|
||||
</target>
|
||||
</generator>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
<configuration>
|
||||
<jdbc>
|
||||
<url>${db.url}</url>
|
||||
<user>${db.username}</user>
|
||||
</jdbc>
|
||||
<generator>
|
||||
<database>
|
||||
<includes>.*</includes>
|
||||
<inputSchema>FLYWAY_TEST</inputSchema>
|
||||
</database>
|
||||
<target>
|
||||
<packageName>org.jooq.example.flyway.db.h2</packageName>
|
||||
<directory>target/generated-sources/jooq-h2</directory>
|
||||
</target>
|
||||
</generator>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@ -1,27 +1,17 @@
|
||||
CREATE TABLE flyway_test.book (
|
||||
id INT NOT NULL,
|
||||
author_id INT NOT NULL,
|
||||
co_author_id INT,
|
||||
details_id INT,
|
||||
title VARCHAR(400) NOT NULL,
|
||||
published_in INT,
|
||||
language_id INT,
|
||||
content_text CLOB,
|
||||
content_pdf BLOB,
|
||||
|
||||
rec_version INT,
|
||||
rec_timestamp TIMESTAMP,
|
||||
|
||||
CONSTRAINT pk_t_book PRIMARY KEY (id),
|
||||
CONSTRAINT fk_t_book_author_id FOREIGN KEY (author_id) REFERENCES flyway_test.author(id),
|
||||
CONSTRAINT fk_t_book_co_author_id FOREIGN KEY (co_author_id) REFERENCES flyway_test.author(id)
|
||||
CONSTRAINT fk_t_book_author_id FOREIGN KEY (author_id) REFERENCES flyway_test.author(id)
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO flyway_test.author VALUES (next value for flyway_test.s_author_id, 'George', 'Orwell', '1903-06-25', 1903, null);
|
||||
INSERT INTO flyway_test.author VALUES (next value for flyway_test.s_author_id, 'Paulo', 'Coelho', '1947-08-24', 1947, null);
|
||||
|
||||
INSERT INTO flyway_test.book VALUES (1, 1, null, null, '1984', 1948, 1, 'To know and not to know, to be conscious of complete truthfulness while telling carefully constructed lies, to hold simultaneously two opinions which cancelled out, knowing them to be contradictory and believing in both of them, to use logic against logic, to repudiate morality while laying claim to it, to believe that democracy was impossible and that the Party was the guardian of democracy, to forget, whatever it was necessary to forget, then to draw it back into memory again at the moment when it was needed, and then promptly to forget it again, and above all, to apply the same process to the process itself -- that was the ultimate subtlety; consciously to induce unconsciousness, and then, once again, to become unconscious of the act of hypnosis you had just performed. Even to understand the word ''doublethink'' involved the use of doublethink..', null, 1, '2010-01-01 00:00:00');
|
||||
INSERT INTO flyway_test.book VALUES (2, 1, null, null, 'Animal Farm', 1945, 1, null, null, null, '2010-01-01 00:00:00');
|
||||
INSERT INTO flyway_test.book VALUES (3, 2, null, null, 'O Alquimista', 1988, 4, null, null, 1, null);
|
||||
INSERT INTO flyway_test.book VALUES (4, 2, null, null, 'Brida', 1990, 2, null, null, null, null);
|
||||
INSERT INTO flyway_test.book VALUES (1, 1, '1984');
|
||||
INSERT INTO flyway_test.book VALUES (2, 1, 'Animal Farm');
|
||||
INSERT INTO flyway_test.book VALUES (3, 2, 'O Alquimista');
|
||||
INSERT INTO flyway_test.book VALUES (4, 2, 'Brida');
|
||||
@ -2,6 +2,9 @@ import org.jooq.Result;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.jooq.example.flyway.db.h2.Tables.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@ -12,22 +15,24 @@ import static org.junit.Assert.assertEquals;
|
||||
public class AfterMigrationTest {
|
||||
|
||||
@Test
|
||||
public void testQueryingAfterMigration() {
|
||||
Result<?> result =
|
||||
DSL.using("jdbc:h2:~/flyway-test", "sa", "")
|
||||
.select(
|
||||
AUTHOR.FIRST_NAME,
|
||||
AUTHOR.LAST_NAME,
|
||||
BOOK.ID,
|
||||
BOOK.TITLE
|
||||
)
|
||||
.from(AUTHOR)
|
||||
.join(BOOK)
|
||||
.on(AUTHOR.ID.eq(BOOK.AUTHOR_ID))
|
||||
.orderBy(BOOK.ID.asc())
|
||||
.fetch();
|
||||
public void testQueryingAfterMigration() throws Exception {
|
||||
try (Connection c = DriverManager.getConnection("jdbc:h2:~/flyway-test", "sa", "")) {
|
||||
Result<?> result =
|
||||
DSL.using(c)
|
||||
.select(
|
||||
AUTHOR.FIRST_NAME,
|
||||
AUTHOR.LAST_NAME,
|
||||
BOOK.ID,
|
||||
BOOK.TITLE
|
||||
)
|
||||
.from(AUTHOR)
|
||||
.join(BOOK)
|
||||
.on(AUTHOR.ID.eq(BOOK.AUTHOR_ID))
|
||||
.orderBy(BOOK.ID.asc())
|
||||
.fetch();
|
||||
|
||||
assertEquals(4, result.size());
|
||||
assertEquals(asList(1, 2, 3, 4), result.getValues(BOOK.ID));
|
||||
assertEquals(4, result.size());
|
||||
assertEquals(asList(1, 2, 3, 4), result.getValues(BOOK.ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user