Skip to content

Commit

Permalink
Exclude update-process for tests #462
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Sep 18, 2023
1 parent 20ec1d7 commit ae6fd45
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 6 additions & 2 deletions app/transformation/TransformAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,19 @@ public static void process(String startOfUpdates,
String sigelBulkOutput = outputPath + "-sigelBulk";
String sigelUpdatesOutput = outputPath + "-sigelUpdates";
TransformSigel.processBulk(sigelBulkOutput, geoServer); //Start processing Sigel pica binary bulk.
TransformSigel.processUpdates(startOfUpdates, sigelUpdatesOutput, geoServer); //Start process Sigel Pica XML Updates via OAI-PMH.
if (startOfUpdates != "") { // exclude updates for the tests, which set startOfUpdates to ""
TransformSigel.processUpdates(startOfUpdates, sigelUpdatesOutput, geoServer); //Start process Sigel Pica XML Updates via OAI-PMH.
}
TransformDbs.process(dbsOutput, geoServer); //Start process DBS data.

// DBS-Data, Sigel Bulk and Updates are joined in a single ES-Bulk-file.
// DBS data first, so that ES prefers Sigel entries that come later and overwrite DBS entries if available.
try (FileWriter resultWriter = new FileWriter(outputPath)) {
writeAll(dbsOutput, resultWriter);
writeAll(sigelBulkOutput, resultWriter);
writeAll(sigelUpdatesOutput, resultWriter);
if (startOfUpdates != "") { // exclude updates for the tests, which set startOfUpdates to ""
writeAll(sigelUpdatesOutput, resultWriter);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/index/ElasticsearchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class ElasticsearchTest {

@BeforeClass
public static void makeIndex() throws IOException {
TransformAll.process("", 0, TransformAll.DATA_OUTPUT_FILE, "");
TransformAll.process("", TransformAll.DATA_OUTPUT_FILE, "");
Index.initialize(TransformAll.DATA_OUTPUT_FILE);
}

Expand Down
8 changes: 3 additions & 5 deletions test/transformation/TestTransformAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public class TestTransformAll {

private static final String SIGEL_DUMP_LOCATION =
TransformAll.DATA_INPUT_DIR + "sigel.dat";
private static final String DUMP_XPATH =
"/" + TransformSigel.DUMP_TOP_LEVEL_TAG + "/" + TransformSigel.XPATH;

@BeforeClass
public static void setUp() {
Expand All @@ -58,7 +56,7 @@ public static void tearDown() {

@Test
public void multiLangAlternateName() throws IOException {
TransformAll.process("", 0, TransformAll.DATA_OUTPUT_FILE, "");
TransformAll.process("", TransformAll.DATA_OUTPUT_FILE, "");
assertThat(new String(
Files.readAllBytes(Paths.get(TransformAll.DATA_OUTPUT_FILE))))
.as("transformation output with multiLangAlternateName")
Expand All @@ -67,7 +65,7 @@ public void multiLangAlternateName() throws IOException {

@Test
public void separateUrlAndProvidesFields() throws IOException {
TransformAll.process("", 0, TransformAll.DATA_OUTPUT_FILE, "");
TransformAll.process("", TransformAll.DATA_OUTPUT_FILE, "");
assertThat(new String(
Files.readAllBytes(Paths.get(TransformAll.DATA_OUTPUT_FILE))))
.as("transformation output with `url` and `provides`")
Expand All @@ -77,7 +75,7 @@ public void separateUrlAndProvidesFields() throws IOException {

@Test
public void preferSigelData() throws IOException {
TransformAll.process("", 0, TransformAll.DATA_OUTPUT_FILE, "");
TransformAll.process("", TransformAll.DATA_OUTPUT_FILE, "");
assertThat(new String(
Files.readAllBytes(Paths.get(TransformAll.DATA_OUTPUT_FILE))))
.as("transformation output with preferred Sigel data")
Expand Down

0 comments on commit ae6fd45

Please sign in to comment.