Search in sources :

Example 31 with NeoStoreRecord

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

the class OwnerCheckTest method shouldReportNodeStoreReferencingSameChainAsNode.

@Test
public void shouldReportNodeStoreReferencingSameChainAsNode() throws Exception {
    // given
    OwnerCheck decorator = new OwnerCheck(true);
    RecordCheck<NodeRecord, ConsistencyReport.NodeConsistencyReport> nodeChecker = decorator.decorateNodeChecker(dummyNodeCheck());
    RecordCheck<NeoStoreRecord, ConsistencyReport.NeoStoreConsistencyReport> neoStoreCheck = decorator.decorateNeoStoreChecker(dummyNeoStoreCheck());
    RecordAccessStub records = new RecordAccessStub();
    NodeRecord node = records.add(inUse(new NodeRecord(1, false, NONE, 7)));
    NeoStoreRecord master = records.add(new NeoStoreRecord());
    master.setNextProp(node.getNextProp());
    // when
    ConsistencyReport.NodeConsistencyReport nodeReport = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node, records);
    ConsistencyReport.NeoStoreConsistencyReport masterReport = check(ConsistencyReport.NeoStoreConsistencyReport.class, neoStoreCheck, master, records);
    // then
    verifyZeroInteractions(nodeReport);
    verify(masterReport).multipleOwners(node);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) NeoStoreRecord(org.neo4j.kernel.impl.store.record.NeoStoreRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 32 with NeoStoreRecord

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

the class OwnerCheckTest method shouldReportNodeWithReferenceToTheGraphGlobalChain.

@Test
public void shouldReportNodeWithReferenceToTheGraphGlobalChain() throws Exception {
    // given
    OwnerCheck decorator = new OwnerCheck(true);
    RecordCheck<NodeRecord, ConsistencyReport.NodeConsistencyReport> nodeChecker = decorator.decorateNodeChecker(dummyNodeCheck());
    RecordCheck<NeoStoreRecord, ConsistencyReport.NeoStoreConsistencyReport> neoStoreCheck = decorator.decorateNeoStoreChecker(dummyNeoStoreCheck());
    RecordAccessStub records = new RecordAccessStub();
    NodeRecord node = records.add(inUse(new NodeRecord(1, false, NONE, 7)));
    NeoStoreRecord master = records.add(new NeoStoreRecord());
    master.setNextProp(node.getNextProp());
    // when
    ConsistencyReport.NeoStoreConsistencyReport masterReport = check(ConsistencyReport.NeoStoreConsistencyReport.class, neoStoreCheck, master, records);
    ConsistencyReport.NodeConsistencyReport nodeReport = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node, records);
    // then
    verifyZeroInteractions(masterReport);
    verify(nodeReport).multipleOwners(master);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) NeoStoreRecord(org.neo4j.kernel.impl.store.record.NeoStoreRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 33 with NeoStoreRecord

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

the class NeoStoreTransactionApplierTest method shouldApplyNeoStoreCommandToTheStore.

// NEO STORE COMMAND
@Test
public void shouldApplyNeoStoreCommandToTheStore() throws Exception {
    // given
    final BatchTransactionApplier applier = newApplier(false);
    final NeoStoreRecord before = new NeoStoreRecord();
    final NeoStoreRecord after = new NeoStoreRecord();
    after.setNextProp(42);
    final Command command = new Command.NeoStoreCommand(before, after);
    // when
    boolean result = apply(applier, command::handle, transactionToApply);
    // then
    assertFalse(result);
    verify(metaDataStore, times(1)).setGraphNextProp(after.getNextProp());
}
Also used : NeoStoreRecord(org.neo4j.kernel.impl.store.record.NeoStoreRecord) RelationshipTypeTokenCommand(org.neo4j.kernel.impl.transaction.command.Command.RelationshipTypeTokenCommand) LabelTokenCommand(org.neo4j.kernel.impl.transaction.command.Command.LabelTokenCommand) PropertyKeyTokenCommand(org.neo4j.kernel.impl.transaction.command.Command.PropertyKeyTokenCommand) BatchTransactionApplier(org.neo4j.kernel.impl.api.BatchTransactionApplier) Test(org.junit.Test)

Example 34 with NeoStoreRecord

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

the class LogCommandSerializationV3_0_10 method readNeoStoreRecord.

private static NeoStoreRecord readNeoStoreRecord(ReadableChannel channel) throws IOException {
    long nextProp = channel.getLong();
    NeoStoreRecord record = new NeoStoreRecord();
    record.setNextProp(nextProp);
    return record;
}
Also used : NeoStoreRecord(org.neo4j.kernel.impl.store.record.NeoStoreRecord)

Example 35 with NeoStoreRecord

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

the class MessageConsistencyLoggerTest method shouldFlattenAMultiLineMessageToASingleLine.

@Test
void shouldFlattenAMultiLineMessageToASingleLine() {
    // when
    logger.error(RecordType.NEO_STORE, new NeoStoreRecord(), "multiple\n line\r\n message", 1, 2);
    // then
    logMatcher.forLevel(ERROR).containsMessages(join("multiple line message", neoStoreRecord(true, -1), "Inconsistent with: 1 2"));
}
Also used : NeoStoreRecord(org.neo4j.kernel.impl.store.record.NeoStoreRecord) Test(org.junit.jupiter.api.Test)

Aggregations

NeoStoreRecord (org.neo4j.kernel.impl.store.record.NeoStoreRecord)36 Test (org.junit.Test)16 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)9 Test (org.junit.jupiter.api.Test)5 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)5 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)5 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)3 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)3 Command (org.neo4j.kernel.impl.transaction.command.Command)3 File (java.io.File)2 BatchTransactionApplier (org.neo4j.kernel.impl.api.BatchTransactionApplier)2 LabelTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.LabelTokenCommand)2 PropertyKeyTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.PropertyKeyTokenCommand)2 RelationshipTypeTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.RelationshipTypeTokenCommand)2 InMemoryClosableChannel (org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel)2 PhysicalLogFile (org.neo4j.kernel.impl.transaction.log.PhysicalLogFile)2 PhysicalLogFiles (org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles)2 LabelTokenRecord (org.neo4j.kernel.impl.store.record.LabelTokenRecord)1 PrimitiveRecord (org.neo4j.kernel.impl.store.record.PrimitiveRecord)1 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)1