Examples of SleepingAnswer


Examples of net.sf.katta.testutil.mockito.SleepingAnswer

  public void testOperationExecution() throws Exception {
    final MasterOperation masterOperation1 = mockOperation(ExecutionInstruction.EXECUTE);
    final MasterOperation masterOperation2 = mockOperation(ExecutionInstruction.EXECUTE);
    final MasterOperation masterOperation3 = mockOperation(ExecutionInstruction.EXECUTE);
    when(_queue.peek()).thenReturn(masterOperation1).thenReturn(masterOperation2).thenReturn(masterOperation3)
            .thenAnswer(new SleepingAnswer());

    when(_protocol.getLiveNodes()).thenReturn(Arrays.asList("node1"));
    long safeModeMaxTime = 200;
    OperatorThread operatorThread = new OperatorThread(_context, safeModeMaxTime);
    operatorThread.start();
View Full Code Here

Examples of net.sf.katta.testutil.mockito.SleepingAnswer

    operationIds.add(new OperationId(nodeName, "e1"));

    final MasterOperation leaderOperation = mock(MasterOperation.class);
    when(leaderOperation.execute(_context, EMPTY_LIST)).thenReturn(operationIds);
    setupExecutionInstruction(leaderOperation, ExecutionInstruction.EXECUTE);
    when(_queue.peek()).thenReturn(leaderOperation).thenAnswer(new SleepingAnswer());

    when(_protocol.isNodeOperationQueued(operationIds.get(0))).thenReturn(false);
    OperationWatchdog watchdog = mock(OperationWatchdog.class);
    when(_queue.moveOperationToWatching(leaderOperation, operationIds)).thenReturn(watchdog);
View Full Code Here

Examples of net.sf.katta.testutil.mockito.SleepingAnswer

    verify(_queue, times(1)).add(leaderOperation2);
  }

  @Test(timeout = 10000)
  public void testRecreateWatchdogs() throws Exception {
    when(_queue.peek()).thenAnswer(new SleepingAnswer());
    when(_protocol.getLiveNodes()).thenReturn(Arrays.asList("node1"));
    OperationWatchdog watchdog1 = mock(OperationWatchdog.class);
    OperationWatchdog watchdog2 = mock(OperationWatchdog.class);
    when(watchdog1.isDone()).thenReturn(true);
    when(watchdog2.isDone()).thenReturn(false);
View Full Code Here

Examples of net.sf.katta.testutil.mockito.SleepingAnswer

  }

  @Test(timeout = 10000000)
  public void testDontStopOnOOM() throws Exception {
    when(_protocol.getLiveNodes()).thenReturn(Arrays.asList("node1"));
    when(_queue.peek()).thenThrow(new OutOfMemoryError("test exception")).thenAnswer(new SleepingAnswer());

    OperatorThread operatorThread = new OperatorThread(_context, 50);
    operatorThread.start();
    operatorThread.join(100);
View Full Code Here

Examples of net.sf.katta.testutil.mockito.SleepingAnswer

    when(_queue.moveOperationToWatching(leaderOperation1, operationIds)).thenReturn(watchdog);

    setupExecutionInstruction(leaderOperation1, ExecutionInstruction.EXECUTE);
    setupExecutionInstruction(leaderOperation2, instruction);
    when(leaderOperation1.execute(_context, EMPTY_LIST)).thenReturn(operationIds);
    when(_queue.peek()).thenReturn(leaderOperation1).thenReturn(leaderOperation2).thenAnswer(new SleepingAnswer());

    // start the operator
    long safeModeMaxTime = 200;
    OperatorThread operatorThread = new OperatorThread(_context, safeModeMaxTime);
    operatorThread.start();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.