@Transactional @Test @Rollback(false) public void testEdgeChangeDetectionCreationAddedOnFind() { TestPerson2PersonRelationship link = edgeRepo.findByAppId(TestPerson2PersonRelationship.class, this.findableEdgeId); EdgeChangeData changeObject = link.getMetaData(SharedGraphRepoKeys.EDGE_CHANGEDATA_KEY, EdgeChangeData.class); assertNotNull(changeObject); assertTrue(changeObject.getPropertyKeysChanged().isEmpty()); }
@Transactional @Test @Rollback(false) public void testEdgeChangeDetectionCreationAddedOnSave() { TestPerson personA = TestPerson.randomPerson(); TestPerson personB = TestPerson.randomPerson(); EdgeLink link = new TestPerson2PersonRelationship(personA, personB); EdgeChangeData changeObject = link.getMetaData(SharedGraphRepoKeys.EDGE_CHANGEDATA_KEY, EdgeChangeData.class); assertNull(changeObject); // Saving the node, adds the change detection so that the repo can get changes when it goes to // save. // Attached to the node, it goes out of scope with the node. edgeRepo.save(Arrays.asList(link)); changeObject = link.getMetaData(SharedGraphRepoKeys.EDGE_CHANGEDATA_KEY, EdgeChangeData.class); assertNotNull(changeObject); assertTrue(changeObject.getPropertyKeysChanged().isEmpty()); }
private void assertNoChanges(EdgeChangeData changeDO) { assertNotNull(changeDO); assertTrue(changeDO.getPropertyKeysChanged().isEmpty()); }
private void assertPropertyMapChanged(EdgeChangeData changeDO, int numChanges) { assertNotNull(changeDO); assertEquals(numChanges, changeDO.getPropertyKeysChanged().size()); }