瀏覽代碼

rename UserSessionRule.login() to logIn() for clarity

tags/6.3-RC1
Sébastien Lesaint 7 年之前
父節點
當前提交
7efab8ef44
共有 100 個文件被更改,包括 1073 次插入1076 次删除
  1. 18
    18
      server/sonar-server/src/test/java/org/sonar/server/batch/ProjectDataLoaderMediumTest.java
  2. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/batch/UsersActionTest.java
  3. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java
  4. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java
  5. 13
    13
      server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java
  6. 4
    4
      server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceUpdateKeyTest.java
  7. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexLoginTest.java
  8. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/component/ws/AppActionTest.java
  9. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java
  10. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java
  11. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowActionTest.java
  12. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java
  13. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/email/ws/SendActionTest.java
  14. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java
  15. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java
  16. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/favorite/ws/SearchActionTest.java
  17. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/issue/ActionFinderTest.java
  18. 6
    6
      server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java
  19. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/issue/SetSeverityActionTest.java
  20. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/issue/SetTypeActionTest.java
  21. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/issue/TransitionActionTest.java
  22. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/issue/TransitionServiceTest.java
  23. 259
    259
      server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java
  24. 6
    6
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java
  25. 4
    4
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java
  26. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java
  27. 14
    14
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/ChangelogActionTest.java
  28. 7
    7
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java
  29. 6
    6
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/DoTransitionActionTest.java
  30. 9
    9
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java
  31. 6
    6
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsMediumTest.java
  32. 12
    12
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java
  33. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetSeverityActionTest.java
  34. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTypeActionTest.java
  35. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/license/ws/ListActionTest.java
  36. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/CreateActionTest.java
  37. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/DeleteActionTest.java
  38. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java
  39. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/SearchActionTest.java
  40. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/UpdateActionTest.java
  41. 439
    439
      server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTest.java
  42. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java
  43. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java
  44. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java
  45. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java
  46. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/metric/ws/CreateActionTest.java
  47. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/metric/ws/DeleteActionTest.java
  48. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/metric/ws/UpdateActionTest.java
  49. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/notification/ws/AddActionTest.java
  50. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/notification/ws/ListActionTest.java
  51. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java
  52. 5
    5
      server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java
  53. 9
    9
      server/sonar-server/src/test/java/org/sonar/server/organization/ws/DeleteActionTest.java
  54. 9
    9
      server/sonar-server/src/test/java/org/sonar/server/organization/ws/UpdateActionTest.java
  55. 6
    6
      server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java
  56. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java
  57. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java
  58. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/BasePermissionWsTest.java
  59. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/GroupsActionTest.java
  60. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java
  61. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java
  62. 1
    2
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchGlobalPermissionsActionTest.java
  63. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java
  64. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/UsersActionTest.java
  65. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddGroupToTemplateActionTest.java
  66. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddProjectCreatorToTemplateActionTest.java
  67. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java
  68. 2
    3
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/ApplyTemplateActionTest.java
  69. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/CreateTemplateActionTest.java
  70. 11
    11
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/DeleteTemplateActionTest.java
  71. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveGroupFromTemplateActionTest.java
  72. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveProjectCreatorFromTemplateActionTest.java
  73. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateActionTest.java
  74. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/SearchTemplatesActionTest.java
  75. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/SetDefaultTemplateActionTest.java
  76. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/TemplateGroupsActionTest.java
  77. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/TemplateUsersActionTest.java
  78. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/UpdateTemplateActionTest.java
  79. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelActionTest.java
  80. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/platform/ws/InfoActionTest.java
  81. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/platform/ws/LogsActionTest.java
  82. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/platform/ws/RestartActionTest.java
  83. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailableActionTest.java
  84. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/plugins/ws/CancelAllActionTest.java
  85. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallActionTest.java
  86. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java
  87. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingActionTest.java
  88. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsMediumTest.java
  89. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UninstallActionTest.java
  90. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdateActionTest.java
  91. 2
    2
      server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesActionTest.java
  92. 23
    24
      server/sonar-server/src/test/java/org/sonar/server/project/ws/CreateActionTest.java
  93. 10
    10
      server/sonar-server/src/test/java/org/sonar/server/project/ws/DeleteActionTest.java
  94. 8
    8
      server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java
  95. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/project/ws/IndexActionTest.java
  96. 7
    7
      server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java
  97. 1
    1
      server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java
  98. 47
    47
      server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java
  99. 3
    3
      server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/DeleteActionTest.java
  100. 0
    0
      server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java

+ 18
- 18
server/sonar-server/src/test/java/org/sonar/server/batch/ProjectDataLoaderMediumTest.java 查看文件

