forked from D-Net/dnet-hadoop
disabled test
This commit is contained in:
parent
a104a632df
commit
026ad40633
|
@ -5,31 +5,23 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.dom4j.Document;
|
import org.dom4j.Document;
|
||||||
import org.dom4j.DocumentException;
|
import org.dom4j.DocumentException;
|
||||||
import org.dom4j.io.SAXReader;
|
import org.dom4j.io.SAXReader;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mock;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import eu.dnetlib.dhp.oa.provision.model.JoinedEntity;
|
import eu.dnetlib.dhp.oa.provision.model.JoinedEntity;
|
||||||
import eu.dnetlib.dhp.oa.provision.utils.ContextMapper;
|
import eu.dnetlib.dhp.oa.provision.utils.ContextMapper;
|
||||||
import eu.dnetlib.dhp.oa.provision.utils.XmlRecordFactory;
|
import eu.dnetlib.dhp.oa.provision.utils.XmlRecordFactory;
|
||||||
import eu.dnetlib.dhp.schema.oaf.Oaf;
|
|
||||||
import eu.dnetlib.dhp.schema.oaf.OafEntity;
|
|
||||||
import eu.dnetlib.dhp.schema.oaf.OafMapperUtils;
|
|
||||||
import eu.dnetlib.dhp.schema.oaf.Publication;
|
|
||||||
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
|
|
||||||
|
|
||||||
//TODO to enable it we need to update the joined_entity.json test file
|
//TODO to enable it we need to update the joined_entity.json test file
|
||||||
//@Disabled
|
@Disabled
|
||||||
public class XmlRecordFactoryTest {
|
public class XmlRecordFactoryTest {
|
||||||
|
|
||||||
private static final String otherDsTypeId = "scholarcomminfra,infospace,pubsrepository::mock,entityregistry,entityregistry::projects,entityregistry::repositories,websource";
|
private static final String otherDsTypeId = "scholarcomminfra,infospace,pubsrepository::mock,entityregistry,entityregistry::projects,entityregistry::repositories,websource";
|
||||||
|
@ -43,27 +35,6 @@ public class XmlRecordFactoryTest {
|
||||||
JoinedEntity je = new ObjectMapper().readValue(json, JoinedEntity.class);
|
JoinedEntity je = new ObjectMapper().readValue(json, JoinedEntity.class);
|
||||||
assertNotNull(je);
|
assertNotNull(je);
|
||||||
|
|
||||||
Document doc = buildXml(je);
|
|
||||||
//// TODO specific test assertion on doc
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testBologna() throws IOException, DocumentException {
|
|
||||||
final String json = IOUtils.toString(getClass().getResourceAsStream("oaf-bologna.json"));
|
|
||||||
Publication oaf = new ObjectMapper().readValue(json, Publication.class);
|
|
||||||
assertNotNull(oaf);
|
|
||||||
JoinedEntity je = new JoinedEntity();
|
|
||||||
je.setEntity(oaf);
|
|
||||||
assertNotNull(je);
|
|
||||||
|
|
||||||
Document doc = buildXml(je);
|
|
||||||
// TODO specific test assertion on doc
|
|
||||||
|
|
||||||
System.out.println(doc.asXML());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Document buildXml(JoinedEntity je) throws DocumentException {
|
|
||||||
ContextMapper contextMapper = new ContextMapper();
|
ContextMapper contextMapper = new ContextMapper();
|
||||||
|
|
||||||
XmlRecordFactory xmlRecordFactory = new XmlRecordFactory(contextMapper, false, XmlConverterJob.schemaLocation,
|
XmlRecordFactory xmlRecordFactory = new XmlRecordFactory(contextMapper, false, XmlConverterJob.schemaLocation,
|
||||||
|
@ -78,7 +49,5 @@ public class XmlRecordFactoryTest {
|
||||||
assertNotNull(doc);
|
assertNotNull(doc);
|
||||||
|
|
||||||
// TODO add assertions based of values extracted from the XML record
|
// TODO add assertions based of values extracted from the XML record
|
||||||
|
|
||||||
return doc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue