use of org.neo4j.graphdb.event.PropertyEntry in project neo4j by neo4j.
the class TxStateTransactionDataViewTest method shouldListAddedNodePropertiesProperties.
@Test
public void shouldListAddedNodePropertiesProperties() throws Exception {
// Given
int propertyKeyId = 1;
DefinedProperty prevProp = stringProperty(propertyKeyId, "prevValue");
state.nodeDoChangeProperty(1L, prevProp, stringProperty(propertyKeyId, "newValue"));
when(ops.propertyKeyGetName(propertyKeyId)).thenReturn("theKey");
long propertyId = 20L;
when(storeStatement.acquireSingleNodeCursor(1L)).thenReturn(asNodeCursor(1L, propertyId, labels()));
when(storeStatement.acquireSinglePropertyCursor(propertyId, propertyKeyId, NO_LOCK)).thenReturn(asPropertyCursor(prevProp));
// When
Iterable<PropertyEntry<Node>> propertyEntries = snapshot().assignedNodeProperties();
// Then
PropertyEntry<Node> 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));
}
use of org.neo4j.graphdb.event.PropertyEntry in project neo4j by neo4j.
the class TxStateTransactionDataViewTest method shouldListRemovedNodeProperties.
@Test
public void shouldListRemovedNodeProperties() throws Exception {
// Given
int propertyKeyId = 1;
DefinedProperty prevProp = stringProperty(propertyKeyId, "prevValue");
state.nodeDoRemoveProperty(1L, prevProp);
when(ops.propertyKeyGetName(propertyKeyId)).thenReturn("theKey");
long propertyId = 20L;
when(storeStatement.acquireSingleNodeCursor(1L)).thenReturn(asNodeCursor(1L, propertyId, labels()));
when(storeStatement.acquireSinglePropertyCursor(propertyId, propertyKeyId, NO_LOCK)).thenReturn(asPropertyCursor(prevProp));
// When
Iterable<PropertyEntry<Node>> propertyEntries = snapshot().removedNodeProperties();
// Then
PropertyEntry<Node> entry = single(propertyEntries);
assertThat(entry.key(), equalTo("theKey"));
assertThat(entry.previouslyCommitedValue(), equalTo("prevValue"));
assertThat(entry.entity().getId(), equalTo(1L));
}
use of org.neo4j.graphdb.event.PropertyEntry in project neo4j by neo4j.
the class TxStateTransactionDataViewTest method shouldListRemovedNodeProperties.
@Test
void shouldListRemovedNodeProperties() throws Exception {
// Given
int propertyKeyId = ops.propertyKeyTokenHolder().getOrCreateId("theKey");
Value prevValue = Values.of("prevValue");
state.nodeDoRemoveProperty(1L, propertyKeyId);
ops.withNode(1).properties("theKey", prevValue);
// When
Iterable<PropertyEntry<Node>> propertyEntries = snapshot().removedNodeProperties();
// Then
PropertyEntry<Node> entry = single(propertyEntries);
assertThat(entry.key()).isEqualTo("theKey");
assertThat(entry.previouslyCommittedValue()).isEqualTo("prevValue");
assertThat(entry.entity().getId()).isEqualTo(1L);
}
use of org.neo4j.graphdb.event.PropertyEntry in project neo4j by neo4j.
the class TxStateTransactionDataViewTest method shouldListAddedRelationshipProperties.
@Test
void shouldListAddedRelationshipProperties() throws Exception {
// Given
Value prevValue = Values.of("prevValue");
int propertyKeyId = ops.propertyKeyTokenHolder().getOrCreateId("theKey");
state.relationshipDoReplaceProperty(1L, propertyKeyId, prevValue, Values.of("newValue"));
ops.withRelationship(1, 0, 0, 0).properties("theKey", prevValue);
// When
Iterable<PropertyEntry<Relationship>> propertyEntries = snapshot().assignedRelationshipProperties();
// Then
PropertyEntry<Relationship> entry = single(propertyEntries);
assertThat(entry.key()).isEqualTo("theKey");
assertThat(entry.value()).isEqualTo("newValue");
assertThat(entry.previouslyCommittedValue()).isEqualTo("prevValue");
assertThat(entry.entity().getId()).isEqualTo(1L);
}
use of org.neo4j.graphdb.event.PropertyEntry in project neo4j by neo4j.
the class TxStateTransactionDataViewTest method shouldListRemovedRelationshipProperties.
@Test
public void shouldListRemovedRelationshipProperties() throws Exception {
// Given
int propertyKeyId = 1;
DefinedProperty prevValue = stringProperty(propertyKeyId, "prevValue");
state.relationshipDoRemoveProperty(1L, prevValue);
when(ops.propertyKeyGetName(propertyKeyId)).thenReturn("theKey");
long propertyId = 40L;
when(storeStatement.acquireSingleRelationshipCursor(1)).thenReturn(asRelationshipCursor(1, 0, 0, 0, propertyId));
when(storeStatement.acquireSinglePropertyCursor(propertyId, propertyKeyId, NO_LOCK)).thenReturn(asPropertyCursor(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));
}
Aggregations