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