merge logics changed to consider invisble in dataInfo
This commit is contained in:
parent
9beef2e678
commit
78929fe658
|
@ -70,7 +70,8 @@ public abstract class Oaf implements Serializable {
|
|||
}
|
||||
|
||||
public void mergeOAFDataInfo(Oaf o) {
|
||||
if (o.getDataInfo() != null && compareTrust(this, o) < 0)
|
||||
|
||||
if (o.getDataInfo() != null && (compareTrust(this, o) < 0 || this.getDataInfo().getInvisible()))
|
||||
dataInfo = o.getDataInfo();
|
||||
}
|
||||
|
||||
|
|
|
@ -189,8 +189,10 @@ class MergeTest {
|
|||
Result p1 = publications.get(1);
|
||||
Result p2 = publications.get(0);
|
||||
|
||||
//merge visible record with OpenAPC
|
||||
p1.mergeFrom(p2);
|
||||
|
||||
assertFalse(p1.getDataInfo().getInvisible());
|
||||
assertEquals("1721.47", p1.getProcessingchargeamount().getValue());
|
||||
assertEquals("EUR", p1.getProcessingchargecurrency().getValue());
|
||||
|
||||
|
@ -204,7 +206,26 @@ class MergeTest {
|
|||
|
||||
assertEquals("EUR", p1.getInstance().stream().filter(i -> i.getProcessingchargeamount() != null)
|
||||
.collect(Collectors.toList()).get(0).getProcessingchargecurrency().getValue());
|
||||
assertFalse(p1.getDataInfo().getInvisible());
|
||||
System.out.println(new ObjectMapper().writeValueAsString(p1));
|
||||
|
||||
//merge OpenAPC with visible record
|
||||
p2.mergeFrom(p1);
|
||||
assertFalse(p2.getDataInfo().getInvisible());
|
||||
assertEquals("1721.47", p2.getProcessingchargeamount().getValue());
|
||||
assertEquals("EUR", p2.getProcessingchargecurrency().getValue());
|
||||
|
||||
assertEquals(2 , p2.getInstance().size());
|
||||
p2.getInstance().stream().anyMatch(i -> i.getProcessingchargeamount() != null);
|
||||
|
||||
p2.getInstance().stream().anyMatch(i -> i.getProcessingchargecurrency() != null);
|
||||
|
||||
assertEquals("1721.47", p2.getInstance().stream().filter(i -> i.getProcessingchargeamount() != null)
|
||||
.collect(Collectors.toList()).get(0).getProcessingchargeamount().getValue());
|
||||
|
||||
assertEquals("EUR", p2.getInstance().stream().filter(i -> i.getProcessingchargeamount() != null)
|
||||
.collect(Collectors.toList()).get(0).getProcessingchargecurrency().getValue());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue