@Transactional @Test @Rollback(false) public void testChangingRelationships() { TestPerson personA = TestPerson.randomPerson(); TestPerson personB = TestPerson.randomPerson(); nodeRepo.save(Arrays.asList(personA, personB)); NodeChangeData changeDO = getChangeData(personA); assertNoChanges(changeDO); TestPerson2PersonRelationship relationA = new TestPerson2PersonRelationship(personA, personB); personA.getRelationMap().addRelation(relationA); assertRelationChange(changeDO, 1, 0); }
@Transactional @Test @Rollback(false) public void testEdgeChangeDetectionCreationOnLoadingRelations() { clearCaches(); TestPerson foundPerson = nodeRepo.findByAppId(TestPerson.class, findablePersonId); NodeChangeData changeObject = foundPerson.getMetaData(SharedGraphRepoKeys.NODE_CHANGEDATA_KEY, NodeChangeData.class); assertNoChanges(changeObject); Map<String, Set<EdgeLink>> result = foundPerson.getRelationMap().getRelationships(IEdgeMap.Direction.BOTH); for (Set<EdgeLink> links : result.values()) { for (EdgeLink link : links) { EdgeChangeData edgeChangeData = link.getMetaData(SharedGraphRepoKeys.EDGE_CHANGEDATA_KEY, EdgeChangeData.class); assertNoChanges(edgeChangeData); } } }