Rules.SearchResponse response = ws.newRequest().executeProtobuf(Rules.SearchResponse.class);
Rules.Rule result = response.getRules(0);
assertThat(result.getCreatedAt()).isNotEmpty();
+ assertThat(result.getUpdatedAt()).isNotEmpty();
assertThat(result.getGapDescription()).isNotEmpty();
assertThat(result.getHtmlDesc()).isNotEmpty();
assertThat(result.hasIsTemplate()).isTrue();
assertThat(result.hasName()).isFalse();
assertThat(result.hasSeverity()).isFalse();
assertThat(result.hasRepo()).isFalse();
+ assertThat(result.hasUpdatedAt()).isFalse();
}
@Test
import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_SYSTEM_TAGS;
import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_TAGS;
import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_TEMPLATE_KEY;
+import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_UPDATED_AT;
import static org.sonarqube.ws.Rules.Rule.DescriptionSection.Context.newBuilder;
/**
setSysTags(ruleResponse, ruleDto, fieldsToReturn);
setParams(ruleResponse, ruleDto, result, fieldsToReturn);
setCreatedAt(ruleResponse, ruleDto, fieldsToReturn);
+ setUpdatedAt(ruleResponse, ruleDto, fieldsToReturn);
setDescriptionFields(ruleResponse, ruleDto, fieldsToReturn);
setSeverity(ruleResponse, ruleDto, fieldsToReturn);
setInternalKey(ruleResponse, ruleDto, fieldsToReturn);
}
}
+ private static void setUpdatedAt(Rules.Rule.Builder ruleResponse, RuleDto ruleDto, Set<String> fieldsToReturn) {
+ if (shouldReturnField(fieldsToReturn, FIELD_UPDATED_AT)) {
+ ruleResponse.setUpdatedAt(formatDateTime(ruleDto.getUpdatedAt()));
+ }
+ }
+
private void setDescriptionFields(Rules.Rule.Builder ruleResponse, RuleDto ruleDto, Set<String> fieldsToReturn) {
if (shouldReturnField(fieldsToReturn, FIELD_HTML_DESCRIPTION)) {
String htmlDescription = ruleDescriptionFormatter.getDescriptionAsHtml(ruleDto);
optional DeprecatedKeys deprecatedKeys = 48;
optional DescriptionSections descriptionSections = 49;
optional EducationPrinciples educationPrinciples = 50;
+ optional string updatedAt = 51;
message DescriptionSections {
repeated DescriptionSection descriptionSections = 1;