-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gretl_3.0' into chore/126_update-gradle-to-version-6
- Loading branch information
Showing
20 changed files
with
3,014 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
gretl/src/integrationTest/java/ch/so/agi/gretl/jobs/Ili2pgValidateDatasetTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package ch.so.agi.gretl.jobs; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
|
||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.testcontainers.containers.PostgisContainerProvider; | ||
import org.testcontainers.containers.PostgreSQLContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
|
||
import ch.so.agi.gretl.util.GradleVariable; | ||
import ch.so.agi.gretl.util.IntegrationTestUtil; | ||
import ch.so.agi.gretl.util.IntegrationTestUtilSql; | ||
|
||
public class Ili2pgValidateDatasetTest { | ||
static String WAIT_PATTERN = ".*database system is ready to accept connections.*\\s"; | ||
|
||
@ClassRule | ||
public static PostgreSQLContainer postgres = | ||
(PostgreSQLContainer) new PostgisContainerProvider() | ||
.newInstance().withDatabaseName("gretl") | ||
.withUsername(IntegrationTestUtilSql.PG_CON_DDLUSER) | ||
.withPassword(IntegrationTestUtilSql.PG_CON_DDLPASS) | ||
.withInitScript("init_postgresql.sql") | ||
.waitingFor(Wait.forLogMessage(WAIT_PATTERN, 2)); | ||
|
||
@Test | ||
public void validateSingleDataset_Ok() throws Exception { | ||
// Run task | ||
GradleVariable[] gvs = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl())}; | ||
IntegrationTestUtil.runJob("src/integrationTest/jobs/Ili2pgValidateSingleDataset", gvs); | ||
|
||
// Check result | ||
String logFileContent = new String(Files.readAllBytes(Paths.get("src/integrationTest/jobs/Ili2pgValidateSingleDataset/validation.log"))); | ||
assertTrue(logFileContent.contains("Info: ...validate done")); | ||
} | ||
|
||
@Test | ||
public void validateMultipleDataset_Ok() throws Exception { | ||
// Run task | ||
GradleVariable[] gvs = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl())}; | ||
IntegrationTestUtil.runJob("src/integrationTest/jobs/Ili2pgValidateMultipleDatasets", gvs); | ||
|
||
// Check result | ||
String logFileContent = new String(Files.readAllBytes(Paths.get("src/integrationTest/jobs/Ili2pgValidateMultipleDatasets/validation.log"))); | ||
assertTrue(logFileContent.contains("Info: ...validate done")); | ||
} | ||
|
||
@Test | ||
public void validateData_Fail() throws Exception { | ||
// Run task | ||
GradleVariable[] gvs = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl())}; | ||
assertEquals(1, IntegrationTestUtil.runJob("src/integrationTest/jobs/Ili2pgValidateDatasetFail", gvs, new StringBuffer(), new StringBuffer())); | ||
|
||
// Check result | ||
String logFileContent = new String(Files.readAllBytes(Paths.get("src/integrationTest/jobs/Ili2pgValidateDatasetFail/validation.log"))); | ||
assertTrue(logFileContent.contains("Error: ...validate failed")); | ||
} | ||
} |
Oops, something went wrong.