use of org.neo4j.storageengine.api.StorageProperty in project neo4j by neo4j.
the class TransactionToRecordStateVisitor method visitRelPropertyChanges.
@Override
public void visitRelPropertyChanges(long id, Iterator<StorageProperty> added, Iterator<StorageProperty> changed, IntIterable removed) {
removed.each(relId -> recordState.relRemoveProperty(id, relId));
while (changed.hasNext()) {
StorageProperty prop = changed.next();
recordState.relChangeProperty(id, prop.propertyKeyId(), prop.value());
}
while (added.hasNext()) {
StorageProperty prop = added.next();
recordState.relAddProperty(id, prop.propertyKeyId(), prop.value());
}
}
use of org.neo4j.storageengine.api.StorageProperty in project neo4j by neo4j.
the class TxStateVisitorTest method shouldSeeAddedRelationshipProperties.
@Test
void shouldSeeAddedRelationshipProperties() throws Exception {
// Given
long relId = 1L;
int propKey = 2;
GatheringVisitor visitor = new GatheringVisitor();
Value value = Values.of("hello");
state.relationshipDoReplaceProperty(relId, propKey, Values.of(""), value);
// When
state.accept(visitor);
// Then
StorageProperty prop = new PropertyKeyValue(propKey, Values.of("hello"));
assertThat(visitor.relPropertyChanges).containsExactly(propChange(relId, noProperty, singletonList(prop), IntSets.immutable.empty()));
}
use of org.neo4j.storageengine.api.StorageProperty in project neo4j by neo4j.
the class TxStateTest method doNotVisitNotModifiedPropertiesOnModifiedNodes.
@Test
void doNotVisitNotModifiedPropertiesOnModifiedNodes() throws KernelException {
state.nodeDoAddLabel(5, 1);
MutableBoolean labelsChecked = new MutableBoolean();
state.accept(new TxStateVisitor.Adapter() {
@Override
public void visitNodeLabelChanges(long id, LongSet added, LongSet removed) {
labelsChecked.setTrue();
assertEquals(1, id);
assertEquals(1, added.size());
assertTrue(added.contains(5));
assertTrue(removed.isEmpty());
}
@Override
public void visitNodePropertyChanges(long id, Iterator<StorageProperty> added, Iterator<StorageProperty> changed, IntIterable removed) {
fail("Properties were not changed.");
}
});
assertTrue(labelsChecked.booleanValue());
}
Aggregations