@@ -88,7 +88,7 @@ public class ProjectDataLoaderMediumTest {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();

@@ -112,7 +112,7 @@ public class ProjectDataLoaderMediumTest {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.login("john").addProjectUuidPermissions(SCAN_EXECUTION, project.projectUuid());
userSessionRule.logIn("john").addProjectUuidPermissions(SCAN_EXECUTION, project.projectUuid());
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();

@@ -136,7 +136,7 @@ public class ProjectDataLoaderMediumTest {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.login("john").addProjectUuidPermissions(UserRole.USER, project.uuid());
userSessionRule.logIn("john").addProjectUuidPermissions(UserRole.USER, project.uuid());
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();

@@ -158,7 +158,7 @@ public class ProjectDataLoaderMediumTest {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();

@@ -194,7 +194,7 @@ public class ProjectDataLoaderMediumTest {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();

@@ -225,7 +225,7 @@ public class ProjectDataLoaderMediumTest {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();

@@ -272,7 +272,7 @@ public class ProjectDataLoaderMediumTest {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();

@@ -318,7 +318,7 @@ public class ProjectDataLoaderMediumTest {
dbClient.organizationDao().insert(dbSession, organizationDto);
// No snapshot attached on the project -> provisioned project
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();

@@ -348,7 +348,7 @@ public class ProjectDataLoaderMediumTest {
// No module properties

ComponentDto subModule = ComponentTesting.newModuleDto(module);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, subModule);

// Sub module properties
@@ -386,7 +386,7 @@ public class ProjectDataLoaderMediumTest {
dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey("sonar.jira.login.secured").setValue("john").setResourceId(module.getId()));

ComponentDto subModule = ComponentTesting.newModuleDto(module);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, subModule);

// Sub module properties
@@ -423,7 +423,7 @@ public class ProjectDataLoaderMediumTest {
// No module property

ComponentDto subModule = ComponentTesting.newModuleDto(module);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, subModule);
// No sub module property

@@ -458,7 +458,7 @@ public class ProjectDataLoaderMediumTest {
dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR-SERVER").setResourceId(module.getId()));

ComponentDto subModule = ComponentTesting.newModuleDto(module);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, subModule);
// No sub module property

@@ -475,7 +475,7 @@ public class ProjectDataLoaderMediumTest {

@Test
public void fail_when_no_browse_permission_and_no_scan_permission() {
userSessionRule.login("john").setGlobalPermissions();
userSessionRule.logIn("john").setGlobalPermissions();

OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
@@ -499,7 +499,7 @@ public class ProjectDataLoaderMediumTest {
dbClient.componentDao().insert(dbSession, project);
dbSession.commit();

userSessionRule.login("john").addProjectUuidPermissions(UserRole.USER, project.projectUuid());
userSessionRule.logIn("john").addProjectUuidPermissions(UserRole.USER, project.projectUuid());

thrown.expect(ForbiddenException.class);
thrown.expectMessage("You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. " +
@@ -515,7 +515,7 @@ public class ProjectDataLoaderMediumTest {
dbClient.componentDao().insert(dbSession, project);
dbSession.commit();

userSessionRule.login("john").addProjectUuidPermissions(GlobalPermissions.SCAN_EXECUTION, project.projectUuid());
userSessionRule.logIn("john").addProjectUuidPermissions(GlobalPermissions.SCAN_EXECUTION, project.projectUuid());

thrown.expect(ForbiddenException.class);
thrown.expectMessage("You don't have the required permissions to access this project. Please contact your SonarQube administrator.");
@@ -527,7 +527,7 @@ public class ProjectDataLoaderMediumTest {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();

@@ -548,7 +548,7 @@ public class ProjectDataLoaderMediumTest {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();

@@ -586,7 +586,7 @@ public class ProjectDataLoaderMediumTest {
tester.get(FileSourceDao.class).insert(newFileSourceDto(projectFile).setSrcHash("123456").setRevision("987654321"));

ComponentDto module = ComponentTesting.newModuleDto(project);
userSessionRule.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSessionRule.logIn("john").setGlobalPermissions(SCAN_EXECUTION);
dbClient.componentDao().insert(dbSession, module);

// File on module

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/batch/UsersActionTest.java 查看文件

@@ -69,7 +69,7 @@ public class UsersActionTest {
es.putDocuments(UserIndexDefinition.INDEX, UserIndexDefinition.TYPE_USER,
new UserDoc().setLogin("ada.lovelace").setName("Ada Lovelace").setActive(false),
new UserDoc().setLogin("grace.hopper").setName("Grace Hopper").setActive(true));
userSessionRule.login("sonarqtech");
userSessionRule.logIn("sonarqtech");

WsTester.TestRequest request = tester.newGetRequest("batch", "users").setParam("logins", "ada.lovelace,grace.hopper");


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java 查看文件

@@ -288,7 +288,7 @@ public class ActivityActionTest {
String view_uuid = "VIEW_1";
dbTester.components().insertView(dbTester.getDefaultOrganization(), view_uuid);
insertActivity("T1", view_uuid, CeActivityDto.Status.SUCCESS);
userSession.login().addProjectUuidPermissions(UserRole.ADMIN, view_uuid);
userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, view_uuid);

ActivityResponse result = call(ws.newRequest().setParam(Param.TEXT_QUERY, "T1"));


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java 查看文件

@@ -92,7 +92,7 @@ public class ActivityStatusActionTest {
public void status_for_a_project_as_project_admin() {
String projectUuid = "project-uuid";
String anotherProjectUuid = "another-project-uuid";
userSession.login().addProjectUuidPermissions(UserRole.ADMIN, projectUuid);
userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, projectUuid);
OrganizationDto organizationDto = db.organizations().insert();
componentDb.insertComponent(newProjectDto(organizationDto, projectUuid));
componentDb.insertComponent(newProjectDto(organizationDto, anotherProjectUuid));

+ 13
- 13
server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java 查看文件

@@ -74,7 +74,7 @@ public class TaskActionTest {

@Test
public void task_is_in_queue() throws Exception {
userSession.login("john").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("john").setGlobalPermissions(SYSTEM_ADMIN);

CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
@@ -103,7 +103,7 @@ public class TaskActionTest {

@Test
public void task_is_archived() throws Exception {
userSession.login("john").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("john").setGlobalPermissions(SYSTEM_ADMIN);

CeActivityDto activityDto = createActivityDto(SOME_TASK_UUID);
persist(activityDto);
@@ -128,7 +128,7 @@ public class TaskActionTest {

@Test
public void return_stacktrace_of_failed_activity_with_stacktrace_when_additionalField_is_set() {
userSession.login("john").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("john").setGlobalPermissions(SYSTEM_ADMIN);

CeActivityDto activityDto = createActivityDto(SOME_TASK_UUID)
.setErrorMessage("error msg")
@@ -151,7 +151,7 @@ public class TaskActionTest {

@Test
public void do_not_return_stacktrace_of_failed_activity_with_stacktrace_when_additionalField_is_not_set() {
userSession.login("john").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("john").setGlobalPermissions(SYSTEM_ADMIN);

CeActivityDto activityDto = createActivityDto(SOME_TASK_UUID)
.setErrorMessage("error msg")
@@ -172,7 +172,7 @@ public class TaskActionTest {

@Test
public void return_scannerContext_of_activity_with_scannerContext_when_additionalField_is_set() {
userSession.login("john").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("john").setGlobalPermissions(SYSTEM_ADMIN);

String scannerContext = "this is some scanner context, yeah!";
persist(createActivityDto(SOME_TASK_UUID));
@@ -192,7 +192,7 @@ public class TaskActionTest {

@Test
public void do_not_return_scannerContext_of_activity_with_scannerContext_when_additionalField_is_not_set() {
userSession.login("john").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("john").setGlobalPermissions(SYSTEM_ADMIN);

String scannerContext = "this is some scanner context, yeah!";
persist(createActivityDto(SOME_TASK_UUID));
@@ -212,7 +212,7 @@ public class TaskActionTest {

@Test
public void do_not_return_stacktrace_of_failed_activity_without_stacktrace() {
userSession.login("john").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("john").setGlobalPermissions(SYSTEM_ADMIN);

CeActivityDto activityDto = createActivityDto(SOME_TASK_UUID)
.setErrorMessage("error msg");
@@ -232,7 +232,7 @@ public class TaskActionTest {

@Test
public void task_not_found() throws Exception {
userSession.login("john").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("john").setGlobalPermissions(SYSTEM_ADMIN);

expectedException.expect(NotFoundException.class);
ws.newRequest()
@@ -242,7 +242,7 @@ public class TaskActionTest {

@Test
public void not_fail_on_queue_task_not_linked_on_project_with_system_admin_permissions() {
userSession.login("john").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("john").setGlobalPermissions(SYSTEM_ADMIN);

CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType("fake");
@@ -258,7 +258,7 @@ public class TaskActionTest {

@Test
public void not_fail_on_queue_task_not_linked_on_project_with_global_scan_permissions() {
userSession.login("john").setGlobalPermissions(SCAN_EXECUTION);
userSession.logIn("john").setGlobalPermissions(SCAN_EXECUTION);

CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType("fake");
@@ -274,7 +274,7 @@ public class TaskActionTest {

@Test
public void fail_on_queue_task_not_linked_on_project_if_not_admin_nor_scan_permission() {
userSession.login("john").setGlobalPermissions(PROVISIONING);
userSession.logIn("john").setGlobalPermissions(PROVISIONING);

CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType("fake");
@@ -291,7 +291,7 @@ public class TaskActionTest {

@Test
public void not_fail_on_queue_task_linked_on_project_with_project_scan_permission() {
userSession.login("john").addProjectUuidPermissions(SCAN_EXECUTION, project.uuid());
userSession.logIn("john").addProjectUuidPermissions(SCAN_EXECUTION, project.uuid());

CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType("fake");
@@ -308,7 +308,7 @@ public class TaskActionTest {

@Test
public void not_fail_on_archived_task_linked_on_project_with_project_scan_permission() throws Exception {
userSession.login("john").addProjectUuidPermissions(SCAN_EXECUTION, project.uuid());
userSession.logIn("john").addProjectUuidPermissions(SCAN_EXECUTION, project.uuid());

CeActivityDto activityDto = createActivityDto(SOME_TASK_UUID)
.setComponentUuid(project.uuid());

+ 4
- 4
server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceUpdateKeyTest.java 查看文件

@@ -69,7 +69,7 @@ public class ComponentServiceUpdateKeyTest {

dbSession.commit();

userSession.login("john").addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
userSession.logIn("john").addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
underTest.updateKey(dbSession, project, "sample2:root");
dbSession.commit();

@@ -94,7 +94,7 @@ public class ComponentServiceUpdateKeyTest {
ComponentDto file = ComponentTesting.newFileDto(module, null).setKey("sample:root:module:src/File.xoo");
dbClient.componentDao().insert(dbSession, file);
dbSession.commit();
userSession.login("john").addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
userSession.logIn("john").addProjectUuidPermissions(UserRole.ADMIN, project.uuid());

underTest.updateKey(dbSession, module, "sample:root2:module");
dbSession.commit();
@@ -112,7 +112,7 @@ public class ComponentServiceUpdateKeyTest {

dbSession.commit();

userSession.login("john").addProjectUuidPermissions(UserRole.ADMIN, provisionedProject.uuid());
userSession.logIn("john").addProjectUuidPermissions(UserRole.ADMIN, provisionedProject.uuid());
underTest.updateKey(dbSession, provisionedProject, "provisionedProject2");
dbSession.commit();

@@ -125,7 +125,7 @@ public class ComponentServiceUpdateKeyTest {
expectedException.expect(ForbiddenException.class);

ComponentDto project = insertSampleRootProject();
userSession.login("john").addProjectUuidPermissions(UserRole.USER, project.uuid());
userSession.logIn("john").addProjectUuidPermissions(UserRole.USER, project.uuid());

underTest.updateKey(dbSession, project, "sample2:root");
}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexLoginTest.java 查看文件

@@ -42,7 +42,7 @@ public class ComponentIndexLoginTest extends ComponentIndexTest {
@Test
public void should_find_project_for_which_the_user_has_direct_permission() {
UserDto user = newUserDto();
userSession.login(user);
userSession.logIn(user);

ComponentDto project = newProject("sonarqube", "Quality Product");
indexer.index(project);
@@ -57,7 +57,7 @@ public class ComponentIndexLoginTest extends ComponentIndexTest {
@Test
public void should_find_project_for_which_the_user_has_indirect_permission_through_group() {
GroupDto group = newGroupDto();
userSession.login().setGroups(group);
userSession.logIn().setGroups(group);

ComponentDto project = newProject("sonarqube", "Quality Product");
indexer.index(project);

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/component/ws/AppActionTest.java 查看文件

@@ -83,7 +83,7 @@ public class AppActionTest {
insertComponentsAndAnalysis();
dbTester.commit();

userSessionRule.login("john").addComponentUuidPermission(UserRole.USER, PROJECT_UUID, FILE_UUID);
userSessionRule.logIn("john").addComponentUuidPermission(UserRole.USER, PROJECT_UUID, FILE_UUID);
WsTester.TestRequest request = wsTester.newGetRequest("api/components", "app").setParam("uuid", FILE_UUID);
request.execute().assertJson(getClass(), "app.json");
}
@@ -100,7 +100,7 @@ public class AppActionTest {
dbTester.commit();

userSessionRule
.login("john")
.logIn("john")
.addComponentUuidPermission(UserRole.USER, PROJECT_UUID, FILE_UUID);
WsTester.TestRequest request = wsTester.newGetRequest("api/components", "app").setParam("uuid", FILE_UUID);
request.execute().assertJson(getClass(), "app_with_measures.json");
@@ -112,7 +112,7 @@ public class AppActionTest {
insertFileMeasure(metricsByKey.get(COVERAGE_KEY).getId(), 95.4, null);
dbTester.commit();

userSessionRule.login("john").addComponentUuidPermission(UserRole.USER, PROJECT_UUID, FILE_UUID);
userSessionRule.logIn("john").addComponentUuidPermission(UserRole.USER, PROJECT_UUID, FILE_UUID);
WsTester.TestRequest request = wsTester.newGetRequest("api/components", "app").setParam("uuid", FILE_UUID);
request.execute().assertJson(getClass(), "app_with_ut_measure.json");
}

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java 查看文件

@@ -96,7 +96,7 @@ public class SearchActionTest {
ws = new WsActionTester(new SearchAction(db.getDbClient(), resourceTypes, i18n, userSession, languages, defaultOrganizationProvider));

user = db.users().insertUser("john");
userSession.login(user);
userSession.logIn(user);
}

@Test

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java 查看文件

@@ -88,7 +88,7 @@ public class SearchProjectsActionTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Rule
public UserSessionRule userSession = UserSessionRule.standalone().login().setUserId(23);
public UserSessionRule userSession = UserSessionRule.standalone().logIn().setUserId(23);
@Rule
public EsTester es = new EsTester(new ProjectMeasuresIndexDefinition(new MapSettings()));
@Rule
@@ -138,7 +138,7 @@ public class SearchProjectsActionTest {
.setUuid(Uuids.UUID_EXAMPLE_03)
.setKey(KeyExamples.KEY_PROJECT_EXAMPLE_003)
.setName("My Project 3"));
userSession.login().setUserId(23);
userSession.logIn().setUserId(23);
addFavourite(project1);
dbSession.commit();


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowActionTest.java 查看文件

@@ -56,7 +56,7 @@ public class ShowActionTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Rule
public UserSessionRule userSession = UserSessionRule.standalone().login().setRoot().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
public UserSessionRule userSession = UserSessionRule.standalone().logIn().setRoot().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
@Rule
public DbTester db = DbTester.create(System2.INSTANCE);


+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java 查看文件

@@ -89,7 +89,7 @@ public class TreeActionTest {

@Before
public void setUp() {
userSession.login().setRoot();
userSession.logIn().setRoot();
userSession.setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
ws = new WsActionTester(new TreeAction(dbClient, new ComponentFinder(dbClient), resourceTypes, userSession, Mockito.mock(I18n.class)));
resourceTypes.setChildrenQualifiers(Qualifiers.MODULE, Qualifiers.FILE, Qualifiers.DIRECTORY);
@@ -99,7 +99,7 @@ public class TreeActionTest {
@Test
public void json_example() throws IOException {
ComponentDto project = initJsonExampleComponents();
userSession.login().addProjectUuidPermissions(UserRole.USER, project.uuid());
userSession.logIn().addProjectUuidPermissions(UserRole.USER, project.uuid());

String response = ws.newRequest()
.setParam(PARAM_BASE_COMPONENT_ID, project.uuid())
@@ -298,7 +298,7 @@ public class TreeActionTest {
@Test
public void fail_when_not_enough_privileges() {
expectedException.expect(ForbiddenException.class);
userSession.anonymous().login()
userSession.anonymous().logIn()
.addProjectUuidPermissions(UserRole.CODEVIEWER, "project-uuid");
componentDb.insertComponent(newProjectDto(db.organizations().insert(), "project-uuid"));
db.commit();

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/email/ws/SendActionTest.java 查看文件

@@ -140,7 +140,7 @@ public class SendActionTest {
}

private void setUserAsSystemAdmin() {
userSession.login("admin").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("admin").setGlobalPermissions(SYSTEM_ADMIN);
}

}

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java 查看文件

@@ -107,7 +107,7 @@ public class AddActionTest {
@Test
public void fail_when_no_browse_permission_on_the_project() {
insertProject();
userSession.login();
userSession.logIn();
userSession.addProjectUuidPermissions(UserRole.ADMIN, PROJECT_UUID);

expectedException.expect(ForbiddenException.class);
@@ -117,7 +117,7 @@ public class AddActionTest {

@Test
public void fail_when_component_is_not_found() {
userSession.login();
userSession.logIn();

expectedException.expect(NotFoundException.class);

@@ -148,7 +148,7 @@ public class AddActionTest {

private ComponentDto insertProjectAndPermissions() {
userSession
.login()
.logIn()
.setUserId(USER_ID)
.addProjectUuidPermissions(UserRole.USER, PROJECT_UUID);


+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java 查看文件

@@ -87,7 +87,7 @@ public class RemoveActionTest {

@Test
public void fail_when_component_is_not_found() {
userSession.login();
userSession.logIn();

expectedException.expect(NotFoundException.class);

@@ -117,7 +117,7 @@ public class RemoveActionTest {
}

private ComponentDto insertProjectAndPermissions() {
userSession.login().setUserId(USER_ID);
userSession.logIn().setUserId(USER_ID);

return insertProject();
}

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/favorite/ws/SearchActionTest.java 查看文件

@@ -62,7 +62,7 @@ public class SearchActionTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Rule
public UserSessionRule userSession = UserSessionRule.standalone().login().setUserId(USER_ID);
public UserSessionRule userSession = UserSessionRule.standalone().logIn().setUserId(USER_ID);
@Rule
public DbTester db = DbTester.create();
private DbClient dbClient = db.getDbClient();

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/issue/ActionFinderTest.java 查看文件

@@ -46,7 +46,7 @@ public class ActionFinderTest {
public ExpectedException thrown = ExpectedException.none();

@Rule
public UserSessionRule userSession = UserSessionRule.standalone().login("arthur");
public UserSessionRule userSession = UserSessionRule.standalone().logIn("arthur");

private ComponentDto project = newProjectDto(OrganizationTesting.newOrganizationDto(), PROJECT_UUID).setKey(PROJECT_KEY);
private IssueDto issue = newDto(newXooX1().setId(10), newFileDto(project, null), project).setKee(ISSUE_KEY);
@@ -73,7 +73,7 @@ public class ActionFinderTest {
@Test
public void doest_not_return_assign_to_me_action_when_issue_already_assigned_to_user() {

userSession.login("julien");
userSession.logIn("julien");
IssueDto issue = newDto(newXooX1().setId(10), newFileDto(project, null), project).setKee(ISSUE_KEY).setAssignee("julien");
assertThat(underTest.listAvailableActions(issue)).doesNotContain("assign_to_me");
}

+ 6
- 6
server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java 查看文件

@@ -101,7 +101,7 @@ public class IssueServiceMediumTest {
RuleDto rule = newRule();
ComponentDto project = newProject();
ComponentDto file = newFile(project);
userSessionRule.login("john").addProjectUuidPermissions(UserRole.USER, project.uuid());
userSessionRule.logIn("john").addProjectUuidPermissions(UserRole.USER, project.uuid());

IssueDto issue = saveIssue(IssueTesting.newDto(rule, file, project));

@@ -122,7 +122,7 @@ public class IssueServiceMediumTest {
RuleDto rule = newRule();
ComponentDto project = newProject();
ComponentDto file = newFile(project);
userSessionRule.login("john").addProjectUuidPermissions(UserRole.USER, project.uuid());
userSessionRule.logIn("john").addProjectUuidPermissions(UserRole.USER, project.uuid());

IssueDto issue = saveIssue(IssueTesting.newDto(rule, file, project).setAssignee("perceval"));

@@ -143,7 +143,7 @@ public class IssueServiceMediumTest {
RuleDto rule = newRule();
ComponentDto project = newProject();
ComponentDto file = newFile(project);
userSessionRule.login("john").addProjectUuidPermissions(UserRole.USER, project.uuid());
userSessionRule.logIn("john").addProjectUuidPermissions(UserRole.USER, project.uuid());

IssueDto issue = saveIssue(IssueTesting.newDto(rule, file, project));

@@ -179,7 +179,7 @@ public class IssueServiceMediumTest {
RuleDto rule = newRule();
ComponentDto project = newProject();
ComponentDto file = newFile(project);
userSessionRule.login("john").addProjectUuidPermissions(UserRole.USER, project.uuid());
userSessionRule.logIn("john").addProjectUuidPermissions(UserRole.USER, project.uuid());

IssueDto issue = saveIssue(IssueTesting.newDto(rule, file, project));

@@ -273,7 +273,7 @@ public class IssueServiceMediumTest {
ComponentDto project = ComponentTesting.newProjectDto(organization);
tester.get(ComponentDao.class).insert(session, project);

userSessionRule.login("admin").addProjectPermissions(UserRole.USER, project.key()).setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSessionRule.logIn("admin").addProjectPermissions(UserRole.USER, project.key()).setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
session.commit();

// project can be seen by group "anyone"
@@ -282,7 +282,7 @@ public class IssueServiceMediumTest {
GroupPermissionChange permissionChange = new GroupPermissionChange(PermissionChange.Operation.ADD, UserRole.USER, new ProjectId(project),
GroupIdOrAnyone.forAnyone(organization.getUuid()));
tester.get(PermissionUpdater.class).apply(session, asList(permissionChange));
userSessionRule.login();
userSessionRule.logIn();

return project;
}

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/issue/SetSeverityActionTest.java 查看文件

@@ -111,7 +111,7 @@ public class SetSeverityActionTest {
}

private void setUserWithBrowseAndAdministerIssuePermission(String projectUuid) {
userSession.login(USER_LOGIN)
userSession.logIn(USER_LOGIN)
.addProjectUuidPermissions(ISSUE_ADMIN, projectUuid)
.addProjectUuidPermissions(USER, projectUuid);
}

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/issue/SetTypeActionTest.java 查看文件

@@ -116,7 +116,7 @@ public class SetTypeActionTest {
}

private void setUserWithBrowseAndAdministerIssuePermission(String projectUuid) {
userSession.login(USER_LOGIN)
userSession.logIn(USER_LOGIN)
.addProjectUuidPermissions(ISSUE_ADMIN, projectUuid)
.addProjectUuidPermissions(USER, projectUuid);
}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/issue/TransitionActionTest.java 查看文件

@@ -73,7 +73,7 @@ public class TransitionActionTest {

@Test
public void execute() {
userSession.login("john").addProjectUuidPermissions(ISSUE_ADMIN, issue.projectUuid());
userSession.logIn("john").addProjectUuidPermissions(ISSUE_ADMIN, issue.projectUuid());
issue.setStatus(Issue.STATUS_RESOLVED);
issue.setResolution(Issue.RESOLUTION_FIXED);

@@ -85,7 +85,7 @@ public class TransitionActionTest {

@Test
public void does_not_execute_if_transition_is_not_available() {
userSession.login("john").addProjectUuidPermissions(ISSUE_ADMIN, issue.projectUuid());
userSession.logIn("john").addProjectUuidPermissions(ISSUE_ADMIN, issue.projectUuid());
issue.setStatus(Issue.STATUS_CLOSED);

action.execute(ImmutableMap.of("transition", "reopen"), context);

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/issue/TransitionServiceTest.java 查看文件

@@ -63,7 +63,7 @@ public class TransitionServiceTest {
@Test
public void list_transitions() throws Exception {
IssueDto issue = newIssue().setStatus(STATUS_OPEN).setResolution(null);
userSession.login("john").addProjectUuidPermissions(ISSUE_ADMIN, issue.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(ISSUE_ADMIN, issue.getProjectUuid());

List<Transition> result = underTest.listTransitions(issue.toDefaultIssue());

@@ -72,7 +72,7 @@ public class TransitionServiceTest {

@Test
public void list_transitions_returns_only_transitions_that_do_not_requires_issue_admin_permission() throws Exception {
userSession.login("john");
userSession.logIn("john");
IssueDto issue = newIssue().setStatus(STATUS_OPEN).setResolution(null);

List<Transition> result = underTest.listTransitions(issue.toDefaultIssue());

+ 259
- 259
server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java 查看文件

@@ -103,7 +103,7 @@ public class IssueIndexTest {
ComponentDto project = newProjectDto(newOrganizationDto());
ComponentDto file = newFileDto(project, null);
IssueDoc issue = IssueDocTesting.newDoc("ISSUE1", file)
.setEffort(100L);
.setEffort(100L);
indexIssues(issue);

Issue loaded = getByKey(issue.key());
@@ -156,8 +156,8 @@ public class IssueIndexTest {
ComponentDto project = newProjectDto(newOrganizationDto());

indexIssues(
IssueDocTesting.newDoc("1", newFileDto(project, null)),
IssueDocTesting.newDoc("2", newFileDto(project, null)));
IssueDocTesting.newDoc("1", newFileDto(project, null)),
IssueDocTesting.newDoc("2", newFileDto(project, null)));

assertThat(underTest.search(IssueQuery.builder().issueKeys(newArrayList("1", "2")).build(), new SearchOptions()).getDocs()).hasSize(2);
assertThat(underTest.search(IssueQuery.builder().issueKeys(newArrayList("1")).build(), new SearchOptions()).getDocs()).hasSize(1);
@@ -171,12 +171,12 @@ public class IssueIndexTest {
ComponentDto subModule = ComponentTesting.newModuleDto(module);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", project),
IssueDocTesting.newDoc("ISSUE2", newFileDto(project, null)),
IssueDocTesting.newDoc("ISSUE3", module),
IssueDocTesting.newDoc("ISSUE4", newFileDto(module, null)),
IssueDocTesting.newDoc("ISSUE5", subModule),
IssueDocTesting.newDoc("ISSUE6", newFileDto(subModule, null)));
IssueDocTesting.newDoc("ISSUE1", project),
IssueDocTesting.newDoc("ISSUE2", newFileDto(project, null)),
IssueDocTesting.newDoc("ISSUE3", module),
IssueDocTesting.newDoc("ISSUE4", newFileDto(module, null)),
IssueDocTesting.newDoc("ISSUE5", subModule),
IssueDocTesting.newDoc("ISSUE6", newFileDto(subModule, null)));

assertThat(underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).build(), new SearchOptions()).getDocs()).hasSize(6);
assertThat(underTest.search(IssueQuery.builder().projectUuids(newArrayList("unknown")).build(), new SearchOptions()).getDocs()).isEmpty();
@@ -189,9 +189,9 @@ public class IssueIndexTest {
ComponentDto project2 = newProjectDto(organizationDto, "EFGH");

indexIssues(
IssueDocTesting.newDoc("ISSUE1", newFileDto(project, null)),
IssueDocTesting.newDoc("ISSUE2", newFileDto(project, null)),
IssueDocTesting.newDoc("ISSUE3", newFileDto(project2, null)));
IssueDocTesting.newDoc("ISSUE1", newFileDto(project, null)),
IssueDocTesting.newDoc("ISSUE2", newFileDto(project, null)),
IssueDocTesting.newDoc("ISSUE3", newFileDto(project2, null)));

SearchResult<IssueDoc> result = underTest.search(IssueQuery.builder().build(), new SearchOptions().addFacets(newArrayList("projectUuids")));
assertThat(result.getFacets().getNames()).containsOnly("projectUuids");
@@ -206,28 +206,28 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(subModule, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE3", module),
IssueDocTesting.newDoc("ISSUE5", subModule),
IssueDocTesting.newDoc("ISSUE2", file));
IssueDocTesting.newDoc("ISSUE3", module),
IssueDocTesting.newDoc("ISSUE5", subModule),
IssueDocTesting.newDoc("ISSUE2", file));

assertThat(
underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).moduleUuids(newArrayList(file.uuid())).build(), new SearchOptions())
.getDocs())
.isEmpty();
underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).moduleUuids(newArrayList(file.uuid())).build(), new SearchOptions())
.getDocs())
.isEmpty();
assertThat(
underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).moduleUuids(newArrayList(module.uuid())).build(), new SearchOptions())
.getDocs())
.hasSize(1);
underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).moduleUuids(newArrayList(module.uuid())).build(), new SearchOptions())
.getDocs())
.hasSize(1);
assertThat(
underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).moduleUuids(newArrayList(subModule.uuid())).build(), new SearchOptions())
.getDocs())
.hasSize(2);
underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).moduleUuids(newArrayList(subModule.uuid())).build(), new SearchOptions())
.getDocs())
.hasSize(2);
assertThat(
underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).moduleUuids(newArrayList(project.uuid())).build(), new SearchOptions())
.getDocs())
.isEmpty();
underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).moduleUuids(newArrayList(project.uuid())).build(), new SearchOptions())
.getDocs())
.isEmpty();
assertThat(
underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).moduleUuids(newArrayList("unknown")).build(), new SearchOptions()).getDocs())
underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).moduleUuids(newArrayList("unknown")).build(), new SearchOptions()).getDocs())
.isEmpty();
}

@@ -243,27 +243,27 @@ public class IssueIndexTest {
indexView(view, newArrayList(project.uuid()));

indexIssues(
IssueDocTesting.newDoc("ISSUE1", project),
IssueDocTesting.newDoc("ISSUE2", file1),
IssueDocTesting.newDoc("ISSUE3", module),
IssueDocTesting.newDoc("ISSUE4", file2),
IssueDocTesting.newDoc("ISSUE5", subModule),
IssueDocTesting.newDoc("ISSUE6", file3));
IssueDocTesting.newDoc("ISSUE1", project),
IssueDocTesting.newDoc("ISSUE2", file1),
IssueDocTesting.newDoc("ISSUE3", module),
IssueDocTesting.newDoc("ISSUE4", file2),
IssueDocTesting.newDoc("ISSUE5", subModule),
IssueDocTesting.newDoc("ISSUE6", file3));

assertThat(underTest.search(IssueQuery.builder().fileUuids(newArrayList(file1.uuid(), file2.uuid(), file3.uuid())).build(), new SearchOptions())
.getDocs()).hasSize(3);
.getDocs()).hasSize(3);
assertThat(underTest.search(IssueQuery.builder().fileUuids(newArrayList(file1.uuid())).build(), new SearchOptions())
.getDocs()).hasSize(1);
.getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().moduleRootUuids(newArrayList(subModule.uuid())).build(), new SearchOptions())
.getDocs()).hasSize(2);
.getDocs()).hasSize(2);
assertThat(underTest.search(IssueQuery.builder().moduleRootUuids(newArrayList(module.uuid())).build(), new SearchOptions())
.getDocs()).hasSize(4);
.getDocs()).hasSize(4);
assertThat(underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).build(), new SearchOptions())
.getDocs()).hasSize(6);
.getDocs()).hasSize(6);
assertThat(underTest.search(IssueQuery.builder().viewUuids(newArrayList(view)).build(), new SearchOptions())
.getDocs()).hasSize(6);
.getDocs()).hasSize(6);
assertThat(underTest.search(IssueQuery.builder().projectUuids(newArrayList("unknown")).build(), new SearchOptions())
.getDocs()).isEmpty();
.getDocs()).isEmpty();
}

@Test
@@ -278,12 +278,12 @@ public class IssueIndexTest {
indexView(view, newArrayList(project.uuid()));

indexIssues(
IssueDocTesting.newDoc("ISSUE1", project),
IssueDocTesting.newDoc("ISSUE2", file1),
IssueDocTesting.newDoc("ISSUE3", module),
IssueDocTesting.newDoc("ISSUE4", file2),
IssueDocTesting.newDoc("ISSUE5", subModule),
IssueDocTesting.newDoc("ISSUE6", file3));
IssueDocTesting.newDoc("ISSUE1", project),
IssueDocTesting.newDoc("ISSUE2", file1),
IssueDocTesting.newDoc("ISSUE3", module),
IssueDocTesting.newDoc("ISSUE4", file2),
IssueDocTesting.newDoc("ISSUE5", subModule),
IssueDocTesting.newDoc("ISSUE6", file3));

assertThat(underTest.search(IssueQuery.builder().projectUuids(newArrayList("unknown")).build(), new SearchOptions()).getDocs()).isEmpty();
assertThat(underTest.search(IssueQuery.builder().projectUuids(newArrayList(project.uuid())).build(), new SearchOptions()).getDocs()).hasSize(6);
@@ -294,7 +294,7 @@ public class IssueIndexTest {
// !
assertThat(underTest.search(IssueQuery.builder().fileUuids(newArrayList(file1.uuid())).build(), new SearchOptions()).getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().fileUuids(newArrayList(file1.uuid(), file2.uuid(), file3.uuid())).build(), new SearchOptions()).getDocs())
.hasSize(3);
.hasSize(3);
}

@Test
@@ -305,16 +305,16 @@ public class IssueIndexTest {
ComponentDto file3 = newFileDto(project, null, "CDEF");

indexIssues(
IssueDocTesting.newDoc("ISSUE1", project),
IssueDocTesting.newDoc("ISSUE2", file1),
IssueDocTesting.newDoc("ISSUE3", file2),
IssueDocTesting.newDoc("ISSUE4", file2),
IssueDocTesting.newDoc("ISSUE5", file3));
IssueDocTesting.newDoc("ISSUE1", project),
IssueDocTesting.newDoc("ISSUE2", file1),
IssueDocTesting.newDoc("ISSUE3", file2),
IssueDocTesting.newDoc("ISSUE4", file2),
IssueDocTesting.newDoc("ISSUE5", file3));

SearchResult<IssueDoc> result = underTest.search(IssueQuery.builder().build(), new SearchOptions().addFacets(newArrayList("fileUuids")));
assertThat(result.getFacets().getNames()).containsOnly("fileUuids");
assertThat(result.getFacets().get("fileUuids"))
.containsOnly(entry("A", 1L), entry("ABCD", 1L), entry("BCDE", 2L), entry("CDEF", 1L));
.containsOnly(entry("A", 1L), entry("ABCD", 1L), entry("BCDE", 2L), entry("CDEF", 1L));
}

@Test
@@ -324,8 +324,8 @@ public class IssueIndexTest {
ComponentDto file2 = newFileDto(project, null).setPath("F2.xoo");

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file1).setDirectoryPath("/src/main/xoo"),
IssueDocTesting.newDoc("ISSUE2", file2).setDirectoryPath("/"));
IssueDocTesting.newDoc("ISSUE1", file1).setDirectoryPath("/src/main/xoo"),
IssueDocTesting.newDoc("ISSUE2", file2).setDirectoryPath("/"));

assertThat(underTest.search(IssueQuery.builder().directories(newArrayList("/src/main/xoo")).build(), new SearchOptions()).getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().directories(newArrayList("/")).build(), new SearchOptions()).getDocs()).hasSize(1);
@@ -339,8 +339,8 @@ public class IssueIndexTest {
ComponentDto file2 = newFileDto(project, null).setPath("F2.xoo");

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file1).setDirectoryPath("/src/main/xoo"),
IssueDocTesting.newDoc("ISSUE2", file2).setDirectoryPath("/"));
IssueDocTesting.newDoc("ISSUE1", file1).setDirectoryPath("/src/main/xoo"),
IssueDocTesting.newDoc("ISSUE2", file2).setDirectoryPath("/"));

SearchResult<IssueDoc> result = underTest.search(IssueQuery.builder().build(), new SearchOptions().addFacets(newArrayList("directories")));
assertThat(result.getFacets().getNames()).containsOnly("directories");
@@ -354,11 +354,11 @@ public class IssueIndexTest {
ComponentDto file1 = newFileDto(project1, null);
ComponentDto project2 = newProjectDto(organizationDto);
indexIssues(
// Project1 has 2 issues (one on a file and one on the project itself)
IssueDocTesting.newDoc("ISSUE1", project1),
IssueDocTesting.newDoc("ISSUE2", file1),
// Project2 has 1 issue
IssueDocTesting.newDoc("ISSUE3", project2));
// Project1 has 2 issues (one on a file and one on the project itself)
IssueDocTesting.newDoc("ISSUE1", project1),
IssueDocTesting.newDoc("ISSUE2", file1),
// Project2 has 1 issue
IssueDocTesting.newDoc("ISSUE3", project2));

// The view1 is containing 2 issues from project1
String view1 = "ABCD";
@@ -380,8 +380,8 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setSeverity(Severity.INFO),
IssueDocTesting.newDoc("ISSUE2", file).setSeverity(Severity.MAJOR));
IssueDocTesting.newDoc("ISSUE1", file).setSeverity(Severity.INFO),
IssueDocTesting.newDoc("ISSUE2", file).setSeverity(Severity.MAJOR));

assertThat(underTest.search(IssueQuery.builder().severities(newArrayList(Severity.INFO, Severity.MAJOR)).build(), new SearchOptions()).getDocs()).hasSize(2);
assertThat(underTest.search(IssueQuery.builder().severities(newArrayList(Severity.INFO)).build(), new SearchOptions()).getDocs()).hasSize(1);
@@ -394,9 +394,9 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setSeverity(Severity.INFO),
IssueDocTesting.newDoc("ISSUE2", file).setSeverity(Severity.INFO),
IssueDocTesting.newDoc("ISSUE3", file).setSeverity(Severity.MAJOR));
IssueDocTesting.newDoc("ISSUE1", file).setSeverity(Severity.INFO),
IssueDocTesting.newDoc("ISSUE2", file).setSeverity(Severity.INFO),
IssueDocTesting.newDoc("ISSUE3", file).setSeverity(Severity.MAJOR));

SearchResult<IssueDoc> result = underTest.search(IssueQuery.builder().build(), new SearchOptions().addFacets(newArrayList("severities")));
assertThat(result.getFacets().getNames()).containsOnly("severities");
@@ -409,11 +409,11 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setStatus(Issue.STATUS_CLOSED),
IssueDocTesting.newDoc("ISSUE2", file).setStatus(Issue.STATUS_OPEN));
IssueDocTesting.newDoc("ISSUE1", file).setStatus(Issue.STATUS_CLOSED),
IssueDocTesting.newDoc("ISSUE2", file).setStatus(Issue.STATUS_OPEN));

assertThat(underTest.search(IssueQuery.builder().statuses(newArrayList(Issue.STATUS_CLOSED, Issue.STATUS_OPEN)).build(), new SearchOptions()).getDocs())
.hasSize(2);
.hasSize(2);
assertThat(underTest.search(IssueQuery.builder().statuses(newArrayList(Issue.STATUS_CLOSED)).build(), new SearchOptions()).getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().statuses(newArrayList(Issue.STATUS_CONFIRMED)).build(), new SearchOptions()).getDocs()).isEmpty();
}
@@ -424,9 +424,9 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setStatus(Issue.STATUS_CLOSED),
IssueDocTesting.newDoc("ISSUE2", file).setStatus(Issue.STATUS_CLOSED),
IssueDocTesting.newDoc("ISSUE3", file).setStatus(Issue.STATUS_OPEN));
IssueDocTesting.newDoc("ISSUE1", file).setStatus(Issue.STATUS_CLOSED),
IssueDocTesting.newDoc("ISSUE2", file).setStatus(Issue.STATUS_CLOSED),
IssueDocTesting.newDoc("ISSUE3", file).setStatus(Issue.STATUS_OPEN));

SearchResult<IssueDoc> result = underTest.search(IssueQuery.builder().build(), new SearchOptions().addFacets(newArrayList("statuses")));
assertThat(result.getFacets().getNames()).containsOnly("statuses");
@@ -439,13 +439,13 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setResolution(Issue.RESOLUTION_FALSE_POSITIVE),
IssueDocTesting.newDoc("ISSUE2", file).setResolution(Issue.RESOLUTION_FIXED));
IssueDocTesting.newDoc("ISSUE1", file).setResolution(Issue.RESOLUTION_FALSE_POSITIVE),
IssueDocTesting.newDoc("ISSUE2", file).setResolution(Issue.RESOLUTION_FIXED));

assertThat(
underTest.search(IssueQuery.builder().resolutions(newArrayList(Issue.RESOLUTION_FALSE_POSITIVE, Issue.RESOLUTION_FIXED)).build(), new SearchOptions())
.getDocs())
.hasSize(2);
underTest.search(IssueQuery.builder().resolutions(newArrayList(Issue.RESOLUTION_FALSE_POSITIVE, Issue.RESOLUTION_FIXED)).build(), new SearchOptions())
.getDocs())
.hasSize(2);
assertThat(underTest.search(IssueQuery.builder().resolutions(newArrayList(Issue.RESOLUTION_FALSE_POSITIVE)).build(), new SearchOptions()).getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().resolutions(newArrayList(Issue.RESOLUTION_REMOVED)).build(), new SearchOptions()).getDocs()).isEmpty();
}
@@ -456,9 +456,9 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setResolution(Issue.RESOLUTION_FALSE_POSITIVE),
IssueDocTesting.newDoc("ISSUE2", file).setResolution(Issue.RESOLUTION_FALSE_POSITIVE),
IssueDocTesting.newDoc("ISSUE3", file).setResolution(Issue.RESOLUTION_FIXED));
IssueDocTesting.newDoc("ISSUE1", file).setResolution(Issue.RESOLUTION_FALSE_POSITIVE),
IssueDocTesting.newDoc("ISSUE2", file).setResolution(Issue.RESOLUTION_FALSE_POSITIVE),
IssueDocTesting.newDoc("ISSUE3", file).setResolution(Issue.RESOLUTION_FIXED));

SearchResult<IssueDoc> result = underTest.search(IssueQuery.builder().build(), new SearchOptions().addFacets(newArrayList("resolutions")));
assertThat(result.getFacets().getNames()).containsOnly("resolutions");
@@ -471,9 +471,9 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setStatus(Issue.STATUS_CLOSED).setResolution(Issue.RESOLUTION_FIXED),
IssueDocTesting.newDoc("ISSUE2", file).setStatus(Issue.STATUS_OPEN).setResolution(null),
IssueDocTesting.newDoc("ISSUE3", file).setStatus(Issue.STATUS_OPEN).setResolution(null));
IssueDocTesting.newDoc("ISSUE1", file).setStatus(Issue.STATUS_CLOSED).setResolution(Issue.RESOLUTION_FIXED),
IssueDocTesting.newDoc("ISSUE2", file).setStatus(Issue.STATUS_OPEN).setResolution(null),
IssueDocTesting.newDoc("ISSUE3", file).setStatus(Issue.STATUS_OPEN).setResolution(null));

assertThat(underTest.search(IssueQuery.builder().resolved(true).build(), new SearchOptions()).getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().resolved(false).build(), new SearchOptions()).getDocs()).hasSize(2);
@@ -501,7 +501,7 @@ public class IssueIndexTest {
indexIssues(IssueDocTesting.newDoc("ISSUE1", file).setRuleKey(ruleKey.toString()).setLanguage("xoo"));

assertThat(underTest.search(IssueQuery.builder().languages(newArrayList("xoo")).build(),
new SearchOptions()).getDocs()).hasSize(1);
new SearchOptions()).getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().languages(newArrayList("unknown")).build(), new SearchOptions()).getDocs()).isEmpty();
}

@@ -524,9 +524,9 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setAssignee("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAssignee("simon"),
IssueDocTesting.newDoc("ISSUE3", file).setAssignee(null));
IssueDocTesting.newDoc("ISSUE1", file).setAssignee("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAssignee("simon"),
IssueDocTesting.newDoc("ISSUE3", file).setAssignee(null));

assertThat(underTest.search(IssueQuery.builder().assignees(newArrayList("steph")).build(), new SearchOptions()).getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().assignees(newArrayList("steph", "simon")).build(), new SearchOptions()).getDocs()).hasSize(2);
@@ -539,10 +539,10 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setAssignee("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAssignee("simon"),
IssueDocTesting.newDoc("ISSUE3", file).setAssignee("simon"),
IssueDocTesting.newDoc("ISSUE4", file).setAssignee(null));
IssueDocTesting.newDoc("ISSUE1", file).setAssignee("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAssignee("simon"),
IssueDocTesting.newDoc("ISSUE3", file).setAssignee("simon"),
IssueDocTesting.newDoc("ISSUE4", file).setAssignee(null));

SearchResult<IssueDoc> result = underTest.search(IssueQuery.builder().build(), new SearchOptions().addFacets(newArrayList("assignees")));
assertThat(result.getFacets().getNames()).containsOnly("assignees");
@@ -555,13 +555,13 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setAssignee("j-b"),
IssueDocTesting.newDoc("ISSUE2", file).setAssignee("simon"),
IssueDocTesting.newDoc("ISSUE3", file).setAssignee("simon"),
IssueDocTesting.newDoc("ISSUE4", file).setAssignee(null));
IssueDocTesting.newDoc("ISSUE1", file).setAssignee("j-b"),
IssueDocTesting.newDoc("ISSUE2", file).setAssignee("simon"),
IssueDocTesting.newDoc("ISSUE3", file).setAssignee("simon"),
IssueDocTesting.newDoc("ISSUE4", file).setAssignee(null));

SearchResult<IssueDoc> result = underTest.search(IssueQuery.builder().assignees(Arrays.asList("j-b")).build(),
new SearchOptions().addFacets(newArrayList("assignees")));
new SearchOptions().addFacets(newArrayList("assignees")));
assertThat(result.getFacets().getNames()).containsOnly("assignees");
assertThat(result.getFacets().get("assignees")).containsOnly(entry("j-b", 1L), entry("simon", 2L), entry("", 1L));
}
@@ -572,9 +572,9 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setAssignee("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAssignee(null),
IssueDocTesting.newDoc("ISSUE3", file).setAssignee(null));
IssueDocTesting.newDoc("ISSUE1", file).setAssignee("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAssignee(null),
IssueDocTesting.newDoc("ISSUE3", file).setAssignee(null));

assertThat(underTest.search(IssueQuery.builder().assigned(true).build(), new SearchOptions()).getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().assigned(false).build(), new SearchOptions()).getDocs()).hasSize(2);
@@ -587,9 +587,9 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setAuthorLogin("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAuthorLogin("simon"),
IssueDocTesting.newDoc("ISSUE3", file).setAssignee(null));
IssueDocTesting.newDoc("ISSUE1", file).setAuthorLogin("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAuthorLogin("simon"),
IssueDocTesting.newDoc("ISSUE3", file).setAssignee(null));

assertThat(underTest.search(IssueQuery.builder().authors(newArrayList("steph")).build(), new SearchOptions()).getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().authors(newArrayList("steph", "simon")).build(), new SearchOptions()).getDocs()).hasSize(2);
@@ -602,10 +602,10 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setAuthorLogin("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAuthorLogin("simon"),
IssueDocTesting.newDoc("ISSUE3", file).setAuthorLogin("simon"),
IssueDocTesting.newDoc("ISSUE4", file).setAuthorLogin(null));
IssueDocTesting.newDoc("ISSUE1", file).setAuthorLogin("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAuthorLogin("simon"),
IssueDocTesting.newDoc("ISSUE3", file).setAuthorLogin("simon"),
IssueDocTesting.newDoc("ISSUE4", file).setAuthorLogin(null));

SearchResult<IssueDoc> result = underTest.search(IssueQuery.builder().build(), new SearchOptions().addFacets(newArrayList("authors")));
assertThat(result.getFacets().getNames()).containsOnly("authors");
@@ -618,8 +618,8 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setFuncCreationDate(parseDate("2014-09-20")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCreationDate(parseDate("2014-09-23")));
IssueDocTesting.newDoc("ISSUE1", file).setFuncCreationDate(parseDate("2014-09-20")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCreationDate(parseDate("2014-09-23")));

assertThat(underTest.search(IssueQuery.builder().createdAfter(parseDate("2014-09-19")).build(), new SearchOptions()).getDocs()).hasSize(2);
// Lower bound is included
@@ -634,8 +634,8 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setFuncCreationDate(parseDate("2014-09-20")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCreationDate(parseDate("2014-09-23")));
IssueDocTesting.newDoc("ISSUE1", file).setFuncCreationDate(parseDate("2014-09-20")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCreationDate(parseDate("2014-09-23")));

assertThat(underTest.search(IssueQuery.builder().createdBefore(parseDate("2014-09-19")).build(), new SearchOptions()).getDocs()).isEmpty();
// Upper bound is excluded
@@ -650,44 +650,44 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setFuncCreationDate(parseDate("2014-09-20")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCreationDate(parseDate("2014-09-23")));
IssueDocTesting.newDoc("ISSUE1", file).setFuncCreationDate(parseDate("2014-09-20")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCreationDate(parseDate("2014-09-23")));

// 19 < createdAt < 25
assertThat(underTest.search(IssueQuery.builder()
.createdAfter(parseDate("2014-09-19")).createdBefore(parseDate("2014-09-25"))
.build(), new SearchOptions()).getDocs()).hasSize(2);
.createdAfter(parseDate("2014-09-19")).createdBefore(parseDate("2014-09-25"))
.build(), new SearchOptions()).getDocs()).hasSize(2);

// 20 < createdAt < 25: excludes first issue
assertThat(underTest.search(IssueQuery.builder()
.createdAfter(parseDate("2014-09-20")).createdBefore(parseDate("2014-09-25"))
.build(), new SearchOptions()).getDocs()).hasSize(2);
.createdAfter(parseDate("2014-09-20")).createdBefore(parseDate("2014-09-25"))
.build(), new SearchOptions()).getDocs()).hasSize(2);

