Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor executeTestRunner Method to avoid having a mandatory taskNam… #209

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Av2chTest {
@Test
public void transformation_Ok() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Av2ch");
IntegrationTestUtil.executeTestRunner(projectDirectory, "transform");
IntegrationTestUtil.executeTestRunner(projectDirectory);

File resultFile = new File(projectDirectory + "/output/254900.itf");

Expand All @@ -31,7 +31,7 @@ public void transformation_Ok() throws Exception {
public void transformationFileSet_Ok() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Av2chFileSet");

IntegrationTestUtil.executeTestRunner(projectDirectory, "transform");
IntegrationTestUtil.executeTestRunner(projectDirectory);

File resultFile1 = new File("src/integrationTest/jobs/Av2chFileSet/output/252400.itf");
File resultFile2 = new File("src/integrationTest/jobs/Av2chFileSet/output/254900.itf");
Expand All @@ -45,7 +45,7 @@ public void transformation_Fail() {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Av2chFail");

assertThrows(Throwable.class, () -> {
IntegrationTestUtil.executeTestRunner(projectDirectory, "transform");
IntegrationTestUtil.executeTestRunner(projectDirectory);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Av2geobauTest {
public void simple() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Av2geobau");
cleanUpFiles(projectDirectory);
IntegrationTestUtil.executeTestRunner(projectDirectory, "av2geobau");
IntegrationTestUtil.executeTestRunner(projectDirectory);

File resultFile = new File(projectDirectory + "/empty.dxf");
assertTrue(resultFile.exists());
Expand All @@ -22,7 +22,7 @@ public void fileSet() throws Exception {
File projectDir = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Av2geobauFileSet");
cleanUpFiles(projectDir);

IntegrationTestUtil.executeTestRunner(projectDir, "av2geobau");
IntegrationTestUtil.executeTestRunner(projectDir);

File resultFile1 = new File(projectDir + "/empty1.dxf");
File resultFile2 = new File(projectDir + "/empty2.dxf");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Csv2ExcelTest {
public void convertCsv_Ok() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Csv2Excel");

IntegrationTestUtil.executeTestRunner(projectDirectory, "convertData");
IntegrationTestUtil.executeTestRunner(projectDirectory);

FileInputStream fis = new FileInputStream(projectDirectory.getAbsolutePath() + "/20230124_sap_Gebaeude.xlsx");
XSSFWorkbook workbook = new XSSFWorkbook(fis);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void exportOk() throws Exception {

File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/CsvExport");
GradleVariable[] gradleVariables = { GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl()) };
IntegrationTestUtil.executeTestRunner(projectDirectory, "csvexport", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

System.out.println("cwd " + new File(".").getAbsolutePath());
java.io.LineNumberReader reader = new java.io.LineNumberReader(new java.io.InputStreamReader(new java.io.FileInputStream(new File("src/integrationTest/jobs/CsvExport/data.csv"))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void importOk() throws Exception {
}

File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/CsvImport");
IntegrationTestUtil.executeTestRunner(projectDirectory, "csvimport", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

try (Connection con = IntegrationTestUtilSql.connectPG(postgres);
Statement s2 = con.createStatement();
Expand Down Expand Up @@ -80,7 +80,7 @@ public void importOk_batchSize() throws Exception {
}

File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/CsvImportBatchSize");
IntegrationTestUtil.executeTestRunner(projectDirectory, "csvimport", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

try (Connection con = IntegrationTestUtilSql.connectPG(postgres);
Statement s2 = con.createStatement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ public class CsvValidatorTest {
public void validationOk() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/CsvValidator");

IntegrationTestUtil.executeTestRunner(projectDirectory, "validate");
IntegrationTestUtil.executeTestRunner(projectDirectory);
}
@Test
public void validationFail() {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/CsvValidatorFail");

assertThrows(Throwable.class, () -> {
IntegrationTestUtil.executeTestRunner(projectDirectory, "validate");
IntegrationTestUtil.executeTestRunner(projectDirectory);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void geodienste_Ok() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/CurlGeodienste");
GradleVariable[] variables = { GradleVariable.newGradleProperty("mockWebServerPort", String.valueOf(mockWebServer.getPort())) };

IntegrationTestUtil.executeTestRunner(projectDirectory, "uploadData", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);

// Validate result
RecordedRequest recordedRequest = mockWebServer.takeRequest();
Expand Down Expand Up @@ -74,7 +74,7 @@ public void geodienste_Fail() throws Exception {
GradleVariable[] variables = { GradleVariable.newGradleProperty("mockWebServerPort", String.valueOf(mockWebServer.getPort())) };

assertThrows(Throwable.class, () -> {
IntegrationTestUtil.executeTestRunner(projectDirectory, "uploadData", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);
});
}

Expand All @@ -88,7 +88,7 @@ public void planregister_Ok() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/CurlPlanregister");
GradleVariable[] variables = { GradleVariable.newGradleProperty("mockWebServerPort", String.valueOf(mockWebServer.getPort())) };

IntegrationTestUtil.executeTestRunner(projectDirectory, "uploadData", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);

// Validate result
RecordedRequest recordedRequest = mockWebServer.takeRequest();
Expand All @@ -102,7 +102,7 @@ public void planregister_Ok() throws Exception {
public void downloadFile_Ok() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/CurlDownload");

IntegrationTestUtil.executeTestRunner(projectDirectory, "downloadData");
IntegrationTestUtil.executeTestRunner(projectDirectory);

String content = new String(Files.readAllBytes(Paths.get(projectDirectory + "/README.md")));
assertTrue(content.contains("_GRETL_"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void exportOk() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/DatabaseDocumentExport");
GradleVariable[] variables = { GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl()) };

IntegrationTestUtil.executeTestRunner(projectDirectory, "databasedocumentexport", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void fetchSizeParameterTest() throws Exception {
}

File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Db2DbTaskFetchSize");
IntegrationTestUtil.executeTestRunner(projectDirectory, "fetchSizeTask", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

try (Connection con = IntegrationTestUtilSql.connectPG(postgres)) {
String countDestSql = String.format("SELECT COUNT(*) FROM %s.target_data", schemaName);
Expand Down Expand Up @@ -95,7 +95,7 @@ public void taskChainTest() throws Exception {
}

File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Db2DbTaskChain");
IntegrationTestUtil.executeTestRunner(projectDirectory, "bToA", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

try (Connection con = IntegrationTestUtilSql.connectPG(postgres)) {
String countDestSql = String.format("SELECT COUNT(*) FROM %s.albums_dest", schemaName);
Expand Down Expand Up @@ -124,7 +124,7 @@ public void relativePathTest() throws Exception {
}

File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Db2DbTaskRelPath");
IntegrationTestUtil.executeTestRunner(projectDirectory, "relativePath", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

try (Connection con = IntegrationTestUtilSql.connectPG(postgres)) {
String countDestSql = String.format("SELECT COUNT(*) FROM %s.albums_dest", schemaName);
Expand Down Expand Up @@ -153,7 +153,7 @@ public void deleteDestTableContent() throws Exception {
}

File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Db2DbTaskDelTable");
IntegrationTestUtil.executeTestRunner(projectDirectory, "sourceToDestWithDelete", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

try (Connection con = IntegrationTestUtilSql.connectPG(postgres)) {
String countDestSql = String.format("SELECT COUNT(*) FROM %s.albums_dest", schemaName);
Expand Down Expand Up @@ -181,7 +181,7 @@ public void parameter() throws Exception {
}

File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Db2DbParameter");
IntegrationTestUtil.executeTestRunner(projectDirectory, "src2dest", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

try (Connection con = IntegrationTestUtilSql.connectPG(postgres)) {
String countDestSql = String.format("SELECT COUNT(*) FROM %s.dest", schemaName);
Expand Down Expand Up @@ -211,7 +211,7 @@ public void parameterList() throws Exception {
}

File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Db2DbParameterList");
IntegrationTestUtil.executeTestRunner(projectDirectory, "src2dest", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

try (Connection con = IntegrationTestUtilSql.connectPG(postgres)) {
String countDestSql = String.format("SELECT COUNT(*) FROM %s.dest", schemaName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import ch.so.agi.gretl.util.GradleVariable;
import ch.so.agi.gretl.util.IntegrationTestUtil;
import ch.so.agi.gretl.util.IntegrationTestUtilSql;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.OracleContainer;
Expand All @@ -12,6 +14,7 @@

import java.io.File;

@Disabled
@Testcontainers
public class DbDriverContainedTest {

Expand All @@ -23,7 +26,7 @@ public class DbDriverContainedTest {
@Tag(TestTags.DB_DRIVERS_REACHABLE_TEST)
public void SqliteDriverContainedTest() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/DbTasks_SqliteLibsPresent");
IntegrationTestUtil.executeTestRunner(projectDirectory, "querySqliteMaster");
IntegrationTestUtil.executeTestRunner(projectDirectory);
}

@Test
Expand All @@ -32,6 +35,6 @@ public void OracleDriverContainedTest() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/DbTasks_OracleLibsPresent");
GradleVariable[] variables = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_ORA_CON_URI, oracle.getJdbcUrl())};

IntegrationTestUtil.executeTestRunner(projectDirectory, "queryOracleVersion", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void export_Ok() throws Exception {
});
}

IntegrationTestUtil.executeTestRunner(projectDirectory, "gpkg2dxf");
IntegrationTestUtil.executeTestRunner(projectDirectory);

// Check results
for (String dxfFile : dxfFiles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void export_Ok() throws Exception {
});
}

IntegrationTestUtil.executeTestRunner(projectDirectory, "gpkg2shp");
IntegrationTestUtil.executeTestRunner(projectDirectory);

// Check results
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void exportTableOk() throws Exception {
con.commit();
}

IntegrationTestUtil.executeTestRunner(projectDirectory, "gpkgexport", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

// Check results
try (
Expand Down Expand Up @@ -96,7 +96,7 @@ public void exportTablesOk() throws Exception {
IntegrationTestUtilSql.closeCon(con);
}

IntegrationTestUtil.executeTestRunner(projectDirectory, "gpkgexport", gradleVariables);
IntegrationTestUtil.executeTestRunner(projectDirectory, gradleVariables);

// Check results
for (int i = 1; i <= 2; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void importOk() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/GpkgImport");
GradleVariable[] variables = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl())};

IntegrationTestUtil.executeTestRunner(projectDirectory, "gpkgimport", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);

// Reconnect to check results
try (Connection con = IntegrationTestUtilSql.connectPG(postgres);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ public class GpkgValidatorTest {
public void validationOk() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/GpkgValidator");

IntegrationTestUtil.executeTestRunner(projectDirectory, "validate");
IntegrationTestUtil.executeTestRunner(projectDirectory);
}
@Test
public void validationFail() {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/GpkgValidatorFail");

assertThrows(Throwable.class, () -> {
IntegrationTestUtil.executeTestRunner(projectDirectory, "validate");
IntegrationTestUtil.executeTestRunner(projectDirectory);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public GzipTest() {
@Test
public void compress_file_Ok() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Gzip");
IntegrationTestUtil.executeTestRunner(projectDirectory, "compressFile");
IntegrationTestUtil.executeTestRunner(projectDirectory);

// Validate result
File gzipFile = new File("src/integrationTest/jobs/Gzip/planregister.xml.gz");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void importOk() throws Exception {

Files.deleteIfExists(Paths.get(projectDirectory + "/ch.so.agi.av_gb_admin_einteilung_edit_2020-08-20.gpkg"));

IntegrationTestUtil.executeTestRunner(projectDirectory, "ili2gpkgimport");
IntegrationTestUtil.executeTestRunner(projectDirectory);


String url = "jdbc:sqlite:" +
Expand Down Expand Up @@ -71,7 +71,7 @@ public void importFileSet() throws Exception {
File projectDirectory = new File(System.getProperty("user.dir") + "/src/integrationTest/jobs/Ili2gpkgImportFileSet");
Files.deleteIfExists(Paths.get(projectDirectory + "/Beispiel2.gpkg"));

IntegrationTestUtil.executeTestRunner(projectDirectory, "ili2gpkgimport");
IntegrationTestUtil.executeTestRunner(projectDirectory);

String url = "jdbc:sqlite:" +
new File(projectDirectory + "/Beispiel2.gpkg").getAbsolutePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void deleteOk() throws Exception {

GradleVariable[] variables = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl())};

IntegrationTestUtil.executeTestRunner(projectDirectory, "ili2pgdelete", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);

try (
Connection con = IntegrationTestUtilSql.connectPG(postgres);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void deleteDataset_Ok() throws Exception {

GradleVariable[] variables = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl())};

IntegrationTestUtil.executeTestRunner(projectDirectory, "ili2pgdelete", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);

try (
Connection con = IntegrationTestUtilSql.connectPG(postgres);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void exportOk() throws Exception {

GradleVariable[] variables = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl())};

IntegrationTestUtil.executeTestRunner(projectDirectory, "ili2pgexport", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);

// check results
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void importOk() throws Exception {

GradleVariable[] variables = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl())};

IntegrationTestUtil.executeTestRunner(projectDirectory, "ili2pgimport", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);

// Check results
try (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void schemaImportOk() throws Exception {

GradleVariable[] variables = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl())};

IntegrationTestUtil.executeTestRunner(projectDirectory, "ili2pgschemaimport", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);

// Check results
try (
Expand Down Expand Up @@ -76,7 +76,7 @@ public void schemaImport_Options1_Ok() throws Exception {

GradleVariable[] variables = {GradleVariable.newGradleProperty(IntegrationTestUtilSql.VARNAME_PG_CON_URI, postgres.getJdbcUrl())};

IntegrationTestUtil.executeTestRunner(projectDirectory, "ili2pgschemaimport", variables);
IntegrationTestUtil.executeTestRunner(projectDirectory, variables);

// Check results
try (
Expand Down
Loading