aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-migration
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2019-03-19 15:00:33 +0100
committerSonarTech <sonartech@sonarsource.com>2019-03-19 20:21:29 +0100
commit17b3feadd562a9114a30391353770740549a575f (patch)
tree39730e60633f5b100b999048f041d46f88a9041c /server/sonar-db-migration
parent97d921d30e915e8b8f7f74d840d9fe331e613039 (diff)
downloadsonarqube-17b3feadd562a9114a30391353770740549a575f.tar.gz
sonarqube-17b3feadd562a9114a30391353770740549a575f.zip
SONAR-11812 Restore ability to set unit tests as favorite
Diffstat (limited to 'server/sonar-db-migration')
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundred.java2
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiers.java2
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiersTest.java4
3 files changed, 5 insertions, 3 deletions
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundred.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundred.java
index 0b9cfb08719..688dcfab9e6 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundred.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundred.java
@@ -43,7 +43,7 @@ public class DeleteFavoritesExceedingOneHundred extends DataChange {
private static final String FAVOURITE_PROPERTY = "favourite";
- private static final List<String> SORTED_QUALIFIERS = asList("TRK", "VW", "APP", "SVW", "FIL");
+ private static final List<String> SORTED_QUALIFIERS = asList("TRK", "VW", "APP", "SVW", "FIL", "UTS");
public DeleteFavoritesExceedingOneHundred(Database db) {
super(db);
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiers.java
index 12a314b1ec6..eae96710a36 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiers.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiers.java
@@ -36,7 +36,7 @@ public class DeleteFavouritesOnNotSupportedComponentQualifiers extends DataChang
public void execute(Context context) throws SQLException {
MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("favourites");
massUpdate.select("SELECT prop.id FROM properties prop " +
- "INNER JOIN projects p ON p.id=prop.resource_id AND p.qualifier NOT IN ('TRK', 'FIL', 'VW', 'SVW', 'APP') " +
+ "INNER JOIN projects p ON p.id=prop.resource_id AND p.qualifier NOT IN ('TRK', 'FIL', 'VW', 'SVW', 'APP', 'UTS') " +
"WHERE prop_key=? AND user_id IS NOT NULL")
.setString(1, "favourite");
massUpdate.update("DELETE FROM properties WHERE id=?");
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiersTest.java
index 188cf9140e9..421ac3c199a 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiersTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiersTest.java
@@ -64,10 +64,12 @@ public class DeleteFavouritesOnNotSupportedComponentQualifiersTest {
int prop4 = insertProperty(FAVOURITE_PROPERTY, subPortfolioId);
int applicationId = insertComponent("APP");
int prop5 = insertProperty(FAVOURITE_PROPERTY, applicationId);
+ int unitTestId = insertComponent("UTS");
+ int prop6 = insertProperty(FAVOURITE_PROPERTY, unitTestId);
underTest.execute();
- assertProperties(prop1, prop2, prop3, prop4, prop5);
+ assertProperties(prop1, prop2, prop3, prop4, prop5, prop6);
}
@Test