use of org.sonar.api.rules.RuleType.SECURITY_HOTSPOT in project sonarqube by SonarSource.
the class SearchActionTest method insertRandomNumberOfHotspotsOfAllSupportedStatusesAndResolutions.
private Stream<IssueDto> insertRandomNumberOfHotspotsOfAllSupportedStatusesAndResolutions(ComponentDto project, ComponentDto file) {
RuleDefinitionDto rule = newRule(SECURITY_HOTSPOT);
List<IssueDto> hotspots = Arrays.stream(validStatusesAndResolutions()).flatMap(objects -> {
String status = (String) objects[0];
String resolution = (String) objects[1];
return IntStream.range(0, 1 + RANDOM.nextInt(15)).mapToObj(i -> newIssue(rule, project, file).setKee("hotspot_" + status + "_" + resolution + "_" + i).setType(SECURITY_HOTSPOT).setStatus(status).setResolution(resolution));
}).collect(toList());
Collections.shuffle(hotspots);
hotspots.forEach(t -> dbTester.issues().insertHotspot(t));
return hotspots.stream();
}
use of org.sonar.api.rules.RuleType.SECURITY_HOTSPOT in project sonarqube by SonarSource.
the class ShowActionTest method returns_user_details_of_users_from_ChangelogAndComments.
@Test
public void returns_user_details_of_users_from_ChangelogAndComments() {
ComponentDto project = dbTester.components().insertPublicProject();
userSessionRule.registerComponents(project);
RuleDefinitionDto rule = newRule(SECURITY_HOTSPOT);
ComponentDto file = dbTester.components().insertComponent(newFileDto(project));
IssueDto hotspot = dbTester.issues().insertHotspot(rule, project, file);
FormattingContext formattingContext = mockChangelogAndCommentsFormattingContext();
Set<UserDto> changeLogAndCommentsUsers = IntStream.range(0, 1 + RANDOM.nextInt(14)).mapToObj(i -> UserTesting.newUserDto()).collect(Collectors.toSet());
when(formattingContext.getUsers()).thenReturn(changeLogAndCommentsUsers);
Hotspots.ShowWsResponse response = newRequest(hotspot).executeProtobuf(Hotspots.ShowWsResponse.class);
assertThat(response.getUsersList()).extracting(User::getLogin, User::getName, User::getActive).containsExactlyInAnyOrder(changeLogAndCommentsUsers.stream().map(t -> tuple(t.getLogin(), t.getName(), t.isActive())).toArray(Tuple[]::new));
}
Aggregations