[DUMP DELTA PROJECTS] refactoring
This commit is contained in:
parent
edddfc6c63
commit
1d1fe3b151
|
@ -1,8 +1,11 @@
|
|||
|
||||
package eu.dnetlib.dhp.oa.graph.dump.projectssubset;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.spark.SparkConf;
|
||||
import org.apache.spark.api.java.JavaRDD;
|
||||
|
@ -15,17 +18,19 @@ import org.junit.jupiter.api.BeforeAll;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.dnetlib.dhp.oa.graph.dump.funderresults.SparkResultLinkedToProject;
|
||||
import eu.dnetlib.dhp.schema.dump.oaf.community.CommunityResult;
|
||||
|
||||
import eu.dnetlib.dhp.schema.dump.oaf.graph.Project;
|
||||
|
||||
public class ProjectSubsetTest {
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
private static SparkSession spark;
|
||||
private static Path workingDir;
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(eu.dnetlib.dhp.oa.graph.dump.projectssubset.ProjectSubsetTest.class);
|
||||
private static final HashMap<String, String> map = new HashMap<>();
|
||||
|
||||
|
||||
@BeforeAll
|
||||
public static void beforeAll() throws IOException {
|
||||
workingDir = Files
|
||||
|
@ -46,11 +51,13 @@ public class ProjectSubsetTest {
|
|||
.config(conf)
|
||||
.getOrCreate();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void afterAll() throws IOException {
|
||||
FileUtils.deleteDirectory(workingDir.toFile());
|
||||
spark.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAllNew() throws Exception {
|
||||
final String projectListPath = getClass()
|
||||
|
@ -83,6 +90,7 @@ public class ProjectSubsetTest {
|
|||
Assertions.assertEquals(1, tmp.filter(p -> p.getId().substring(3, 15).equals("corda_______")).count());
|
||||
Assertions.assertEquals(40, sc.textFile(workingDir.toString() + "/projectIds").count());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMatchOne() throws Exception {
|
||||
final String projectListPath = getClass()
|
||||
|
|
Loading…
Reference in New Issue