Sensible equals and hashCode for FragmentEntity (CPS-1664 #1) 72/134472/3
authordanielhanrahan <daniel.hanrahan@est.tech>
Wed, 3 May 2023 14:07:34 +0000 (15:07 +0100)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Thu, 4 May 2023 08:59:58 +0000 (09:59 +0100)
commitd701ea2c8a9d437846a3c08c103c8b68eaff7334
treef16a7053a7419ddeddd3d71a6b1273e860b3fb21
parent08a47195fb3882e396b2dd01b01afa5da42255fb
Sensible equals and hashCode for FragmentEntity (CPS-1664 #1)

Include Anchor and Xpath in equals and hashCode methods for
FragmentEntity. (This also requires adding equals and hashCode for
AnchorEntity and DataspaceEntity.) The combination of dataspace,
anchor, and xpath uniquely identify a fragment/datanode.
This allows FragmentEntity objects returned from query across anchors
to be stored in Set collections.
Performance was observed to be unaffected by the change.

Issue-ID: CPS-1664
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I2c7e3957e392af36f5230d08c9bbd550f44e7444
cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java
cps-ri/src/main/java/org/onap/cps/spi/entities/DataspaceEntity.java
cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntity.java
cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceServiceSpec.groovy