2020-04-27 14:52:31 +02:00
|
|
|
|
2020-03-27 10:42:17 +01:00
|
|
|
package eu.dnetlib.dhp.oa.provision;
|
2020-02-27 10:10:55 +01:00
|
|
|
|
2020-03-02 17:03:07 +01:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.nio.file.Files;
|
|
|
|
import java.nio.file.Path;
|
2020-04-28 11:23:29 +02:00
|
|
|
|
2020-04-18 12:42:58 +02:00
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
2020-03-02 17:03:07 +01:00
|
|
|
|
2020-02-27 10:10:55 +01:00
|
|
|
public class GraphJoinerTest {
|
2020-03-02 17:03:07 +01:00
|
|
|
|
2020-04-29 19:09:07 +02:00
|
|
|
private final ClassLoader cl = getClass().getClassLoader();
|
2020-04-27 14:52:31 +02:00
|
|
|
private Path workingDir;
|
|
|
|
private Path inputDir;
|
|
|
|
private Path outputDir;
|
2020-03-02 17:03:07 +01:00
|
|
|
|
2020-04-27 14:52:31 +02:00
|
|
|
@BeforeEach
|
|
|
|
public void before() throws IOException {
|
|
|
|
workingDir = Files.createTempDirectory("promote_action_set");
|
|
|
|
inputDir = workingDir.resolve("input");
|
|
|
|
outputDir = workingDir.resolve("output");
|
|
|
|
}
|
2020-03-02 17:03:07 +01:00
|
|
|
|
2020-04-27 14:52:31 +02:00
|
|
|
private static void copyFiles(Path source, Path target) throws IOException {
|
|
|
|
Files
|
|
|
|
.list(source)
|
|
|
|
.forEach(
|
|
|
|
f -> {
|
|
|
|
try {
|
|
|
|
if (Files.isDirectory(f)) {
|
|
|
|
Path subTarget = Files.createDirectories(target.resolve(f.getFileName()));
|
|
|
|
copyFiles(f, subTarget);
|
|
|
|
} else {
|
|
|
|
Files.copy(f, target.resolve(f.getFileName()));
|
|
|
|
}
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-02-27 10:10:55 +01:00
|
|
|
}
|