Search in sources :

Example 26 with NodeRecord

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

the class NodeCheckTypeTest method inUseRecordEquality.

@Test
public void inUseRecordEquality() {
    NodeRecord record1 = new NodeRecord(1);
    record1.initialize(true, 1, false, 2, 3);
    record1.setSecondaryUnitId(42);
    NodeRecord record2 = record1.clone();
    NodeCheckType check = new NodeCheckType();
    assertTrue(check.equal(record1, record2));
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) Test(org.junit.Test)

Example 27 with NodeRecord

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

the class NodeRecordFormatTest method readDoubleUnitRecordStoredNotInFixedReferenceFormat.

@Test
public void readDoubleUnitRecordStoredNotInFixedReferenceFormat() throws Exception {
    NodeRecord oldFormatRecord = new NodeRecord(1);
    NodeRecord newFormatRecord = new NodeRecord(1);
    oldFormatRecord.initialize(true, bigReference(), true, bigReference(), 1L);
    writeRecordWithOldFormat(oldFormatRecord);
    assertTrue("This should be double unit record.", oldFormatRecord.hasSecondaryUnitId());
    assertFalse("Old format is not aware about fixed references.", oldFormatRecord.isUseFixedReferences());
    recordFormat.read(newFormatRecord, pageCursor, RecordLoad.NORMAL, NodeRecordFormat.RECORD_SIZE);
    verifySameReferences(oldFormatRecord, newFormatRecord);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) Test(org.junit.Test)

Example 28 with NodeRecord

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

the class NodeRecordFormatTest method readSingleUnitRecordStoredNotInFixedReferenceFormat.

@Test
public void readSingleUnitRecordStoredNotInFixedReferenceFormat() throws Exception {
    NodeRecord oldFormatRecord = new NodeRecord(1);
    NodeRecord newFormatRecord = new NodeRecord(1);
    oldFormatRecord.initialize(true, randomFixedReference(), true, randomFixedReference(), 1L);
    writeRecordWithOldFormat(oldFormatRecord);
    assertFalse("This should be single unit record.", oldFormatRecord.hasSecondaryUnitId());
    assertFalse("Old format is not aware about fixed references.", oldFormatRecord.isUseFixedReferences());
    recordFormat.read(newFormatRecord, pageCursor, RecordLoad.NORMAL, NodeRecordFormat.RECORD_SIZE);
    verifySameReferences(oldFormatRecord, newFormatRecord);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) Test(org.junit.Test)

Example 29 with NodeRecord

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

the class NodeRecordFormatTest method useVariableLengthFormatWhenPropertyReferenceTooBig.

@Test
public void useVariableLengthFormatWhenPropertyReferenceTooBig() throws IOException {
    NodeRecord source = new NodeRecord(1);
    NodeRecord target = new NodeRecord(1);
    source.initialize(true, randomFixedReference(), true, 1L << 37, 0L);
    writeReadRecord(source, target);
    assertFalse("Record should use variable length reference format.", target.isUseFixedReferences());
    verifySameReferences(source, target);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) Test(org.junit.Test)

Example 30 with NodeRecord

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

the class NodeRecordFormatTest method useFixedReferencesFormatWhenPropertyIsMissing.

@Test
public void useFixedReferencesFormatWhenPropertyIsMissing() throws IOException {
    NodeRecord source = new NodeRecord(1);
    NodeRecord target = new NodeRecord(1);
    source.initialize(true, Record.NULL_REFERENCE.intValue(), true, randomFixedReference(), 0L);
    writeReadRecord(source, target);
    assertTrue("Record should use fixed reference format.", target.isUseFixedReferences());
    verifySameReferences(source, target);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) Test(org.junit.Test)

Aggregations

NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)257 Test (org.junit.Test)190 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)62 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)51 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)38 Command (org.neo4j.kernel.impl.transaction.command.Command)29 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)28 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)27 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)26 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)23 NodeLabels (org.neo4j.kernel.impl.store.NodeLabels)23 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)22 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)22 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)22 ArrayList (java.util.ArrayList)19 DynamicNodeLabels (org.neo4j.kernel.impl.store.DynamicNodeLabels)19 File (java.io.File)15 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)13 NodeStore (org.neo4j.kernel.impl.store.NodeStore)11 ReusableRecordsAllocator (org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator)10