for (Map.Entry detail : details.entrySet()) {
fields.put((String) detail.getKey(), detail.getValue());
}
+ if (!fields.containsKey("severity")) {
+ fields.put("severity", null);
+ }
}
@CheckForNull
return getNullableField(ActivityNormalizer.LogFields.LOGIN.field());
}
+ @CheckForNull
public String severity(){
- return (String) getField("severity");
+ return (String) getNullableField("severity");
}
public Map<String, String> parameters() {
<td valign="top" width="1%" nowrap><%= change.authorName() ? change.authorName() : change.login() ? !change.login().emtpy? : 'System' %></td>
<td valign="top" width="1%" nowrap><%= action_message %></td>
<td valign="top"><%= change.ruleName() ? change.ruleName() : change.ruleKey() %></td>
- <td valign="top"></td>
+ <td valign="top">
+ <% if change.severity() %>
+ <%= message('quality_profiles.severity_set_to_x', :params => ["<i class=\"icon-severity-#{change.severity().downcase}\"></i>", change.severity()]) -%>
+ <br/>
+ <% end %>
+ <% change.parameters().each do |param_key, param_value| %>
+ <%= message('quality_profiles.parameter_set_to_x', :params => [param_key, param_value]) -%>
+ <br/>
+ <% end %>
+ </td>
</tr>
<% end %>
</table>
assertThat(activity.action()).isEqualTo(ActiveRuleChange.Type.ACTIVATED.name());
assertThat(activity.ruleKey()).isEqualTo(RuleTesting.XOO_X1);
assertThat(activity.profileKey()).isEqualTo(XOO_P1_KEY);
- assertThat(activity.parameters().get("max")).isEqualTo("10");
assertThat(activity.severity()).isEqualTo(Severity.MAJOR);
assertThat(activity.ruleName()).isEqualTo(rule.getName());
assertThat(activity.login()).isEqualTo("me");
assertThat(activity.authorName()).isNull();
+
+ assertThat(activity.parameters()).hasSize(1);
+ assertThat(activity.parameters().get("max")).isEqualTo("10");
+ }
+
+ @Test
+ public void search_qprofile_activity_without_severity() throws InterruptedException {
+ MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN).setLogin("me");
+
+ RuleKey ruleKey = RuleKey.of("xoo", "deleted_rule");
+
+ tester.get(ActivityService.class).write(dbSession, Activity.Type.QPROFILE,
+ ActiveRuleChange.createFor(ActiveRuleChange.Type.UPDATED, ActiveRuleKey.of(XOO_P1_KEY, ruleKey))
+ .setParameter("max", "10")
+ );
+ dbSession.commit();
+
+ List<QProfileActivity> activities = service.findActivities(new QProfileActivityQuery(), new QueryOptions());
+ assertThat(activities).hasSize(1);
+
+ QProfileActivity activity = activities.get(0);
+ assertThat(activity.severity()).isNull();
+ assertThat(activity.parameters()).hasSize(1);
+ assertThat(activity.parameters().get("max")).isEqualTo("10");
}
@Test