Package com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap

Examples of com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.Task


    final int[] expected = { map.nextOrder };
    int maxTasks = 2 * BUFFER_THRESHOLD;

    for (int i = 0; i < maxTasks; i++) {
      final int id = map.nextOrdering();
      Task task = mock(Task.class);
      when(task.getOrder()).thenReturn(id);
      doAnswer(new Answer<Void>() {
        @Override public Void answer(InvocationOnMock invocation) {
          assertThat(id, is(expected[0]++));
          return null;
        }
View Full Code Here


  @Test(dataProvider = "guardedMap")
  public void exceedsMaximumBufferSize_onRead(ConcurrentLinkedHashMap<Integer, Integer> map) {
    map.bufferLengths.set(bufferIndex(), MAXIMUM_BUFFER_SIZE);

    Task task = mock(Task.class);
    map.afterCompletion(task);
    verify(task, never()).run();

    assertThat(map.buffers[bufferIndex()].size(), is(0));
    map.bufferLengths.set(bufferIndex(), 0);
View Full Code Here

  @Test(dataProvider = "guardedMap")
  public void exceedsMaximumBufferSize_onWrite(ConcurrentLinkedHashMap<Integer, Integer> map) {
    map.bufferLengths.set(bufferIndex(), MAXIMUM_BUFFER_SIZE);

    Task task = mock(Task.class);
    when(task.isWrite()).thenReturn(true);
    map.afterCompletion(task);
    verify(task, times(1)).run();

    assertThat(map.buffers[bufferIndex()].size(), is(0));
    map.bufferLengths.set(bufferIndex(), 0);
View Full Code Here

TOP

Related Classes of com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.