[Graph Dump] changed the dump since the measures have been moded at the level of the instance

This commit is contained in:
Miriam Baglioni 2021-11-16 12:04:21 +01:00
parent 6595135a1a
commit 99d86134f5
4 changed files with 24 additions and 15 deletions

View File

@ -43,15 +43,6 @@ public class ResultMapper implements Serializable {
try {
addTypeSpecificInformation(out, input, ort);
// Optional<List<Measure>> mes = Optional.ofNullable(input.getMeasures());
// if (mes.isPresent()) {
// List<KeyValue> measure = new ArrayList<>();
// mes
// .get()
// .forEach(
// m -> m.getUnit().forEach(u -> measure.add(KeyValue.newInstance(m.getId(), u.getValue()))));
// out.setMeasures(measure);
// }
Optional
.ofNullable(input.getAuthor())
@ -460,6 +451,17 @@ public class ResultMapper implements Serializable {
code,
Constants.coarCodeLabelMap.get(code),
Constants.COAR_ACCESS_RIGHT_SCHEMA));
Optional<List<Measure>> mes = Optional.ofNullable(i.getMeasures());
if (mes.isPresent()){
List<KeyValue> measure = new ArrayList<>();
mes
.get()
.forEach(
m -> m.getUnit().forEach(u -> measure.add(KeyValue.newInstance(m.getId(), u.getValue()))));
instance.setMeasures(measure );
}
if (opAr.get().getOpenAccessRoute() != null) {
switch (opAr.get().getOpenAccessRoute()) {
case hybrid:

View File

@ -171,10 +171,14 @@ public class DumpJobTest {
GraphResult gr = verificationDataset.first();
Assertions.assertEquals(2, gr.getMeasures().size());
Assertions.assertEquals(1, gr.getInstance().size());
Assertions.assertEquals(2, gr.getInstance().get(0).getMeasures().size());
Assertions
.assertTrue(
gr
.getInstance()
.get(0)
.getMeasures()
.stream()
.anyMatch(
@ -183,6 +187,8 @@ public class DumpJobTest {
Assertions
.assertTrue(
gr
.getInstance()
.get(0)
.getMeasures()
.stream()
.anyMatch(
@ -357,11 +363,12 @@ public class DumpJobTest {
Assertions.assertEquals("50|pensoft_____::00ea4a1cd53806a97d62ea6bf268f2a2", gr.getId());
Assertions.assertEquals(2, gr.getOriginalId().size());
System.out.println(gr.getOriginalId().size());
Assertions.assertEquals(1, gr.getOriginalId().size());
Assertions
.assertTrue(
gr.getOriginalId().contains("50|pensoft_____::00ea4a1cd53806a97d62ea6bf268f2a2")
&& gr.getOriginalId().contains("10.3897/oneeco.2.e13718"));
gr.getOriginalId().contains("10.3897/oneeco.2.e13718"));
Assertions.assertEquals(1, gr.getPid().size());
Assertions

View File

@ -753,7 +753,7 @@
<mockito-core.version>3.3.3</mockito-core.version>
<mongodb.driver.version>3.4.2</mongodb.driver.version>
<vtd.version>[2.12,3.0)</vtd.version>
<dhp-schemas.version>[2.8.22]</dhp-schemas.version>
<dhp-schemas.version>[2.9.23]</dhp-schemas.version>
<dnet-actionmanager-api.version>[4.0.3]</dnet-actionmanager-api.version>
<dnet-actionmanager-common.version>[6.0.5]</dnet-actionmanager-common.version>
<dnet-openaire-broker-common.version>[3.1.6]</dnet-openaire-broker-common.version>