Package net.sf.katta.operation.master

Examples of net.sf.katta.operation.master.MasterOperation.execute()


    MasterOperation masterOperation = new StatefulMasterOperation();
    queue.add(masterOperation);

    masterOperation = queue.peek();
    masterOperation.execute(mock(MasterContext.class), Collections.EMPTY_LIST);

    queue.moveOperationToWatching(masterOperation, Collections.EMPTY_LIST);
    assertEquals(1, queue.getWatchdogs().size());
    masterOperation = queue.getWatchdogs().get(0).getOperation();
    masterOperation.nodeOperationsComplete(mock(MasterContext.class), Collections.EMPTY_LIST);
View Full Code Here


    when(operation1.getExecutionInstruction((List<MasterOperation>) notNull()))
            .thenReturn(ExecutionInstruction.EXECUTE);
    when(operation2.getExecutionInstruction((List<MasterOperation>) notNull()))
            .thenReturn(ExecutionInstruction.EXECUTE);
    when(operation1.execute((MasterContext) notNull(), (List<MasterOperation>) notNull())).thenAnswer(answer);
    when(operation2.execute((MasterContext) notNull(), (List<MasterOperation>) notNull())).thenAnswer(answer);
    _protocol.addMasterOperation(operation1);
    _protocol.addMasterOperation(operation2);
    answer.getCountDownLatch().await();

    master.shutdown();
View Full Code Here

    when(_protocol.getLiveNodes()).thenReturn(Arrays.asList(nodeName));
    List<OperationId> operationIds = new ArrayList<OperationId>();
    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);
View Full Code Here

  @Test(timeout = 10000)
  public void testInterruptedException_Operation() throws Exception {
    when(_protocol.getLiveNodes()).thenReturn(Arrays.asList("node1"));
    final MasterOperation masterOperation = mockOperation(ExecutionInstruction.EXECUTE);
    when(masterOperation.execute(_context, EMPTY_LIST)).thenThrow(new InterruptedException());
    when(_queue.peek()).thenReturn(masterOperation);
    OperatorThread operatorThread = new OperatorThread(_context, 50);
    operatorThread.start();
    operatorThread.join();
  }
View Full Code Here

  @Test(timeout = 1000000)
  public void testInterruptedException_Operation_Zk() throws Exception {
    when(_protocol.getLiveNodes()).thenReturn(Arrays.asList("node1"));
    ZkInterruptedException zkInterruptedException = mock(ZkInterruptedException.class);
    final MasterOperation masterOperation = mockOperation(ExecutionInstruction.EXECUTE);
    when(masterOperation.execute(_context, EMPTY_LIST)).thenThrow(zkInterruptedException);
    when(_queue.peek()).thenReturn(masterOperation);
    OperatorThread operatorThread = new OperatorThread(_context, 50);
    operatorThread.start();
    operatorThread.join();
  }
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.