コード例 #1
0
  @Test
  public void shouldListRemovedNodeProperties() throws Exception {
    // Given
    DefinedProperty prevProp = stringProperty(1, "prevValue");
    state.nodeDoRemoveProperty(1l, prevProp);
    when(ops.propertyKeyGetName(1)).thenReturn("theKey");
    when(ops.nodeGetProperty(1, 1)).thenReturn(prevProp);

    // When
    Iterable<PropertyEntry<Node>> propertyEntries = snapshot().removedNodeProperties();

    // Then
    PropertyEntry<Node> entry = single(propertyEntries);
    assertThat(entry.key(), equalTo("theKey"));
    assertThat(entry.previouslyCommitedValue(), equalTo((Object) "prevValue"));
    assertThat(entry.entity().getId(), equalTo(1l));
  }
コード例 #2
0
 void compareToRemoved(PropertyEntry<T> entry) {
   basicCompareTo(entry);
   try {
     entry.value();
     fail("Should throw IllegalStateException");
   } catch (IllegalStateException e) {
     // OK
   }
   assertNull(value());
 }
コード例 #3
0
  @Test
  public void shouldListAddedRelationshipProperties() throws Exception {
    // Given
    DefinedProperty prevProp = stringProperty(1, "prevValue");
    state.relationshipDoReplaceProperty(1l, prevProp, stringProperty(1, "newValue"));

    when(ops.propertyKeyGetName(1)).thenReturn("theKey");
    when(ops.relationshipGetProperty(1, 1)).thenReturn(prevProp);

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

    // Then
    PropertyEntry<Relationship> entry = single(propertyEntries);
    assertThat(entry.key(), equalTo("theKey"));
    assertThat(entry.value(), equalTo((Object) "newValue"));
    assertThat(entry.previouslyCommitedValue(), equalTo((Object) "prevValue"));
    assertThat(entry.entity().getId(), equalTo(1l));
  }
コード例 #4
0
 @Override
 public void afterCommit(TransactionData data, Object state) {
   for (PropertyEntry<Node> entry : data.removedNodeProperties()) {
     String key = entry.key();
     Object value = entry.previouslyCommitedValue();
     nodeProps.put(key, value);
   }
   for (PropertyEntry<Relationship> entry : data.removedRelationshipProperties()) {
     relProps.put(entry.key(), entry.previouslyCommitedValue());
   }
 }
コード例 #5
0
 void basicCompareTo(PropertyEntry<T> entry) {
   assertEquals(entry.entity(), entity());
   assertEquals(entry.key(), key());
   assertEqualsMaybeNull(entry.previouslyCommitedValue(), previouslyCommitedValue());
 }
コード例 #6
0
 void compareToAssigned(PropertyEntry<T> entry) {
   basicCompareTo(entry);
   assertEqualsMaybeNull(entry.value(), value());
 }