// 21 < createdAt < 25
assertThat(underTest.search(IssueQuery.builder()
.createdAfter(parseDate("2014-09-21")).createdBefore(parseDate("2014-09-25"))
.build(), new SearchOptions()).getDocs()).hasSize(1);
.createdAfter(parseDate("2014-09-21")).createdBefore(parseDate("2014-09-25"))
.build(), new SearchOptions()).getDocs()).hasSize(1);

// 21 < createdAt < 24
assertThat(underTest.search(IssueQuery.builder()
.createdAfter(parseDate("2014-09-21")).createdBefore(parseDate("2014-09-24"))
.build(), new SearchOptions()).getDocs()).hasSize(1);
.createdAfter(parseDate("2014-09-21")).createdBefore(parseDate("2014-09-24"))
.build(), new SearchOptions()).getDocs()).hasSize(1);

// 21 < createdAt < 23: excludes second issue
assertThat(underTest.search(IssueQuery.builder()
.createdAfter(parseDate("2014-09-21")).createdBefore(parseDate("2014-09-23"))
.build(), new SearchOptions()).getDocs()).isEmpty();
.createdAfter(parseDate("2014-09-21")).createdBefore(parseDate("2014-09-23"))
.build(), new SearchOptions()).getDocs()).isEmpty();

// 19 < createdAt < 21: only first issue
assertThat(underTest.search(IssueQuery.builder()
.createdAfter(parseDate("2014-09-19")).createdBefore(parseDate("2014-09-21"))
.build(), new SearchOptions()).getDocs()).hasSize(1);
.createdAfter(parseDate("2014-09-19")).createdBefore(parseDate("2014-09-21"))
.build(), new SearchOptions()).getDocs()).hasSize(1);

// 20 < createdAt < 20: exception
expectedException.expect(IllegalArgumentException.class);
underTest.search(IssueQuery.builder()
.createdAfter(parseDate("2014-09-20")).createdBefore(parseDate("2014-09-20"))
.build(), new SearchOptions()).getDocs();
.createdAfter(parseDate("2014-09-20")).createdBefore(parseDate("2014-09-20"))
.build(), new SearchOptions()).getDocs();
}

@Test
@@ -696,23 +696,23 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setFuncCreationDate(parseDateTime("2014-09-20T00:00:00+0100")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")));
IssueDocTesting.newDoc("ISSUE1", file).setFuncCreationDate(parseDateTime("2014-09-20T00:00:00+0100")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")));

assertThat(underTest.search(IssueQuery.builder()
.createdAfter(parseDateTime("2014-09-19T23:00:00+0000")).createdBefore(parseDateTime("2014-09-22T23:00:01+0000"))
.build(), new SearchOptions()).getDocs()).hasSize(2);
.createdAfter(parseDateTime("2014-09-19T23:00:00+0000")).createdBefore(parseDateTime("2014-09-22T23:00:01+0000"))
.build(), new SearchOptions()).getDocs()).hasSize(2);

assertThat(underTest.search(IssueQuery.builder()
.createdAfter(parseDateTime("2014-09-19T23:00:01+0000")).createdBefore(parseDateTime("2014-09-22T23:00:00+0000"))
.build(), new SearchOptions()).getDocs()).hasSize(0);
.createdAfter(parseDateTime("2014-09-19T23:00:01+0000")).createdBefore(parseDateTime("2014-09-22T23:00:00+0000"))
.build(), new SearchOptions()).getDocs()).hasSize(0);
}

@Test
public void filter_by_created_before_must_be_lower_than_after() {
try {
underTest.search(IssueQuery.builder().createdAfter(parseDate("2014-09-20")).createdBefore(parseDate("2014-09-19")).build(),
new SearchOptions());
new SearchOptions());
Fail.failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
} catch (IllegalArgumentException exception) {
assertThat(exception.getMessage()).isEqualTo("Start bound cannot be larger or equal to end bound");
@@ -754,21 +754,21 @@ public class IssueIndexTest {
SearchOptions options = fixtureForCreatedAtFacet();

IssueQuery query = IssueQuery.builder()
.createdAfter(parseDateTime("2014-09-01T00:00:00+0100"))
.createdBefore(parseDateTime("2014-09-08T00:00:00+0100"))
.checkAuthorization(false)
.build();
.createdAfter(parseDateTime("2014-09-01T00:00:00+0100"))
.createdBefore(parseDateTime("2014-09-08T00:00:00+0100"))
.checkAuthorization(false)
.build();
SearchResult<IssueDoc> result = underTest.search(query, options);
Map<String, Long> buckets = result.getFacets().get("createdAt");
assertThat(buckets).containsOnly(
entry("2014-08-31T01:00:00+0000", 0L),
entry("2014-09-01T01:00:00+0000", 2L),
entry("2014-09-02T01:00:00+0000", 1L),
entry("2014-09-03T01:00:00+0000", 0L),
entry("2014-09-04T01:00:00+0000", 0L),
entry("2014-09-05T01:00:00+0000", 1L),
entry("2014-09-06T01:00:00+0000", 0L),
entry("2014-09-07T01:00:00+0000", 0L));
entry("2014-08-31T01:00:00+0000", 0L),
entry("2014-09-01T01:00:00+0000", 2L),
entry("2014-09-02T01:00:00+0000", 1L),
entry("2014-09-03T01:00:00+0000", 0L),
entry("2014-09-04T01:00:00+0000", 0L),
entry("2014-09-05T01:00:00+0000", 1L),
entry("2014-09-06T01:00:00+0000", 0L),
entry("2014-09-07T01:00:00+0000", 0L));
}

@Test
@@ -777,14 +777,14 @@ public class IssueIndexTest {
SearchOptions SearchOptions = fixtureForCreatedAtFacet();

Map<String, Long> createdAt = underTest.search(IssueQuery.builder()
.createdAfter(parseDateTime("2014-09-01T00:00:00+0100"))
.createdBefore(parseDateTime("2014-09-21T00:00:00+0100")).build(),
SearchOptions).getFacets().get("createdAt");
.createdAfter(parseDateTime("2014-09-01T00:00:00+0100"))
.createdBefore(parseDateTime("2014-09-21T00:00:00+0100")).build(),
SearchOptions).getFacets().get("createdAt");
assertThat(createdAt).containsOnly(
entry("2014-08-25T01:00:00+0000", 0L),
entry("2014-09-01T01:00:00+0000", 4L),
entry("2014-09-08T01:00:00+0000", 0L),
entry("2014-09-15T01:00:00+0000", 1L));
entry("2014-08-25T01:00:00+0000", 0L),
entry("2014-09-01T01:00:00+0000", 4L),
entry("2014-09-08T01:00:00+0000", 0L),
entry("2014-09-15T01:00:00+0000", 1L));
}

@Test
@@ -793,16 +793,16 @@ public class IssueIndexTest {
SearchOptions SearchOptions = fixtureForCreatedAtFacet();

Map<String, Long> createdAt = underTest.search(IssueQuery.builder()
.createdAfter(parseDateTime("2014-09-01T00:00:00+0100"))
.createdBefore(parseDateTime("2015-01-19T00:00:00+0100")).build(),
SearchOptions).getFacets().get("createdAt");
.createdAfter(parseDateTime("2014-09-01T00:00:00+0100"))
.createdBefore(parseDateTime("2015-01-19T00:00:00+0100")).build(),
SearchOptions).getFacets().get("createdAt");
assertThat(createdAt).containsOnly(
entry("2014-08-01T01:00:00+0000", 0L),
entry("2014-09-01T01:00:00+0000", 5L),
entry("2014-10-01T01:00:00+0000", 0L),
entry("2014-11-01T01:00:00+0000", 0L),
entry("2014-12-01T01:00:00+0000", 0L),
entry("2015-01-01T01:00:00+0000", 1L));
entry("2014-08-01T01:00:00+0000", 0L),
entry("2014-09-01T01:00:00+0000", 5L),
entry("2014-10-01T01:00:00+0000", 0L),
entry("2014-11-01T01:00:00+0000", 0L),
entry("2014-12-01T01:00:00+0000", 0L),
entry("2015-01-01T01:00:00+0000", 1L));
}

