Package com.facebook.testing

Examples of com.facebook.testing.MockExecutor


    mockZkConnectionManager3.refreshClient(); // Generate a new client
    zk3 = mockZooKeeperFactory.getLastZooKeeper();
    zk3.triggerConnect();

    // Create ZkLeaderElection1
    mockExecutor1 = new MockExecutor();
    variablePayload1 = new VariablePayload(testData1);
    mockLeaderElectionCallback1 = new MockLeaderElectionCallback();
    zkLeaderElection1 =
      new ZkLeaderElection(
        mockZkConnectionManager1,
        electionRoot,
        candidateBaseName,
        variablePayload1,
        mockLeaderElectionCallback1,
        mockExecutor1
      );

    // Create ZkLeaderElection2
    mockExecutor2 = new MockExecutor();
    variablePayload2 = new VariablePayload(testData2);
    mockLeaderElectionCallback2 = new MockLeaderElectionCallback();
    zkLeaderElection2 =
      new ZkLeaderElection(
        mockZkConnectionManager2,
        electionRoot,
        candidateBaseName,
        variablePayload2,
        mockLeaderElectionCallback2,
        mockExecutor2     
      );

    // Create ZkLeaderElection3
    mockExecutor3 = new MockExecutor();
    variablePayload3 = new VariablePayload(testData3);
    mockLeaderElectionCallback3 = new MockLeaderElectionCallback();
    zkLeaderElection3 =
      new ZkLeaderElection(
        mockZkConnectionManager3,
View Full Code Here


  private ExecutorService executor;
  private MockExecutor mockExecutor;

  @BeforeMethod(alwaysRun = true)
  public void setUp() throws Exception {
    mockExecutor = new MockExecutor();
    executor = new UnstoppableExecutorService(mockExecutor);
  }
View Full Code Here

        }
        count.incrementAndGet();
      }
    };
    latchTask = LatchTask.createPaused();
    mockExecutor = new MockExecutor();
    executorFront = new ExecutorServiceFront(
      mockExecutor, 10000, TimeUnit.MILLISECONDS
    );
    executorFront2 = new ExecutorServiceFront(
      new LinkedBlockingQueue<Runnable>(),
View Full Code Here

    executor2.shutdownNow();
  }

  @Test(groups = "fast")
  public void testSanity() throws Exception {
    MockExecutor mockExecutor = new MockExecutor();
    TaskGroup taskGroup = new TaskGroup(mockExecutor);
    // Register some tasks
    DelayRunnable runnable1 = new DelayRunnable();
    DelayRunnable runnable2 = new DelayRunnable();
    DelayRunnable runnable3 = new DelayRunnable();

    taskGroup.register(runnable1);
    taskGroup.register(runnable2);
    taskGroup.register(runnable3);

    TaskGroup.FinishLatch latch = taskGroup.execute();

    // Run all tasks
    mockExecutor.drain();

    // Should not block
    latch.await();

    Assert.assertTrue(runnable1.isRun());
View Full Code Here

  public void setUp() throws Exception {
    value1 = "value1";
    reapableValue1 = new ReapableString(value1);
    producer =
      new BlockingValueProducer<ReapableString, RuntimeException>(reapableValue1);
    mockExecutor = new MockExecutor();
    // arbitrary time for now
    DateTimeUtils.setCurrentMillisFixed(0);   
    legacyCache = ExpiringConcurrentCache.createWithReapableValue(
      new ValueFactory<String, ReapableString, RuntimeException>() {
        @Override
View Full Code Here

  private ScheduledExecutorService executor;
  private MockExecutor mockExecutor;

  @BeforeMethod(alwaysRun = true)
  public void setUp() throws Exception {
    mockExecutor = new MockExecutor();
    executor = new UnstoppableScheduledExecutorService(mockExecutor);
  }
View Full Code Here

  private ExecutorService executor;
  private MockExecutor mockExecutor;

  @BeforeMethod(alwaysRun = true)
  public void setUp() throws Exception {
    mockExecutor = new MockExecutor();
    executor = new UnstoppableExecutorService(mockExecutor);
  }
View Full Code Here

        }
        count.incrementAndGet();
      }
    };
    latchTask = LatchTask.createPaused();
    mockExecutor = new MockExecutor();
    executorFront = new ExecutorServiceFront(
      mockExecutor, 10000, TimeUnit.MILLISECONDS
    );
    executorFront2 = new ExecutorServiceFront(
      new LinkedBlockingQueue<Runnable>(),
View Full Code Here

TOP

Related Classes of com.facebook.testing.MockExecutor

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.