aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2018-03-27 11:55:41 +0200
committerSonarTech <sonartech@sonarsource.com>2018-04-06 20:21:52 +0200
commitb3fd6a607be4a0c4afdbe7e9eb0facab53260818 (patch)
tree01d43630959e334f6d3cf142f8e2de2c91a53a7d
parent58257aeb573f4ceeffda764c28be4e9a847ba3fa (diff)
downloadsonarqube-b3fd6a607be4a0c4afdbe7e9eb0facab53260818.tar.gz
sonarqube-b3fd6a607be4a0c4afdbe7e9eb0facab53260818.zip
GOV-331 factor multiple Project classes into one
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/component/ComponentTreeBuilder.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/view/TriggerViewRefreshDelegate.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookPostTask.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/project/Project.java (renamed from server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/Project.java)9
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/webhook/Project.java76
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/webhook/ProjectAnalysis.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/webhook/WebhookPayloadFactoryImpl.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/webhook/WebhookQGChangeEventListener.java1
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java1
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java1
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java1
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/BranchPersisterImplTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ComponentTreeBuilderTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ConfigurationRepositoryTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/BuildComponentTreeStepTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistLiveMeasuresStepTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/QualityGateEventsStepTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistComponentsStepTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/TriggerViewRefreshStepTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookPostTaskTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/project/ProjectTest.java (renamed from server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/ProjectTest.java)11
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/webhook/ProjectAnalysisTest.java3
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/webhook/ProjectTest.java64
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java1
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java1
30 files changed, 39 insertions, 163 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java
index 77738cc6ffb..c6e00eb87e0 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java
@@ -21,6 +21,7 @@ package org.sonar.server.computation.task.projectanalysis.analysis;
import java.util.Map;
import javax.annotation.CheckForNull;
+import org.sonar.server.project.Project;
import org.sonar.server.qualityprofile.QualityProfile;
public interface AnalysisMetadataHolder {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java
index 6fee4c5f70c..157da3ac9cb 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java
@@ -25,6 +25,7 @@ import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.db.component.BranchType;
import org.sonar.server.computation.util.InitializedProperty;
+import org.sonar.server.project.Project;
import org.sonar.server.qualityprofile.QualityProfile;
import static com.google.common.base.Preconditions.checkState;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java
index 09acc83d648..a23d83f5841 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java
@@ -21,6 +21,7 @@ package org.sonar.server.computation.task.projectanalysis.analysis;
import java.util.Map;
import javax.annotation.Nullable;
+import org.sonar.server.project.Project;
import org.sonar.server.qualityprofile.QualityProfile;
public interface MutableAnalysisMetadataHolder extends AnalysisMetadataHolder {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/component/ComponentTreeBuilder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/component/ComponentTreeBuilder.java
index 36365235fa3..50cdf2e082a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/component/ComponentTreeBuilder.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/component/ComponentTreeBuilder.java
@@ -28,7 +28,7 @@ import org.sonar.db.component.SnapshotDto;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReport.Component.FileStatus;
import org.sonar.server.computation.task.projectanalysis.analysis.Branch;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkArgument;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java
index c74e9d46789..88bcb8fffaf 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java
@@ -42,7 +42,7 @@ import org.sonar.scanner.protocol.output.ScannerReport.Metadata.Plugin;
import org.sonar.scanner.protocol.output.ScannerReport.Metadata.QProfile;
import org.sonar.server.computation.task.projectanalysis.analysis.MutableAnalysisMetadataHolder;
import org.sonar.server.computation.task.projectanalysis.analysis.Organization;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import org.sonar.server.computation.task.projectanalysis.analysis.ScannerPlugin;
import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReader;
import org.sonar.server.computation.task.projectanalysis.component.BranchLoader;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/view/TriggerViewRefreshDelegate.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/view/TriggerViewRefreshDelegate.java
index e36832051b6..9ade436f8c6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/view/TriggerViewRefreshDelegate.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/view/TriggerViewRefreshDelegate.java
@@ -21,7 +21,7 @@
package org.sonar.server.computation.task.projectanalysis.view;
import java.util.function.Consumer;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
public interface TriggerViewRefreshDelegate extends Consumer<Project> {
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookPostTask.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookPostTask.java
index e8be7daead6..e043b37fecf 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookPostTask.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookPostTask.java
@@ -25,13 +25,13 @@ import java.util.Set;
import org.sonar.api.ce.posttask.PostProjectAnalysisTask;
import org.sonar.api.measures.Metric;
import org.sonar.core.util.stream.MoreCollectors;
+import org.sonar.server.project.Project;
import org.sonar.server.qualitygate.Condition;
import org.sonar.server.qualitygate.EvaluatedCondition;
import org.sonar.server.qualitygate.EvaluatedQualityGate;
import org.sonar.server.webhook.Analysis;
import org.sonar.server.webhook.Branch;
import org.sonar.server.webhook.CeTask;
-import org.sonar.server.webhook.Project;
import org.sonar.server.webhook.WebHooks;
import org.sonar.server.webhook.WebhookPayloadFactory;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/Project.java b/server/sonar-server/src/main/java/org/sonar/server/project/Project.java
index b683160198f..dd368746f45 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/Project.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/project/Project.java
@@ -17,8 +17,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.server.computation.task.projectanalysis.analysis;
+package org.sonar.server.project;
+import java.util.Objects;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@@ -72,12 +73,14 @@ public class Project {
return false;
}
Project project = (Project) o;
- return uuid.equals(project.uuid);
+ return uuid.equals(project.uuid)
+ && key.equals(project.key)
+ && name.equals(project.name);
}
@Override
public int hashCode() {
- return uuid.hashCode();
+ return Objects.hash(uuid, key, name);
}
@Override
diff --git a/server/sonar-server/src/main/java/org/sonar/server/webhook/Project.java b/server/sonar-server/src/main/java/org/sonar/server/webhook/Project.java
deleted file mode 100644
index ae2b383a3a8..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/webhook/Project.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2018 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.webhook;
-
-import java.util.Objects;
-
-import static java.util.Objects.requireNonNull;
-
-public final class Project {
- private final String uuid;
- private final String key;
- private final String name;
-
- public Project(String uuid, String key, String name) {
- this.uuid = requireNonNull(uuid, "uuid can't be null");
- this.key = requireNonNull(key, "key can't be null");
- this.name = requireNonNull(name, "name can't be null");
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public String getKey() {
- return key;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Project project = (Project) o;
- return Objects.equals(uuid, project.uuid) &&
- Objects.equals(key, project.key) &&
- Objects.equals(name, project.name);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(uuid, key, name);
- }
-
- @Override
- public String toString() {
- return "Project{" +
- "uuid='" + uuid + '\'' +
- ", key='" + key + '\'' +
- ", name='" + name + '\'' +
- '}';
- }
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/webhook/ProjectAnalysis.java b/server/sonar-server/src/main/java/org/sonar/server/webhook/ProjectAnalysis.java
index 2e055ad77f6..3a9175adbfb 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/webhook/ProjectAnalysis.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/webhook/ProjectAnalysis.java
@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;
+import org.sonar.server.project.Project;
import org.sonar.server.qualitygate.EvaluatedQualityGate;
import static com.google.common.collect.ImmutableMap.copyOf;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/webhook/WebhookPayloadFactoryImpl.java b/server/sonar-server/src/main/java/org/sonar/server/webhook/WebhookPayloadFactoryImpl.java
index 39f6d102c5b..32440c4b2cb 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/webhook/WebhookPayloadFactoryImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/webhook/WebhookPayloadFactoryImpl.java
@@ -30,6 +30,7 @@ import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.platform.Server;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.text.JsonWriter;
+import org.sonar.server.project.Project;
import org.sonar.server.qualitygate.Condition;
import org.sonar.server.qualitygate.EvaluatedCondition;
import org.sonar.server.qualitygate.EvaluatedQualityGate;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/webhook/WebhookQGChangeEventListener.java b/server/sonar-server/src/main/java/org/sonar/server/webhook/WebhookQGChangeEventListener.java
index f7d3310af8b..ee040fa0afc 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/webhook/WebhookQGChangeEventListener.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/webhook/WebhookQGChangeEventListener.java
@@ -32,6 +32,7 @@ import org.sonar.db.component.AnalysisPropertyDto;
import org.sonar.db.component.BranchDto;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.SnapshotDto;
+import org.sonar.server.project.Project;
import org.sonar.server.qualitygate.EvaluatedQualityGate;
import org.sonar.server.qualitygate.changeevent.QGChangeEvent;
import org.sonar.server.qualitygate.changeevent.QGChangeEventListener;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java
index 4a112bbb4de..58d9a362a6d 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java
@@ -25,6 +25,7 @@ import org.junit.rules.ExpectedException;
import org.sonar.db.component.BranchType;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.server.computation.task.projectanalysis.component.DefaultBranchImpl;
+import org.sonar.server.project.Project;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java
index 08f75f27e95..a24e7311c65 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java
@@ -27,6 +27,7 @@ import org.junit.rules.ExternalResource;
import org.sonar.db.component.BranchType;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.server.computation.util.InitializedProperty;
+import org.sonar.server.project.Project;
import org.sonar.server.qualityprofile.QualityProfile;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java
index 24a8f1d15fd..5eb99bc59f3 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java
@@ -23,6 +23,7 @@ import java.util.Map;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.junit.rules.ExternalResource;
+import org.sonar.server.project.Project;
import org.sonar.server.qualityprofile.QualityProfile;
public class MutableAnalysisMetadataHolderRule extends ExternalResource implements MutableAnalysisMetadataHolder {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/BranchPersisterImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/BranchPersisterImplTest.java
index 252d510fe34..12a8855e42b 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/BranchPersisterImplTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/BranchPersisterImplTest.java
@@ -30,7 +30,7 @@ import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentTesting;
import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
import org.sonar.server.computation.task.projectanalysis.analysis.Branch;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ComponentTreeBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ComponentTreeBuilderTest.java
index bc1096dc551..a140b43050f 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ComponentTreeBuilderTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ComponentTreeBuilderTest.java
@@ -35,7 +35,7 @@ import org.sonar.core.component.ComponentKeys;
import org.sonar.db.component.SnapshotDto;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.server.computation.task.projectanalysis.analysis.Branch;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import static com.google.common.base.Preconditions.checkArgument;
import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ConfigurationRepositoryTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ConfigurationRepositoryTest.java
index fbd6cf41791..810e19c0fab 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ConfigurationRepositoryTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ConfigurationRepositoryTest.java
@@ -32,7 +32,7 @@ import org.sonar.db.component.ComponentDto;
import org.sonar.db.property.PropertyDto;
import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
import org.sonar.server.computation.task.projectanalysis.analysis.Branch;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/BuildComponentTreeStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/BuildComponentTreeStepTest.java
index 906c345a1ad..0c7e75ae999 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/BuildComponentTreeStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/BuildComponentTreeStepTest.java
@@ -39,7 +39,7 @@ import org.sonar.scanner.protocol.output.ScannerReport.Component.ComponentType;
import org.sonar.scanner.protocol.output.ScannerReport.Component.FileStatus;
import org.sonar.server.computation.task.projectanalysis.analysis.Branch;
import org.sonar.server.computation.task.projectanalysis.analysis.MutableAnalysisMetadataHolderRule;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule;
import org.sonar.server.computation.task.projectanalysis.component.Component;
import org.sonar.server.computation.task.projectanalysis.component.DefaultBranchImpl;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java
index a123e69b0b1..587d5ae5349 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java
@@ -39,7 +39,7 @@ import org.sonar.db.organization.OrganizationDto;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.server.computation.task.projectanalysis.analysis.MutableAnalysisMetadataHolderRule;
import org.sonar.server.computation.task.projectanalysis.analysis.Organization;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import org.sonar.server.computation.task.projectanalysis.analysis.ScannerPlugin;
import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule;
import org.sonar.server.computation.task.projectanalysis.component.BranchLoader;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistLiveMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistLiveMeasuresStepTest.java
index 7db1635a996..04793b0dca6 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistLiveMeasuresStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistLiveMeasuresStepTest.java
@@ -31,7 +31,7 @@ import org.sonar.db.component.ComponentDto;
import org.sonar.db.measure.LiveMeasureDto;
import org.sonar.db.metric.MetricDto;
import org.sonar.server.computation.task.projectanalysis.analysis.MutableAnalysisMetadataHolderRule;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import org.sonar.server.computation.task.projectanalysis.component.Component;
import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/QualityGateEventsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/QualityGateEventsStepTest.java
index 0501ef46791..03deaea4de4 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/QualityGateEventsStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/QualityGateEventsStepTest.java
@@ -28,7 +28,7 @@ import org.sonar.api.notifications.Notification;
import org.sonar.db.component.BranchType;
import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
import org.sonar.server.computation.task.projectanalysis.analysis.Branch;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import org.sonar.server.computation.task.projectanalysis.component.Component;
import org.sonar.server.computation.task.projectanalysis.component.DefaultBranchImpl;
import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistComponentsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistComponentsStepTest.java
index 75a68862c44..13c3ade55c2 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistComponentsStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistComponentsStepTest.java
@@ -39,7 +39,7 @@ import org.sonar.db.component.ComponentTesting;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
import org.sonar.server.computation.task.projectanalysis.analysis.Branch;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import org.sonar.server.computation.task.projectanalysis.component.BranchPersister;
import org.sonar.server.computation.task.projectanalysis.component.Component;
import org.sonar.server.computation.task.projectanalysis.component.DefaultBranchImpl;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/TriggerViewRefreshStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/TriggerViewRefreshStepTest.java
index 155475b5ac5..aa36a257eb9 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/TriggerViewRefreshStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/TriggerViewRefreshStepTest.java
@@ -21,7 +21,7 @@ package org.sonar.server.computation.task.projectanalysis.step;
import org.junit.Test;
import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolder;
-import org.sonar.server.computation.task.projectanalysis.analysis.Project;
+import org.sonar.server.project.Project;
import org.sonar.server.computation.task.projectanalysis.view.TriggerViewRefreshDelegate;
import static org.mockito.Mockito.mock;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookPostTaskTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookPostTaskTest.java
index bb8616830f8..02c27ac314e 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookPostTaskTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookPostTaskTest.java
@@ -158,7 +158,7 @@ public class WebhookPostTaskTest {
}
verify(payloadFactory).create(new ProjectAnalysis(
- new org.sonar.server.webhook.Project(project.getUuid(), project.getKey(), project.getName()),
+ new org.sonar.server.project.Project(project.getUuid(), project.getKey(), project.getName()),
new org.sonar.server.webhook.CeTask(ceTask.getId(), org.sonar.server.webhook.CeTask.Status.valueOf(ceTask.getStatus().name())),
analysisUUid == null ? null : new Analysis(analysisUUid, date.getTime()),
new org.sonar.server.webhook.Branch(branch.isMain(), branch.getName().get(), org.sonar.server.webhook.Branch.Type.valueOf(branch.getType().name())),
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/ProjectTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ProjectTest.java
index c5b64f8ef52..4f2a351e844 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/ProjectTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/project/ProjectTest.java
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.server.computation.task.projectanalysis.analysis;
+package org.sonar.server.project;
import org.junit.Test;
@@ -38,6 +38,7 @@ public class ProjectTest {
.isEqualTo(project2.toString())
.isEqualTo("Project{uuid='U1', key='K1', name='N1', description=null}");
}
+
@Test
public void test_bean_with_description() {
Project project1 = new Project("U1", "K1", "N1", "D1");
@@ -61,16 +62,16 @@ public class ProjectTest {
assertThat(project1).isNotEqualTo(null);
assertThat(project1).isNotEqualTo(new Object());
assertThat(project1).isEqualTo(new Project("U1", "K1", "N1", null));
- assertThat(project1).isEqualTo(new Project("U1", "K2", "N1", null));
- assertThat(project1).isEqualTo(new Project("U1", "K1", "N2", null));
+ assertThat(project1).isNotEqualTo(new Project("U1", "K2", "N1", null));
+ assertThat(project1).isNotEqualTo(new Project("U1", "K1", "N2", null));
assertThat(project1).isEqualTo(project2);
assertThat(project1.hashCode()).isEqualTo(project1.hashCode());
assertThat(project1.hashCode()).isNotEqualTo(null);
assertThat(project1.hashCode()).isNotEqualTo(new Object().hashCode());
assertThat(project1.hashCode()).isEqualTo(new Project("U1", "K1", "N1", null).hashCode());
- assertThat(project1.hashCode()).isEqualTo(new Project("U1", "K2", "N1", null).hashCode());
- assertThat(project1.hashCode()).isEqualTo(new Project("U1", "K1", "N2", null).hashCode());
+ assertThat(project1.hashCode()).isNotEqualTo(new Project("U1", "K2", "N1", null).hashCode());
+ assertThat(project1.hashCode()).isNotEqualTo(new Project("U1", "K1", "N2", null).hashCode());
assertThat(project1.hashCode()).isEqualTo(project2.hashCode());
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/webhook/ProjectAnalysisTest.java b/server/sonar-server/src/test/java/org/sonar/server/webhook/ProjectAnalysisTest.java
index 21c7cb87390..0a453709b67 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/webhook/ProjectAnalysisTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/webhook/ProjectAnalysisTest.java
@@ -25,6 +25,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.measures.Metric;
+import org.sonar.server.project.Project;
import org.sonar.server.qualitygate.EvaluatedQualityGate;
import org.sonar.server.qualitygate.QualityGate;
@@ -148,6 +149,6 @@ public class ProjectAnalysisTest {
@Test
public void verify_toString() {
assertThat(underTest.toString()).isEqualTo(
- "ProjectAnalysis{project=Project{uuid='uuid', key='key', name='name'}, ceTask=CeTask{id='id', status=SUCCESS}, branch=Branch{main=true, name='name', type=SHORT}, qualityGate=EvaluatedQualityGate{qualityGate=QualityGate{id=id, name='name', conditions=[]}, status=WARN, evaluatedConditions=[]}, updatedAt=1, properties={a=b}, analysis=Analysis{uuid='analysis_uuid', date=1500}}");
+ "ProjectAnalysis{project=Project{uuid='uuid', key='key', name='name', description=null}, ceTask=CeTask{id='id', status=SUCCESS}, branch=Branch{main=true, name='name', type=SHORT}, qualityGate=EvaluatedQualityGate{qualityGate=QualityGate{id=id, name='name', conditions=[]}, status=WARN, evaluatedConditions=[]}, updatedAt=1, properties={a=b}, analysis=Analysis{uuid='analysis_uuid', date=1500}}");
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/webhook/ProjectTest.java b/server/sonar-server/src/test/java/org/sonar/server/webhook/ProjectTest.java
deleted file mode 100644
index 5db1229019c..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/webhook/ProjectTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2018 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.webhook;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ProjectTest {
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private Project underTest = new Project("a", "b", "c");
-
- @Test
- public void constructor_throws_NPE_if_uuid_is_null() {
- expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("uuid can't be null");
-
- new Project(null, "b", "c");
- }
-
- @Test
- public void constructor_throws_NPE_if_key_is_null() {
- expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("key can't be null");
-
- new Project("a", null, "c");
- }
-
- @Test
- public void constructor_throws_NPE_if_name_is_null() {
- expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("name can't be null");
-
- new Project("a", "b", null);
- }
-
- @Test
- public void verify_getters() {
- assertThat(underTest.getUuid()).isEqualTo("a");
- assertThat(underTest.getKey()).isEqualTo("b");
- assertThat(underTest.getName()).isEqualTo("c");
- }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java
index be8df1f933e..a494b9a86e7 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java
@@ -27,6 +27,7 @@ import org.junit.Test;
import org.sonar.api.measures.Metric;
import org.sonar.api.platform.Server;
import org.sonar.api.utils.System2;
+import org.sonar.server.project.Project;
import org.sonar.server.qualitygate.Condition;
import org.sonar.server.qualitygate.EvaluatedCondition;
import org.sonar.server.qualitygate.EvaluatedQualityGate;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java b/server/sonar-server/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java
index f748399122f..ca1adbb94d5 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java
@@ -49,6 +49,7 @@ import org.sonar.db.component.BranchType;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.SnapshotDto;
import org.sonar.db.organization.OrganizationDto;
+import org.sonar.server.project.Project;
import org.sonar.server.qualitygate.EvaluatedQualityGate;
import org.sonar.server.qualitygate.changeevent.QGChangeEvent;
import org.sonar.server.qualitygate.changeevent.QGChangeEventListener;