コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void recordWithReservedIdIsSkipped()
        public virtual void RecordWithReservedIdIsSkipped()
        {
            RecordStore <NodeRecord>       store        = mock(typeof(NodeStore));
            StageControl                   stageControl = mock(typeof(StageControl));
            UpdateRecordsStep <NodeRecord> step         = new UpdateRecordsStep <NodeRecord>(stageControl, Configuration.DEFAULT, store, new StorePrepareIdSequence());

            NodeRecord node1 = new NodeRecord(1);

            node1.InUse = true;
            NodeRecord node2 = new NodeRecord(2);

            node2.InUse = true;
            NodeRecord nodeWithReservedId = new NodeRecord(IdGeneratorImpl.INTEGER_MINUS_ONE);

            NodeRecord[] batch = new NodeRecord[] { node1, node2, nodeWithReservedId };

            step.Process(batch, mock(typeof(BatchSender)));

            verify(store).prepareForCommit(eq(node1), any(typeof(IdSequence)));
            verify(store).updateRecord(node1);
            verify(store).prepareForCommit(eq(node2), any(typeof(IdSequence)));
            verify(store).updateRecord(node2);
            verify(store, never()).prepareForCommit(eq(nodeWithReservedId), any(typeof(IdSequence)));
            verify(store, never()).updateRecord(nodeWithReservedId);
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void ioThroughputStatDoesNotOverflow()
        public virtual void IoThroughputStatDoesNotOverflow()
        {
            // store with huge record size to force overflow and not create huge batch of records
            RecordStore <NodeRecord> store = mock(typeof(RecordStore));

            when(store.RecordSize).thenReturn(int.MaxValue / 2);

            Configuration configuration         = mock(typeof(Configuration));
            StageControl  stageControl          = mock(typeof(StageControl));
            UpdateRecordsStep <NodeRecord> step = new UpdateRecordsStep <NodeRecord>(stageControl, configuration, store, new StorePrepareIdSequence());

            NodeRecord record = new NodeRecord(1);

            record.InUse = true;
            NodeRecord[] batch = new NodeRecord[11];
            Arrays.fill(batch, record);

            step.Process(batch, mock(typeof(BatchSender)));

            Stat stat = step.Stat(Keys.io_throughput);

            assertThat(stat.AsLong(), greaterThan(0L));
        }