use of org.neo4j.kernel.api.index.NodeUpdates in project neo4j by neo4j.
the class PropertyPhysicalToLogicalConverterTest method shouldConvertDynamicChangedProperty.
@Test
public void shouldConvertDynamicChangedProperty() throws Exception {
// GIVEN
int key = 10;
PropertyRecord before = propertyRecord(property(key, longString));
PropertyRecord after = propertyRecord(property(key, longerString));
// WHEN
NodeUpdates update = convert(none, none, change(before, after));
// THEN
NodeUpdates expected = NodeUpdates.forNode(0).changed(key, longString, longerString).build();
assertEquals(expected, update);
}
use of org.neo4j.kernel.api.index.NodeUpdates in project neo4j by neo4j.
the class PropertyPhysicalToLogicalConverterTest method shouldTreatPropertyThatMovedToAnotherRecordAsChange.
@Test
public void shouldTreatPropertyThatMovedToAnotherRecordAsChange() throws Exception {
// GIVEN
int key = 12;
String oldValue = "value1";
String newValue = "value two";
PropertyRecordChange movedFrom = change(propertyRecord(property(key, oldValue)), propertyRecord());
PropertyRecordChange movedTo = change(propertyRecord(), propertyRecord(property(key, newValue)));
// WHEN
NodeUpdates update = convert(none, none, movedFrom, movedTo);
// THEN
NodeUpdates expected = NodeUpdates.forNode(0).changed(key, oldValue, newValue).build();
assertEquals(expected, update);
}
use of org.neo4j.kernel.api.index.NodeUpdates in project neo4j by neo4j.
the class PropertyPhysicalToLogicalConverterTest method shouldConvertInlinedChangedProperty.
@Test
public void shouldConvertInlinedChangedProperty() throws Exception {
// GIVEN
int key = 10;
int valueBefore = 12341, valueAfter = 738;
PropertyRecord before = propertyRecord(property(key, valueBefore));
PropertyRecord after = propertyRecord(property(key, valueAfter));
// WHEN
NodeUpdates update = convert(none, none, change(before, after));
// THEN
NodeUpdates expected = NodeUpdates.forNode(0).changed(key, valueBefore, valueAfter).build();
assertEquals(expected, update);
}
use of org.neo4j.kernel.api.index.NodeUpdates in project neo4j by neo4j.
the class PropertyPhysicalToLogicalConverterTest method shouldNotConvertDynamicAddedProperty.
@Test
public void shouldNotConvertDynamicAddedProperty() throws Exception {
// GIVEN
int key = 10;
PropertyRecord before = propertyRecord();
PropertyRecord after = propertyRecord(property(key, longString));
// WHEN
NodeUpdates update = convert(none, none, change(before, after));
// THEN
assertFalse(update.hasIndexingAppropriateUpdates());
}
use of org.neo4j.kernel.api.index.NodeUpdates in project neo4j by neo4j.
the class MultiIndexPopulationConcurrentUpdatesIT method applyConcurrentChangesToPopulatedIndex.
@Test
public void applyConcurrentChangesToPopulatedIndex() throws Exception {
List<NodeUpdates> updates = new ArrayList<>(2);
updates.add(NodeUpdates.forNode(3, id(COLOR_LABEL)).changed(propertyId, "green", "pink").build());
updates.add(NodeUpdates.forNode(5, id(CAR_LABEL)).changed(propertyId, "Ford", "SAAB").build());
launchCustomIndexPopulation(labelsNameIdMap, propertyId, updates);
waitAndActivateIndexes(labelsNameIdMap, propertyId);
try (Transaction ignored = embeddedDatabase.beginTx()) {
Integer colorLabelId = labelsNameIdMap.get(COLOR_LABEL);
Integer carLabelId = labelsNameIdMap.get(CAR_LABEL);
try (IndexReader indexReader = getIndexReader(propertyId, colorLabelId)) {
assertEquals("Should be deleted by concurrent change.", 0, indexReader.countIndexedNodes(3, "green"));
}
try (IndexReader indexReader = getIndexReader(propertyId, colorLabelId)) {
assertEquals("Should be updated by concurrent change.", 1, indexReader.countIndexedNodes(3, "pink"));
}
try (IndexReader indexReader = getIndexReader(propertyId, carLabelId)) {
assertEquals("Should be added by concurrent change.", 1, indexReader.countIndexedNodes(5, "SAAB"));
}
}
}
Aggregations