use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdateWhenAddingOneTokenForNonSchemaIndex.
@Test
void shouldGenerateUpdateWhenAddingOneTokenForNonSchemaIndex() {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(EMPTY).withTokensAfter(TOKEN).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(singleton(NON_SCHEMA_NODE_INDEX), propertyLoader(PROPERTY_1, PROPERTY_2, PROPERTY_3), EntityType.NODE, NULL, INSTANCE)).contains(IndexEntryUpdate.add(ENTITY_ID, NON_SCHEMA_NODE_INDEX, VALUES_123));
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdateForSingleChangeNonSchemaIndex.
@ParameterizedTest
@EnumSource(Entity.class)
void shouldGenerateUpdateForSingleChangeNonSchemaIndex(Entity entity) {
// When
Value newValue2 = Values.of(10L);
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(TOKEN).changed(PROPERTY_2.propertyKeyId(), PROPERTY_2.value(), newValue2).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[] { PROPERTY_1.value(), newValue2, PROPERTY_3.value() }));
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdateWhenSwitchingToUselessTokenForNonSchemaIndex.
@Test
void shouldGenerateUpdateWhenSwitchingToUselessTokenForNonSchemaIndex() {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(UNUSED_TOKEN_ID).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(singleton(NON_SCHEMA_NODE_INDEX), propertyLoader(PROPERTY_1, PROPERTY_2, PROPERTY_3), EntityType.NODE, NULL, INSTANCE)).contains(IndexEntryUpdate.remove(ENTITY_ID, NON_SCHEMA_NODE_INDEX, VALUES_123));
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldNotGenerateUpdatesForLabelRemoveAndPropertyAdd.
@Test
void shouldNotGenerateUpdatesForLabelRemoveAndPropertyAdd() {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(EMPTY).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(NODE_INDEXES, assertNoLoading(), EntityType.NODE, NULL, INSTANCE)).isEmpty();
}
use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.
the class EntityValueUpdatesTest method shouldGenerateUpdateForLabelRemovalWithExistingProperty.
@Test
void shouldGenerateUpdateForLabelRemovalWithExistingProperty() {
// When
EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(EMPTY).build();
// Then
assertThat(updates.valueUpdatesForIndexKeys(NODE_INDEXES, propertyLoader(PROPERTY_1), EntityType.NODE, NULL, INSTANCE)).contains(IndexEntryUpdate.remove(ENTITY_ID, NODE_INDEX_1, PROPERTY_1.value()));
}
Aggregations