underTest.remove(peek.get(), CeActivityDto.Status.SUCCESS, null, null);
// queue is empty
- assertThat(db.getDbClient().ceQueueDao().selectByUuid(db.getSession(), task.getUuid()).isPresent()).isFalse();
- assertThat(underTest.peek(WORKER_UUID_2, false, false).isPresent()).isFalse();
+ assertThat(db.getDbClient().ceQueueDao().selectByUuid(db.getSession(), task.getUuid())).isNotPresent();
+ assertThat(underTest.peek(WORKER_UUID_2, false, false)).isNotPresent();
// available in history
Optional<CeActivityDto> history = db.getDbClient().ceActivityDao().selectByUuid(db.getSession(), task.getUuid());
@Test
public void peek_none_if_no_pendings() {
- assertThat(underTest.peek(db.getSession(), WORKER_UUID_1, false, false).isPresent()).isFalse();
+ assertThat(underTest.peek(db.getSession(), WORKER_UUID_1, false, false)).isNotPresent();
// not pending, but in progress
makeInProgress(WORKER_UUID_1, 2_232_222L, insertPending(TASK_UUID_1, MAIN_COMPONENT_UUID_1));
- assertThat(underTest.peek(db.getSession(), WORKER_UUID_1, false, false).isPresent()).isFalse();
+ assertThat(underTest.peek(db.getSession(), WORKER_UUID_1, false, false)).isNotPresent();
}
@Test
verifyCeQueueStatuses(TASK_UUID_1, IN_PROGRESS, TASK_UUID_2, IN_PROGRESS);
// no more pendings
- assertThat(underTest.peek(db.getSession(), WORKER_UUID_1, false, false).isPresent()).isFalse();
+ assertThat(underTest.peek(db.getSession(), WORKER_UUID_1, false, false)).isNotPresent();
}
@Test
dbClient.branchDao().updateAllNeedIssueSync(dbSession);
List<BranchDto> branchInNeedOfIssueSync = dbClient.branchDao().selectBranchNeedingIssueSync(dbSession);
+ LOG.info("{} branch found in need of issue sync.", branchInNeedOfIssueSync.size());
if (branchInNeedOfIssueSync.isEmpty()) {
- LOG.info("No branch found in need of issue sync");
return;
}
- String branchListForDisplay = branchInNeedOfIssueSync.stream().map(BranchDto::toString).collect(Collectors.joining(", "));
- LOG.info("{} branch found in need of issue sync : {}", branchInNeedOfIssueSync.size(), branchListForDisplay);
-
- List<String> projectUuids = new ArrayList<>(branchInNeedOfIssueSync.stream().map(BranchDto::getProjectUuid).collect(Collectors.toSet()));
+ List<String> projectUuids = branchInNeedOfIssueSync.stream().map(BranchDto::getProjectUuid).distinct().collect(Collectors.toList());
LOG.info("{} projects found in need of issue sync.", projectUuids.size());
sortProjectUuids(dbSession, projectUuids);
verify(ceQueue, times(1)).prepareSubmit();
verify(ceQueue, times(1)).massSubmit(anyCollection());
assertThat(logTester.logs(LoggerLevel.INFO))
- .contains("1 branch found in need of issue sync : BranchDto{uuid='branch_uuid', projectUuid='project_uuid'," +
- " kee='branchName', keyType=BRANCH, branchType=BRANCH, mergeBranchUuid='null', excludeFromPurge=false, needIssueSync=true}");
+ .contains("1 branch found in need of issue sync.");
}
@Test
public void triggerOnIndexCreation_no_branch() {
underTest.triggerOnIndexCreation();
- assertThat(logTester.logs(LoggerLevel.INFO)).contains("No branch found in need of issue sync");
+ assertThat(logTester.logs(LoggerLevel.INFO)).contains("0 branch found in need of issue sync.");
}
@Test
assertThat(dbClient.ceActivityDao().selectByTaskType(dbTester.getSession(), REPORT)).hasSize(1);
- assertThat(dbClient.ceTaskCharacteristicsDao().selectByTaskUuids(dbTester.getSession(), new HashSet<>(Arrays.asList("uuid_2")))).hasSize(0);
+ assertThat(dbClient.ceTaskCharacteristicsDao().selectByTaskUuids(dbTester.getSession(), new HashSet<>(Arrays.asList("uuid_2")))).isEmpty();
assertThat(logTester.logs(LoggerLevel.INFO))
.contains(