Search in sources :

Example 91 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class PropertyPhysicalToLogicalConverterTest method shouldConvertDynamicInlinedRemovedProperty.

@Test
void shouldConvertDynamicInlinedRemovedProperty() {
    // GIVEN
    int key = 10;
    PropertyRecord before = propertyRecord(property(key, longString));
    PropertyRecord after = propertyRecord();
    // WHEN
    EntityUpdates update = convert(none, none, change(before, after));
    // THEN
    EntityUpdates expected = EntityUpdates.forEntity(0, false).removed(key, longString).build();
    assertEquals(expected, update);
}
Also used : EntityUpdates(org.neo4j.storageengine.api.EntityUpdates) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) Test(org.junit.jupiter.api.Test)

Example 92 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class PropertyPhysicalToLogicalConverterTest method shouldIgnoreInlinedUnchangedProperty.

@Test
void shouldIgnoreInlinedUnchangedProperty() {
    // GIVEN
    int key = 10;
    Value value = Values.of(12341);
    PropertyRecord before = propertyRecord(property(key, value));
    PropertyRecord after = propertyRecord(property(key, value));
    // WHEN
    assertThat(convert(none, none, change(before, after))).isEqualTo(EntityUpdates.forEntity(0, false).build());
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) Value(org.neo4j.values.storable.Value) Test(org.junit.jupiter.api.Test)

Example 93 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class PropertyPhysicalToLogicalConverterTest method propertyRecord.

private static PropertyRecord propertyRecord(PropertyBlock... propertyBlocks) {
    PropertyRecord record = new PropertyRecord(0);
    if (propertyBlocks != null) {
        record.setInUse(true);
        for (PropertyBlock propertyBlock : propertyBlocks) {
            record.addPropertyBlock(propertyBlock);
        }
    }
    record.setNodeId(0);
    return record;
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) PropertyBlock(org.neo4j.kernel.impl.store.record.PropertyBlock)

Example 94 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class PropertyPhysicalToLogicalConverterTest method shouldConvertDynamicAddedProperty.

@Test
void shouldConvertDynamicAddedProperty() {
    // GIVEN
    int key = 10;
    PropertyRecord before = propertyRecord();
    PropertyRecord after = propertyRecord(property(key, longString));
    // THEN
    assertThat(convert(none, none, change(before, after))).isEqualTo(EntityUpdates.forEntity(0, false).added(key, longString).build());
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) Test(org.junit.jupiter.api.Test)

Example 95 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class LogCommandSerializationV4_0Test method readPropertyCommandWithSecondaryUnit.

@Test
void readPropertyCommandWithSecondaryUnit() throws IOException {
    InMemoryClosableChannel channel = new InMemoryClosableChannel();
    PropertyRecord before = new PropertyRecord(1);
    PropertyRecord after = new PropertyRecord(1);
    after.setSecondaryUnitIdOnCreate(78);
    new Command.PropertyCommand(writer(), before, after).serialize(channel);
    CommandReader reader = createReader();
    StorageCommand command = reader.read(channel);
    assertTrue(command instanceof Command.PropertyCommand);
    Command.PropertyCommand propertyCommand = (Command.PropertyCommand) command;
    // Then
    assertBeforeAndAfterEquals(propertyCommand, before, after);
}
Also used : CommandReader(org.neo4j.storageengine.api.CommandReader) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) InMemoryClosableChannel(org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel) StorageCommand(org.neo4j.storageengine.api.StorageCommand) StorageCommand(org.neo4j.storageengine.api.StorageCommand) RepeatedTest(org.junit.jupiter.api.RepeatedTest) Test(org.junit.jupiter.api.Test)

Aggregations

PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)230 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)86 Test (org.junit.Test)75 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)37 Test (org.junit.jupiter.api.Test)36 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)35 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)28 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)19 ArrayList (java.util.ArrayList)17 Value (org.neo4j.values.storable.Value)17 PrimitiveRecord (org.neo4j.kernel.impl.store.record.PrimitiveRecord)14 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)14 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)12 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 PropertyStore (org.neo4j.kernel.impl.store.PropertyStore)9 IOException (java.io.IOException)8 InterruptedIOException (java.io.InterruptedIOException)8 Pair (org.neo4j.helpers.collection.Pair)8 DefinedProperty (org.neo4j.kernel.api.properties.DefinedProperty)8 NodeStore (org.neo4j.kernel.impl.store.NodeStore)8