Ejemplo n.º 1
0
        private ReplicatedIdRangeAcquirer SimpleRangeAcquirer(IdType idType, long start, int length)
        {
            ReplicatedIdRangeAcquirer rangeAcquirer = mock(typeof(ReplicatedIdRangeAcquirer));

            //noinspection unchecked
            when(rangeAcquirer.AcquireIds(idType)).thenReturn(Allocation(start, length, -1)).thenThrow(typeof(NoMoreIds));
            return(rangeAcquirer);
        }
Ejemplo n.º 2
0
        private ReplicatedIdRangeAcquirer StubAcquirer()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ReplicatedIdRangeAcquirer rangeAcquirer = mock(ReplicatedIdRangeAcquirer.class);
            ReplicatedIdRangeAcquirer rangeAcquirer = mock(typeof(ReplicatedIdRangeAcquirer));

            when(rangeAcquirer.AcquireIds(IdType.NODE)).thenReturn(Allocation(0, 1024, -1)).thenReturn(Allocation(1024, 1024, 1023)).thenReturn(Allocation(2048, 1024, 2047)).thenReturn(Allocation(3072, 1024, 3071)).thenReturn(Allocation(4096, 1024, 4095)).thenReturn(Allocation(5120, 1024, 5119)).thenReturn(Allocation(6144, 1024, 6143)).thenReturn(Allocation(7168, 1024, 7167)).thenReturn(Allocation(8192, 1024, 8191)).thenReturn(Allocation(9216, 1024, 9215)).thenReturn(Allocation(-1, 0, 9216 + 1024));
            return(rangeAcquirer);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected = IllegalStateException.class) public void shouldThrowIfAdjustmentFailsDueToInconsistentValues()
        public virtual void ShouldThrowIfAdjustmentFailsDueToInconsistentValues()
        {
            ReplicatedIdRangeAcquirer rangeAcquirer = mock(typeof(ReplicatedIdRangeAcquirer));

            when(rangeAcquirer.AcquireIds(IdType.NODE)).thenReturn(Allocation(3, 21, 21));
            _idGenerator = GetReplicatedIdGenerator(10, 42L, rangeAcquirer);

            _idGenerator.nextId();
        }