@Test
@@ -810,16 +810,16 @@ public class IssueIndexTest {
SearchOptions SearchOptions = fixtureForCreatedAtFacet();

Map<String, Long> createdAt = underTest.search(IssueQuery.builder()
.createdAfter(parseDateTime("2011-01-01T00:00:00+0100"))
.createdBefore(parseDateTime("2016-01-01T00:00:00+0100")).build(),
SearchOptions).getFacets().get("createdAt");
.createdAfter(parseDateTime("2011-01-01T00:00:00+0100"))
.createdBefore(parseDateTime("2016-01-01T00:00:00+0100")).build(),
SearchOptions).getFacets().get("createdAt");
assertThat(createdAt).containsOnly(
entry("2010-01-01T01:00:00+0000", 0L),
entry("2011-01-01T01:00:00+0000", 1L),
entry("2012-01-01T01:00:00+0000", 0L),
entry("2013-01-01T01:00:00+0000", 0L),
entry("2014-01-01T01:00:00+0000", 5L),
entry("2015-01-01T01:00:00+0000", 1L));
entry("2010-01-01T01:00:00+0000", 0L),
entry("2011-01-01T01:00:00+0000", 1L),
entry("2012-01-01T01:00:00+0000", 0L),
entry("2013-01-01T01:00:00+0000", 0L),
entry("2014-01-01T01:00:00+0000", 5L),
entry("2015-01-01T01:00:00+0000", 1L));

}

@@ -828,11 +828,11 @@ public class IssueIndexTest {
SearchOptions SearchOptions = fixtureForCreatedAtFacet();

Map<String, Long> createdAt = underTest.search(IssueQuery.builder()
.createdAfter(parseDateTime("2014-09-01T00:00:00-0100"))
.createdBefore(parseDateTime("2014-09-02T00:00:00-0100")).build(),
SearchOptions).getFacets().get("createdAt");
.createdAfter(parseDateTime("2014-09-01T00:00:00-0100"))
.createdBefore(parseDateTime("2014-09-02T00:00:00-0100")).build(),
SearchOptions).getFacets().get("createdAt");
assertThat(createdAt).containsOnly(
entry("2014-09-01T01:00:00+0000", 2L));
entry("2014-09-01T01:00:00+0000", 2L));
}

@Test
@@ -840,18 +840,18 @@ public class IssueIndexTest {
SearchOptions options = fixtureForCreatedAtFacet();

Map<String, Long> createdAt = underTest.search(IssueQuery.builder()
.createdAfter(parseDateTime("2009-01-01T00:00:00+0100"))
.createdBefore(parseDateTime("2016-01-01T00:00:00+0100"))
.build(), options).getFacets().get("createdAt");
.createdAfter(parseDateTime("2009-01-01T00:00:00+0100"))
.createdBefore(parseDateTime("2016-01-01T00:00:00+0100"))
.build(), options).getFacets().get("createdAt");
assertThat(createdAt).containsOnly(
entry("2008-01-01T01:00:00+0000", 0L),
entry("2009-01-01T01:00:00+0000", 0L),
entry("2010-01-01T01:00:00+0000", 0L),
entry("2011-01-01T01:00:00+0000", 1L),
entry("2012-01-01T01:00:00+0000", 0L),
entry("2013-01-01T01:00:00+0000", 0L),
entry("2014-01-01T01:00:00+0000", 5L),
entry("2015-01-01T01:00:00+0000", 1L));
entry("2008-01-01T01:00:00+0000", 0L),
entry("2009-01-01T01:00:00+0000", 0L),
entry("2010-01-01T01:00:00+0000", 0L),
entry("2011-01-01T01:00:00+0000", 1L),
entry("2012-01-01T01:00:00+0000", 0L),
entry("2013-01-01T01:00:00+0000", 0L),
entry("2014-01-01T01:00:00+0000", 5L),
entry("2015-01-01T01:00:00+0000", 1L));
}

@Test
@@ -859,14 +859,14 @@ public class IssueIndexTest {
SearchOptions SearchOptions = fixtureForCreatedAtFacet();

Map<String, Long> createdAt = underTest.search(IssueQuery.builder()
.createdBefore(parseDateTime("2016-01-01T00:00:00+0100")).build(),
SearchOptions).getFacets().get("createdAt");
.createdBefore(parseDateTime("2016-01-01T00:00:00+0100")).build(),
SearchOptions).getFacets().get("createdAt");
assertThat(createdAt).containsOnly(
entry("2011-01-01T01:00:00+0000", 1L),
entry("2012-01-01T01:00:00+0000", 0L),
entry("2013-01-01T01:00:00+0000", 0L),
entry("2014-01-01T01:00:00+0000", 5L),
entry("2015-01-01T01:00:00+0000", 1L));
entry("2011-01-01T01:00:00+0000", 1L),
entry("2012-01-01T01:00:00+0000", 0L),
entry("2013-01-01T01:00:00+0000", 0L),
entry("2014-01-01T01:00:00+0000", 5L),
entry("2015-01-01T01:00:00+0000", 1L));
}

@Test
@@ -874,7 +874,7 @@ public class IssueIndexTest {
SearchOptions SearchOptions = new SearchOptions().addFacets("createdAt");

Map<String, Long> createdAt = underTest.search(IssueQuery.builder().build(),
SearchOptions).getFacets().get("createdAt");
SearchOptions).getFacets().get("createdAt");
assertThat(createdAt).isNull();
}

@@ -940,9 +940,9 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setStatus(Issue.STATUS_OPEN),
IssueDocTesting.newDoc("ISSUE2", file).setStatus(Issue.STATUS_CLOSED),
IssueDocTesting.newDoc("ISSUE3", file).setStatus(Issue.STATUS_REOPENED));
IssueDocTesting.newDoc("ISSUE1", file).setStatus(Issue.STATUS_OPEN),
IssueDocTesting.newDoc("ISSUE2", file).setStatus(Issue.STATUS_CLOSED),
IssueDocTesting.newDoc("ISSUE3", file).setStatus(Issue.STATUS_REOPENED));

IssueQuery.Builder query = IssueQuery.builder().sort(IssueQuery.SORT_BY_STATUS).asc(true);
SearchResult<IssueDoc> result = underTest.search(query.build(), new SearchOptions());
@@ -963,11 +963,11 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setSeverity(Severity.BLOCKER),
IssueDocTesting.newDoc("ISSUE2", file).setSeverity(Severity.INFO),
IssueDocTesting.newDoc("ISSUE3", file).setSeverity(Severity.MINOR),
IssueDocTesting.newDoc("ISSUE4", file).setSeverity(Severity.CRITICAL),
IssueDocTesting.newDoc("ISSUE5", file).setSeverity(Severity.MAJOR));
IssueDocTesting.newDoc("ISSUE1", file).setSeverity(Severity.BLOCKER),
IssueDocTesting.newDoc("ISSUE2", file).setSeverity(Severity.INFO),
IssueDocTesting.newDoc("ISSUE3", file).setSeverity(Severity.MINOR),
IssueDocTesting.newDoc("ISSUE4", file).setSeverity(Severity.CRITICAL),
IssueDocTesting.newDoc("ISSUE5", file).setSeverity(Severity.MAJOR));

IssueQuery.Builder query = IssueQuery.builder().sort(IssueQuery.SORT_BY_SEVERITY).asc(true);
SearchResult<IssueDoc> result = underTest.search(query.build(), new SearchOptions());
@@ -992,8 +992,8 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setAssignee("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAssignee("simon"));
IssueDocTesting.newDoc("ISSUE1", file).setAssignee("steph"),
IssueDocTesting.newDoc("ISSUE2", file).setAssignee("simon"));

IssueQuery.Builder query = IssueQuery.builder().sort(IssueQuery.SORT_BY_ASSIGNEE).asc(true);
SearchResult<IssueDoc> result = underTest.search(query.build(), new SearchOptions());
@@ -1014,8 +1014,8 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCreationDate(parseDateTime("2014-09-24T00:00:00+0100")));
IssueDocTesting.newDoc("ISSUE1", file).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCreationDate(parseDateTime("2014-09-24T00:00:00+0100")));

IssueQuery.Builder query = IssueQuery.builder().sort(IssueQuery.SORT_BY_CREATION_DATE).asc(true);
SearchResult<IssueDoc> result = underTest.search(query.build(), new SearchOptions());
@@ -1036,8 +1036,8 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setFuncUpdateDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncUpdateDate(parseDateTime("2014-09-24T00:00:00+0100")));
IssueDocTesting.newDoc("ISSUE1", file).setFuncUpdateDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncUpdateDate(parseDateTime("2014-09-24T00:00:00+0100")));

IssueQuery.Builder query = IssueQuery.builder().sort(IssueQuery.SORT_BY_UPDATE_DATE).asc(true);
SearchResult<IssueDoc> result = underTest.search(query.build(), new SearchOptions());
@@ -1058,9 +1058,9 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE1", file).setFuncCloseDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCloseDate(parseDateTime("2014-09-24T00:00:00+0100")),
IssueDocTesting.newDoc("ISSUE3", file).setFuncCloseDate(null));
IssueDocTesting.newDoc("ISSUE1", file).setFuncCloseDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("ISSUE2", file).setFuncCloseDate(parseDateTime("2014-09-24T00:00:00+0100")),
IssueDocTesting.newDoc("ISSUE3", file).setFuncCloseDate(null));

IssueQuery.Builder query = IssueQuery.builder().sort(IssueQuery.SORT_BY_CLOSE_DATE).asc(true);
SearchResult<IssueDoc> result = underTest.search(query.build(), new SearchOptions());
@@ -1084,16 +1084,16 @@ public class IssueIndexTest {
ComponentDto file2 = newFileDto(project, null, "F2").setPath("src/main/xoo/org/sonar/samples/File2.xoo");

indexIssues(
// file F1
IssueDocTesting.newDoc("F1_2", file1).setLine(20),
IssueDocTesting.newDoc("F1_1", file1).setLine(null),
IssueDocTesting.newDoc("F1_3", file1).setLine(25),
// file F1
IssueDocTesting.newDoc("F1_2", file1).setLine(20),
IssueDocTesting.newDoc("F1_1", file1).setLine(null),
IssueDocTesting.newDoc("F1_3", file1).setLine(25),

// file F2
IssueDocTesting.newDoc("F2_1", file2).setLine(9),
IssueDocTesting.newDoc("F2_2", file2).setLine(109),
// two issues on the same line -> sort by key
IssueDocTesting.newDoc("F2_3", file2).setLine(109));
// file F2
IssueDocTesting.newDoc("F2_1", file2).setLine(9),
IssueDocTesting.newDoc("F2_2", file2).setLine(109),
// two issues on the same line -> sort by key
IssueDocTesting.newDoc("F2_3", file2).setLine(109));

// ascending sort -> F1 then F2. Line "0" first.
IssueQuery.Builder query = IssueQuery.builder().sort(IssueQuery.SORT_BY_FILE_LINE).asc(true);
@@ -1129,23 +1129,23 @@ public class IssueIndexTest {
ComponentDto file3 = newFileDto(project2, null, "F3").setPath("src/main/xoo/org/sonar/samples/File3.xoo");

indexIssues(
// file F1 from project P1
IssueDocTesting.newDoc("F1_1", file1).setLine(20).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("F1_2", file1).setLine(null).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("F1_3", file1).setLine(25).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
// file F1 from project P1
IssueDocTesting.newDoc("F1_1", file1).setLine(20).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("F1_2", file1).setLine(null).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("F1_3", file1).setLine(25).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),

// file F2 from project P1
IssueDocTesting.newDoc("F2_1", file2).setLine(9).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("F2_2", file2).setLine(109).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
// two issues on the same line -> sort by key
IssueDocTesting.newDoc("F2_3", file2).setLine(109).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
// file F2 from project P1
IssueDocTesting.newDoc("F2_1", file2).setLine(9).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
IssueDocTesting.newDoc("F2_2", file2).setLine(109).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),
// two issues on the same line -> sort by key
IssueDocTesting.newDoc("F2_3", file2).setLine(109).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")),

// file F3 from project P2
IssueDocTesting.newDoc("F3_1", file3).setLine(20).setFuncCreationDate(parseDateTime("2014-09-24T00:00:00+0100")),
IssueDocTesting.newDoc("F3_2", file3).setLine(20).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")));
// file F3 from project P2
IssueDocTesting.newDoc("F3_1", file3).setLine(20).setFuncCreationDate(parseDateTime("2014-09-24T00:00:00+0100")),
IssueDocTesting.newDoc("F3_2", file3).setLine(20).setFuncCreationDate(parseDateTime("2014-09-23T00:00:00+0100")));

assertThat(underTest.search(IssueQuery.builder().build(), new SearchOptions()).getDocs()).extracting(IssueDoc::key)
.containsExactly("F3_1", "F1_2", "F1_1", "F1_3", "F2_1", "F2_2", "F2_3", "F3_2");
.containsExactly("F3_1", "F1_2", "F1_1", "F1_3", "F2_1", "F2_2", "F2_3", "F3_2");
}

@Test
@@ -1169,20 +1169,20 @@ public class IssueIndexTest {
// project3 can be seen by nobody
indexIssue(IssueDocTesting.newDoc("ISSUE3", file3));

userSessionRule.login().setGroups(group1);
userSessionRule.logIn().setGroups(group1);
assertThat(underTest.search(IssueQuery.builder().build(), new SearchOptions()).getDocs()).hasSize(1);

userSessionRule.login().setGroups(group2);
userSessionRule.logIn().setGroups(group2);
assertThat(underTest.search(IssueQuery.builder().build(), new SearchOptions()).getDocs()).hasSize(1);

userSessionRule.login().setGroups(group1, group2);
userSessionRule.logIn().setGroups(group1, group2);
assertThat(underTest.search(IssueQuery.builder().build(), new SearchOptions()).getDocs()).hasSize(2);

GroupDto otherGroup = newGroupDto();
userSessionRule.login().setGroups(otherGroup);
userSessionRule.logIn().setGroups(otherGroup);
assertThat(underTest.search(IssueQuery.builder().build(), new SearchOptions()).getDocs()).isEmpty();

userSessionRule.login().setGroups(group1, group2);
userSessionRule.logIn().setGroups(group1, group2);
assertThat(underTest.search(IssueQuery.builder().projectUuids(newArrayList(project3.uuid())).build(), new SearchOptions()).getDocs()).isEmpty();
}

@@ -1205,15 +1205,15 @@ public class IssueIndexTest {
authorizationIndexerTester.allowOnlyUser(project2, user2);
indexIssue(IssueDocTesting.newDoc("ISSUE3", file3));

userSessionRule.login(user1);
userSessionRule.logIn(user1);
assertThat(underTest.search(IssueQuery.builder().build(), new SearchOptions()).getDocs()).hasSize(1);
assertThat(underTest.search(IssueQuery.builder().projectUuids(newArrayList(project3.key())).build(), new SearchOptions()).getDocs()).hasSize(0);

userSessionRule.login(user2);
userSessionRule.logIn(user2);
assertThat(underTest.search(IssueQuery.builder().build(), new SearchOptions()).getDocs()).hasSize(1);

// another user
userSessionRule.login(newUserDto());
userSessionRule.logIn(newUserDto());
assertThat(underTest.search(IssueQuery.builder().build(), new SearchOptions()).getDocs()).hasSize(0);
}

@@ -1223,16 +1223,16 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(project, null).setPath("src/File.xoo");

IssueDoc issue = IssueDocTesting.newDoc("ISSUE", file)
.setRuleKey("squid:S001")
.setChecksum("12345")
.setAssignee("john")
.setLine(11)
.setMessage("the message")
.setSeverity(Severity.BLOCKER)
.setManualSeverity(true)
.setStatus(Issue.STATUS_RESOLVED)
.setResolution(Issue.RESOLUTION_FIXED)
.setFuncCreationDate(new Date());
.setRuleKey("squid:S001")
.setChecksum("12345")
.setAssignee("john")
.setLine(11)
.setMessage("the message")
.setSeverity(Severity.BLOCKER)
.setManualSeverity(true)
.setStatus(Issue.STATUS_RESOLVED)
.setResolution(Issue.RESOLUTION_FIXED)
.setFuncCreationDate(new Date());
indexIssues(issue);

List<IssueDoc> issues = Lists.newArrayList(underTest.selectIssuesForBatch(file));
@@ -1261,11 +1261,11 @@ public class IssueIndexTest {
ComponentDto file = newFileDto(subModule, null);

indexIssues(
IssueDocTesting.newDoc("ISSUE3", module),
IssueDocTesting.newDoc("ISSUE5", subModule),
IssueDocTesting.newDoc("ISSUE2", file),
// Close Issue, should never be returned
IssueDocTesting.newDoc("CLOSE_ISSUE", file).setStatus(Issue.STATUS_CLOSED).setResolution(Issue.RESOLUTION_FIXED));
IssueDocTesting.newDoc("ISSUE3", module),
IssueDocTesting.newDoc("ISSUE5", subModule),
IssueDocTesting.newDoc("ISSUE2", file),
// Close Issue, should never be returned
IssueDocTesting.newDoc("CLOSE_ISSUE", file).setStatus(Issue.STATUS_CLOSED).setResolution(Issue.RESOLUTION_FIXED));

assertThat(Lists.newArrayList(underTest.selectIssuesForBatch(project))).hasSize(3);
assertThat(Lists.newArrayList(underTest.selectIssuesForBatch(module))).hasSize(3);
@@ -1300,10 +1300,10 @@ public class IssueIndexTest {
// project3 can be seen by nobody
indexIssue(IssueDocTesting.newDoc("ISSUE3", file2));

userSessionRule.login().setGroups(allowedGroup);
userSessionRule.logIn().setGroups(allowedGroup);
assertThat(Lists.newArrayList(underTest.selectIssuesForBatch(project1))).hasSize(1);

userSessionRule.login().setGroups(otherGroup);
userSessionRule.logIn().setGroups(otherGroup);
assertThat(Lists.newArrayList(underTest.selectIssuesForBatch(project2))).isEmpty();
}


+ 6
- 6
server/sonar-server/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java 查看文件

