From 4244d2ea76411f80d1ce9da40eefe2781c404327 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Mon, 11 Nov 2019 15:49:12 -0600 Subject: SONAR-12679 Use single branch type --- .../sonar/server/telemetry/TelemetryDataLoaderImplTest.java | 4 ++-- .../server/webhook/WebhookQGChangeEventListenerTest.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'server/sonar-webserver-core') diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java index 5141a356757..c7dd10533ef 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java @@ -59,7 +59,7 @@ import static org.sonar.api.measures.CoreMetrics.LINES_KEY; import static org.sonar.api.measures.CoreMetrics.NCLOC_KEY; import static org.sonar.api.measures.CoreMetrics.NCLOC_LANGUAGE_DISTRIBUTION_KEY; import static org.sonar.core.platform.EditionProvider.Edition.DEVELOPER; -import static org.sonar.db.component.BranchType.LONG; +import static org.sonar.db.component.BranchType.BRANCH; import static org.sonar.db.component.BranchType.PULL_REQUEST; public class TelemetryDataLoaderImplTest { @@ -149,7 +149,7 @@ public class TelemetryDataLoaderImplTest { server.setId("AU-TpxcB-iU5OvuD2FL7").setVersion("7.5.4"); MetricDto ncloc = db.measures().insertMetric(m -> m.setKey(NCLOC_KEY)); ComponentDto project = db.components().insertMainBranch(db.getDefaultOrganization()); - ComponentDto branch1 = db.components().insertProjectBranch(project, b -> b.setBranchType(LONG)); + ComponentDto branch1 = db.components().insertProjectBranch(project, b -> b.setBranchType(BRANCH)); ComponentDto pr = db.components().insertProjectBranch(project, b -> b.setBranchType(PULL_REQUEST)); db.measures().insertLiveMeasure(project, ncloc, m -> m.setValue(10d)); db.measures().insertLiveMeasure(branch1, ncloc, m -> m.setValue(20d)); diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java index 1f33d63519b..cbc18717ad6 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java @@ -65,7 +65,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.sonar.core.util.stream.MoreCollectors.toArrayList; -import static org.sonar.db.component.BranchType.LONG; +import static org.sonar.db.component.BranchType.BRANCH; import static org.sonar.db.component.ComponentTesting.newBranchDto; import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto; @@ -146,7 +146,7 @@ public class WebhookQGChangeEventListenerTest { public void onIssueChanges_calls_webhook_for_changeEvent_with_webhook_enabled(@Nullable EvaluatedQualityGate newQualityGate) { OrganizationDto organization = dbTester.organizations().insert(); ComponentDto project = dbTester.components().insertPublicProject(organization); - ComponentAndBranch branch = insertProjectBranch(project, BranchType.LONG, "foo"); + ComponentAndBranch branch = insertProjectBranch(project, BRANCH, "foo"); SnapshotDto analysis = insertAnalysisTask(branch); Configuration configuration = mock(Configuration.class); mockPayloadSupplierConsumedByWebhooks(); @@ -165,7 +165,7 @@ public class WebhookQGChangeEventListenerTest { new Project(project.uuid(), project.getKey(), project.name()), null, new Analysis(analysis.getUuid(), analysis.getCreatedAt(), analysis.getRevision()), - new Branch(false, "foo", Branch.Type.LONG), + new Branch(false, "foo", Branch.Type.BRANCH), newQualityGate, null, properties)); @@ -187,8 +187,8 @@ public class WebhookQGChangeEventListenerTest { } @Test - public void onIssueChanges_calls_webhook_on_long_branch() { - onIssueChangesCallsWebhookOnBranch(BranchType.LONG); + public void onIssueChanges_calls_webhook_on_branch() { + onIssueChangesCallsWebhookOnBranch(BRANCH); } @Test @@ -277,7 +277,7 @@ public class WebhookQGChangeEventListenerTest { public ComponentAndBranch insertMainBranch(OrganizationDto organization) { ComponentDto project = newPrivateProjectDto(organization); - BranchDto branch = newBranchDto(project, LONG).setKey("master"); + BranchDto branch = newBranchDto(project, BRANCH).setKey("master"); dbTester.components().insertComponent(project); dbClient.branchDao().insert(dbTester.getSession(), branch); dbTester.commit(); -- cgit v1.2.3