use of org.sonar.server.project.Project in project sonarqube by SonarSource.
the class AnalysisMetadataHolderImplTest method set_and_get_project.
@Test
public void set_and_get_project() {
AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(editionProvider);
Project project = Project.from(newPrivateProjectDto());
underTest.setProject(project);
assertThat(underTest.getProject()).isSameAs(project);
}
use of org.sonar.server.project.Project in project sonarqube by SonarSource.
the class TargetBranchComponentUuidsTest method setup.
@Before
public void setup() {
underTest = new TargetBranchComponentUuids(analysisMetadataHolder, db.getDbClient());
Project project = mock(Project.class);
analysisMetadataHolder.setProject(project);
analysisMetadataHolder.setBranch(branch);
ComponentDto projectDto = db.components().insertPublicProject();
when(project.getUuid()).thenReturn(projectDto.uuid());
branch1 = db.components().insertProjectBranch(projectDto, b -> b.setKey(BRANCH_KEY));
ComponentDto pr1branch = db.components().insertProjectBranch(projectDto, b -> b.setKey(PR_KEY).setBranchType(BranchType.PULL_REQUEST).setPullRequestData(DbProjectBranches.PullRequestData.newBuilder().setTarget(BRANCH_KEY).build()).setMergeBranchUuid(projectDto.getMainBranchProjectUuid()));
branch1File = ComponentTesting.newFileDto(branch1, null, "file").setUuid("branch1File");
pr1File = ComponentTesting.newFileDto(pr1branch, null, "file").setUuid("file1");
db.components().insertComponents(branch1File, pr1File);
}
use of org.sonar.server.project.Project in project sonarqube by SonarSource.
the class PostMeasuresComputationChecksStepTest method context_contains_project_uuid_from_analysis_metada_holder.
@Test
public void context_contains_project_uuid_from_analysis_metada_holder() {
Project project = Project.from(newPrivateProjectDto());
analysisMetadataHolder.setProject(project);
PostMeasuresComputationCheck check = mock(PostMeasuresComputationCheck.class);
newStep(check).execute(new TestComputationStepContext());
ArgumentCaptor<Context> contextArgumentCaptor = ArgumentCaptor.forClass(Context.class);
verify(check).onCheck(contextArgumentCaptor.capture());
assertThat(contextArgumentCaptor.getValue().getProjectUuid()).isEqualTo(project.getUuid());
}
use of org.sonar.server.project.Project in project sonarqube by SonarSource.
the class SendIssueNotificationsStepTest method do_not_send_notifications_if_no_subscribers.
@Test
public void do_not_send_notifications_if_no_subscribers() {
analysisMetadataHolder.setProject(new Project(PROJECT.getUuid(), PROJECT.getKey(), PROJECT.getName(), null, emptyList()));
when(notificationService.hasProjectSubscribersForTypes(PROJECT.getUuid(), NOTIF_TYPES)).thenReturn(false);
TestComputationStepContext context = new TestComputationStepContext();
underTest.execute(context);
verify(notificationService, never()).deliver(any(Notification.class));
verify(notificationService, never()).deliverEmails(anyCollection());
verifyStatistics(context, 0, 0, 0);
}
use of org.sonar.server.project.Project in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method setUp.
@Before
public void setUp() {
CeTask defaultOrgCeTask = createCeTask(PROJECT_KEY);
underTest = createStep(defaultOrgCeTask);
project = db.components().insertPublicProject(p -> p.setDbKey(PROJECT_KEY));
}
Aggregations