]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5329 - Fix migration bug
authorStephane Gamard <stephane.gamard@searchbox.com>
Fri, 20 Jun 2014 13:16:25 +0000 (15:16 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Fri, 20 Jun 2014 13:16:25 +0000 (15:16 +0200)
sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigration.java
sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java

index 0c995b80823b760c314ec2b121264fb0789607e3..9b1055227004a2ec41071046bff3bfed4704f579 100644 (file)
@@ -114,9 +114,9 @@ public class ChangeLogMigration implements DatabaseMigration {
 
   private void processRuleChange(ActiveRuleChange ruleChange, ChangeLog change) {
     ruleChange.setSeverity(SeverityUtil.getSeverityFromOrdinal(change.getSeverity()));
-    String param_value = change.getParamKey();
-    String param_name = change.getParamValue();
-    if (StringUtils.isNotEmpty(param_name) && !param_name.equals("null")) {
+    String param_name = change.getParamKey();
+    String param_value = change.getParamValue();
+    if (StringUtils.isNotEmpty(param_name)) {
       ruleChange.setParameter(param_name, param_value);
     }
   }
index 405ef8bcde16fa52e9e049c477c5bff8e62782b0..26ac5f209522bc7fc29c446ecba0f9b18da58066 100644 (file)
@@ -28,11 +28,14 @@ import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.sonar.api.utils.DateUtils;
 import org.sonar.api.utils.System2;
+import org.sonar.core.activity.db.ActivityDto;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.persistence.TestDatabase;
 import org.sonar.server.activity.db.ActivityDao;
 import org.sonar.server.db.DbClient;
 
+import java.util.List;
+
 import static org.fest.assertions.Assertions.assertThat;
 import static org.mockito.Mockito.when;
 
@@ -68,8 +71,10 @@ public class ChangeLogMigrationTest {
   public void migrate() throws Exception {
     db.prepareDbUnit(getClass(), "active_rules_changes.xml");
     migration.execute();
-
     assertThat(dao.findAll(session)).hasSize(5);
+
+    List<ActivityDto> changes = dao.findAll(session);
+    assertThat(changes.get(1).getData()).contains("param_PARAM1=TODO");
   }
 
   @Test