Search in sources :

Example 41 with EntityUpdates

use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.

the class EntityTokenUpdatesTest method shouldGenerateUpdateForAddedTokens.

@ParameterizedTest
@EnumSource(Entity.class)
void shouldGenerateUpdateForAddedTokens(Entity entity) {
    EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(EMPTY).withTokensAfter(TOKEN_1_ID, TOKEN_2_ID).build();
    assertThat(updates.tokenUpdateForIndexKey(entity.getTokenIndex(), -1)).contains(IndexEntryUpdate.change(ENTITY_ID, entity.getTokenIndex(), EMPTY, new long[] { TOKEN_1_ID, TOKEN_2_ID }));
}
Also used : EntityUpdates(org.neo4j.storageengine.api.EntityUpdates) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 42 with EntityUpdates

use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.

the class EntityValueUpdatesTest method shouldGenerateUpdateWhenCompletingCompositeSchemaIndexUpdate.

@ParameterizedTest
@EnumSource(Entity.class)
void shouldGenerateUpdateWhenCompletingCompositeSchemaIndexUpdate(Entity entity) {
    // When
    EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(TOKEN).added(PROPERTY_KEY_ID_1, Values.of("Neo")).added(PROPERTY_KEY_ID_3, Values.pointValue(CoordinateReferenceSystem.WGS84, 12.3, 45.6)).build();
    // Then
    assertThat(updates.valueUpdatesForIndexKeys(singleton(entity.index123()), propertyLoader(PROPERTY_2), entity.type(), NULL, INSTANCE)).contains(IndexEntryUpdate.add(ENTITY_ID, entity.index123(), VALUES_123));
}
Also used : EntityUpdates(org.neo4j.storageengine.api.EntityUpdates) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 43 with EntityUpdates

use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.

the class EntityValueUpdatesTest method shouldNotLoadPropertyForNoTokenAndNoPropertyChanges.

@ParameterizedTest
@EnumSource(Entity.class)
void shouldNotLoadPropertyForNoTokenAndNoPropertyChanges(Entity entity) {
    // When
    EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).build();
    // Then
    assertThat(updates.valueUpdatesForIndexKeys(singleton(entity.index1()), assertNoLoading(), entity.type(), NULL, INSTANCE)).isEmpty();
}
Also used : EntityUpdates(org.neo4j.storageengine.api.EntityUpdates) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 44 with EntityUpdates

use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.

the class EntityValueUpdatesTest method shouldNotGenerateUpdatesForTokenAdditionWithNoProperties.

@ParameterizedTest
@EnumSource(Entity.class)
void shouldNotGenerateUpdatesForTokenAdditionWithNoProperties(Entity entity) {
    // When
    EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(EMPTY).withTokensAfter(TOKEN).build();
    // Then
    assertThat(updates.valueUpdatesForIndexKeys(entity.indexes(), propertyLoader(), entity.type(), NULL, INSTANCE)).isEmpty();
}
Also used : EntityUpdates(org.neo4j.storageengine.api.EntityUpdates) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 45 with EntityUpdates

use of org.neo4j.storageengine.api.EntityUpdates in project neo4j by neo4j.

the class EntityValueUpdatesTest method shouldNotGenerateUpdateWhenAddingAnotherUselessTokenForNonSchemaIndex.

@Test
void shouldNotGenerateUpdateWhenAddingAnotherUselessTokenForNonSchemaIndex() {
    // When
    EntityUpdates updates = EntityUpdates.forEntity(ENTITY_ID, false).withTokens(TOKEN).withTokensAfter(TOKEN_ID_1, UNUSED_TOKEN_ID).build();
    // Then
    assertThat(updates.valueUpdatesForIndexKeys(singleton(NON_SCHEMA_NODE_INDEX), propertyLoader(PROPERTY_1, PROPERTY_2, PROPERTY_3), EntityType.NODE, NULL, INSTANCE)).isEmpty();
}
Also used : EntityUpdates(org.neo4j.storageengine.api.EntityUpdates) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

EntityUpdates (org.neo4j.storageengine.api.EntityUpdates)50 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)41 Test (org.junit.jupiter.api.Test)22 EnumSource (org.junit.jupiter.params.provider.EnumSource)21 Value (org.neo4j.values.storable.Value)6 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)4 ArrayList (java.util.ArrayList)3 MethodSource (org.junit.jupiter.params.provider.MethodSource)3 Transaction (org.neo4j.graphdb.Transaction)3 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)3 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)3 PropertyKeyValue (org.neo4j.storageengine.api.PropertyKeyValue)3 StorageNodeCursor (org.neo4j.storageengine.api.StorageNodeCursor)2 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)1 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)1 IndexAccessor (org.neo4j.kernel.api.index.IndexAccessor)1 IndexUpdater (org.neo4j.kernel.api.index.IndexUpdater)1 StoragePropertyCursor (org.neo4j.storageengine.api.StoragePropertyCursor)1 StorageReader (org.neo4j.storageengine.api.StorageReader)1 ValueIndexEntryUpdate (org.neo4j.storageengine.api.ValueIndexEntryUpdate)1