diff --git a/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlIndexingJobTest.java b/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlIndexingJobTest.java
index 6f1956578..47f0ec8c3 100644
--- a/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlIndexingJobTest.java
+++ b/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlIndexingJobTest.java
@@ -4,6 +4,7 @@ package eu.dnetlib.dhp.oa.provision;
import java.io.IOException;
import java.io.StringReader;
import java.net.URI;
+import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.io.Text;
@@ -11,6 +12,7 @@ import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrInputField;
import org.apache.solr.common.params.CommonParams;
+import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaSparkContext;
@@ -30,6 +32,8 @@ import eu.dnetlib.dhp.oa.provision.utils.ISLookupClient;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
@ExtendWith(MockitoExtension.class)
public class XmlIndexingJobTest extends SolrTest {
@@ -101,14 +105,34 @@ public class XmlIndexingJobTest extends SolrTest {
new XmlIndexingJob(spark, inputPath, FORMAT, batchSize, XmlIndexingJob.OutputFormat.SOLR, null)
.run(isLookupClient);
- Assertions.assertEquals(0, miniCluster.getSolrClient().commit().getStatus());
+ assertEquals(0, miniCluster.getSolrClient().commit().getStatus());
QueryResponse rsp = miniCluster.getSolrClient().query(new SolrQuery().add(CommonParams.Q, "*:*"));
- Assertions
- .assertEquals(
+ assertEquals(
nRecord, rsp.getResults().getNumFound(),
"the number of indexed records should be equal to the number of input records");
+
+
+ rsp = miniCluster.getSolrClient().query(new SolrQuery().add(CommonParams.Q, "isgreen:true"));
+ assertEquals(
+ 0, rsp.getResults().getNumFound(),
+ "the number of indexed records having isgreen = true");
+
+ rsp = miniCluster.getSolrClient().query(new SolrQuery().add(CommonParams.Q, "openaccesscolor:bronze"));
+ assertEquals(
+ 0, rsp.getResults().getNumFound(),
+ "the number of indexed records having openaccesscolor = bronze");
+
+ rsp = miniCluster.getSolrClient().query(new SolrQuery().add(CommonParams.Q, "isindiamondjournal:true"));
+ assertEquals(
+ 0, rsp.getResults().getNumFound(),
+ "the number of indexed records having isindiamondjournal = true");
+
+ rsp = miniCluster.getSolrClient().query(new SolrQuery().add(CommonParams.Q, "publiclyfunded:true"));
+ assertEquals(
+ 0, rsp.getResults().getNumFound(),
+ "the number of indexed records having publiclyfunded = publiclyfunded");
}
@Test
@@ -126,7 +150,7 @@ public class XmlIndexingJobTest extends SolrTest {
.map(s -> new SAXReader().read(new StringReader(s)).valueOf(ID_XPATH))
.distinct()
.count();
- Assertions.assertEquals(nRecord, xmlIdUnique, "IDs should be unique among input records");
+ assertEquals(nRecord, xmlIdUnique, "IDs should be unique among input records");
final String outputPath = workingDir.resolve("outputPath").toAbsolutePath().toString();
new XmlIndexingJob(spark, inputPath, FORMAT, batchSize, XmlIndexingJob.OutputFormat.HDFS, outputPath)
@@ -142,7 +166,7 @@ public class XmlIndexingJobTest extends SolrTest {
}, Encoders.STRING())
.distinct()
.count();
- Assertions.assertEquals(xmlIdUnique, docIdUnique, "IDs should be unique among the output records");
+ assertEquals(xmlIdUnique, docIdUnique, "IDs should be unique among the output records");
}
diff --git a/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java b/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java
index 88bffd0e7..097d36d05 100644
--- a/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java
+++ b/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java
@@ -32,7 +32,7 @@ public class XmlRecordFactoryTest {
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@Test
- public void testXMLRecordFactory() throws IOException, DocumentException {
+ void testXMLRecordFactory() throws IOException, DocumentException {
final ContextMapper contextMapper = new ContextMapper();
@@ -93,6 +93,12 @@ public class XmlRecordFactoryTest {
"https://osf.io/preprints/socarxiv/7vgtu/download",
doc.valueOf("//*[local-name() = 'result']/fulltext[1]"));
+ assertEquals("true", doc.valueOf("//*[local-name() = 'result']/isgreen/text()"));
+ assertEquals("bronze", doc.valueOf("//*[local-name() = 'result']/openaccesscolor/text()"));
+ assertEquals("true", doc.valueOf("//*[local-name() = 'result']/isindiamondjournal/text()"));
+ assertEquals("true", doc.valueOf("//*[local-name() = 'result']/publiclyfunded/text()"));
+
+ System.out.println(doc.asXML());
}
@Test
diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/fields.xml b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/fields.xml
index 0bf588a57..513ead1dd 100644
--- a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/fields.xml
+++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/fields.xml
@@ -1,116 +1,134 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/publication.json b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/publication.json
index 4ba20292c..a89ec62d5 100644
--- a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/publication.json
+++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/publication.json
@@ -1048,8 +1048,8 @@
"schemename": "dnet:dataCite_resource"
},
"refereed": {
- "classid": "0001",
- "classname": "peerReviewed",
+ "classid": "0002",
+ "classname": "nonPeerReviewed",
"schemeid": "dnet:review_levels",
"schemename": "dnet:review_levels"
},
@@ -1949,5 +1949,9 @@
"schemename": "dnet:provenanceActions"
}
}
- }
+ },
+ "isGreen": true,
+ "openAccessColor": "bronze",
+ "isInDiamondJournal": true,
+ "publiclyFunded": true
}
\ No newline at end of file
diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/solr/conf/exploreTestConfig/managed-schema b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/solr/conf/exploreTestConfig/managed-schema
index 39c811f83..28a439619 100644
--- a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/solr/conf/exploreTestConfig/managed-schema
+++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/solr/conf/exploreTestConfig/managed-schema
@@ -219,20 +219,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -368,6 +354,10 @@
+
+
+
+
diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/solr/conf/testConfig/managed-schema b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/solr/conf/testConfig/managed-schema
index 977e0b2d7..962e0cc6f 100644
--- a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/solr/conf/testConfig/managed-schema
+++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/solr/conf/testConfig/managed-schema
@@ -365,7 +365,13 @@
+
+
+
+
+
+