use of org.sonar.db.component.BranchType in project sonarqube by SonarSource.
the class SendIssueNotificationsStep method execute.
@Override
public void execute(ComputationStep.Context context) {
BranchType branchType = analysisMetadataHolder.getBranch().getType();
if (branchType == PULL_REQUEST) {
return;
}
Component project = treeRootHolder.getRoot();
NotificationStatistics notificationStatistics = new NotificationStatistics();
if (service.hasProjectSubscribersForTypes(analysisMetadataHolder.getProject().getUuid(), NOTIF_TYPES)) {
doExecute(notificationStatistics, project);
}
notificationStatistics.dumpTo(context);
}
use of org.sonar.db.component.BranchType in project sonarqube by SonarSource.
the class BranchReportSubmitterTest method createButDoNotInsertBranch.
private static ComponentDto createButDoNotInsertBranch(ComponentDto project) {
BranchType randomBranchType = BranchType.values()[new Random().nextInt(BranchType.values().length)];
BranchDto branchDto = newBranchDto(project.projectUuid(), randomBranchType);
return ComponentTesting.newBranchComponent(project, branchDto);
}
use of org.sonar.db.component.BranchType in project sonarqube by SonarSource.
the class PostProjectAnalysisTasksExecutorTest method branch_comes_from_AnalysisMetadataHolder_when_set.
@Test
public void branch_comes_from_AnalysisMetadataHolder_when_set() {
analysisMetadataHolder.setBranch(new Branch() {
@Override
public BranchType getType() {
return BranchType.BRANCH;
}
@Override
public boolean isMain() {
return false;
}
@Override
public String getReferenceBranchUuid() {
throw new UnsupportedOperationException();
}
@Override
public String getName() {
return "feature/foo";
}
@Override
public boolean supportsCrossProjectCpd() {
throw new UnsupportedOperationException();
}
@Override
public String getPullRequestKey() {
throw new UnsupportedOperationException();
}
@Override
public String getTargetBranchName() {
throw new UnsupportedOperationException();
}
@Override
public String generateKey(String projectKey, @Nullable String fileOrDirPath) {
throw new UnsupportedOperationException();
}
});
underTest.finished(true);
verify(postProjectAnalysisTask).finished(taskContextCaptor.capture());
org.sonar.api.ce.posttask.Branch branch = taskContextCaptor.getValue().getProjectAnalysis().getBranch().get();
assertThat(branch.isMain()).isFalse();
assertThat(branch.getName()).hasValue("feature/foo");
assertThat(branch.getType()).isEqualTo(BranchImpl.Type.BRANCH);
}
Aggregations