use of org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method shouldReadPropertyKeyCommand.
@Test
void shouldReadPropertyKeyCommand() throws Exception {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
PropertyKeyTokenRecord before = new PropertyKeyTokenRecord(42);
PropertyKeyTokenRecord after = before.copy();
after.initialize(true, 13);
after.setCreated();
new Command.PropertyKeyTokenCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.PropertyKeyTokenCommand);
Command.PropertyKeyTokenCommand propertyKeyTokenCommand = (Command.PropertyKeyTokenCommand) command;
// Then
assertBeforeAndAfterEquals(propertyKeyTokenCommand, before, after);
}
use of org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method shouldReadInternalPropertyKeyCommand.
@Test
void shouldReadInternalPropertyKeyCommand() throws Exception {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
PropertyKeyTokenRecord before = new PropertyKeyTokenRecord(42);
PropertyKeyTokenRecord after = before.copy();
after.initialize(true, 13);
after.setCreated();
after.setInternal(true);
new Command.PropertyKeyTokenCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.PropertyKeyTokenCommand);
Command.PropertyKeyTokenCommand propertyKeyTokenCommand = (Command.PropertyKeyTokenCommand) command;
// Then
assertBeforeAndAfterEquals(propertyKeyTokenCommand, before, after);
}
use of org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord in project neo4j by neo4j.
the class LogTruncationTest method createPropertyKeyTokenRecord.
private static PropertyKeyTokenRecord createPropertyKeyTokenRecord(int id) {
PropertyKeyTokenRecord propertyKeyTokenRecord = new PropertyKeyTokenRecord(id);
propertyKeyTokenRecord.setInUse(true);
propertyKeyTokenRecord.setNameId(333);
propertyKeyTokenRecord.addNameRecord(new DynamicRecord(43));
return propertyKeyTokenRecord;
}
use of org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord in project neo4j by neo4j.
the class AbstractRecordCloningTest method preparedPropertyKeyTokenClone.
@RepeatedTest(1000)
void preparedPropertyKeyTokenClone() {
PropertyKeyTokenRecord propertyKeyTokenRecord = getPropertyKeyTokenRecord();
propertyKeyTokenFormat.prepare(propertyKeyTokenRecord, propertyKeyTokenRecordSize, idSequence, NULL);
keys.propertyKeyToken().assertRecordsEquals(propertyKeyTokenRecord, propertyKeyTokenRecord.copy());
}
use of org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord in project neo4j by neo4j.
the class ManyPropertyKeysIT method databaseWithManyPropertyKeys.
private GraphDatabaseAPI databaseWithManyPropertyKeys(int propertyKeyCount) throws IOException {
var cacheTracer = PageCacheTracer.NULL;
var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("databaseWithManyPropertyKeys"));
StoreFactory storeFactory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fileSystem, immediate(), databaseLayout.getDatabaseName()), pageCache, fileSystem, NullLogProvider.getInstance(), cacheTracer, writable());
NeoStores neoStores = storeFactory.openAllNeoStores(true);
PropertyKeyTokenStore store = neoStores.getPropertyKeyTokenStore();
for (int i = 0; i < propertyKeyCount; i++) {
PropertyKeyTokenRecord record = new PropertyKeyTokenRecord((int) store.nextId(cursorContext));
record.setInUse(true);
Collection<DynamicRecord> nameRecords = store.allocateNameRecords(PropertyStore.encodeString(key(i)), cursorContext, INSTANCE);
record.addNameRecords(nameRecords);
record.setNameId((int) Iterables.first(nameRecords).getId());
store.updateRecord(record, NULL);
}
neoStores.flush(cursorContext);
neoStores.close();
return database();
}
Aggregations