use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_1Test method propertyBlockWithSomeDynamicRecords.
private PropertyBlock propertyBlockWithSomeDynamicRecords(int keyId, PropertyType type, long value, byte[]... dynamicRecordData) {
PropertyBlock block = new PropertyBlock();
block.setSingleBlock(PropertyStore.singleBlockLongValue(keyId, type, value));
for (byte[] bytes : dynamicRecordData) {
block.addValueRecord(dynamicRecord(true, bytes, type.intValue()));
}
return block;
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_1Test method shouldReadPropertyCommandWithDeletedDynamicRecords.
@Test
public void shouldReadPropertyCommandWithDeletedDynamicRecords() throws Exception {
// GIVEN
PhysicalLogCommandReaderV2_1 reader = new PhysicalLogCommandReaderV2_1();
InMemoryClosableChannel data = new InMemoryClosableChannel();
long id = 5;
int keyId = 6;
byte[] data1 = new byte[] { 1, 2, 3, 4, 5 };
byte[] data2 = new byte[] { 6, 7, 8, 9, 10 };
long value = 1234;
PropertyRecord property = new PropertyRecord(id);
property.setInUse(true);
property.addPropertyBlock(propertyBlockWithSomeDynamicRecords(keyId, STRING, value, data1, data2));
property.addDeletedRecord(dynamicRecord(false, null, STRING.intValue()));
property.addDeletedRecord(dynamicRecord(false, null, STRING.intValue()));
// WHEN
new PropertyCommand(new PropertyRecord(id), property).serialize(data);
// THEN
PropertyCommand readCommand = (PropertyCommand) reader.read(data);
PropertyRecord readRecord = readCommand.getAfter();
assertEquals(id, readRecord.getId());
PropertyBlock readBlock = Iterables.single((Iterable<PropertyBlock>) readRecord);
assertArrayEquals(data1, readBlock.getValueRecords().get(0).getData());
assertArrayEquals(data2, readBlock.getValueRecords().get(1).getData());
assertEquals(2, readRecord.getDeletedRecords().size());
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class StorePropertyCursorTest method createSinglePropertyValue.
private static PropertyRecord createSinglePropertyValue(PropertyStore store, int keyId, Object value) {
DynamicRecordAllocator stringAllocator = store.getStringStore();
DynamicRecordAllocator arrayAllocator = store.getArrayStore();
PropertyBlock block = new PropertyBlock();
PropertyStore.encodeValue(block, keyId, value, stringAllocator, arrayAllocator);
PropertyRecord record = new PropertyRecord(store.nextId());
record.addPropertyBlock(block);
record.setInUse(true);
updateRecord(store, record);
return record;
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class StorePropertyCursorTest method markDynamicRecordsNotInUse.
private static void markDynamicRecordsNotInUse(int keyId, PropertyRecord record, PropertyStore store, int... dynamicRecordIndexes) {
PropertyBlock propertyBlock = record.getPropertyBlock(keyId);
store.ensureHeavy(propertyBlock);
List<DynamicRecord> valueRecords = propertyBlock.getValueRecords();
for (int index : dynamicRecordIndexes) {
DynamicRecord dynamicRecord = valueRecords.get(index);
dynamicRecord.setInUse(false);
}
updateRecord(store, record);
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class PropertyCreatorTest method existingRecord.
private void existingRecord(PropertyRecord record, ExpectedRecord initialRecord) {
for (ExpectedProperty initialProperty : initialRecord.properties) {
PropertyBlock block = new PropertyBlock();
PropertyStore.encodeValue(block, initialProperty.key, initialProperty.value, null, null);
record.addPropertyBlock(block);
}
assertTrue(record.size() <= PropertyType.getPayloadSize());
}
Aggregations