コード例 #1
0
  @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());
  }
コード例 #2
0
  @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());
  }
コード例 #3
0
 private void assertPropertyMapChanged(NodeChangeData changeDO, int numChanges) {
   assertNotNull(changeDO);
   assertEquals(numChanges, changeDO.getPropertyKeysChanged().size());
   assertTrue(changeDO.getAddedLinks().isEmpty());
   assertTrue(changeDO.getRemovedLinks().isEmpty());
 }
コード例 #4
0
 private void assertNoChanges(NodeChangeData changeDO) {
   assertNotNull(changeDO);
   assertTrue(changeDO.getPropertyKeysChanged().isEmpty());
   assertTrue(changeDO.getAddedLinks().isEmpty());
   assertTrue(changeDO.getRemovedLinks().isEmpty());
 }
コード例 #5
0
 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());
 }