//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void readRelationshipGroupCommandWithFixedReferenceFormat302() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ReadRelationshipGroupCommandWithFixedReferenceFormat302() { // Given InMemoryClosableChannel channel = new InMemoryClosableChannel(); RelationshipGroupRecord before = new RelationshipGroupRecord(42, 3); before.UseFixedReferences = true; RelationshipGroupRecord after = new RelationshipGroupRecord(42, 3, 4, 5, 6, 7, 8, true); after.UseFixedReferences = true; (new Command.RelationshipGroupCommand(before, after)).Serialize(channel); // When PhysicalLogCommandReaderV3_0_2 reader = new PhysicalLogCommandReaderV3_0_2(); Command command = reader.Read(channel); assertTrue(command is Command.RelationshipGroupCommand); Command.RelationshipGroupCommand relationshipGroupCommand = (Command.RelationshipGroupCommand)command; // Then assertEquals(before, relationshipGroupCommand.Before); assertEquals(after, relationshipGroupCommand.After); assertTrue(relationshipGroupCommand.Before.UseFixedReferences); assertTrue(relationshipGroupCommand.After.UseFixedReferences); }
public void CheckConsistency(Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord record, CheckerEngine <Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipGroupConsistencyReport> engine, Org.Neo4j.Consistency.store.RecordAccess records) { if (record.Next != Record.NO_NEXT_RELATIONSHIP.intValue()) { engine.ComparativeCheck(records.RelationshipGroup(record.Next), this); } }
private static void AssertValidRelGroupCommand(StorageCommand command) { assertThat(command, instanceOf(typeof(RelationshipGroupCommand))); RelationshipGroupCommand relGroupCommand = ( RelationshipGroupCommand )command; RelationshipGroupRecord record = relGroupCommand.After; assertEquals(ID, record.Id); if (_inUseFlag == Record.IN_USE.byteValue()) { assertTrue(record.InUse()); } else if (_inUseFlag == Record.NOT_IN_USE.byteValue()) { assertFalse(record.InUse()); } else { throw new System.InvalidOperationException("Illegal inUse flag: " + _inUseFlag); } assertEquals(_typeAsInt, record.Type); assertEquals(NEXT, record.Next); assertEquals(FIRST_OUT, record.FirstOut); assertEquals(FIRST_IN, record.FirstIn); assertEquals(FIRST_LOOP, record.Next); assertEquals(OWNING_NODE, record.OwningNode); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void readRelationshipGroupCommandWithNonRequiredSecondaryUnit() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ReadRelationshipGroupCommandWithNonRequiredSecondaryUnit() { // Given InMemoryClosableChannel channel = new InMemoryClosableChannel(); RelationshipGroupRecord before = new RelationshipGroupRecord(42, 3); RelationshipGroupRecord after = new RelationshipGroupRecord(42, 3, 4, 5, 6, 7, 8, true); after.RequiresSecondaryUnit = false; after.SecondaryUnitId = 17; after.SetCreated(); (new Command.RelationshipGroupCommand(before, after)).Serialize(channel); // When PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0(); Command command = reader.Read(channel); assertTrue(command is Command.RelationshipGroupCommand); Command.RelationshipGroupCommand relationshipGroupCommand = (Command.RelationshipGroupCommand)command; // Then assertEquals(before, relationshipGroupCommand.Before); assertEquals(after, relationshipGroupCommand.After); VerifySecondaryUnit(after, relationshipGroupCommand.After); }
public override void Run(StoreAccess store, PrintStream @out) { RecordStore <NodeRecord> nodeStore = store.NodeStore; NodeRecord node = nodeStore.GetRecord(Id, nodeStore.NewRecord(), NORMAL); if (node.Dense) { RecordStore <RelationshipGroupRecord> relationshipGroupStore = store.RelationshipGroupStore; RelationshipGroupRecord group = relationshipGroupStore.NewRecord(); relationshipGroupStore.GetRecord(node.NextRel, group, NORMAL); do { @out.println("group " + group); @out.println("out:"); PrintRelChain(store, @out, group.FirstOut); @out.println("in:"); PrintRelChain(store, @out, group.FirstIn); @out.println("loop:"); PrintRelChain(store, @out, group.FirstLoop); group = group.Next != -1 ? relationshipGroupStore.GetRecord(group.Next, group, NORMAL) : null; } while (group != null); } else { PrintRelChain(store, @out, node.NextRel); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTrackSecondaryUnitIdsAsWell() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldTrackSecondaryUnitIdsAsWell() { // GIVEN NeoStores neoStores = NeoStoresRule.builder().build(); HighIdTransactionApplier tracker = new HighIdTransactionApplier(neoStores); NodeRecord node = (new NodeRecord(5)).initialize(true, 123, true, 456, 0); node.SecondaryUnitId = 6; node.RequiresSecondaryUnit = true; RelationshipRecord relationship = (new RelationshipRecord(10)).initialize(true, 1, 2, 3, 4, 5, 6, 7, 8, true, true); relationship.SecondaryUnitId = 12; relationship.RequiresSecondaryUnit = true; RelationshipGroupRecord relationshipGroup = (new RelationshipGroupRecord(8)).initialize(true, 0, 1, 2, 3, 4, 5); relationshipGroup.SecondaryUnitId = 20; relationshipGroup.RequiresSecondaryUnit = true; // WHEN tracker.VisitNodeCommand(new NodeCommand(new NodeRecord(node.Id), node)); tracker.VisitRelationshipCommand(new RelationshipCommand(new RelationshipRecord(relationship.Id), relationship)); tracker.VisitRelationshipGroupCommand(new RelationshipGroupCommand(new RelationshipGroupRecord(relationshipGroup.Id), relationshipGroup)); tracker.Close(); // THEN assertEquals(node.SecondaryUnitId + 1, neoStores.NodeStore.HighId); assertEquals(relationship.SecondaryUnitId + 1, neoStores.RelationshipStore.HighId); assertEquals(relationshipGroup.SecondaryUnitId + 1, neoStores.RelationshipGroupStore.HighId); }
private RelationshipGroupRecord Group(long id, int type) { RelationshipGroupRecord group = new RelationshipGroupRecord(id, type); group.InUse = true; return(group); }
public void CheckReference(Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord record, Org.Neo4j.Kernel.impl.store.record.NodeRecord referred, CheckerEngine <Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipGroupConsistencyReport> engine, Org.Neo4j.Consistency.store.RecordAccess records) { if (!referred.InUse()) { engine.Report().ownerNotInUse(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleGroupCountBeyondSignedShortRange() public virtual void ShouldHandleGroupCountBeyondSignedShortRange() { // GIVEN long nodeId = 0; int limit = short.MaxValue + 10; RelationshipGroupCache cache = new RelationshipGroupCache(HEAP, ByteUnit.kibiBytes(100), nodeId + 1); // WHEN first counting all groups per node for (int type = 0; type < limit; type++) { cache.IncrementGroupCount(nodeId); } // and WHEN later putting group records into the cache RelationshipGroupRecord group = new RelationshipGroupRecord(-1); group.OwningNode = nodeId; for (int type = 0; type < limit; type++) { group.Id = type; group.FirstOut = type; // just some relationship group.Type = type; cache.Put(group); } long prepared = cache.Prepare(nodeId); // THEN that should work, because it used to fail inside prepare, but we can also ask // the groupCount method to be sure assertEquals(nodeId, prepared); assertEquals(limit, cache.GroupCount(nodeId)); }
public void CheckConsistency(Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord record, CheckerEngine <Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipGroupConsistencyReport> engine, Org.Neo4j.Consistency.store.RecordAccess records) { if (record.OwningNode < 0) { engine.Report().illegalOwner(); } else { engine.ComparativeCheck(records.Node(record.OwningNode), this); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void inUseRecordEquality() public virtual void InUseRecordEquality() { RelationshipGroupRecord record1 = new RelationshipGroupRecord(1); record1.Initialize(true, 1, 2, 3, 4, 5, 6); record1.SecondaryUnitId = 42; RelationshipGroupRecord record2 = record1.Clone(); RelationshipGroupCheckType check = new RelationshipGroupCheckType(); assertTrue(check.Equal(record1, record2)); }
protected internal override void Process(RelationshipGroupRecord[] batch, BatchSender sender) { // These records are read page-wise forwards, but should be cached in reverse // since the records exists in the store in reverse order. for (int i = batch.Length - 1; i >= 0; i--) { RelationshipGroupRecord record = batch[i]; if (record.InUse()) { _cache.put(record); } } }
public void checkReference(NodeRecord record, RelationshipGroupRecord group, CheckerEngine <NodeRecord, ConsistencyReport_NodeConsistencyReport> engine, RecordAccess records) { if (!group.inUse()) { engine.report().relationshipGroupNotInUse(group); } else { if (group.OwningNode != record.Id) { engine.report().relationshipGroupHasOtherOwner(group); } } }
public override long Visit(long nodeId, int typeId, long @out, long @in, long loop) { long id = outerInstance.store.nextId(); RelationshipGroupRecord record = Batch[Cursor++]; record.Id = id; record.Initialize(true, typeId, @out, @in, loop, nodeId, loop); if (Cursor == outerInstance.BatchSize) { Send(); Batch = control.reuse(this); Cursor = 0; } return(id); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void notInUseRecordEquality() public virtual void NotInUseRecordEquality() { RelationshipGroupRecord record1 = new RelationshipGroupRecord(1); record1.Initialize(false, 1, 2, 3, 4, 5, 6); record1.SecondaryUnitId = 42; RelationshipGroupRecord record2 = new RelationshipGroupRecord(1); record1.Initialize(false, 11, 22, 33, 44, 55, 66); record2.SecondaryUnitId = 24; RelationshipGroupCheckType check = new RelationshipGroupCheckType(); assertTrue(check.Equal(record1, record2)); }
public void checkReference(Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord record, Org.Neo4j.Kernel.impl.store.record.RelationshipRecord referred, CheckerEngine <Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipGroupConsistencyReport> engine, Org.Neo4j.Consistency.store.RecordAccess records) { if (!referred.inUse()) { relationshipNotInUse(engine.report()); } else { if (!isFirstInChain(referred)) { relationshipNotFirstInChain(engine.report()); } if (referred.getType() != record.getType()) { relationshipOfOtherType(engine.report()); } } }
public void CheckReference(Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord record, Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord referred, CheckerEngine <Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipGroupConsistencyReport> engine, Org.Neo4j.Consistency.store.RecordAccess records) { if (!referred.InUse()) { engine.Report().nextGroupNotInUse(); } else { if (record.Type >= referred.Type) { engine.Report().invalidTypeSortOrder(); } if (record.OwningNode != referred.OwningNode) { engine.Report().nextHasOtherOwner(referred); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAbortLoadingGroupChainIfComeTooFar() public virtual void ShouldAbortLoadingGroupChainIfComeTooFar() { // GIVEN a node with relationship group chain 2-->4-->10-->23 LogProvider logProvider = NullLogProvider.Instance; StoreFactory storeFactory = new StoreFactory(_testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(_fs.get()), _pageCache.getPageCache(_fs.get()), _fs.get(), logProvider, EmptyVersionContextSupplier.EMPTY); using (NeoStores stores = storeFactory.OpenNeoStores(true, StoreType.RELATIONSHIP_GROUP)) { RecordStore <RelationshipGroupRecord> store = spy(stores.RelationshipGroupStore); RelationshipGroupRecord group2 = Group(0, 2); RelationshipGroupRecord group4 = Group(1, 4); RelationshipGroupRecord group10 = Group(2, 10); RelationshipGroupRecord group23 = Group(3, 23); Link(group2, group4, group10, group23); store.UpdateRecord(group2); store.UpdateRecord(group4); store.UpdateRecord(group10); store.UpdateRecord(group23); RelationshipGroupGetter groupGetter = new RelationshipGroupGetter(store); NodeRecord node = new NodeRecord(0, true, group2.Id, -1); // WHEN trying to find relationship group 7 RecordAccess <RelationshipGroupRecord, int> access = new DirectRecordAccess <RelationshipGroupRecord, int>(store, Loaders.relationshipGroupLoader(store)); RelationshipGroupGetter.RelationshipGroupPosition result = groupGetter.GetRelationshipGroup(node, 7, access); // THEN only groups 2, 4 and 10 should have been loaded InOrder verification = inOrder(store); verification.verify(store).getRecord(eq(group2.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad))); verification.verify(store).getRecord(eq(group4.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad))); verification.verify(store).getRecord(eq(group10.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad))); verification.verify(store, never()).getRecord(eq(group23.Id), any(typeof(RelationshipGroupRecord)), any(typeof(RecordLoad))); // it should also be reported as not found assertNull(result.Group()); // with group 4 as closes previous one assertEquals(group4, result.ClosestPrevious().forReadingData()); } }
public abstract void setNextRel(Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord group, long firstNextRel);
public abstract long getNextRel(Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord group);
public long ValueFrom(Org.Neo4j.Kernel.impl.store.record.RelationshipGroupRecord record) { return(record.OwningNode); }