Exemplo n.º 1
0
  private void test1Item(
      boolean mergeSuccess,
      boolean createBranchThrowsException,
      boolean updateBranchThrowsException,
      VerificationStatus finalStatus,
      boolean isDone)
      throws JobExecutionException {

    createItem(
        TestCollectorConstants.BRANCH_1,
        mergeSuccess,
        createBranchThrowsException,
        updateBranchThrowsException,
        true,
        true);
    // consume
    new ConsumerJob().execute(null);
    // wait for task in queue to finish
    SynchronizeableThreadPoolExecutor executor =
        (SynchronizeableThreadPoolExecutor) ExecutorServiceFactory.getCachedThreadPoolExecutor();
    executor.join();
    // run decision maker again
    new ConsumerJob().execute(null);
    assertItem(TestCollectorConstants.BRANCH_1, finalStatus, isDone);
  }
Exemplo n.º 2
0
  @Test
  public void testE2EWith2Items() throws Exception {

    createItem(TestCollectorConstants.BRANCH_1, true, false, false, true, false);
    createItem(TestCollectorConstants.BRANCH_2, true, false, false, false, true);
    // consume
    new ConsumerJob().execute(null);
    // wait for task in queue to finish
    SynchronizeableThreadPoolExecutor executor =
        (SynchronizeableThreadPoolExecutor) ExecutorServiceFactory.getCachedThreadPoolExecutor();
    executor.join();
    // run decision maker again
    new ConsumerJob().execute(null);
    assertItem(TestCollectorConstants.BRANCH_1, VerificationStatus.PASSED_AND_PUSHED, true);
    assertItem(TestCollectorConstants.BRANCH_2, VerificationStatus.PASSED_AND_PUSHED, true);
  }
Exemplo n.º 3
0
  @Test
  public void testE2EWith2ItemsSeparately() throws Exception {

    JenkinsVerifierMockFactory.setHangMock();
    CommitItem item1 = createItem(TestCollectorConstants.BRANCH_1, true, false, false, true, true);
    // consume
    new ConsumerJob().execute(null);
    CommitItem item2 = createItem(TestCollectorConstants.BRANCH_2, true, false, false, true, true);
    new ConsumerJob().execute(null);
    item2 = CollectorApi.getCommitItemContainer().get(item2.getKey());
    Assert.assertEquals(item2.getParent(), item1);
    // run decision maker again
    // wait for task in queue to finish
    SynchronizeableThreadPoolExecutor executor =
        (SynchronizeableThreadPoolExecutor) ExecutorServiceFactory.getCachedThreadPoolExecutor();
    executor.join();
    new ConsumerJob().execute(null);
    item1 = CollectorApi.getCommitItemContainer().get(item1.getKey());
    item2 = CollectorApi.getCommitItemContainer().get(item2.getKey());
    assertItem(TestCollectorConstants.BRANCH_1, VerificationStatus.TIMEOUT, true);
    assertItem(TestCollectorConstants.BRANCH_2, VerificationStatus.RUNNING, false);
    Assert.assertNull(item2.getParent());
  }