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);
}
}
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;
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