use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdateForAllChangedNonSchemaIndex.
@ParameterizedTest
@EnumSource(Entity.class)
void shouldGenerateUpdateForAllChangedNonSchemaIndex(Entity entity) {
// When
Value newValue1 = Values.of("Nio");
Value newValue2 = Values.of(10L);
Value newValue3 = Values.pointValue(CoordinateReferenceSystem.WGS84, 32.3, 15.6);
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(TOKEN).changed(PROPERTY_1.propertyKeyId(), PROPERTY_1.value(), newValue1).changed(PROPERTY_2.propertyKeyId(), PROPERTY_2.value(), newValue2).changed(PROPERTY_3.propertyKeyId(), PROPERTY_3.value(), newValue3).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(singleton(entity.nonSchemaIndex()), propertyLoader(PROPERTY_1, PROPERTY_2, PROPERTY_3), entity.type(), NULL, INSTANCE)).contains(IndexEntryUpdate.change(ENTITY_ID, entity.nonSchemaIndex(), VALUES_123, new Value[] { newValue1, newValue2, newValue3 }));
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdateForFullNonSchemaIndexUpdate.
@ParameterizedTest
@EnumSource(Entity.class)
void shouldGenerateUpdateForFullNonSchemaIndexUpdate(Entity entity) {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(TOKEN).added(PROPERTY_1.propertyKeyId(), PROPERTY_1.value()).added(PROPERTY_2.propertyKeyId(), PROPERTY_2.value()).added(PROPERTY_3.propertyKeyId(), PROPERTY_3.value()).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(singleton(entity.nonSchemaIndex()), propertyLoader(), entity.type(), NULL, INSTANCE)).contains(IndexEntryUpdate.add(ENTITY_ID, entity.nonSchemaIndex(), VALUES_123));
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldNotGenerateUpdatesForTokenRemovalWithNoProperties.
@ParameterizedTest
@EnumSource(Entity.class)
void shouldNotGenerateUpdatesForTokenRemovalWithNoProperties(Entity entity) {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(EMPTY).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(entity.indexes(), propertyLoader(), entity.type(), NULL, INSTANCE)).isEmpty();
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdateWhenRemovingLastPropForNonSchemaIndex.
@ParameterizedTest
@EnumSource(Entity.class)
void shouldGenerateUpdateWhenRemovingLastPropForNonSchemaIndex(Entity entity) {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(TOKEN).removed(PROPERTY_2.propertyKeyId(), PROPERTY_2.value()).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(singleton(entity.nonSchemaIndex()), propertyLoader(PROPERTY_2), entity.type(), NULL, INSTANCE)).contains(IndexEntryUpdate.remove(ENTITY_ID, entity.nonSchemaIndex(), null, PROPERTY_2.value(), null));
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldNotGenerateUpdateWhenRemovingOneTokenForNonSchemaIndex.
@Test
void shouldNotGenerateUpdateWhenRemovingOneTokenForNonSchemaIndex() {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(ALL_TOKENS).withTokensAfter(TOKEN).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(singleton(NON_SCHEMA_NODE_INDEX), propertyLoader(PROPERTY_1, PROPERTY_2, PROPERTY_3), EntityType.NODE, NULL, INSTANCE)).isEmpty();
}
Aggregations