Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldUpdateLabelStoreScanOnNodeCommands() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldUpdateLabelStoreScanOnNodeCommands()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final IndexBatchTransactionApplier applier = newIndexTransactionApplier();
            IndexBatchTransactionApplier applier = NewIndexTransactionApplier();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.store.record.NodeRecord before = new org.neo4j.kernel.impl.store.record.NodeRecord(11);
            NodeRecord before = new NodeRecord(11);

            before.SetLabelField(17, _emptyDynamicRecords);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.store.record.NodeRecord after = new org.neo4j.kernel.impl.store.record.NodeRecord(12);
            NodeRecord after = new NodeRecord(12);

            after.SetLabelField(18, _emptyDynamicRecords);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Command.NodeCommand command = new Command.NodeCommand(before, after);
            Command.NodeCommand command = new Command.NodeCommand(before, after);

            LabelScanWriter labelScanWriter = mock(typeof(LabelScanWriter));

            when(_labelScanStore.get()).thenReturn(labelScanWriter);

            // when
            bool result;

            using (TransactionApplier txApplier = applier.StartTx(_transactionToApply))
            {
                result = txApplier.VisitNodeCommand(command);
            }
            // then
            assertFalse(result);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void nodeCommandWithFixedReferenceFormat302() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void NodeCommandWithFixedReferenceFormat302()
        {
            // Given
            InMemoryClosableChannel channel = new InMemoryClosableChannel();
            NodeRecord before = new NodeRecord(42, true, false, 33, 99, 66);
            NodeRecord after  = new NodeRecord(42, true, false, 33, 99, 66);

            before.UseFixedReferences = true;
            after.UseFixedReferences  = true;

            (new Command.NodeCommand(before, after)).Serialize(channel);

            // When
            PhysicalLogCommandReaderV3_0_2 reader = new PhysicalLogCommandReaderV3_0_2();
            Command command = reader.Read(channel);

            assertTrue(command is Command.NodeCommand);

            Command.NodeCommand nodeCommand = (Command.NodeCommand)command;

            // Then
            assertEquals(before, nodeCommand.Before);
            assertEquals(after, nodeCommand.After);
            assertTrue(nodeCommand.Before.UseFixedReferences);
            assertTrue(nodeCommand.After.UseFixedReferences);
        }
Ejemplo n.º 3
0
            public override bool VisitNodeCommand(Command.NodeCommand command)
            {
                // for label store updates
                NodeRecord before = command.Before;
                NodeRecord after  = command.After;

                NodeLabels labelFieldBefore = parseLabelsField(before);
                NodeLabels labelFieldAfter  = parseLabelsField(after);

                if (!(labelFieldBefore.Inlined && labelFieldAfter.Inlined && before.LabelField == after.LabelField))
                {
                    long[] labelsBefore = labelFieldBefore.IfLoaded;
                    long[] labelsAfter  = labelFieldAfter.IfLoaded;
                    if (labelsBefore != null && labelsAfter != null)
                    {
                        if (outerInstance.labelUpdates == null)
                        {
                            outerInstance.labelUpdates = new List <NodeLabelUpdate>();
                        }
                        outerInstance.labelUpdates.Add(NodeLabelUpdate.labelChanges(command.Key, labelsBefore, labelsAfter, outerInstance.txId));
                    }
                }

                // for indexes
                return(IndexUpdatesExtractor.visitNodeCommand(command));
            }
Ejemplo n.º 4
0
        public override bool VisitNodeCommand(Command.NodeCommand command)
        {
            // acquire lock
            _lockGroup.add(_lockService.acquireNodeLock(command.Key, Org.Neo4j.Kernel.impl.locking.LockService_LockType.WriteLock));

            // update store
            UpdateStore(_neoStores.NodeStore, command);
            return(false);
        }