2021-04-29 11:34:47 +02:00
|
|
|
|
2021-04-29 09:29:19 +02:00
|
|
|
package eu.dnetlib.dhp.actionmanager.ror;
|
|
|
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
2021-04-29 09:50:05 +02:00
|
|
|
import org.junit.jupiter.api.Disabled;
|
2021-04-29 09:29:19 +02:00
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
|
|
|
import eu.dnetlib.dhp.actionmanager.ror.model.RorOrganization;
|
|
|
|
import eu.dnetlib.dhp.schema.oaf.Organization;
|
|
|
|
|
2021-04-29 09:50:05 +02:00
|
|
|
@Disabled
|
2021-04-29 09:29:19 +02:00
|
|
|
class GenerateRorActionSetJobTest {
|
|
|
|
|
|
|
|
private static final ObjectMapper mapper = new ObjectMapper();
|
|
|
|
|
|
|
|
private static final String local_file_path = "/Users/michele/Downloads/ror-data-2021-04-06.json";
|
|
|
|
|
|
|
|
@BeforeEach
|
2021-04-29 11:34:47 +02:00
|
|
|
void setUp() throws Exception {
|
|
|
|
}
|
2021-04-29 09:29:19 +02:00
|
|
|
|
|
|
|
@Test
|
|
|
|
void testConvertRorOrg() throws Exception {
|
2021-04-29 11:34:47 +02:00
|
|
|
final RorOrganization r = mapper
|
|
|
|
.readValue(IOUtils.toString(getClass().getResourceAsStream("ror_org.json")), RorOrganization.class);
|
2021-04-29 09:29:19 +02:00
|
|
|
final Organization org = GenerateRorActionSetJob.convertRorOrg(r);
|
|
|
|
|
|
|
|
System.out.println(mapper.writeValueAsString(org));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void testConvertAllRorOrg() throws Exception {
|
2021-04-29 11:34:47 +02:00
|
|
|
final RorOrganization[] arr = mapper
|
|
|
|
.readValue(IOUtils.toString(new FileInputStream(local_file_path)), RorOrganization[].class);
|
2021-04-29 09:29:19 +02:00
|
|
|
|
|
|
|
for (final RorOrganization r : arr) {
|
|
|
|
GenerateRorActionSetJob.convertRorOrg(r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|