internal override DynamicRecord Record(long id) { DynamicRecord result = new DynamicRecord(id); result.SetType(SCHEMA_RECORD_TYPE); return(result); }
public static DynamicRecord AllocateRecord(long id) { DynamicRecord record = new DynamicRecord(id); record.SetCreated(); record.InUse = true; return(record); }
private DynamicRecord DynamicRecord() { DynamicRecord dynamicRecord = new DynamicRecord(42); dynamicRecord.SetType(PropertyType.String.intValue()); dynamicRecord.SetCreated(); return(dynamicRecord); }
private PropertyBlock PropertyBlockWith(DynamicRecord dynamicRecord) { PropertyBlock propertyBlock = new PropertyBlock(); PropertyKeyTokenRecord key = new PropertyKeyTokenRecord(10); propertyBlock.SingleBlock = key.Id | ((( long )PropertyType.String.intValue()) << 24) | (dynamicRecord.Id << 28); propertyBlock.AddValueRecord(dynamicRecord); return(propertyBlock); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void allocateReusableRecordsAndSwitchToDefaultWhenExhausted() public virtual void AllocateReusableRecordsAndSwitchToDefaultWhenExhausted() { DynamicRecord dynamicRecord1 = new DynamicRecord(1); DynamicRecord dynamicRecord2 = new DynamicRecord(2); DynamicRecordAllocator recordAllocator = mock(typeof(DynamicRecordAllocator)); Mockito.when(recordAllocator.NextRecord()).thenReturn(dynamicRecord2); ReusableRecordsCompositeAllocator compositeAllocator = new ReusableRecordsCompositeAllocator(singletonList(dynamicRecord1), recordAllocator); assertSame("Same as pre allocated record.", dynamicRecord1, compositeAllocator.NextRecord()); assertSame("Same as expected allocated record.", dynamicRecord2, compositeAllocator.NextRecord()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void trackRecordsAvailability() public virtual void TrackRecordsAvailability() { DynamicRecord dynamicRecord1 = new DynamicRecord(1); DynamicRecord dynamicRecord2 = new DynamicRecord(1); ReusableRecordsAllocator recordsAllocator = new ReusableRecordsAllocator(10, dynamicRecord1, dynamicRecord2); assertSame("Should be the same as first available record.", dynamicRecord1, recordsAllocator.NextRecord()); assertTrue("Should have second record.", recordsAllocator.HasNext()); assertSame("Should be the same as second available record.", dynamicRecord2, recordsAllocator.NextRecord()); assertFalse("Should be out of available records", recordsAllocator.HasNext()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void allocatePreviouslyUsedRecord() public virtual void AllocatePreviouslyUsedRecord() { DynamicRecord dynamicRecord = new DynamicRecord(1); dynamicRecord.InUse = true; ReusableRecordsAllocator recordsAllocator = new ReusableRecordsAllocator(10, dynamicRecord); DynamicRecord allocatedRecord = recordsAllocator.NextRecord(); assertSame("Records should be the same.", allocatedRecord, dynamicRecord); assertTrue("Record should be marked as used.", allocatedRecord.InUse()); assertFalse("Record should be marked as created.", allocatedRecord.Created); }
public override void CheckReference(RECORD record, DynamicRecord name, CheckerEngine <RECORD, REPORT> engine, RecordAccess records) { if (!name.InUse()) { NameNotInUse(engine.Report(), name); } else { if (name.Length <= 0) { EmptyName(engine.Report(), name); } } }
public override RecordGenerators_Generator <DynamicRecord> Dynamic() { return((recordSize, format, recordId) => { int dataSize = recordSize - format.RecordHeaderSize; int length = _random.nextBoolean() ? dataSize : _random.Next(dataSize); long next = length == dataSize?RandomLong(_propertyBits) : _nullValue; DynamicRecord record = (new DynamicRecord(max(1, recordId))).initialize(_random.nextBoolean(), _random.nextBoolean(), next, _random.Next(PropertyType.values().length), length); sbyte[] bytes = _random.nextByteArray(record.Length, record.Length).asObjectCopy(); record.Data = bytes; return record; }); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReportEmptyName() internal virtual void ShouldReportEmptyName() { // given RelationshipTypeTokenRecord label = InUse(new RelationshipTypeTokenRecord(42)); DynamicRecord name = AddRelationshipTypeName(InUse(new DynamicRecord(6))); label.NameId = ( int )name.Id; // when ConsistencyReport_RelationshipTypeConsistencyReport report = Check(label); // then verify(report).emptyName(name); verifyNoMoreInteractions(report); }
private SchemaRecord Serialize(SchemaRule rule, long id, bool inUse, bool created) { DynamicRecord record = new DynamicRecord(id); record.Data = SchemaRuleSerialization.serialize(rule); if (created) { record.SetCreated(); } if (inUse) { record.InUse = true; } return(new SchemaRecord(singletonList(record))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReportEmptyName() internal virtual void ShouldReportEmptyName() { // given PropertyKeyTokenRecord key = InUse(new PropertyKeyTokenRecord(42)); DynamicRecord name = AddKeyName(InUse(new DynamicRecord(6))); key.NameId = ( int )name.Id; // when ConsistencyReport_PropertyKeyTokenConsistencyReport report = Check(key); // then verify(report).emptyName(name); verifyNoMoreInteractions(report); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReportDynamicBlockNotInUse() internal virtual void ShouldReportDynamicBlockNotInUse() { // given LabelTokenRecord key = InUse(new LabelTokenRecord(42)); DynamicRecord name = AddLabelName(NotInUse(new DynamicRecord(6))); key.NameId = ( int )name.Id; // when ConsistencyReport_LabelTokenConsistencyReport report = Check(key); // then verify(report).nameBlockNotInUse(name); verifyNoMoreInteractions(report); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReportStringRecordNotInUse() internal virtual void ShouldReportStringRecordNotInUse() { // given PropertyRecord property = InUse(new PropertyRecord(42)); PropertyKeyTokenRecord key = Add(InUse(new PropertyKeyTokenRecord(6))); DynamicRecord value = Add(NotInUse(String(new DynamicRecord(1001)))); PropertyBlock block = PropertyBlock(key, value); property.AddPropertyBlock(block); // when Org.Neo4j.Consistency.report.ConsistencyReport_PropertyConsistencyReport report = Check(property); // then verify(report).stringNotInUse(block, value); verifyNoMoreInteractions(report); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteOutTheDynamicChainBeforeUpdatingThePropertyRecord() public virtual void ShouldWriteOutTheDynamicChainBeforeUpdatingThePropertyRecord() { // given PageCache pageCache = PageCacheRule.getPageCache(_fileSystemAbstraction); Config config = Config.defaults(GraphDatabaseSettings.rebuild_idgenerators_fast, "true"); DynamicStringStore stringPropertyStore = mock(typeof(DynamicStringStore)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final PropertyStore store = new PropertyStore(storeFile, idFile, config, new org.neo4j.kernel.impl.core.JumpingIdGeneratorFactory(1), pageCache, org.neo4j.logging.NullLogProvider.getInstance(), stringPropertyStore, mock(PropertyKeyTokenStore.class), mock(DynamicArrayStore.class), org.neo4j.kernel.impl.store.format.RecordFormatSelector.defaultFormat()); PropertyStore store = new PropertyStore(_storeFile, _idFile, config, new JumpingIdGeneratorFactory(1), pageCache, NullLogProvider.Instance, stringPropertyStore, mock(typeof(PropertyKeyTokenStore)), mock(typeof(DynamicArrayStore)), RecordFormatSelector.defaultFormat()); store.Initialise(true); try { store.MakeStoreOk(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long propertyRecordId = store.nextId(); long propertyRecordId = store.NextId(); PropertyRecord record = new PropertyRecord(propertyRecordId); record.InUse = true; DynamicRecord dynamicRecord = dynamicRecord(); PropertyBlock propertyBlock = PropertyBlockWith(dynamicRecord); record.PropertyBlock = propertyBlock; doAnswer(invocation => { PropertyRecord recordBeforeWrite = store.GetRecord(propertyRecordId, store.NewRecord(), FORCE); assertFalse(recordBeforeWrite.inUse()); return(null); }).when(stringPropertyStore).updateRecord(dynamicRecord); // when store.UpdateRecord(record); // then verify that our mocked method above, with the assert, was actually called verify(stringPropertyStore).updateRecord(dynamicRecord); } finally { store.Close(); } }
internal abstract void NameNotInUse(REPORT report, DynamicRecord name);
internal abstract void EmptyName(REPORT report, DynamicRecord name);
internal override void EmptyName(Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipTypeConsistencyReport report, DynamicRecord name) { report.EmptyName(name); }
internal override void NameNotInUse(Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipTypeConsistencyReport report, DynamicRecord name) { report.NameBlockNotInUse(name); }
internal override DynamicRecord Fill(DynamicRecord record, int size) { record.Length = size; return(record); }
public override void OnRecordNotInUse(DynamicRecord dynamicRecord, CheckerEngine <RECORD, REPORT> engine) { // checked elsewhere }
public override void OnRecordChainCycle(DynamicRecord record, CheckerEngine <RECORD, REPORT> engine) { // checked elsewhere }
internal override void EmptyName(Org.Neo4j.Consistency.report.ConsistencyReport_PropertyKeyTokenConsistencyReport report, DynamicRecord name) { report.EmptyName(name); }
internal override void NameNotInUse(Org.Neo4j.Consistency.report.ConsistencyReport_PropertyKeyTokenConsistencyReport report, DynamicRecord name) { report.NameBlockNotInUse(name); }