From 9b20a21b24784f545a060f3d95da6228fbe18ffa Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Tue, 7 Jul 2020 18:23:37 +0200 Subject: [PATCH] removed unuseful tests --- .../dhp/oa/graph/dump/DumpJobTest.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/DumpJobTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/DumpJobTest.java index eea4e9414..e21b71de8 100644 --- a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/DumpJobTest.java +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/DumpJobTest.java @@ -313,4 +313,38 @@ public class DumpJobTest { } + + @Test + public void testRecord() throws Exception { + final String sourcePath = getClass() + .getResource("/eu/dnetlib/dhp/oa/graph/dump/resultDump/singelRecord_pub.json") + .getPath(); + + SparkDumpCommunityProducts.main(new String[] { + "-isLookUpUrl", MOCK_IS_LOOK_UP_URL, + "-isSparkSessionManaged", Boolean.FALSE.toString(), + "-outputPath", workingDir.toString() + "/result", + "-sourcePath", sourcePath, + "-resultTableName", "eu.dnetlib.dhp.schema.oaf.Publication", + "-communityMap", new Gson().toJson(map) + }); + +// dumpCommunityProducts.exec(MOCK_IS_LOOK_UP_URL,Boolean.FALSE, workingDir.toString()+"/dataset",sourcePath,"eu.dnetlib.dhp.schema.oaf.Dataset","eu.dnetlib.dhp.schema.dump.oaf.Dataset"); + + final JavaSparkContext sc = JavaSparkContext.fromSparkContext(spark.sparkContext()); + + JavaRDD tmp = sc + .textFile(workingDir.toString() + "/result") + .map(item -> OBJECT_MAPPER.readValue(item, eu.dnetlib.dhp.schema.dump.oaf.Result.class)); + + org.apache.spark.sql.Dataset verificationDataset = spark + .createDataset(tmp.rdd(), Encoders.bean(eu.dnetlib.dhp.schema.dump.oaf.Result.class)); + + Assertions.assertEquals(1, verificationDataset.count()); + verificationDataset.show(false); + + Assertions.assertEquals(1, verificationDataset.filter("type = 'publication'").count()); + + } + }