BrBETA_dnet-hadoop/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/provision/ExtractInfoTest.java

60 lines
1.6 KiB
Java

package eu.dnetlib.dhp.provision;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.dhp.provision.scholix.Scholix;
import eu.dnetlib.dhp.provision.scholix.summary.ScholixSummary;
import org.apache.commons.io.IOUtils;
import org.junit.Ignore;
import org.junit.Test;
import scala.Tuple2;
public class ExtractInfoTest {
@Test
public void test() throws Exception {
final String json = IOUtils.toString(getClass().getResourceAsStream("record.json"));
ProvisionUtil.getItemType(json,ProvisionUtil.TARGETJSONPATH);
}
@Test
public void testSerialization() throws Exception {
ScholixSummary summary = new ScholixSummary();
summary.setDescription("descrizione");
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(summary);
System.out.println(json);
System.out.println(mapper.readValue(json, ScholixSummary.class).getDescription());
}
@Test
public void testScholix() throws Exception {
final String jsonSummary = IOUtils.toString(getClass().getResourceAsStream("summary.json"));
final String jsonRelation = IOUtils.toString(getClass().getResourceAsStream("relation.json"));
Scholix.generateScholixWithSource(jsonSummary, jsonRelation);
}
@Test
@Ignore
public void testIndex() throws Exception {
SparkIndexCollectionOnES.main(
new String[] {
"-mt", "local[*]",
"-s", "/home/sandro/dli",
"-i", "dli_object"
}
);
}
}