@Transactional @Test @Rollback(false) public void testNodeChangeDetectionCreationAddedOnFind() { clearCaches(); TestPerson personA = nodeRepo.findByAppId(TestPerson.class, this.findablePersonId); NodeChangeData changeObject = personA.getMetaData(SharedGraphRepoKeys.NODE_CHANGEDATA_KEY, NodeChangeData.class); assertNotNull(changeObject); assertTrue(changeObject.getPropertyKeysChanged().isEmpty()); assertTrue(changeObject.getAddedLinks().isEmpty()); assertTrue(changeObject.getRemovedLinks().isEmpty()); }
@Transactional @Test @Rollback(false) public void testNodeChangeDetectionCreationAddedOnSave() { TestPerson personA = TestPerson.randomPerson(); NodeChangeData changeObject = personA.getMetaData(SharedGraphRepoKeys.NODE_CHANGEDATA_KEY, NodeChangeData.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. nodeRepo.save(Arrays.asList(personA)); changeObject = personA.getMetaData(SharedGraphRepoKeys.NODE_CHANGEDATA_KEY, NodeChangeData.class); assertNotNull(changeObject); assertTrue(changeObject.getPropertyKeysChanged().isEmpty()); assertTrue(changeObject.getAddedLinks().isEmpty()); assertTrue(changeObject.getRemovedLinks().isEmpty()); }
private void assertPropertyMapChanged(NodeChangeData changeDO, int numChanges) { assertNotNull(changeDO); assertEquals(numChanges, changeDO.getPropertyKeysChanged().size()); assertTrue(changeDO.getAddedLinks().isEmpty()); assertTrue(changeDO.getRemovedLinks().isEmpty()); }
private void assertNoChanges(NodeChangeData changeDO) { assertNotNull(changeDO); assertTrue(changeDO.getPropertyKeysChanged().isEmpty()); assertTrue(changeDO.getAddedLinks().isEmpty()); assertTrue(changeDO.getRemovedLinks().isEmpty()); }
private void assertRelationChange(NodeChangeData changeDO, int numAdded, int numRemoved) { assertNotNull(changeDO); assertTrue(changeDO.getPropertyKeysChanged().isEmpty()); assertEquals(numAdded, changeDO.getAddedLinks().size()); assertEquals(numRemoved, changeDO.getRemovedLinks().size()); }