Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
-
f9bdec58
by tchemit at 2019-01-04T14:09:52Z
7 changed files:
- services-local/src/test/java/fr/ird/observe/services/local/service/sql/MigrateTestsDatabases.java
- test/src/main/resources/db/6.0/dataForTestLongline.sql.gz
- test/src/main/resources/db/7.0/dataForTestLongline.sql.gz
- test/src/main/resources/db/7.0/dataForTestSeine.sql.gz
- test/src/main/resources/db/7.0/empty_h2.sql.gz
- test/src/main/resources/db/7.0/empty_pg.sql.gz
- test/src/main/resources/db/7.0/referentiel.sql.gz
Changes:
| ... | ... | @@ -38,12 +38,15 @@ import org.junit.Before; |
| 38 | 38 |
import org.junit.BeforeClass;
|
| 39 | 39 |
import org.junit.Test;
|
| 40 | 40 |
import org.nuiton.topia.persistence.jdbc.JdbcH2Helper;
|
| 41 |
+import org.nuiton.topia.persistence.script.SqlScriptReader;
|
|
| 42 |
+import org.nuiton.topia.persistence.script.SqlScriptWriter;
|
|
| 41 | 43 |
import org.nuiton.topia.persistence.script.TopiaSqlScript;
|
| 42 | 44 |
import org.nuiton.version.Version;
|
| 43 | 45 |
|
| 44 | 46 |
import java.io.File;
|
| 45 | 47 |
import java.io.IOException;
|
| 46 | 48 |
import java.nio.file.Files;
|
| 49 |
+import java.nio.file.Path;
|
|
| 47 | 50 |
|
| 48 | 51 |
/**
|
| 49 | 52 |
* Created on 25/12/15.
|
| ... | ... | @@ -154,7 +157,18 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport { |
| 154 | 157 |
}
|
| 155 | 158 |
|
| 156 | 159 |
Files.createDirectories(scriptFile.toPath().getParent());
|
| 157 |
- dump.copy(scriptFile.toPath());
|
|
| 160 |
+ copy(dump, scriptFile.toPath());
|
|
| 161 |
+ |
|
| 162 |
+ }
|
|
| 163 |
+ |
|
| 164 |
+ public void copy(TopiaSqlScript reader, Path target) throws IOException {
|
|
| 165 |
+ try (SqlScriptWriter scriptWriter = SqlScriptWriter.builder(target).gzip().keepCommentLine().keepEmptyLine().build()) {
|
|
| 166 |
+ try (SqlScriptReader scriptReader = reader.getLocation()) {
|
|
| 167 |
+ for (String statement : scriptReader) {
|
|
| 168 |
+ scriptWriter.writeSql(statement);
|
|
| 169 |
+ }
|
|
| 170 |
+ }
|
|
| 171 |
+ }
|
|
| 158 | 172 |
}
|
| 159 | 173 |
|
| 160 | 174 |
}
|
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type