Package org.apache.giraph.time

Examples of org.apache.giraph.time.Time


  /**
   * SMake sure the the event is not signaled.
   */
  @Test
  public void testWaitMsecsNoEvent() {
    Time mockTime = mock(Time.class);
    when(mockTime.getMilliseconds()).
        thenReturn(0L).thenReturn(2L);
    BspEvent event = new PredicateLock(getStubProgressable(), 1, mockTime);
    boolean gotPredicate = event.waitMsecs(1);
    assertFalse(gotPredicate);
    assertEquals(0, progressCalled.get());
    when(mockTime.getMilliseconds()).
        thenReturn(0L).thenReturn(0L).thenReturn(2L);
    gotPredicate = event.waitMsecs(1);
    assertFalse(gotPredicate);
    assertEquals(1, progressCalled.get());
  }
View Full Code Here


  /**
   * Single threaded case where the event is signaled.
   */
  @Test
  public void testEvent() {
    Time mockTime = mock(Time.class);
    when(mockTime.getMilliseconds()).
        thenReturn(0L).thenReturn(2L);
    BspEvent event = new PredicateLock(getStubProgressable(), 1, mockTime);
    event.signal();
    boolean gotPredicate = event.waitMsecs(2);
    assertTrue(gotPredicate);
    event.reset();
    when(mockTime.getMilliseconds()).
        thenReturn(0L).thenReturn(2L);
    gotPredicate = event.waitMsecs(0);
    assertFalse(gotPredicate);
  }
View Full Code Here

TOP

Related Classes of org.apache.giraph.time.Time

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.