コード例 #1
0
 @Override
 public Property relationshipGetProperty(
     KernelStatement state, long relationshipId, int propertyKeyId)
     throws EntityNotFoundException {
   if (state.hasTxStateWithChanges()) {
     Iterator<DefinedProperty> properties = relationshipGetAllProperties(state, relationshipId);
     while (properties.hasNext()) {
       Property property = properties.next();
       if (property.propertyKeyId() == propertyKeyId) {
         return property;
       }
     }
     return Property.noRelationshipProperty(relationshipId, propertyKeyId);
   }
   return storeLayer.relationshipGetProperty(relationshipId, propertyKeyId);
 }
コード例 #2
0
  @Test
  public void shouldListRemovedRelationshipProperties() throws Exception {
    // Given
    DefinedProperty prevValue = stringProperty(1, "prevValue");
    state.relationshipDoRemoveProperty(1l, prevValue);
    when(ops.propertyKeyGetName(1)).thenReturn("theKey");
    when(ops.relationshipGetProperty(1, 1)).thenReturn(prevValue);

    // When
    Iterable<PropertyEntry<Relationship>> propertyEntries =
        snapshot().removedRelationshipProperties();

    // Then
    PropertyEntry<Relationship> entry = single(propertyEntries);
    assertThat(entry.key(), equalTo("theKey"));
    assertThat(entry.previouslyCommitedValue(), equalTo((Object) "prevValue"));
    assertThat(entry.entity().getId(), equalTo(1l));
  }