Skip to content

Commit 4576644

Browse files
committed
testFilterAndReplaceSeqValue
travis CI - more wait to allow Oracle to be initialized and more debug output
1 parent 4aab0ec commit 4576644

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

.travis.yml

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
language: java
2-
sudo: required
2+
#sudo: required
33

44
services:
55
- docker
66

77
jdk:
8-
- oraclejdk8
8+
# - oraclejdk8
99
- openjdk6
1010

1111

1212
before_install:
1313
- docker pull wnameless/oracle-xe-11g
14-
- docker run -d -p 49161:1521 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g
14+
- docker run --name oracle -d -p 127.0.0.1:49161:1521 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g
15+
# - docker inspect oracle
16+
# - docker ps -a
1517
- echo "Wait to allow Oracle to be initialized"
16-
- sleep 60
18+
- travis_wait sleep 10
19+
- docker top oracle
20+
- travis_wait sleep 10
21+
- docker top oracle
22+
- travis_wait sleep 10
23+
- docker top oracle
24+
- travis_wait sleep 10
25+
- docker top oracle
26+
- travis_wait sleep 10
27+
- docker top oracle
28+
- travis_wait sleep 10
29+
- docker top oracle
1730

1831
script: "mvn verify"

src/test/java/com/googlecode/scheme2ddl/MainIT.java

+27
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.io.File;
1616
import java.io.IOException;
1717
import java.io.PrintStream;
18+
import java.util.UUID;
1819

1920
import static org.hamcrest.MatcherAssert.assertThat;
2021
import static org.hamcrest.core.StringContains.containsString;
@@ -159,6 +160,32 @@ public void testExportHRSchemaDefault() throws Exception {
159160

160161
}
161162

163+
@Test
164+
public void testFilterAndReplaceSeqValue() throws Exception {
165+
File tempOutput = FileUtils.getFile(FileUtils.getTempDirectoryPath(),
166+
"scheme2ddl-test-" + UUID.randomUUID().toString().substring(0,8));
167+
String outputPath = tempOutput.getAbsolutePath();
168+
169+
String[] args = {"-url", url, "-f", "LOCATIONS_SEQ", "-o", outputPath};
170+
Main.main(args);
171+
172+
String out = outContent.toString();
173+
assertThat(out, containsString("Found 1 items for processing in schema HR"));
174+
175+
assertEqualsFileContent(outputPath + "/sequences/locations_seq.sql", "CREATE SEQUENCE \"HR\".\"LOCATIONS_SEQ\"" +
176+
" MINVALUE 1 MAXVALUE 9900 INCREMENT BY 100 START WITH 3300 NOCACHE NOORDER NOCYCLE ;");
177+
178+
179+
String[] args2 = {"-url", url, "--filter", "LOCATIONS_SEQ", "--output", outputPath, "--replace-sequence-values"};
180+
Main.main(args2);
181+
out = outContent.toString();
182+
assertThat(out, containsString("Found 1 items for processing in schema HR"));
183+
184+
assertEqualsFileContent(outputPath + "/sequences/locations_seq.sql", "CREATE SEQUENCE \"HR\".\"LOCATIONS_SEQ\" MINVALUE 1 MAXVALUE 9900 INCREMENT BY 100 START WITH 1 NOCACHE NOORDER NOCYCLE ;\n" +
185+
"/* -- actual sequence value was replaced by scheme2ddl to 1 */");
186+
187+
}
188+
162189

163190
private static void assertEqualsFileContent(String path, String content) throws IOException {
164191
File file = new File(path);

0 commit comments

Comments
 (0)