@@ -101,7 +101,7 @@ public class AddCommentActionTest {
@Test
public void add_comment() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

call(issueDto.getKey(), "please fix it");

@@ -122,7 +122,7 @@ public class AddCommentActionTest {

@Test
public void fail_when_missing_issue_key() throws Exception {
userSession.login("john");
userSession.logIn("john");

expectedException.expect(IllegalArgumentException.class);
call(null, "please fix it");
@@ -130,7 +130,7 @@ public class AddCommentActionTest {

@Test
public void fail_when_issue_does_not_exist() throws Exception {
userSession.login("john");
userSession.logIn("john");

expectedException.expect(NotFoundException.class);
call("ABCD", "please fix it");
@@ -138,7 +138,7 @@ public class AddCommentActionTest {

@Test
public void fail_when_missing_comment_text() throws Exception {
userSession.login("john");
userSession.logIn("john");

expectedException.expect(IllegalArgumentException.class);
call("ABCD", null);
@@ -147,7 +147,7 @@ public class AddCommentActionTest {
@Test
public void fail_when_empty_comment_text() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

expectedException.expect(IllegalArgumentException.class);
call(issueDto.getKey(), "");
@@ -162,7 +162,7 @@ public class AddCommentActionTest {
@Test
public void fail_when_not_enough_permission() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
userSession.login("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());

expectedException.expect(ForbiddenException.class);
call(issueDto.getKey(), "please fix it");

+ 4
- 4
server/sonar-server/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java 查看文件

@@ -49,7 +49,7 @@ public class AssignActionTest {

@Test
public void assign_to_me() throws Exception {
userSession.login("perceval");
userSession.logIn("perceval");

tester.newRequest()
.setParam("issue", "ABC")
@@ -62,7 +62,7 @@ public class AssignActionTest {

@Test
public void assign_to_me_with_deprecated_param() throws Exception {
userSession.login("perceval");
userSession.logIn("perceval");

tester.newRequest()
.setParam("issue", "ABC")
@@ -75,7 +75,7 @@ public class AssignActionTest {

@Test
public void assign_to_someone() throws Exception {
userSession.login("perceval");
userSession.logIn("perceval");

tester.newRequest()
.setParam("issue", "ABC")
@@ -98,7 +98,7 @@ public class AssignActionTest {

@Test
public void unassign() throws Exception {
userSession.login("perceval");
userSession.logIn("perceval");

tester.newRequest()
.setParam("issue", "ABC")

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java 查看文件

@@ -432,7 +432,7 @@ public class BulkChangeActionTest {

@Test
public void fail_when_number_of_issues_is_more_than_500() throws Exception {
userSession.login("john");
userSession.logIn("john");
expectedException.expectMessage("Number of issues is limited to 500");
expectedException.expect(IllegalArgumentException.class);

@@ -482,7 +482,7 @@ public class BulkChangeActionTest {
}

private void setUserProjectPermissions(String... permissions) {
userSession.login(user);
userSession.logIn(user);
addUserProjectPermissions(project, permissions);
}


+ 14
- 14
server/sonar-server/src/test/java/org/sonar/server/issue/ws/ChangelogActionTest.java 查看文件

@@ -73,7 +73,7 @@ public class ChangelogActionTest {
public void return_changelog() throws Exception {
UserDto user = db.users().insertUser();
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(user.getLogin()).setDiff("severity", "MAJOR", "BLOCKER"));

ChangelogWsResponse result = call(issueDto.getKey());
@@ -93,7 +93,7 @@ public class ChangelogActionTest {
ComponentDto file1 = db.components().insertComponent(newFileDto(project));
ComponentDto file2 = db.components().insertComponent(newFileDto(project));
IssueDto issueDto = db.issues().insertIssue(newDto(rule, file2, project));
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setDiff("file", file1.uuid(), file2.uuid()));

ChangelogWsResponse result = call(issueDto.getKey());
@@ -108,7 +108,7 @@ public class ChangelogActionTest {
@Test
public void changelog_of_file_move_is_empty_when_files_does_not_exists() throws Exception {
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setDiff("file", "UNKNOWN_1", "UNKNOWN_2"));

ChangelogWsResponse result = call(issueDto.getKey());
@@ -122,7 +122,7 @@ public class ChangelogActionTest {
public void return_changelog_on_user_without_email() throws Exception {
UserDto user = db.users().insertUser(UserTesting.newUserDto("john", "John", null));
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(user.getLogin()).setDiff("severity", "MAJOR", "BLOCKER"));

ChangelogWsResponse result = call(issueDto.getKey());
@@ -136,7 +136,7 @@ public class ChangelogActionTest {
@Test
public void return_changelog_not_having_user() throws Exception {
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(null).setDiff("severity", "MAJOR", "BLOCKER"));

ChangelogWsResponse result = call(issueDto.getKey());
@@ -151,7 +151,7 @@ public class ChangelogActionTest {
@Test
public void return_changelog_on_none_existing_user() throws Exception {
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin("UNKNOWN").setDiff("severity", "MAJOR", "BLOCKER"));

ChangelogWsResponse result = call(issueDto.getKey());
@@ -167,7 +167,7 @@ public class ChangelogActionTest {
public void return_multiple_diffs() throws Exception {
UserDto user = db.users().insertUser();
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(user.getLogin()).setDiff("severity", "MAJOR", "BLOCKER").setDiff("status", "RESOLVED", "CLOSED"));

ChangelogWsResponse result = call(issueDto.getKey());
@@ -181,7 +181,7 @@ public class ChangelogActionTest {
public void return_changelog_when_no_old_value() throws Exception {
UserDto user = db.users().insertUser();
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(user.getLogin()).setDiff("severity", null, "BLOCKER"));

ChangelogWsResponse result = call(issueDto.getKey());
@@ -194,7 +194,7 @@ public class ChangelogActionTest {
public void return_changelog_when_no_new_value() throws Exception {
UserDto user = db.users().insertUser();
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(user.getLogin()).setDiff("severity", "MAJOR", null));

ChangelogWsResponse result = call(issueDto.getKey());
@@ -207,7 +207,7 @@ public class ChangelogActionTest {
public void return_many_changelog() throws Exception {
UserDto user = db.users().insertUser();
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto,
new FieldDiffs().setUserLogin(user.getLogin()).setDiff("severity", "MAJOR", "BLOCKER"),
new FieldDiffs().setDiff("status", "RESOLVED", "CLOSED"));
@@ -221,7 +221,7 @@ public class ChangelogActionTest {
public void replace_technical_debt_key_by_effort() throws Exception {
UserDto user = db.users().insertUser();
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(user.getLogin()).setDiff("technicalDebt", "10", "20"));

ChangelogWsResponse result = call(issueDto.getKey());
@@ -233,7 +233,7 @@ public class ChangelogActionTest {
@Test
public void return_empty_changelog_when_no_changes_on_issue() {
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

ChangelogWsResponse result = call(issueDto.getKey());

@@ -243,7 +243,7 @@ public class ChangelogActionTest {
@Test
public void fail_when_not_enough_permission() {
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());

expectedException.expect(ForbiddenException.class);
call(issueDto.getKey());
@@ -253,7 +253,7 @@ public class ChangelogActionTest {
public void test_example() throws Exception {
UserDto user = db.users().insertUser(newUserDto("john.smith", "John Smith", "john@smith.com"));
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs()
.setUserLogin(user.getLogin())
.setDiff("severity", "MAJOR", "BLOCKER")

+ 7
- 7
server/sonar-server/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java 查看文件

@@ -74,7 +74,7 @@ public class DeleteCommentActionTest {
public void delete_comment() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

call(commentDto.getKey());

@@ -86,7 +86,7 @@ public class DeleteCommentActionTest {
public void delete_comment_using_deprecated_key_parameter() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

tester.newRequest().setParam("key", commentDto.getKey()).setParam("text", "please have a look").execute();

@@ -98,7 +98,7 @@ public class DeleteCommentActionTest {
public void fail_when_comment_does_not_belong_to_current_user() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.login("another").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("another").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("You can only delete your own comments");
@@ -109,7 +109,7 @@ public class DeleteCommentActionTest {
public void fail_when_comment_has_not_user() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, null, "please fix it");
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("You can only delete your own comments");
@@ -118,7 +118,7 @@ public class DeleteCommentActionTest {

@Test
public void fail_when_missing_comment_key() throws Exception {
userSession.login("john");
userSession.logIn("john");

expectedException.expect(IllegalArgumentException.class);
call(null);
@@ -126,7 +126,7 @@ public class DeleteCommentActionTest {

@Test
public void fail_when_comment_does_not_exist() throws Exception {
userSession.login("john");
userSession.logIn("john");

expectedException.expect(NotFoundException.class);
call("ABCD");
@@ -142,7 +142,7 @@ public class DeleteCommentActionTest {
public void fail_when_not_enough_permission() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.login("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());

expectedException.expect(ForbiddenException.class);
call(commentDto.getKey());

+ 6
- 6
server/sonar-server/src/test/java/org/sonar/server/issue/ws/DoTransitionActionTest.java 查看文件

@@ -110,7 +110,7 @@ public class DoTransitionActionTest {
@Test
public void do_transition() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue(newIssue().setStatus(STATUS_OPEN).setResolution(null));
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

call(issueDto.getKey(), "confirm");

@@ -121,7 +121,7 @@ public class DoTransitionActionTest {

@Test
public void fail_if_issue_does_not_exist() throws Exception {
userSession.login("john");
userSession.logIn("john");

expectedException.expect(NotFoundException.class);
call("UNKNOWN", "confirm");
@@ -129,7 +129,7 @@ public class DoTransitionActionTest {

@Test
public void fail_if_no_issue_param() throws Exception {
userSession.login("john");
userSession.logIn("john");

expectedException.expect(IllegalArgumentException.class);
call(null, "confirm");
@@ -138,7 +138,7 @@ public class DoTransitionActionTest {
@Test
public void fail_if_no_transition_param() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue(newIssue().setStatus(STATUS_OPEN).setResolution(null));
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

expectedException.expect(IllegalArgumentException.class);
call(issueDto.getKey(), null);
@@ -147,7 +147,7 @@ public class DoTransitionActionTest {
@Test
public void fail_if_not_enough_permission_to_access_issue() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue(newIssue().setStatus(STATUS_OPEN).setResolution(null));
userSession.login("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());

expectedException.expect(ForbiddenException.class);
call(issueDto.getKey(), "confirm");
@@ -156,7 +156,7 @@ public class DoTransitionActionTest {
@Test
public void fail_if_not_enough_permission_to_apply_transition() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue(newIssue().setStatus(STATUS_OPEN).setResolution(null));
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

// False-positive transition is requiring issue admin permission
expectedException.expect(ForbiddenException.class);

+ 9
- 9
server/sonar-server/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java 查看文件

@@ -86,7 +86,7 @@ public class EditCommentActionTest {
public void edit_comment() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

call(commentDto.getKey(), "please have a look");

@@ -100,7 +100,7 @@ public class EditCommentActionTest {
public void edit_comment_using_deprecated_key_parameter() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

tester.newRequest().setParam("key", commentDto.getKey()).setParam("text", "please have a look").execute();

@@ -114,7 +114,7 @@ public class EditCommentActionTest {
public void fail_when_comment_does_not_belong_to_current_user() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.login("another").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("another").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("You can only edit your own comments");
@@ -125,7 +125,7 @@ public class EditCommentActionTest {
public void fail_when_comment_has_not_user() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, null, "please fix it");
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("You can only edit your own comments");
@@ -134,7 +134,7 @@ public class EditCommentActionTest {

@Test
public void fail_when_missing_comment_key() throws Exception {
userSession.login("john");
userSession.logIn("john");

expectedException.expect(IllegalArgumentException.class);
call(null, "please fix it");
@@ -142,7 +142,7 @@ public class EditCommentActionTest {

@Test
public void fail_when_comment_does_not_exist() throws Exception {
userSession.login("john");
userSession.logIn("john");

expectedException.expect(NotFoundException.class);
call("ABCD", "please fix it");
@@ -150,7 +150,7 @@ public class EditCommentActionTest {

@Test
public void fail_when_missing_comment_text() throws Exception {
userSession.login("john");
userSession.logIn("john");

expectedException.expect(IllegalArgumentException.class);
call("ABCD", null);
@@ -160,7 +160,7 @@ public class EditCommentActionTest {
public void fail_when_empty_comment_text() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

expectedException.expect(IllegalArgumentException.class);
call(commentDto.getKey(), "");
@@ -176,7 +176,7 @@ public class EditCommentActionTest {
public void fail_when_not_enough_permission() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.login("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());

expectedException.expect(ForbiddenException.class);
call(commentDto.getKey(), "please have a look");

+ 6
- 6
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsMediumTest.java 查看文件

@@ -483,7 +483,7 @@ public class SearchActionComponentsMediumTest {
session.commit();
tester.get(IssueIndexer.class).indexAll();

userSessionRule.login("john");
userSessionRule.logIn("john");
WsTester.Result result = wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam("resolved", "false")
.setParam(WebService.Param.FACETS, "directories")
@@ -502,7 +502,7 @@ public class SearchActionComponentsMediumTest {
indexView(view.uuid(), newArrayList(project.uuid()));

setAnyoneProjectPermission(view, UserRole.USER);
userSessionRule.login("john").addProjectUuidPermissions(UserRole.USER, view.uuid());
userSessionRule.logIn("john").addProjectUuidPermissions(UserRole.USER, view.uuid());

wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam(IssuesWsParameters.PARAM_COMPONENT_UUIDS, view.uuid())
@@ -522,7 +522,7 @@ public class SearchActionComponentsMediumTest {

setAnyoneProjectPermission(view, UserRole.USER);
// User has wrong permission on the view, no issue will be returned
userSessionRule.login("john").addProjectUuidPermissions(UserRole.CODEVIEWER, view.uuid());
userSessionRule.logIn("john").addProjectUuidPermissions(UserRole.CODEVIEWER, view.uuid());

wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam(IssuesWsParameters.PARAM_COMPONENT_UUIDS, view.uuid())
@@ -543,7 +543,7 @@ public class SearchActionComponentsMediumTest {
indexView(subView.uuid(), newArrayList(project.uuid()));

setAnyoneProjectPermission(view, UserRole.USER);
userSessionRule.login("john").addComponentUuidPermission(UserRole.USER, view.uuid(), subView.uuid());
userSessionRule.logIn("john").addComponentUuidPermission(UserRole.USER, view.uuid(), subView.uuid());

wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam(IssuesWsParameters.PARAM_COMPONENT_UUIDS, subView.uuid())
@@ -565,7 +565,7 @@ public class SearchActionComponentsMediumTest {

setAnyoneProjectPermission(view, UserRole.USER);
// User has wrong permission on the view, no issue will be returned
userSessionRule.login("john").addComponentUuidPermission(UserRole.CODEVIEWER, view.uuid(), subView.uuid());
userSessionRule.logIn("john").addComponentUuidPermission(UserRole.CODEVIEWER, view.uuid(), subView.uuid());

wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam(IssuesWsParameters.PARAM_COMPONENT_UUIDS, subView.uuid())
@@ -670,7 +670,7 @@ public class SearchActionComponentsMediumTest {
}

private void setAnyoneProjectPermission(ComponentDto project, String permission) {
userSessionRule.login("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSessionRule.logIn("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
// TODO correctly feed default organization. Not a problem as long as issues search does not support "anyone"
// for each organization
GroupPermissionChange permissionChange = new GroupPermissionChange(PermissionChange.Operation.ADD, permission, new ProjectId(project), GroupIdOrAnyone.forAnyone(project.getOrganizationUuid()));

+ 12
- 12
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java 查看文件

@@ -196,7 +196,7 @@ public class SearchActionMediumTest {
session.commit();
tester.get(IssueIndexer.class).indexAll();

userSessionRule.login("john");
userSessionRule.logIn("john");
WsTester.Result result = wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam("additionalFields", "comments,users")
.execute();
@@ -232,7 +232,7 @@ public class SearchActionMediumTest {
session.commit();
tester.get(IssueIndexer.class).indexAll();

userSessionRule.login("john");
userSessionRule.logIn("john");
WsTester.Result result = wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH).setParam(PARAM_HIDE_COMMENTS, "true").execute();
result.assertJson(this.getClass(), "issue_with_comment_hidden.json");
assertThat(result.outputAsString()).doesNotContain("fabrice");
@@ -367,7 +367,7 @@ public class SearchActionMediumTest {
session.commit();
tester.get(IssueIndexer.class).indexAll();

userSessionRule.login("john");
userSessionRule.logIn("john");
WsTester.Result result = wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam("resolved", "false")
.setParam(WebService.Param.FACETS, "statuses,severities,resolutions,projectUuids,rules,fileUuids,assignees,languages,actionPlans,types")
@@ -391,7 +391,7 @@ public class SearchActionMediumTest {
session.commit();
tester.get(IssueIndexer.class).indexAll();

userSessionRule.login("john");
userSessionRule.logIn("john");
WsTester.Result result = wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam("resolved", "false")
.setParam(WebService.Param.FACETS, "statuses,severities,resolutions,projectUuids,rules,fileUuids,assignees,languages,actionPlans")
@@ -416,7 +416,7 @@ public class SearchActionMediumTest {
session.commit();
tester.get(IssueIndexer.class).indexAll();

userSessionRule.login("john");
userSessionRule.logIn("john");
WsTester.Result result = wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam("resolved", "false")
.setParam("severities", "MAJOR,MINOR")
@@ -429,7 +429,7 @@ public class SearchActionMediumTest {
@Test
public void assignedToMe_facet_must_escape_login_of_authenticated_user() throws Exception {
// login looks like an invalid regexp
userSessionRule.login("foo[");
userSessionRule.logIn("foo[");

// should not fail
wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
@@ -474,7 +474,7 @@ public class SearchActionMediumTest {
session.commit();
tester.get(IssueIndexer.class).indexAll();

userSessionRule.login("john");
userSessionRule.logIn("john");
wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam("resolved", "false")
.setParam("assignees", "__me__")
@@ -485,7 +485,7 @@ public class SearchActionMediumTest {

@Test
public void filter_by_assigned_to_me_unauthenticated() throws Exception {
userSessionRule.login();
userSessionRule.logIn();

ComponentDto project = insertComponent(ComponentTesting.newProjectDto(otherOrganization1, "PROJECT_ID").setKey("PROJECT_KEY"));
setDefaultProjectPermission(project);
@@ -548,7 +548,7 @@ public class SearchActionMediumTest {
session.commit();
tester.get(IssueIndexer.class).indexAll();

userSessionRule.login("john-bob.polop");
userSessionRule.logIn("john-bob.polop");
wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam("resolved", "false")
.setParam("assignees", "alice")
@@ -669,7 +669,7 @@ public class SearchActionMediumTest {
session.commit();
tester.get(IssueIndexer.class).indexAll();

userSessionRule.login("john");
userSessionRule.logIn("john");
WsTester.Result result = wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
.setParam("resolved", "false")
.setParam(WebService.Param.FACETS, "severities")
@@ -700,7 +700,7 @@ public class SearchActionMediumTest {

private void setDefaultProjectPermission(ComponentDto project) {
// project can be seen by anyone and by code viewer
userSessionRule.login("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSessionRule.logIn("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
// TODO correctly feed default organization. Not a problem as long as issues search does not support "anyone"
// for each organization
GroupPermissionChange permissionChange = new GroupPermissionChange(PermissionChange.Operation.ADD, UserRole.USER, new ProjectId(project), GroupIdOrAnyone.forAnyone(project.getOrganizationUuid()));
@@ -709,7 +709,7 @@ public class SearchActionMediumTest {

private void setProjectPermission(ComponentDto project, String... permissions) {
// project can be seen by anyone and by code viewer
userSessionRule.login("admin");
userSessionRule.logIn("admin");
Arrays.stream(permissions).forEach(permission -> userSessionRule.addProjectUuidPermissions(permission, project.uuid()));
tester.get(PermissionUpdater.class).apply(session, Arrays.stream(permissions)
// TODO correctly feed default organization. Not a problem as long as issues search does not support "anyone" for each organization

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetSeverityActionTest.java 查看文件

@@ -139,7 +139,7 @@ public class SetSeverityActionTest {
@Test
public void fail_when_missing_browse_permission() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
userSession.login("john").addProjectUuidPermissions(ISSUE_ADMIN, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(ISSUE_ADMIN, issueDto.getProjectUuid());

expectedException.expect(ForbiddenException.class);
call(issueDto.getKey(), MAJOR);
@@ -148,7 +148,7 @@ public class SetSeverityActionTest {
@Test
public void fail_when_missing_administer_issue_permission() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

expectedException.expect(ForbiddenException.class);
call(issueDto.getKey(), MAJOR);
@@ -179,7 +179,7 @@ public class SetSeverityActionTest {
}

private void setUserWithBrowseAndAdministerIssuePermission(String projectUuid) {
userSession.login("john")
userSession.logIn("john")
.addProjectUuidPermissions(ISSUE_ADMIN, projectUuid)
.addProjectUuidPermissions(USER, projectUuid);
}

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTypeActionTest.java 查看文件

@@ -138,7 +138,7 @@ public class SetTypeActionTest {
@Test
public void fail_when_missing_browse_permission() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
userSession.login("john").addProjectUuidPermissions(ISSUE_ADMIN, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(ISSUE_ADMIN, issueDto.getProjectUuid());

expectedException.expect(ForbiddenException.class);
call(issueDto.getKey(), BUG.name());
@@ -147,7 +147,7 @@ public class SetTypeActionTest {
@Test
public void fail_when_missing_administer_issue_permission() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
userSession.login("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());

expectedException.expect(ForbiddenException.class);
call(issueDto.getKey(), BUG.name());
@@ -178,7 +178,7 @@ public class SetTypeActionTest {
}

private void setUserWithBrowseAndAdministerIssuePermission(String projectUuid) {
userSession.login("john")
userSession.logIn("john")
.addProjectUuidPermissions(ISSUE_ADMIN, projectUuid)
.addProjectUuidPermissions(USER, projectUuid);
}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/license/ws/ListActionTest.java 查看文件

@@ -260,7 +260,7 @@ public class ListActionTest {

@Test
public void fail_when_not_system_admin() throws Exception {
userSession.login("not-admin").setGlobalPermissions(GlobalPermissions.QUALITY_GATE_ADMIN);
userSession.logIn("not-admin").setGlobalPermissions(GlobalPermissions.QUALITY_GATE_ADMIN);
definitions.addComponent(PropertyDefinition.builder("foo").build());

expectedException.expect(ForbiddenException.class);
@@ -289,7 +289,7 @@ public class ListActionTest {
}

private void setUserAsSystemAdmin() {
userSession.login("admin").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("admin").setGlobalPermissions(SYSTEM_ADMIN);
}

private void addLicenseSetting(String key, @Nullable String name, String value) {

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/CreateActionTest.java 查看文件

@@ -91,7 +91,7 @@ public class CreateActionTest {
public void setUp() {
ws = new WsTester(new CustomMeasuresWs(new CreateAction(dbClient, userSession, System2.INSTANCE, new CustomMeasureValidator(newFullTypeValidations()),
new CustomMeasureJsonWriter(new UserJsonWriter(userSession)), new ComponentFinder(dbClient))));
userSession.login("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSession.logIn("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);

db.getDbClient().userDao().insert(dbSession, new UserDto()
.setLogin("login")
@@ -163,7 +163,7 @@ public class CreateActionTest {
public void create_text_custom_measure_as_project_admin() throws Exception {
insertProject(DEFAULT_PROJECT_UUID);
MetricDto metric = insertMetric(STRING);
userSession.login("login").addProjectUuidPermissions(UserRole.ADMIN, DEFAULT_PROJECT_UUID);
userSession.logIn("login").addProjectUuidPermissions(UserRole.ADMIN, DEFAULT_PROJECT_UUID);

newRequest()
.setParam(CreateAction.PARAM_PROJECT_ID, DEFAULT_PROJECT_UUID)
@@ -460,7 +460,7 @@ public class CreateActionTest {
@Test
public void fail_when_not_enough_permission() throws Exception {
expectedException.expect(ForbiddenException.class);
userSession.login("login");
userSession.logIn("login");
insertProject(DEFAULT_PROJECT_UUID);
MetricDto metric = insertMetric(STRING);


+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/DeleteActionTest.java 查看文件

@@ -79,7 +79,7 @@ public class DeleteActionTest {
public void delete_in_db_when_admin_on_project() throws Exception {
ComponentDto project = ComponentTesting.newProjectDto(db.getDefaultOrganization(), "project-uuid");
dbClient.componentDao().insert(dbSession, project);
userSessionRule.login("login").addProjectUuidPermissions(UserRole.ADMIN, "project-uuid");
userSessionRule.logIn("login").addProjectUuidPermissions(UserRole.ADMIN, "project-uuid");
long id = insertCustomMeasure(newCustomMeasureDto().setComponentUuid("project-uuid"));

newRequest().setParam(PARAM_ID, String.valueOf(id)).execute();
@@ -97,7 +97,7 @@ public class DeleteActionTest {
@Test
public void fail_when_insufficient_permissions() throws Exception {
expectedException.expect(ForbiddenException.class);
userSessionRule.login("login");
userSessionRule.logIn("login");
ComponentDto project = ComponentTesting.newProjectDto(db.organizations().insert(), "any-uuid");
dbClient.componentDao().insert(dbSession, project);
long id = insertCustomMeasure(newCustomMeasureDto().setComponentUuid("any-uuid"));

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java 查看文件

@@ -76,7 +76,7 @@ public class MetricsActionTest {
.setEmail("login@login.com")
.setActive(true));
ws = new WsTester(new CustomMeasuresWs(new MetricsAction(dbClient, userSession, new ComponentFinder(dbClient))));
userSession.login("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSession.logIn("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
defaultProject = insertDefaultProject();
}

@@ -146,7 +146,7 @@ public class MetricsActionTest {
@Test
public void list_metrics_as_a_project_admin() throws Exception {
insertCustomMetric("metric-key-1");
userSession.login("login").addProjectUuidPermissions(UserRole.ADMIN, defaultProject.uuid());
userSession.logIn("login").addProjectUuidPermissions(UserRole.ADMIN, defaultProject.uuid());

String response = newRequest().outputAsString();

@@ -198,7 +198,7 @@ public class MetricsActionTest {
@Test
public void fail_if_insufficient_privilege() throws Exception {
expectedException.expect(ForbiddenException.class);
userSession.login("login");
userSession.logIn("login");

insertCustomMetric("metric-key-1");


+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/SearchActionTest.java 查看文件

@@ -82,7 +82,7 @@ public class SearchActionTest {
CustomMeasureJsonWriter customMeasureJsonWriter = new CustomMeasureJsonWriter(new UserJsonWriter(userSessionRule));
ws = new WsTester(new CustomMeasuresWs(new SearchAction(dbClient, customMeasureJsonWriter, userSessionRule, new ComponentFinder(dbClient))));
defaultProject = insertDefaultProject();
userSessionRule.login("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSessionRule.logIn("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);

db.getDbClient().userDao().insert(dbSession, new UserDto()
.setLogin("login")
@@ -201,7 +201,7 @@ public class SearchActionTest {

@Test
public void search_as_project_admin() throws Exception {
userSessionRule.login("login").addProjectUuidPermissions(UserRole.ADMIN, DEFAULT_PROJECT_UUID);
userSessionRule.logIn("login").addProjectUuidPermissions(UserRole.ADMIN, DEFAULT_PROJECT_UUID);
MetricDto metric1 = insertCustomMetric(1);
insertCustomMeasure(1, metric1);

@@ -250,7 +250,7 @@ public class SearchActionTest {
@Test
public void fail_when_not_enough_privileges() throws Exception {
expectedException.expect(ForbiddenException.class);
userSessionRule.login("login");
userSessionRule.logIn("login");
MetricDto metric1 = insertCustomMetric(1);
insertCustomMeasure(1, metric1);


+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/UpdateActionTest.java 查看文件

@@ -76,7 +76,7 @@ public class UpdateActionTest {
CustomMeasureValidator validator = new CustomMeasureValidator(newFullTypeValidations());

ws = new WsTester(new CustomMeasuresWs(new UpdateAction(dbClient, userSessionRule, system, validator, new CustomMeasureJsonWriter(new UserJsonWriter(userSessionRule)))));
userSessionRule.login("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSessionRule.logIn("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);

db.getDbClient().userDao().insert(dbSession, new UserDto()
.setLogin("login")
@@ -239,7 +239,7 @@ public class UpdateActionTest {

@Test
public void fail_if_insufficient_privileges() throws Exception {
userSessionRule.login("login").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
userSessionRule.logIn("login").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
expectedException.expect(ForbiddenException.class);
MetricDto metric = MetricTesting.newMetricDto().setEnabled(true).setValueType(ValueType.STRING.name());
dbClient.metricDao().insert(dbSession, metric);

+ 439
- 439
server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTest.java
文件差異過大導致無法顯示
查看文件


+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java 查看文件

@@ -84,7 +84,7 @@ public class ComponentActionTest {

@Before
public void setUp() {
userSession.login().setRoot().setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn().setRoot().setGlobalPermissions(SYSTEM_ADMIN);
}

@Test
@@ -232,7 +232,7 @@ public class ComponentActionTest {

@Test
public void fail_when_not_enough_permission() {
userSession.login().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
userSession.logIn().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
componentDb.insertProjectAndSnapshot(newProjectDto(db.organizations().insert(), PROJECT_UUID));
insertNclocMetric();


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java 查看文件

@@ -106,7 +106,7 @@ public class ComponentTreeActionTest {

@Before
public void setUp() {
userSession.login().setRoot().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSession.logIn().setRoot().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
resourceTypes.setChildrenQualifiers(Qualifiers.MODULE, Qualifiers.FILE, Qualifiers.DIRECTORY);
resourceTypes.setLeavesQualifiers(Qualifiers.FILE, Qualifiers.UNIT_TEST_FILE);
}

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java 查看文件

@@ -91,7 +91,7 @@ public class SearchActionTest {
@Before
public void setUp() throws Exception {
user = db.users().insertUser("john");
userSession.login(user);
userSession.logIn(user);
}

@Test

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java 查看文件

@@ -267,7 +267,7 @@ public class SearchHistoryActionTest {

@Test
public void fail_if_not_enough_permissions() {
userSession.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());

expectedException.expect(ForbiddenException.class);


+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/metric/ws/CreateActionTest.java 查看文件

@@ -66,7 +66,7 @@ public class CreateActionTest {
@Before
public void setUp() {
ws = new WsTester(new MetricsWs(new CreateAction(dbClient, userSessionRule)));
userSessionRule.login("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSessionRule.logIn("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
}

@Test
@@ -230,7 +230,7 @@ public class CreateActionTest {
@Test
public void fail_when_insufficient_privileges() throws Exception {
expectedException.expect(ForbiddenException.class);
userSessionRule.login("login");
userSessionRule.logIn("login");

newRequest()
.setParam(PARAM_KEY, "any-key")

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/metric/ws/DeleteActionTest.java 查看文件

@@ -57,7 +57,7 @@ public class DeleteActionTest {

@Before
public void setUp() {
userSessionRule.login("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSessionRule.logIn("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
ws = new WsTester(new MetricsWs(new DeleteAction(dbClient, userSessionRule)));
metricDao = dbClient.metricDao();
}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/metric/ws/UpdateActionTest.java 查看文件

@@ -66,7 +66,7 @@ public class UpdateActionTest {
@Before
public void setUp() {
ws = new WsTester(new MetricsWs(new UpdateAction(dbClient, userSessionRule)));
userSessionRule.login("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSessionRule.logIn("login").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
}

@Test
@@ -184,7 +184,7 @@ public class UpdateActionTest {
@Test
public void fail_when_insufficient_privileges() throws Exception {
expectedException.expect(ForbiddenException.class);
userSessionRule.login("login");
userSessionRule.logIn("login");

newRequest().execute();
}

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/notification/ws/AddActionTest.java 查看文件

@@ -59,7 +59,7 @@ public class AddActionTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Rule
public UserSessionRule userSession = UserSessionRule.standalone().login().setUserId(123);
public UserSessionRule userSession = UserSessionRule.standalone().logIn().setUserId(123);
@Rule
public DbTester db = DbTester.create();
private DbClient dbClient = db.getDbClient();

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/notification/ws/ListActionTest.java 查看文件

@@ -59,7 +59,7 @@ public class ListActionTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Rule
public UserSessionRule userSession = UserSessionRule.standalone().login().setUserId(123);
public UserSessionRule userSession = UserSessionRule.standalone().logIn().setUserId(123);
@Rule
public DbTester db = DbTester.create();
private DbClient dbClient = db.getDbClient();

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java 查看文件

@@ -60,7 +60,7 @@ public class RemoveActionTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Rule
public UserSessionRule userSession = UserSessionRule.standalone().login().setUserId(123);
public UserSessionRule userSession = UserSessionRule.standalone().logIn().setUserId(123);
@Rule
public DbTester db = DbTester.create();
private DbClient dbClient = db.getDbClient();

+ 5
- 5
server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java 查看文件

@@ -142,7 +142,7 @@ public class CreateActionTest {

@Test
public void request_fails_if_user_is_not_root_and_logged_in_user_can_not_create_organizations() {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
@@ -180,7 +180,7 @@ public class CreateActionTest {
@Test
public void request_succeeds_if_user_is_not_root_and_logged_in_user_can_create_organizations() {
settings.setProperty(ORGANIZATIONS_ANYONE_CAN_CREATE, true);
userSession.login();
userSession.logIn();
mockForSuccessfulInsert(SOME_UUID, SOME_DATE);

verifyResponseAndDb(executeRequest("foo"), SOME_UUID, "foo", "foo", SOME_DATE);
@@ -439,7 +439,7 @@ public class CreateActionTest {
public void request_creates_owners_group_with_all_permissions_for_new_organization_and_add_current_user_to_it() {
mockForSuccessfulInsert(SOME_UUID, SOME_DATE);
UserDto user = dbTester.users().makeRoot(dbTester.users().insertUser());
userSession.login(user).setRoot();
userSession.logIn(user).setRoot();

executeRequest("orgFoo");

@@ -463,7 +463,7 @@ public class CreateActionTest {
public void request_creates_default_template_for_owner_group_and_anyone() {
mockForSuccessfulInsert(SOME_UUID, SOME_DATE);
UserDto user = dbTester.users().makeRoot(dbTester.users().insertUser());
userSession.login(user).setRoot();
userSession.logIn(user).setRoot();

executeRequest("orgFoo");

@@ -484,7 +484,7 @@ public class CreateActionTest {
}

private void makeUserRoot() {
userSession.login().setRoot();
userSession.logIn().setRoot();
}

private void mockForSuccessfulInsert(String uuid, long now) {

+ 9
- 9
server/sonar-server/src/test/java/org/sonar/server/organization/ws/DeleteActionTest.java 查看文件

@@ -96,7 +96,7 @@ public class DeleteActionTest {

@Test
public void request_fails_with_IAE_if_key_param_is_missing() {
userSession.login();
userSession.logIn();

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("The 'key' parameter is missing");
@@ -107,7 +107,7 @@ public class DeleteActionTest {

@Test
public void request_fails_with_IAE_if_key_is_the_one_of_default_organization() {
userSession.login();
userSession.logIn();

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Default Organization can't be deleted");
@@ -117,7 +117,7 @@ public class DeleteActionTest {

@Test
public void request_fails_with_NotFoundException_if_organization_with_specified_key_does_not_exist() {
userSession.login();
userSession.logIn();

expectedException.expect(NotFoundException.class);
expectedException.expectMessage("Organization with key 'foo' not found");
@@ -128,7 +128,7 @@ public class DeleteActionTest {
@Test
public void request_fails_with_ForbiddenException_when_user_has_no_System_Administer_permission() {
OrganizationDto organization = dbTester.organizations().insert();
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
@@ -139,7 +139,7 @@ public class DeleteActionTest {
@Test
public void request_fails_with_ForbiddenException_when_user_does_not_have_System_Administer_permission_on_specified_organization() {
OrganizationDto organization = dbTester.organizations().insert();
userSession.login().addOrganizationPermission(dbTester.getDefaultOrganization().getUuid(), SYSTEM_ADMIN);
userSession.logIn().addOrganizationPermission(dbTester.getDefaultOrganization().getUuid(), SYSTEM_ADMIN);

expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
@@ -150,7 +150,7 @@ public class DeleteActionTest {
@Test
public void request_deletes_specified_organization_if_exists_and_user_has_Admin_permission_on_it() {
OrganizationDto organization = dbTester.organizations().insert();
userSession.login().addOrganizationPermission(organization.getUuid(), SYSTEM_ADMIN);
userSession.logIn().addOrganizationPermission(organization.getUuid(), SYSTEM_ADMIN);

sendRequest(organization);

@@ -160,7 +160,7 @@ public class DeleteActionTest {
@Test
public void request_deletes_specified_organization_if_exists_and_user_is_root() {
OrganizationDto organization = dbTester.organizations().insert();
userSession.login().setRoot();
userSession.logIn().setRoot();

sendRequest(organization);

@@ -169,7 +169,7 @@ public class DeleteActionTest {

@Test
public void request_also_deletes_components_of_specified_organization() {
userSession.login().setRoot();
userSession.logIn().setRoot();

OrganizationDto organization = dbTester.organizations().insert();
ComponentDto project = dbTester.components().insertProject(organization);
@@ -192,7 +192,7 @@ public class DeleteActionTest {

@Test
public void request_also_deletes_permissions_templates_and_permissions_and_groups_of_specified_organization() {
userSession.login().setRoot();
userSession.logIn().setRoot();

OrganizationDto org = dbTester.organizations().insert();
OrganizationDto otherOrg = dbTester.organizations().insert();

+ 9
- 9
server/sonar-server/src/test/java/org/sonar/server/organization/ws/UpdateActionTest.java 查看文件

@@ -108,7 +108,7 @@ public class UpdateActionTest {
@Test
public void request_fails_if_user_does_not_have_any_SYSTEM_ADMIN_permission() {
OrganizationDto dto = mockForSuccessfulUpdate(DATE_1, DATE_2);
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
@@ -120,7 +120,7 @@ public class UpdateActionTest {
public void request_fails_if_user_has_SYSTEM_ADMIN_permission_on_other_organization() {
OrganizationDto dto = dbTester.organizations().insert();
userSession.addOrganizationPermission(dbTester.getDefaultOrganization().getUuid(), SYSTEM_ADMIN);
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
@@ -130,7 +130,7 @@ public class UpdateActionTest {

@Test
public void request_fails_if_key_is_missing() {
userSession.login();
userSession.logIn();

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("The 'key' parameter is missing");
@@ -148,7 +148,7 @@ public class UpdateActionTest {

@Test
public void request_fails_if_name_is_one_char_long() {
userSession.login();
userSession.logIn();

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Name 'a' must be at least 2 chars long");
@@ -166,7 +166,7 @@ public class UpdateActionTest {

@Test
public void request_fails_if_name_is_65_chars_long() {
userSession.login();
userSession.logIn();

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Name '" + STRING_65_CHARS_LONG + "' must be at most 64 chars long");
@@ -204,7 +204,7 @@ public class UpdateActionTest {

@Test
public void request_fails_if_description_is_257_chars_long() {
userSession.login();
userSession.logIn();

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("description '" + STRING_257_CHARS_LONG + "' must be at most 256 chars long");
@@ -224,7 +224,7 @@ public class UpdateActionTest {

@Test
public void request_fails_if_url_is_257_chars_long() {
userSession.login();
userSession.logIn();

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("url '" + STRING_257_CHARS_LONG + "' must be at most 256 chars long");
@@ -244,7 +244,7 @@ public class UpdateActionTest {

@Test
public void request_fails_if_avatar_is_257_chars_long() {
userSession.login();
userSession.logIn();

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("avatar '" + STRING_257_CHARS_LONG + "' must be at most 256 chars long");
@@ -272,7 +272,7 @@ public class UpdateActionTest {
}

private void giveUserSystemAdminPermission(OrganizationDto organizationDto) {
userSession.login().addOrganizationPermission(organizationDto.getUuid(), SYSTEM_ADMIN);
userSession.logIn().addOrganizationPermission(organizationDto.getUuid(), SYSTEM_ADMIN);
}

private OrganizationDto mockForSuccessfulUpdate(long createdAt, long nextNow) {

+ 6
- 6
server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java 查看文件

@@ -248,22 +248,22 @@ public class PermissionIndexerTest {
}

private void verifyAuthorized(ComponentDto project, UserDto user) {
logIn(user);
log_in(user);
verifyAuthorized(project, true);
}

private void verifyAuthorized(ComponentDto project, UserDto user, GroupDto group) {
logIn(user).setGroups(group);
log_in(user).setGroups(group);
verifyAuthorized(project, true);
}

private void verifyNotAuthorized(ComponentDto project, UserDto user) {
logIn(user);
log_in(user);
verifyAuthorized(project, false);
}

private void verifyNotAuthorized(ComponentDto project, UserDto user, GroupDto group) {
logIn(user).setGroups(group);
log_in(user).setGroups(group);
verifyAuthorized(project, false);
}

@@ -281,8 +281,8 @@ public class PermissionIndexerTest {
assertThat(fooIndex.hasAccessToProject(project.uuid())).isEqualTo(expectedAccess);
}

private UserSessionRule logIn(UserDto u) {
userSession.login(u.getLogin()).setUserId(u.getId().intValue());
private UserSessionRule log_in(UserDto u) {
userSession.logIn(u.getLogin()).setUserId(u.getId().intValue());
return userSession;
}


+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java 查看文件

@@ -269,7 +269,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
public void adding_global_permission_fails_if_not_administrator_of_organization() throws Exception {
GroupDto group = db.users().insertGroup(db.getDefaultOrganization(), "sonar-administrators");
// user is administrator of another organization
userSession.login().addOrganizationPermission("anotherOrg", SYSTEM_ADMIN);
userSession.logIn().addOrganizationPermission("anotherOrg", SYSTEM_ADMIN);

expectedException.expect(ForbiddenException.class);

@@ -283,7 +283,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
public void adding_project_permission_fails_if_not_administrator_of_project() throws Exception {
GroupDto group = db.users().insertGroup(db.getDefaultOrganization(), "sonar-administrators");
ComponentDto project = db.components().insertProject();
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -301,7 +301,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
public void adding_project_permission_is_allowed_to_project_administrators() throws Exception {
GroupDto group = db.users().insertGroup(db.getDefaultOrganization(), "sonar-administrators");
ComponentDto project = db.components().insertProject();
userSession.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());

newRequest()
.setParam(PARAM_GROUP_NAME, group.getName())

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java 查看文件

@@ -206,7 +206,7 @@ public class AddUserActionTest extends BasePermissionWsTest<AddUserAction> {

@Test
public void adding_global_permission_fails_if_not_administrator_of_organization() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -219,7 +219,7 @@ public class AddUserActionTest extends BasePermissionWsTest<AddUserAction> {
@Test
public void adding_project_permission_fails_if_not_administrator_of_project() throws Exception {
ComponentDto project = db.components().insertProject();
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -237,7 +237,7 @@ public class AddUserActionTest extends BasePermissionWsTest<AddUserAction> {
public void adding_project_permission_is_allowed_to_project_administrators() throws Exception {
ComponentDto project = db.components().insertProject();

userSession.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());

newRequest()
.setParam(PARAM_USER_LOGIN, user.getLogin())

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/BasePermissionWsTest.java 查看文件

@@ -100,7 +100,7 @@ public abstract class BasePermissionWsTest<A extends PermissionsWsAction> {
}

protected void loginAsAdmin(OrganizationDto org, OrganizationDto... otherOrgs) {
userSession.login().addOrganizationPermission(org.getUuid(), SYSTEM_ADMIN);
userSession.logIn().addOrganizationPermission(org.getUuid(), SYSTEM_ADMIN);
for (OrganizationDto otherOrg : otherOrgs) {
userSession.addOrganizationPermission(otherOrg.getUuid(), SYSTEM_ADMIN);
}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/permission/ws/GroupsActionTest.java 查看文件

@@ -163,7 +163,7 @@ public class GroupsActionTest extends BasePermissionWsTest<GroupsAction> {

GroupDto groupWithoutPermission = db.users().insertGroup(organizationDto, "group-without-permission");

userSession.login().addProjectUuidPermissions(ADMIN, "project-uuid");
userSession.logIn().addProjectUuidPermissions(ADMIN, "project-uuid");
String result = newRequest()
.setParam(PARAM_PERMISSION, ISSUE_ADMIN)
.setParam(PARAM_PROJECT_ID, "project-uuid")
@@ -267,7 +267,7 @@ public class GroupsActionTest extends BasePermissionWsTest<GroupsAction> {
public void fail_if_insufficient_privileges() throws Exception {
expectedException.expect(ForbiddenException.class);

userSession.login("login");
userSession.logIn("login");
newRequest()
.setParam(PARAM_PERMISSION, "scan")
.execute();

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java 查看文件

@@ -313,7 +313,7 @@ public class RemoveGroupActionTest extends BasePermissionWsTest<RemoveGroupActio

@Test
public void removing_global_permission_fails_if_not_administrator_of_organization() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -326,7 +326,7 @@ public class RemoveGroupActionTest extends BasePermissionWsTest<RemoveGroupActio
@Test
public void removing_project_permission_fails_if_not_administrator_of_project() throws Exception {
ComponentDto project = db.components().insertProject();
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -346,7 +346,7 @@ public class RemoveGroupActionTest extends BasePermissionWsTest<RemoveGroupActio
db.users().insertProjectPermissionOnGroup(aGroup, CODEVIEWER, project);
db.users().insertProjectPermissionOnGroup(aGroup, ISSUE_ADMIN, project);

userSession.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
newRequest()
.setParam(PARAM_GROUP_NAME, aGroup.getName())
.setParam(PARAM_PROJECT_ID, project.uuid())

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java 查看文件

@@ -292,7 +292,7 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>

@Test
public void removing_global_permission_fails_if_not_administrator_of_organization() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -305,7 +305,7 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
@Test
public void removing_project_permission_fails_if_not_administrator_of_project() throws Exception {
ComponentDto project = db.components().insertProject();
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -324,7 +324,7 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
ComponentDto project = db.components().insertProject();
db.users().insertProjectPermissionOnUser(user, CODEVIEWER, project);
db.users().insertProjectPermissionOnUser(user, ISSUE_ADMIN, project);
userSession.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());

newRequest()
.setParam(PARAM_USER_LOGIN, user.getLogin())

+ 1
- 2
server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchGlobalPermissionsActionTest.java 查看文件

@@ -40,7 +40,6 @@ import static org.sonar.core.permission.GlobalPermissions.QUALITY_GATE_ADMIN;
import static org.sonar.core.permission.GlobalPermissions.QUALITY_PROFILE_ADMIN;
import static org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION;
import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN;
import static org.sonar.db.organization.OrganizationTesting.newOrganizationDto;
import static org.sonar.test.JsonAssert.assertJson;

public class SearchGlobalPermissionsActionTest extends BasePermissionWsTest<SearchGlobalPermissionsAction> {
@@ -128,7 +127,7 @@ public class SearchGlobalPermissionsActionTest extends BasePermissionWsTest<Sear

@Test
public void fail_if_not_admin_of_default_organization() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);


+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java 查看文件

@@ -57,7 +57,7 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
@Before
public void setUp() {
i18n.setProjectPermissions();
userSession.login().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
userSession.logIn().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
}

@Override
@@ -122,7 +122,7 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea

@Test
public void search_project_permissions_with_project_permission() throws Exception {
userSession.login().addProjectUuidPermissions(UserRole.ADMIN, "project-uuid");
userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, "project-uuid");
db.components().insertComponent(newProjectDto(db.getDefaultOrganization(), "project-uuid"));

String result = newRequest()
@@ -225,7 +225,7 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea

@Test
public void fail_if_not_admin() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);


+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/permission/ws/UsersActionTest.java 查看文件

@@ -90,7 +90,7 @@ public class UsersActionTest extends BasePermissionWsTest<UsersAction> {
// User has no permission
UserDto withoutPermission = db.users().insertUser(newUserDto());

userSession.login().addProjectUuidPermissions(SYSTEM_ADMIN, project.uuid());
userSession.logIn().addProjectUuidPermissions(SYSTEM_ADMIN, project.uuid());
String result = newRequest()
.setParam(PARAM_PERMISSION, ISSUE_ADMIN)
.setParam(PARAM_PROJECT_ID, project.uuid())
@@ -216,7 +216,7 @@ public class UsersActionTest extends BasePermissionWsTest<UsersAction> {

@Test
public void fail_if_insufficient_privileges() throws Exception {
userSession.login("login");
userSession.logIn("login");

expectedException.expect(ForbiddenException.class);


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddGroupToTemplateActionTest.java 查看文件

@@ -136,7 +136,7 @@ public class AddGroupToTemplateActionTest extends BasePermissionWsTest<AddGroupT

@Test
public void fail_if_not_admin_of_default_organization() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddProjectCreatorToTemplateActionTest.java 查看文件

@@ -116,7 +116,7 @@ public class AddProjectCreatorToTemplateActionTest extends BasePermissionWsTest<

@Test
public void fail_if_not_admin_of_default_organization() throws Exception {
userSession.login().addOrganizationPermission(db.getDefaultOrganization().getUuid(), QUALITY_GATE_ADMIN);
userSession.logIn().addOrganizationPermission(db.getDefaultOrganization().getUuid(), QUALITY_GATE_ADMIN);

expectedException.expect(ForbiddenException.class);


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java 查看文件

@@ -100,7 +100,7 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT

@Test
public void fail_if_not_admin_of_default_organization() throws Exception {
userSession.login().addOrganizationPermission(db.getDefaultOrganization().getUuid(), QUALITY_PROFILE_ADMIN);
userSession.logIn().addOrganizationPermission(db.getDefaultOrganization().getUuid(), QUALITY_PROFILE_ADMIN);

expectedException.expect(ForbiddenException.class);


+ 2
- 3
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/ApplyTemplateActionTest.java 查看文件

@@ -24,7 +24,6 @@ import javax.annotation.Nullable;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.sonar.api.config.MapSettings;
import org.sonar.api.web.UserRole;
import org.sonar.core.permission.GlobalPermissions;
import org.sonar.db.component.ComponentDto;
@@ -177,10 +176,10 @@ public class ApplyTemplateActionTest extends BasePermissionWsTest<ApplyTemplateA

@Test
public void fail_when_not_admin_of_organization() throws Exception {
userSession.login().addOrganizationPermission("otherOrg", SYSTEM_ADMIN);
userSession.logIn().addOrganizationPermission("otherOrg", SYSTEM_ADMIN);

expectedException.expect(ForbiddenException.class);
userSession.login().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
userSession.logIn().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);

newRequest(template1.getUuid(), project.uuid(), null);
}

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/CreateTemplateActionTest.java 查看文件

@@ -122,7 +122,7 @@ public class CreateTemplateActionTest extends BasePermissionWsTest<CreateTemplat

@Test
public void fail_if_not_admin() throws Exception {
userSession.login().addOrganizationPermission(db.getDefaultOrganization().getUuid(), QUALITY_PROFILE_ADMIN);
userSession.logIn().addOrganizationPermission(db.getDefaultOrganization().getUuid(), QUALITY_PROFILE_ADMIN);

expectedException.expect(ForbiddenException.class);


+ 11
- 11
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/DeleteTemplateActionTest.java 查看文件

@@ -151,7 +151,7 @@ public class DeleteTemplateActionTest {

@Test
public void fail_if_uuid_is_not_known_without_views() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(NotFoundException.class);

@@ -160,7 +160,7 @@ public class DeleteTemplateActionTest {

@Test
public void fail_if_uuid_is_not_known_with_views() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(NotFoundException.class);

@@ -272,7 +272,7 @@ public class DeleteTemplateActionTest {
public void fail_to_delete_by_uuid_if_not_admin_without_views() throws Exception {
OrganizationDto organization = db.organizations().insert();
PermissionTemplateDto template = insertTemplateAndAssociatedPermissions(organization);
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -283,7 +283,7 @@ public class DeleteTemplateActionTest {
public void fail_to_delete_by_uuid_if_not_admin_with_views() throws Exception {
OrganizationDto organization = db.organizations().insert();
PermissionTemplateDto template = insertTemplateAndAssociatedPermissions(organization);
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -294,7 +294,7 @@ public class DeleteTemplateActionTest {
public void fail_to_delete_by_name_if_not_admin_without_views() throws Exception {
OrganizationDto organization = db.organizations().insert();
PermissionTemplateDto template = db.permissionTemplates().insertTemplate(organization);
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -307,7 +307,7 @@ public class DeleteTemplateActionTest {
PermissionTemplateDto template = db.permissionTemplates().insertTemplate(PermissionTemplateTesting.newPermissionTemplateDto()
.setOrganizationUuid(organization.getUuid())
.setName("the name"));
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -316,7 +316,7 @@ public class DeleteTemplateActionTest {

@Test
public void fail_if_neither_uuid_nor_name_is_provided_without_views() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(BadRequestException.class);

@@ -325,7 +325,7 @@ public class DeleteTemplateActionTest {

@Test
public void fail_if_neither_uuid_nor_name_is_provided_with_views() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(BadRequestException.class);

@@ -334,7 +334,7 @@ public class DeleteTemplateActionTest {

@Test
public void fail_if_both_uuid_and_name_are_provided_without_views() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(BadRequestException.class);

@@ -346,7 +346,7 @@ public class DeleteTemplateActionTest {

@Test
public void fail_if_both_uuid_and_name_are_provided_with_views() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(BadRequestException.class);

@@ -373,7 +373,7 @@ public class DeleteTemplateActionTest {
// }

private UserSessionRule loginAsAdmin(OrganizationDto organization) {
return userSession.login().addOrganizationPermission(organization.getUuid(), SYSTEM_ADMIN);
return userSession.logIn().addOrganizationPermission(organization.getUuid(), SYSTEM_ADMIN);
}

private void runOnAllUnderTests(ConsumerWithException<WsActionTester> consumer) throws Exception {

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveGroupFromTemplateActionTest.java 查看文件

@@ -120,7 +120,7 @@ public class RemoveGroupFromTemplateActionTest extends BasePermissionWsTest<Remo

@Test
public void fail_if_insufficient_privileges() throws Exception {
userSession.login().addOrganizationPermission(db.getDefaultOrganization().getUuid(), SCAN_EXECUTION);
userSession.logIn().addOrganizationPermission(db.getDefaultOrganization().getUuid(), SCAN_EXECUTION);

expectedException.expect(ForbiddenException.class);


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveProjectCreatorFromTemplateActionTest.java 查看文件

@@ -123,7 +123,7 @@ public class RemoveProjectCreatorFromTemplateActionTest extends BasePermissionWs
@Test
public void fail_if_insufficient_privileges() throws Exception {
expectedException.expect(ForbiddenException.class);
userSession.login().setGlobalPermissions(GlobalPermissions.QUALITY_GATE_ADMIN);
userSession.logIn().setGlobalPermissions(GlobalPermissions.QUALITY_GATE_ADMIN);

newRequest()
.setParam(PARAM_PERMISSION, UserRole.ADMIN)

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateActionTest.java 查看文件

@@ -122,7 +122,7 @@ public class RemoveUserFromTemplateActionTest extends BasePermissionWsTest<Remov
@Test
public void fail_if_insufficient_privileges() throws Exception {
expectedException.expect(ForbiddenException.class);
userSession.login("john").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
userSession.logIn("john").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);

newRequest(user.getLogin(), template.getUuid(), DEFAULT_PERMISSION);
}

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/SearchTemplatesActionTest.java 查看文件

@@ -73,7 +73,7 @@ public class SearchTemplatesActionTest extends BasePermissionWsTest<SearchTempla
SearchTemplatesDataLoader dataLoaderWithViews = new SearchTemplatesDataLoader(dbClient, defaultTemplatesResolverWithViews);
underTestWithoutViews = new WsActionTester(new SearchTemplatesAction(dbClient, userSession, i18n, newPermissionWsSupport(), dataLoaderWithViews));
i18n.setProjectPermissions();
userSession.login().addOrganizationPermission(db.getDefaultOrganization().getUuid(), SYSTEM_ADMIN);
userSession.logIn().addOrganizationPermission(db.getDefaultOrganization().getUuid(), SYSTEM_ADMIN);
}

@Test

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/SetDefaultTemplateActionTest.java 查看文件

@@ -122,7 +122,7 @@ public class SetDefaultTemplateActionTest extends BasePermissionWsTest<SetDefaul
public void fail_if_not_admin() throws Exception {
OrganizationDto organization = db.organizations().insert();
PermissionTemplateDto template = insertTemplate(organization);
userSession.login().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
userSession.logIn().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);

expectedException.expect(ForbiddenException.class);


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/TemplateGroupsActionTest.java 查看文件

@@ -309,7 +309,7 @@ public class TemplateGroupsActionTest extends BasePermissionWsTest<TemplateGroup
@Test
public void fail_if_insufficient_privileges() throws Exception {
PermissionTemplateDto template1 = addTemplateToDefaultOrganization();
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/TemplateUsersActionTest.java 查看文件

@@ -275,7 +275,7 @@ public class TemplateUsersActionTest extends BasePermissionWsTest<TemplateUsersA
@Test
public void fail_if_insufficient_privileges() throws Exception {
PermissionTemplateDto template = addTemplateToDefaultOrganization();
userSession.login().addOrganizationPermission(db.getDefaultOrganization().getUuid(), SCAN_EXECUTION);
userSession.logIn().addOrganizationPermission(db.getDefaultOrganization().getUuid(), SCAN_EXECUTION);

expectedException.expect(ForbiddenException.class);


+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/UpdateTemplateActionTest.java 查看文件

@@ -190,7 +190,7 @@ public class UpdateTemplateActionTest extends BasePermissionWsTest<UpdateTemplat

@Test
public void fail_if_not_admin() throws Exception {
userSession.login().addOrganizationPermission(db.getDefaultOrganization().getUuid(), SCAN_EXECUTION);
userSession.logIn().addOrganizationPermission(db.getDefaultOrganization().getUuid(), SCAN_EXECUTION);

expectedException.expect(ForbiddenException.class);


+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelActionTest.java 查看文件

@@ -57,7 +57,7 @@ public class ChangeLogLevelActionTest {

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -116,6 +116,6 @@ public class ChangeLogLevelActionTest {
}

private void makeAuthenticatedUserRoot() {
userSession.login().setRoot();
userSession.logIn().setRoot();
}
}

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/platform/ws/InfoActionTest.java 查看文件

@@ -39,7 +39,7 @@ import static org.mockito.Mockito.when;

public class InfoActionTest {
@Rule
public UserSessionRule userSessionRule = UserSessionRule.standalone().login("login")
public UserSessionRule userSessionRule = UserSessionRule.standalone().logIn("login")
.setName("name");
@Rule
public ExpectedException expectedException = ExpectedException.none();
@@ -68,7 +68,7 @@ public class InfoActionTest {

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() {
userSessionRule.login();
userSessionRule.logIn();

expectedException.expect(ForbiddenException.class);

@@ -96,6 +96,6 @@ public class InfoActionTest {
}

private void makeAuthenticatedUserRoot() {
userSessionRule.login().setRoot();
userSessionRule.logIn().setRoot();
}
}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/platform/ws/LogsActionTest.java 查看文件

@@ -67,7 +67,7 @@ public class LogsActionTest {

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -165,6 +165,6 @@ public class LogsActionTest {
}

private void makeAuthenticatedUserRoot() {
userSession.login().setRoot();
userSession.logIn().setRoot();
}
}

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/platform/ws/RestartActionTest.java 查看文件

@@ -100,7 +100,7 @@ public class RestartActionTest {

@Test
public void request_fails_in_production_mode_with_ForbiddenException_when_user_is_not_root() {
userSessionRule.login();
userSessionRule.logIn();

expectedException.expect(ForbiddenException.class);

@@ -109,7 +109,7 @@ public class RestartActionTest {

@Test
public void calls_ProcessCommandWrapper_requestForSQRestart_in_production_mode() throws Exception {
userSessionRule.login().setRoot();
userSessionRule.logIn().setRoot();

actionTester.newRequest().execute();

@@ -120,7 +120,7 @@ public class RestartActionTest {
@Test
public void logs_login_of_authenticated_user_requesting_the_restart_in_production_mode() throws Exception {
String login = "BigBother";
userSessionRule.login(login).setRoot();
userSessionRule.logIn(login).setRoot();

actionTester.newRequest().execute();


+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailableActionTest.java 查看文件

@@ -95,7 +95,7 @@ public class AvailableActionTest extends AbstractUpdateCenterBasedPluginsWsActio

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -174,7 +174,7 @@ public class AvailableActionTest extends AbstractUpdateCenterBasedPluginsWsActio
}

private void makeAuthenticatedUserRoot() {
userSession.login().setRoot();
userSession.logIn().setRoot();
}

}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/CancelAllActionTest.java 查看文件

@@ -79,7 +79,7 @@ public class CancelAllActionTest {

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() throws Exception {
userSessionRule.login();
userSessionRule.logIn();

expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
@@ -89,7 +89,7 @@ public class CancelAllActionTest {

@Test
public void triggers_cancel_for_downloads_and_uninstalls() throws Exception {
userSessionRule.login().setRoot();
userSessionRule.logIn().setRoot();

underTest.handle(request, response);


+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallActionTest.java 查看文件

@@ -81,7 +81,7 @@ public class InstallActionTest {

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() throws Exception {
userSessionRule.login();
userSessionRule.logIn();

expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
@@ -157,6 +157,6 @@ public class InstallActionTest {
}

private void makeAuthenticatedUserRoot() {
userSessionRule.login().setRoot();
userSessionRule.logIn().setRoot();
}
}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java 查看文件

@@ -92,7 +92,7 @@ public class InstalledActionTest {

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -278,7 +278,7 @@ public class InstalledActionTest {
}

private void makeAuthenticatedUserRoot() {
userSession.login().setRoot();
userSession.logIn().setRoot();
}

}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingActionTest.java 查看文件

@@ -88,7 +88,7 @@ public class PendingActionTest {

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);

@@ -339,6 +339,6 @@ public class PendingActionTest {
}

private void makeAuthenticatedUserRoot() {
userSession.login().setRoot();
userSession.logIn().setRoot();
}
}

+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsMediumTest.java 查看文件

@@ -51,7 +51,7 @@ public class PluginsWsMediumTest {
WsTester wsTester = new WsTester(serverTester.get(PluginsWs.class));

// 1 - check what's installed, available and pending
userSessionRule.login().setRoot();
userSessionRule.logIn().setRoot();
wsTester.newGetRequest("api/plugins", "installed").execute().assertJson("{" +
" \"plugins\": [" +
" {" +
@@ -115,7 +115,7 @@ public class PluginsWsMediumTest {
wsTester = restartServerTester();

// 4 - make sure plugin is installed
userSessionRule.login().setRoot();
userSessionRule.logIn().setRoot();
wsTester.newGetRequest("api/plugins", "installed").execute().assertJson("{" +
" \"plugins\": [" +
" {" +
@@ -148,7 +148,7 @@ public class PluginsWsMediumTest {
wsTester = restartServerTester();

// 7 - make sure plugin has been uninstalled
userSessionRule.login().setRoot();
userSessionRule.logIn().setRoot();
wsTester.newGetRequest("api/plugins", "installed").execute().assertJson("{" +
" \"plugins\": [" +
" {" +

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UninstallActionTest.java 查看文件

@@ -64,7 +64,7 @@ public class UninstallActionTest {

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() throws Exception {
userSessionRule.login();
userSessionRule.logIn();

expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
@@ -128,7 +128,7 @@ public class UninstallActionTest {
}

private void makeAuthenticatedUserRoot() {
userSessionRule.login().setRoot();
userSessionRule.logIn().setRoot();
}

}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdateActionTest.java 查看文件

@@ -83,7 +83,7 @@ public class UpdateActionTest {

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() throws Exception {
userSessionRule.login();
userSessionRule.logIn();

expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
@@ -161,7 +161,7 @@ public class UpdateActionTest {
}

private void makeAuthenticatedUserRoot() {
userSessionRule.login().setRoot();
userSessionRule.logIn().setRoot();
}

}

+ 2
- 2
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesActionTest.java 查看文件

@@ -110,7 +110,7 @@ public class UpdatesActionTest extends AbstractUpdateCenterBasedPluginsWsActionT

@Test
public void request_fails_with_ForbiddenException_when_user_is_not_root() throws Exception {
userSession.login();
userSession.logIn();

expectedException.expect(ForbiddenException.class);
underTest.handle(request, response);
@@ -191,6 +191,6 @@ public class UpdatesActionTest extends AbstractUpdateCenterBasedPluginsWsActionT
}

private void makeAuthenticatedUserRoot() {
userSession.login().setRoot();
userSession.logIn().setRoot();
}
}

+ 23
- 24
server/sonar-server/src/test/java/org/sonar/server/project/ws/CreateActionTest.java 查看文件

@@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

package org.sonar.server.project.ws;

import com.google.common.base.Throwables;
@@ -76,10 +75,10 @@ public class CreateActionTest {
private ComponentUpdater componentUpdater = mock(ComponentUpdater.class, Mockito.RETURNS_MOCKS);

private WsActionTester ws = new WsActionTester(
new CreateAction(
db.getDbClient(), userSession,
componentUpdater,
defaultOrganizationProvider));
new CreateAction(
db.getDbClient(), userSession,
componentUpdater,
defaultOrganizationProvider));

@Test
public void create_project() throws Exception {
@@ -87,9 +86,9 @@ public class CreateActionTest {
expectSuccessfulCallToComponentUpdater();

CreateWsResponse response = call(CreateRequest.builder()
.setKey(DEFAULT_PROJECT_KEY)
.setName(DEFAULT_PROJECT_NAME)
.build());
.setKey(DEFAULT_PROJECT_KEY)
.setName(DEFAULT_PROJECT_NAME)
.build());

assertThat(response.getProject().getKey()).isEqualTo(DEFAULT_PROJECT_KEY);
assertThat(response.getProject().getName()).isEqualTo(DEFAULT_PROJECT_NAME);
@@ -101,10 +100,10 @@ public class CreateActionTest {
userSession.setGlobalPermissions(PROVISIONING);

call(CreateRequest.builder()
.setKey(DEFAULT_PROJECT_KEY)
.setName(DEFAULT_PROJECT_NAME)
.setBranch("origin/master")
.build());
.setKey(DEFAULT_PROJECT_KEY)
.setName(DEFAULT_PROJECT_NAME)
.setBranch("origin/master")
.build());

NewComponent called = verifyCallToComponentUpdater();
assertThat(called.key()).isEqualTo(DEFAULT_PROJECT_KEY);
@@ -116,10 +115,10 @@ public class CreateActionTest {
userSession.setGlobalPermissions(PROVISIONING);

ws.newRequest()
.setMethod(POST.name())
.setParam("key", DEFAULT_PROJECT_KEY)
.setParam(PARAM_NAME, DEFAULT_PROJECT_NAME)
.execute();
.setMethod(POST.name())
.setParam("key", DEFAULT_PROJECT_KEY)
.setParam(PARAM_NAME, DEFAULT_PROJECT_NAME)
.execute();

NewComponent called = verifyCallToComponentUpdater();
assertThat(called.key()).isEqualTo(DEFAULT_PROJECT_KEY);
@@ -134,9 +133,9 @@ public class CreateActionTest {
expectedException.expect(BadRequestException.class);

call(CreateRequest.builder()
.setKey(DEFAULT_PROJECT_KEY)
.setName(DEFAULT_PROJECT_NAME)
.build());
.setKey(DEFAULT_PROJECT_KEY)
.setName(DEFAULT_PROJECT_NAME)
.build());
}

@Test
@@ -171,9 +170,9 @@ public class CreateActionTest {
expectSuccessfulCallToComponentUpdater();

String result = ws.newRequest()
.setParam("key", DEFAULT_PROJECT_KEY)
.setParam("name", DEFAULT_PROJECT_NAME)
.execute().getInput();
.setParam("key", DEFAULT_PROJECT_KEY)
.setParam("name", DEFAULT_PROJECT_NAME)
.execute().getInput();

assertJson(result).isSimilarTo(getClass().getResource("create-example.json"));
}
@@ -191,8 +190,8 @@ public class CreateActionTest {

private CreateWsResponse call(CreateRequest request) {
TestRequest httpRequest = ws.newRequest()
.setMethod(POST.name())
.setMediaType(MediaTypes.PROTOBUF);
.setMethod(POST.name())
.setMediaType(MediaTypes.PROTOBUF);
setNullable(request.getKey(), e -> httpRequest.setParam("project", e));
setNullable(request.getName(), e -> httpRequest.setParam("name", e));
setNullable(request.getBranch(), e -> httpRequest.setParam("branch", e));

+ 10
- 10
server/sonar-server/src/test/java/org/sonar/server/project/ws/DeleteActionTest.java 查看文件

@@ -69,18 +69,18 @@ public class DeleteActionTest {
@Before
public void setUp() {
ws = new WsTester(new ProjectsWs(
new DeleteAction(
componentCleanerService,
new ComponentFinder(dbClient),
dbClient,
userSessionRule)));
new DeleteAction(
componentCleanerService,
new ComponentFinder(dbClient),
dbClient,
userSessionRule)));
}

@Test
public void global_admin_deletes_project_by_id() throws Exception {
ComponentDto project = componentDbTester.insertProject();

userSessionRule.login().setGlobalPermissions(UserRole.ADMIN);
userSessionRule.logIn().setGlobalPermissions(UserRole.ADMIN);
WsTester.TestRequest request = newRequest().setParam(PARAM_ID, project.uuid());
call(request);

@@ -91,7 +91,7 @@ public class DeleteActionTest {
public void global_admin_deletes_project_by_key() throws Exception {
ComponentDto project = componentDbTester.insertProject();

userSessionRule.login().setGlobalPermissions(UserRole.ADMIN);
userSessionRule.logIn().setGlobalPermissions(UserRole.ADMIN);
call(newRequest().setParam(PARAM_KEY, project.key()));

assertThat(verifyDeletedKey()).isEqualTo(project.key());
@@ -106,7 +106,7 @@ public class DeleteActionTest {
@Test
public void project_administrator_deletes_the_project_by_uuid() throws Exception {
ComponentDto project = componentDbTester.insertProject();
userSessionRule.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
userSessionRule.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());

call(newRequest().setParam(PARAM_ID, project.uuid()));

@@ -116,7 +116,7 @@ public class DeleteActionTest {
@Test
public void project_administrator_deletes_the_project_by_key() throws Exception {
ComponentDto project = componentDbTester.insertProject();
userSessionRule.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
userSessionRule.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());

call(newRequest().setParam(PARAM_KEY, project.key()));

@@ -127,7 +127,7 @@ public class DeleteActionTest {
public void return_403_if_not_project_admin_nor_org_admin() throws Exception {
ComponentDto project = componentDbTester.insertProject();

userSessionRule.login().addProjectUuidPermissions(project.uuid(), UserRole.CODEVIEWER, UserRole.ISSUE_ADMIN, UserRole.USER);
userSessionRule.logIn().addProjectUuidPermissions(project.uuid(), UserRole.CODEVIEWER, UserRole.ISSUE_ADMIN, UserRole.USER);
expectedException.expect(ForbiddenException.class);

call(newRequest().setParam(PARAM_ID, project.uuid()));

+ 8
- 8
server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java 查看文件

@@ -87,7 +87,7 @@ public class GhostsActionTest {
ComponentDto ghost1 = insertGhostProject(organization);
ComponentDto ghost2 = insertGhostProject(organization);
ComponentDto activeProject = insertActiveProject(organization);
userSessionRule.login().addOrganizationPermission(organization, SYSTEM_ADMIN);
userSessionRule.logIn().addOrganizationPermission(organization, SYSTEM_ADMIN);

TestResponse result = underTest.newRequest()
.setParam("organization", organization.getKey())
@@ -118,7 +118,7 @@ public class GhostsActionTest {
int count = i;
insertGhostProject(organization, dto -> dto.setKey("ghost-key-" + count));
}
userSessionRule.login().addOrganizationPermission(organization, SYSTEM_ADMIN);
userSessionRule.logIn().addOrganizationPermission(organization, SYSTEM_ADMIN);

TestResponse result = underTest.newRequest()
.setParam("organization", organization.getKey())
@@ -139,7 +139,7 @@ public class GhostsActionTest {
public void ghost_projects_with_chosen_fields() throws Exception {
OrganizationDto organization = db.organizations().insert();
insertGhostProject(organization);
userSessionRule.login().addOrganizationPermission(organization, SYSTEM_ADMIN);
userSessionRule.logIn().addOrganizationPermission(organization, SYSTEM_ADMIN);

TestResponse result = underTest.newRequest()
.setParam("organization", organization.getKey())
@@ -159,7 +159,7 @@ public class GhostsActionTest {
insertGhostProject(organization, dto -> dto.setName("ghost-name-11"));
insertGhostProject(organization, dto -> dto.setName("ghost-name-20"));

userSessionRule.login().addOrganizationPermission(organization, SYSTEM_ADMIN);
userSessionRule.logIn().addOrganizationPermission(organization, SYSTEM_ADMIN);

TestResponse result = underTest.newRequest()
.setParam("organization", organization.getKey())
@@ -176,7 +176,7 @@ public class GhostsActionTest {
OrganizationDto organization = db.organizations().insert();
insertGhostProject(organization, dto -> dto.setKey("ghost-key-1"));

userSessionRule.login().addOrganizationPermission(organization, SYSTEM_ADMIN);
userSessionRule.logIn().addOrganizationPermission(organization, SYSTEM_ADMIN);

TestResponse result = underTest.newRequest()
.setParam("organization", organization.getKey())
@@ -205,7 +205,7 @@ public class GhostsActionTest {
dbClient.snapshotDao().insert(db.getSession(), SnapshotTesting.newAnalysis(roslynProject)
.setStatus(STATUS_UNPROCESSED));
db.getSession().commit();
userSessionRule.login().addOrganizationPermission(organizationDto, SYSTEM_ADMIN);
userSessionRule.logIn().addOrganizationPermission(organizationDto, SYSTEM_ADMIN);

TestResponse result = underTest.newRequest()
.setParam("organization", organizationDto.getKey())
@@ -217,7 +217,7 @@ public class GhostsActionTest {

@Test(expected = ForbiddenException.class)
public void fail_if_does_not_have_sufficient_rights() throws Exception {
userSessionRule.login()
userSessionRule.logIn()
.addOrganizationPermission(db.getDefaultOrganization(), UserRole.USER)
.addOrganizationPermission(db.getDefaultOrganization(), UserRole.ISSUE_ADMIN)
.addOrganizationPermission(db.getDefaultOrganization(), UserRole.CODEVIEWER);
@@ -229,7 +229,7 @@ public class GhostsActionTest {
public void fail_with_NotFoundException_when_organization_with_specified_key_does_not_exist() {
TestRequest request = underTest.newRequest()
.setParam("organization", "foo");
userSessionRule.login();
userSessionRule.logIn();

expectedException.expect(NotFoundException.class);
expectedException.expectMessage("No organization for key 'foo'");

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/project/ws/IndexActionTest.java 查看文件

@@ -63,7 +63,7 @@ public class IndexActionTest {
@Before
public void setUp() {
user = db.users().insertUser("john");
userSession.login(user);
userSession.logIn(user);
}

@Test

+ 7
- 7
server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java 查看文件

@@ -84,7 +84,7 @@ public class ProvisionedActionTest {
ComponentDto analyzedProject = ComponentTesting.newProjectDto(organizationDto, "analyzed-uuid-1");
db.components().insertComponents(newProvisionedProject(organizationDto, "1"), newProvisionedProject(organizationDto, "2"), analyzedProject);
db.components().insertSnapshot(SnapshotTesting.newAnalysis(analyzedProject));
userSessionRule.login().addOrganizationPermission(organizationDto, GlobalPermissions.PROVISIONING);
userSessionRule.logIn().addOrganizationPermission(organizationDto, GlobalPermissions.PROVISIONING);

TestResponse result = underTest.newRequest()
.setParam(PARAM_ORGANIZATION, organizationDto.getKey())
@@ -115,7 +115,7 @@ public class ProvisionedActionTest {
for (int i = 1; i <= 10; i++) {
db.components().insertComponent(newProvisionedProject(organizationDto, String.valueOf(i)));
}
userSessionRule.login().addOrganizationPermission(organizationDto, GlobalPermissions.PROVISIONING);
userSessionRule.logIn().addOrganizationPermission(organizationDto, GlobalPermissions.PROVISIONING);

TestRequest request = underTest.newRequest()
.setParam(PARAM_ORGANIZATION, organizationDto.getKey())
@@ -131,7 +131,7 @@ public class ProvisionedActionTest {
public void provisioned_projects_with_desired_fields() throws Exception {
OrganizationDto organization = db.organizations().insert();
db.components().insertComponent(newProvisionedProject(organization, "1"));
userSessionRule.login().addOrganizationPermission(organization, GlobalPermissions.PROVISIONING);
userSessionRule.logIn().addOrganizationPermission(organization, GlobalPermissions.PROVISIONING);

String jsonOutput = underTest.newRequest()
.setParam(PARAM_ORGANIZATION, organization.getKey())
@@ -147,7 +147,7 @@ public class ProvisionedActionTest {
public void provisioned_projects_with_query() throws Exception {
OrganizationDto organization = db.organizations().insert();
db.components().insertComponents(newProvisionedProject(organization, "1"), newProvisionedProject(organization, "2"));
userSessionRule.login().addOrganizationPermission(organization, GlobalPermissions.PROVISIONING);
userSessionRule.logIn().addOrganizationPermission(organization, GlobalPermissions.PROVISIONING);

String jsonOutput = underTest.newRequest()
.setParam(PARAM_ORGANIZATION, organization.getKey())
@@ -171,7 +171,7 @@ public class ProvisionedActionTest {
.setName("Roslyn")
.setCreatedAt(DateUtils.parseDateTime("2013-03-04T23:03:44+0100"));
db.components().insertComponents(hBaseProject, roslynProject);
userSessionRule.login().addOrganizationPermission(organizationDto.getUuid(), GlobalPermissions.PROVISIONING);
userSessionRule.logIn().addOrganizationPermission(organizationDto.getUuid(), GlobalPermissions.PROVISIONING);

TestResponse result = underTest.newRequest()
.setParam(PARAM_ORGANIZATION, organizationDto.getKey())
@@ -185,7 +185,7 @@ public class ProvisionedActionTest {
public void fail_when_not_enough_privileges() throws Exception {
OrganizationDto organizationDto = db.organizations().insert();
db.components().insertComponent(newProvisionedProject(organizationDto, "1"));
userSessionRule.login().addOrganizationPermission(organizationDto.getUuid(), GlobalPermissions.SCAN_EXECUTION);
userSessionRule.logIn().addOrganizationPermission(organizationDto.getUuid(), GlobalPermissions.SCAN_EXECUTION);

expectedException.expect(ForbiddenException.class);

@@ -196,7 +196,7 @@ public class ProvisionedActionTest {
public void fail_with_NotFoundException_when_organization_with_specified_key_does_not_exist() {
TestRequest request = underTest.newRequest()
.setParam(PARAM_ORGANIZATION, "foo");
userSessionRule.login();
userSessionRule.logIn();

expectedException.expect(NotFoundException.class);
expectedException.expectMessage("No organization for key 'foo'");

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java 查看文件

@@ -80,7 +80,7 @@ public class SearchMyProjectsActionTest {
@Before
public void setUp() {
user = db.users().insertUser();
userSession.login(user);
userSession.logIn(user);
alertStatusMetric = dbClient.metricDao().insert(dbSession, newMetricDto().setKey(ALERT_STATUS_KEY).setValueType(ValueType.LEVEL.name()));
db.commit();


+ 47
- 47
server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java 查看文件

@@ -79,7 +79,7 @@ public class CreateActionTest {
underTest = new CreateAction(dbClient, userSession, componentFinder);
ws = new WsActionTester(underTest);

userSession.login("login").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("login").setGlobalPermissions(SYSTEM_ADMIN);
}

@Test
@@ -87,11 +87,11 @@ public class CreateActionTest {
ComponentDto project = insertProject();

String result = ws.newRequest()
.setMethod("POST")
.setParam(PARAM_PROJECT_KEY, project.key())
.setParam(PARAM_NAME, "Custom")
.setParam(PARAM_URL, "http://example.org")
.execute().getInput();
.setMethod("POST")
.setParam(PARAM_PROJECT_KEY, project.key())
.setParam(PARAM_NAME, "Custom")
.setParam(PARAM_URL, "http://example.org")
.execute().getInput();

assertJson(result).ignoreFields("id").isSimilarTo(getClass().getResource("create-example.json"));
}
@@ -101,25 +101,25 @@ public class CreateActionTest {
ComponentDto project = insertProject();

String result = ws.newRequest()
.setMethod("POST")
.setParam(PARAM_PROJECT_ID, project.uuid())
.setParam(PARAM_NAME, "Custom")
.setParam(PARAM_URL, "http://example.org")
.execute().getInput();
.setMethod("POST")
.setParam(PARAM_PROJECT_ID, project.uuid())
.setParam(PARAM_NAME, "Custom")
.setParam(PARAM_URL, "http://example.org")
.execute().getInput();

assertJson(result).ignoreFields("id").isSimilarTo(getClass().getResource("create-example.json"));
}

@Test
public void global_admin() throws IOException {
userSession.login().setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn().setGlobalPermissions(SYSTEM_ADMIN);
ComponentDto project = insertProject();
createAndTest(project);
}

@Test
public void require_project_admin() throws IOException {
userSession.login();
userSession.logIn();
ComponentDto project = insertProject();
userSession.addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
createAndTest(project);
@@ -138,48 +138,48 @@ public class CreateActionTest {
public void fail_if_no_name() {
expectedException.expect(IllegalArgumentException.class);
ws.newRequest()
.setParam(PARAM_PROJECT_KEY, "unknown")
.setParam(PARAM_URL, "http://example.org")
.execute();
.setParam(PARAM_PROJECT_KEY, "unknown")
.setParam(PARAM_URL, "http://example.org")
.execute();
}

@Test
public void fail_if_long_name() {
expectedException.expect(IllegalArgumentException.class);
ws.newRequest()
.setParam(PARAM_PROJECT_KEY, "unknown")
.setParam(PARAM_NAME, StringUtils.leftPad("", 129, "*"))
.setParam(PARAM_URL, "http://example.org")
.execute();
.setParam(PARAM_PROJECT_KEY, "unknown")
.setParam(PARAM_NAME, StringUtils.leftPad("", 129, "*"))
.setParam(PARAM_URL, "http://example.org")
.execute();
}

@Test
public void fail_if_no_url() {
expectedException.expect(IllegalArgumentException.class);
ws.newRequest()
.setParam(PARAM_PROJECT_KEY, "unknown")
.setParam(PARAM_NAME, "Custom")
.execute();
.setParam(PARAM_PROJECT_KEY, "unknown")
.setParam(PARAM_NAME, "Custom")
.execute();
}

@Test
public void fail_if_long_url() {
expectedException.expect(IllegalArgumentException.class);
ws.newRequest()
.setParam(PARAM_PROJECT_KEY, "unknown")
.setParam(PARAM_NAME, "random")
.setParam(PARAM_URL, StringUtils.leftPad("", 2049, "*"))
.execute();
.setParam(PARAM_PROJECT_KEY, "unknown")
.setParam(PARAM_NAME, "random")
.setParam(PARAM_URL, StringUtils.leftPad("", 2049, "*"))
.execute();
}

@Test
public void fail_when_no_project() {
expectedException.expect(NotFoundException.class);
ws.newRequest()
.setParam(PARAM_PROJECT_KEY, "unknown")
.setParam(PARAM_NAME, "Custom")
.setParam(PARAM_URL, "http://example.org")
.execute();
.setParam(PARAM_PROJECT_KEY, "unknown")
.setParam(PARAM_NAME, "Custom")
.setParam(PARAM_URL, "http://example.org")
.execute();
}

@Test
@@ -189,39 +189,39 @@ public class CreateActionTest {

expectedException.expect(ForbiddenException.class);
ws.newRequest()
.setParam(PARAM_PROJECT_KEY, PROJECT_KEY)
.setParam(PARAM_NAME, "Custom")
.setParam(PARAM_URL, "http://example.org")
.execute();
.setParam(PARAM_PROJECT_KEY, PROJECT_KEY)
.setParam(PARAM_NAME, "Custom")
.setParam(PARAM_URL, "http://example.org")
.execute();
}

@Test
public void fail_if_not_project_admin() {
userSession.login();
userSession.logIn();
insertProject();

expectedException.expect(ForbiddenException.class);
ws.newRequest()
.setParam(PARAM_PROJECT_KEY, PROJECT_KEY)
.setParam(PARAM_NAME, "Custom")
.setParam(PARAM_URL, "http://example.org")
.execute();
.setParam(PARAM_PROJECT_KEY, PROJECT_KEY)
.setParam(PARAM_NAME, "Custom")
.setParam(PARAM_URL, "http://example.org")
.execute();
}

private ComponentDto insertProject() {
OrganizationDto org = db.organizations().insert();
return db.components().insertComponent(
ComponentTesting.newProjectDto(org, PROJECT_UUID).setKey(PROJECT_KEY));
ComponentTesting.newProjectDto(org, PROJECT_UUID).setKey(PROJECT_KEY));
}

private void createAndTest(ComponentDto project, String name, String url, String type) throws IOException {
InputStream responseStream = ws.newRequest()
.setMethod("POST")
.setParam(PARAM_PROJECT_KEY, project.key())
.setParam(PARAM_NAME, name)
.setParam(PARAM_URL, url)
.setMediaType(PROTOBUF)
.execute().getInputStream();
.setMethod("POST")
.setParam(PARAM_PROJECT_KEY, project.key())
.setParam(PARAM_NAME, name)
.setParam(PARAM_URL, url)
.setMediaType(PROTOBUF)
.execute().getInputStream();

WsProjectLinks.CreateWsResponse response = WsProjectLinks.CreateWsResponse.parseFrom(responseStream);


+ 3
- 3
server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/DeleteActionTest.java 查看文件

@@ -70,7 +70,7 @@ public class DeleteActionTest {
underTest = new DeleteAction(dbClient, userSession);
ws = new WsActionTester(underTest);

userSession.login("login").setGlobalPermissions(SYSTEM_ADMIN);
userSession.logIn("login").setGlobalPermissions(SYSTEM_ADMIN);
}

@Test
@@ -96,7 +96,7 @@ public class DeleteActionTest {

@Test
public void project_admin() throws IOException {
userSession.login("login");
userSession.logIn("login");

ComponentDto project = insertProject();
userSession.addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
@@ -150,7 +150,7 @@ public class DeleteActionTest {

@Test
public void fail_if_not_project_admin() {
userSession.login("login");
userSession.logIn("login");

ComponentDto project = insertProject();
ComponentLinkDto link = insertCustomLink(project.uuid());

+ 0
- 0
server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java 查看文件


部分文件因文件數量過多而無法顯示

Loading…
取消
儲存