From 969fa8d96e2aa942c40ccad4cffe33fe0019ba25 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Fri, 25 Sep 2020 13:32:34 +0200 Subject: [PATCH] fixed issue and changed the transformation of the programme file to consider the new model --- .../dnetlib/dhp/actionmanager/project/ReadProjectsFromDB.java | 2 +- .../dhp/actionmanager/project/SparkAtomicActionJob.java | 2 +- .../eu/dnetlib/dhp/actionmanager/project/CSVParserTest.java | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/project/ReadProjectsFromDB.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/project/ReadProjectsFromDB.java index e6e2c95c7..0c8b9e114 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/project/ReadProjectsFromDB.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/project/ReadProjectsFromDB.java @@ -33,7 +33,7 @@ public class ReadProjectsFromDB implements Closeable { private final BufferedWriter writer; private final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); - private final static String query = "SELECT code , optional1, optional2" + + private final static String query = "SELECT code , optional1, optional2 " + "from projects where id like 'corda__h2020%' "; public static void main(final String[] args) throws Exception { diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/project/SparkAtomicActionJob.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/project/SparkAtomicActionJob.java index 07d1e4160..222e623fd 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/project/SparkAtomicActionJob.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/project/SparkAtomicActionJob.java @@ -147,7 +147,7 @@ public class SparkAtomicActionJob { } private static void setLevels(H2020Classification h2020Classification, String classification) { - String[] tmp = classification.split(" | "); + String[] tmp = classification.split(" \\| "); h2020Classification.setLevel1(tmp[0]); if (tmp.length > 1) { h2020Classification.setLevel2(tmp[1]); diff --git a/dhp-workflows/dhp-aggregation/src/test/java/eu/dnetlib/dhp/actionmanager/project/CSVParserTest.java b/dhp-workflows/dhp-aggregation/src/test/java/eu/dnetlib/dhp/actionmanager/project/CSVParserTest.java index 17fdd4511..101ed5eea 100644 --- a/dhp-workflows/dhp-aggregation/src/test/java/eu/dnetlib/dhp/actionmanager/project/CSVParserTest.java +++ b/dhp-workflows/dhp-aggregation/src/test/java/eu/dnetlib/dhp/actionmanager/project/CSVParserTest.java @@ -7,10 +7,14 @@ import java.nio.file.Path; import java.util.List; import org.apache.commons.io.IOUtils; +import org.apache.spark.api.java.function.FilterFunction; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import com.google.gson.Gson; + import eu.dnetlib.dhp.actionmanager.project.csvutils.CSVParser; +import eu.dnetlib.dhp.actionmanager.project.csvutils.CSVProgramme; public class CSVParserTest {