]> source.dussan.org Git - sonarqube.git/commitdiff
rename UserSessionRule.login() to logIn() for clarity
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 30 Jan 2017 15:06:25 +0000 (16:06 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 2 Feb 2017 15:12:13 +0000 (16:12 +0100)
161 files changed:
server/sonar-server/src/test/java/org/sonar/server/batch/ProjectDataLoaderMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/batch/UsersActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceUpdateKeyTest.java
server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexLoginTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/AppActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/email/ws/SendActionTest.java
server/sonar-server/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java
server/sonar-server/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java
server/sonar-server/src/test/java/org/sonar/server/favorite/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ActionFinderTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/SetSeverityActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/SetTypeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/TransitionActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/TransitionServiceTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/ChangelogActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/DoTransitionActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetSeverityActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTypeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/license/ws/ListActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/UpdateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java
server/sonar-server/src/test/java/org/sonar/server/metric/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/metric/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/metric/ws/UpdateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/notification/ws/AddActionTest.java
server/sonar-server/src/test/java/org/sonar/server/notification/ws/ListActionTest.java
server/sonar-server/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java
server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/organization/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/organization/ws/UpdateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/BasePermissionWsTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/GroupsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchGlobalPermissionsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/UsersActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddGroupToTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddProjectCreatorToTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/ApplyTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/CreateTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/DeleteTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveGroupFromTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveProjectCreatorFromTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/SearchTemplatesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/SetDefaultTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/TemplateGroupsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/TemplateUsersActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/UpdateTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelActionTest.java
server/sonar-server/src/test/java/org/sonar/server/platform/ws/InfoActionTest.java
server/sonar-server/src/test/java/org/sonar/server/platform/ws/LogsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/platform/ws/RestartActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailableActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/CancelAllActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UninstallActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/IndexActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/property/ws/IndexActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/QgateProjectFinderTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/AppActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateConditionActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/DeselectActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/SelectActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/UpdateConditionActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/RuleActivatorMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/AddProjectActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ChangeParentActionMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CopyActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProjectsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/RenameActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/RestoreActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/RestoreBuiltInActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java
server/sonar-server/src/test/java/org/sonar/server/root/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/root/ws/SetRootActionTest.java
server/sonar-server/src/test/java/org/sonar/server/root/ws/UnsetRootActionTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/RuleServiceMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/RuleUpdaterMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/ws/CreateActionMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/ws/ShowActionMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/ws/UpdateActionMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/serverid/ws/ShowActionTest.java
server/sonar-server/src/test/java/org/sonar/server/setting/ws/ListDefinitionsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/setting/ws/ResetActionTest.java
server/sonar-server/src/test/java/org/sonar/server/setting/ws/ValuesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/source/ws/HashActionTest.java
server/sonar-server/src/test/java/org/sonar/server/source/ws/LinesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/tester/UserSessionRule.java
server/sonar-server/src/test/java/org/sonar/server/ui/ws/ComponentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ui/ws/GlobalActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ui/ws/OrganizationActionTest.java
server/sonar-server/src/test/java/org/sonar/server/updatecenter/ws/UploadActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/CurrentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/UpdateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/AddUserActionTest.java
server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/RemoveUserActionTest.java
server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/UpdateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/UsersActionTest.java
server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/GenerateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/RevokeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/webhook/ws/WebhookDeliveriesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/webhook/ws/WebhookDeliveryActionTest.java

index 843782c121e97d810714c9f602ead8fc38a1aa49..4be933ac23f69fe2610f46587e507c7b2da96f4a 100644 (file)
@@ -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
index fb5e11792f9353997887962a62272bd0b44733da..3a12fdd82e3bb1dd25424b7fc9905e03ba4f20bf 100644 (file)
@@ -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");
 
index 5015781d0d90999cdb32fb03b987760719a8306a..48090f5a0d3698f58d6893ed4bfe884c4afc6913 100644 (file)
@@ -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"));
 
index 7bfce2b2473382c7bc3a556dddac3085e43d5073..309eafbf2fc67e4c939012f5855eb64e5b9a0377 100644 (file)
@@ -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));
index 525d6f7f4014477f5928a3ce047d176abdc771df..dff0f9b0ab4009a32f0076853d9ffed7150e0c1c 100644 (file)
@@ -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());
index 92500b50f1e5fd49cf0915ca59b93c5969b25cb9..a715e26308b86e492e5b443dbb34b0ed1696cd64 100644 (file)
@@ -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");
   }
index c9a6c9f8f66b06b0617a1cbda794a3067170cbed..7fd5404d182753ce51b740c0e49185842dbd0ede 100644 (file)
@@ -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);
index ddc1ec3f952e7ddb663365cb415c600299a75d83..b8acfcaa4dad7a540af5f7faf3f7fd1a310d13b4 100644 (file)
@@ -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");
   }
index 275c9e6c7ae45d2430e538350bae7f754c3e275f..4f6a8132bdc7b7c54a73dc98208ca6b8509de9c7 100644 (file)
@@ -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
index b729bd8f6db66e20fe56032247dfb717eff1cac7..a90778e60f12460126f2467b64dbced76b71f18a 100644 (file)
@@ -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();
 
index 25806b24a3554bba0d1530a70233b4445bb20000..065484a276bb470526261f43619b5867400304a8 100644 (file)
@@ -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);
 
index e4f00888bbb96c2d5122e0e62eeea085dc5273ec..255f69968d178c73cd707ae66dd932157144ccb3 100644 (file)
@@ -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();
index 4d7b5220bf83b5f5f3eb3e921e9d468c71149d81..60233292abb5e3de387c941b65da2f4d6d524997 100644 (file)
@@ -140,7 +140,7 @@ public class SendActionTest {
   }
 
   private void setUserAsSystemAdmin() {
-    userSession.login("admin").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(SYSTEM_ADMIN);
   }
 
 }
index 654e62a23607552c99cd7c45eee586a36b852564..0f6aa040f0a3413b1018211ded7daa43feaab434 100644 (file)
@@ -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);
 
index 60b0910e897abaa49e7e6cd263a88c924b8d99b9..d9f122b26e4a0262263161eec6efe9dc657fd404 100644 (file)
@@ -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();
   }
index 3a37b8f43ea8341c855694bd8f4e5e149e4e3001..aabc2e80ba19d73be14358077f78e046c2907322 100644 (file)
@@ -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();
index 82d7614cf383604c0159d919ac21cd534cd9e82c..76d0b54e6ec53b7f76c138f58df7b413d1226c19 100644 (file)
@@ -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");
   }
index 4b1dd6163e9d103c95cfd7fef8462af69f7eff51..b3a93c68a77f4e15909192f3213fff6aba91d476 100644 (file)
@@ -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;
   }
index c23858d3f81a2675a2c497774702a8c65bd88d6b..4734d501c7d3a9ba3af627e8af7ebf7813bfb35b 100644 (file)
@@ -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);
   }
index 50bcc5e619b23fd2a958e1e966329acb4bf9de2a..38c346495c2d5b76e7383f8184ba8c366675d66f 100644 (file)
@@ -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);
   }
index acd0cdd7c8f49a09f456c3cf83e78c2d12e50223..59720f8744a16b04ee9e4720ac35c2f1a1fad318 100644 (file)
@@ -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);
index 07ddea694939215ea5dbc8b774b0f0c754c9350d..1abe4bf44b6e57fd5a9ae6937078c62fbcb3be75 100644 (file)
@@ -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());
index ded89941a5d8064e0c0d4782d39d4187ac0078eb..f605440186d38cc307bff46c411d0ca7b8165680 100644 (file)
@@ -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();
   }
 
index 87f9797acad078a733823aaff140b05c8a9c274d..e38d30ec2d16003b5f1f867e2bcbb718449c4b5f 100644 (file)
@@ -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");
index 39f5f4e68fc2a92c6324253a84819d58ad74a186..b02e609f6198fcce8ef2117a7483377c3bc4205e 100644 (file)
@@ -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")
index 4e520514a52f5759beb58e2c5da43ac57a205dcd..5260045503ebf73a1eb468e456b2abe361e1f270 100644 (file)
@@ -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);
   }
 
index f33564cd6cc3847a64b5b8ef9ccd98db9f01672d..edfee6d1f88a1bd12b475364169e0390e425386b 100644 (file)
@@ -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")
index 79e64428e7d136f310ad04df8cfee2b745c15260..02070dcec20b2208028d5ac7b5fd1ddb478982dc 100644 (file)
@@ -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());
index 26f91bc71e18a5632ef1889579afc4f7633065f8..3308bcafd095b6903747cd47da01aee6706ade6a 100644 (file)
@@ -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);
index bd8c46bbe085ac4d254bbc19a6b85214be7dfae5..9ddd9a37dbbd23e0454a1466ea937f8570195f97 100644 (file)
@@ -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");
index 829232a9ba27367e68c22e5d5df698d904d981b1..7066c712161a3d01f7a9bef13b50612c19ddaa70 100644 (file)
@@ -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()));
index d6b7080f7bb89d1653dcbbd9a1b957b8796a1eef..44852baafa532d48a856dc6c3d1e2858847c31ea 100644 (file)
@@ -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
index 1302fa66b9d37ba5056baed9203ebc5629019f61..e64a6cd6683a0b29ad2c90851799902a11d28856 100644 (file)
@@ -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);
   }
index a1cb52cc4372992e66893a81e96687225de570f9..f80b34d39dbfe03bbdbf415441658edfffc27849 100644 (file)
@@ -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);
   }
index d4b703656460aafa35f6d4ab47df10e466d23d01..e2610ed579732ad6598398d0b80057c0d7520337 100644 (file)
@@ -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) {
index 27faf4d7dc131c578b97c8f0992c3db6cdae586e..eb4e87540c0c8fe0283927db5e440dfa97a3e545 100644 (file)
@@ -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);
 
index 5d5ae3dc7429b7a7dde6f89a15a811d3ac5530f7..d55a4d4f9577b53444d00acd34f0d2018f1eb7f2 100644 (file)
@@ -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"));
index 1ff7cde67dd1db787d96da36e530a94baa537811..2b6d356fd941ef2bc87ee4e2d3eb3343a1f481e9 100644 (file)
@@ -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");
 
index ed2c412a27249d64f4510d16660f44a7c048b315..bdce7d4e52051d8c346e98fec0503be2348c165a 100644 (file)
@@ -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);
 
index e81bde18486f5a91eda4047b1ebe63dd04c50bf4..f084ffb329144716172e87a49b027471196a4794 100644 (file)
@@ -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);
index 2b126188a8fb31823737008e04dfc87a97558cd0..5ad8c7f4e712adc79c5b16a9246280e4d9361e93 100644 (file)
@@ -107,7 +107,7 @@ public class ProjectMeasuresIndexTest {
   @Test
   public void search_paginate_results() {
     IntStream.rangeClosed(1, 9)
-      .forEach(i -> index(newDoc(newProjectDto(ORG, "P" + i))));
+        .forEach(i -> index(newDoc(newProjectDto(ORG, "P" + i))));
 
     SearchIdResult<String> result = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().setPage(2, 3));
 
@@ -118,12 +118,12 @@ public class ProjectMeasuresIndexTest {
   @Test
   public void filter_with_lower_than() {
     index(
-      newDoc(PROJECT1, COVERAGE, 79d, NCLOC, 10_000d),
-      newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 10_000d),
-      newDoc(PROJECT3, COVERAGE, 81d, NCLOC, 10_000d));
+        newDoc(PROJECT1, COVERAGE, 79d, NCLOC, 10_000d),
+        newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 10_000d),
+        newDoc(PROJECT3, COVERAGE, 81d, NCLOC, 10_000d));
 
     ProjectMeasuresQuery query = new ProjectMeasuresQuery()
-      .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LT, 80d));
+        .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LT, 80d));
 
     assertResults(query, PROJECT1);
   }
@@ -131,12 +131,12 @@ public class ProjectMeasuresIndexTest {
   @Test
   public void filter_with_lower_than_or_equals() {
     index(
-      newDoc(PROJECT1, COVERAGE, 79d, NCLOC, 10_000d),
-      newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 10_000d),
-      newDoc(PROJECT3, COVERAGE, 81d, NCLOC, 10_000d));
+        newDoc(PROJECT1, COVERAGE, 79d, NCLOC, 10_000d),
+        newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 10_000d),
+        newDoc(PROJECT3, COVERAGE, 81d, NCLOC, 10_000d));
 
     ProjectMeasuresQuery query = new ProjectMeasuresQuery()
-      .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LTE, 80d));
+        .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LTE, 80d));
 
     assertResults(query, PROJECT1, PROJECT2);
   }
@@ -144,9 +144,9 @@ public class ProjectMeasuresIndexTest {
   @Test
   public void filter_with_greater_than() {
     index(
-      newDoc(PROJECT1, COVERAGE, 80d, NCLOC, 30_000d),
-      newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 30_001d),
-      newDoc(PROJECT3, COVERAGE, 80d, NCLOC, 30_001d));
+        newDoc(PROJECT1, COVERAGE, 80d, NCLOC, 30_000d),
+        newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 30_001d),
+        newDoc(PROJECT3, COVERAGE, 80d, NCLOC, 30_001d));
 
     ProjectMeasuresQuery query = new ProjectMeasuresQuery().addMetricCriterion(new MetricCriterion(NCLOC, Operator.GT, 30_000d));
     assertResults(query, PROJECT2, PROJECT3);
@@ -158,9 +158,9 @@ public class ProjectMeasuresIndexTest {
   @Test
   public void filter_with_greater_than_or_equals() {
     index(
-      newDoc(PROJECT1, COVERAGE, 80d, NCLOC, 30_000d),
-      newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 30_001d),
-      newDoc(PROJECT3, COVERAGE, 80d, NCLOC, 30_001d));
+        newDoc(PROJECT1, COVERAGE, 80d, NCLOC, 30_000d),
+        newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 30_001d),
+        newDoc(PROJECT3, COVERAGE, 80d, NCLOC, 30_001d));
 
     ProjectMeasuresQuery query = new ProjectMeasuresQuery().addMetricCriterion(new MetricCriterion(NCLOC, Operator.GTE, 30_001d));
     assertResults(query, PROJECT2, PROJECT3);
@@ -172,12 +172,12 @@ public class ProjectMeasuresIndexTest {
   @Test
   public void filter_with_equals() {
     index(
-      newDoc(PROJECT1, COVERAGE, 79d, NCLOC, 10_000d),
-      newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 10_000d),
-      newDoc(PROJECT3, COVERAGE, 81d, NCLOC, 10_000d));
+        newDoc(PROJECT1, COVERAGE, 79d, NCLOC, 10_000d),
+        newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 10_000d),
+        newDoc(PROJECT3, COVERAGE, 81d, NCLOC, 10_000d));
 
     ProjectMeasuresQuery query = new ProjectMeasuresQuery()
-      .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.EQ, 80d));
+        .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.EQ, 80d));
 
     assertResults(query, PROJECT2);
   }
@@ -185,23 +185,23 @@ public class ProjectMeasuresIndexTest {
   @Test
   public void filter_on_several_metrics() {
     index(
-      newDoc(PROJECT1, COVERAGE, 81d, NCLOC, 10_001d),
-      newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 10_001d),
-      newDoc(PROJECT3, COVERAGE, 79d, NCLOC, 10_000d));
+        newDoc(PROJECT1, COVERAGE, 81d, NCLOC, 10_001d),
+        newDoc(PROJECT2, COVERAGE, 80d, NCLOC, 10_001d),
+        newDoc(PROJECT3, COVERAGE, 79d, NCLOC, 10_000d));
 
     ProjectMeasuresQuery esQuery = new ProjectMeasuresQuery()
-      .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LTE, 80d))
-      .addMetricCriterion(new MetricCriterion(NCLOC, Operator.GT, 10_000d))
-      .addMetricCriterion(new MetricCriterion(NCLOC, Operator.LT, 11_000d));
+        .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LTE, 80d))
+        .addMetricCriterion(new MetricCriterion(NCLOC, Operator.GT, 10_000d))
+        .addMetricCriterion(new MetricCriterion(NCLOC, Operator.LT, 11_000d));
     assertResults(esQuery, PROJECT2);
   }
 
   @Test
   public void filter_on_quality_gate_status() {
     index(
-      newDoc(PROJECT1).setQualityGate("OK"),
-      newDoc(PROJECT2).setQualityGate("OK"),
-      newDoc(PROJECT3).setQualityGate("WARN"));
+        newDoc(PROJECT1).setQualityGate("OK"),
+        newDoc(PROJECT2).setQualityGate("OK"),
+        newDoc(PROJECT3).setQualityGate("WARN"));
 
     ProjectMeasuresQuery query = new ProjectMeasuresQuery().setQualityGateStatus(OK);
     assertResults(query, PROJECT1, PROJECT2);
@@ -210,9 +210,9 @@ public class ProjectMeasuresIndexTest {
   @Test
   public void filter_on_ids() {
     index(
-      newDoc(PROJECT1),
-      newDoc(PROJECT2),
-      newDoc(PROJECT3));
+        newDoc(PROJECT1),
+        newDoc(PROJECT2),
+        newDoc(PROJECT3));
 
     ProjectMeasuresQuery query = new ProjectMeasuresQuery().setProjectUuids(newHashSet(PROJECT1.uuid(), PROJECT3.uuid()));
     assertResults(query, PROJECT1, PROJECT3);
@@ -223,7 +223,7 @@ public class ProjectMeasuresIndexTest {
     indexForUser(USER1, newDoc(PROJECT1), newDoc(PROJECT2));
     indexForUser(USER2, newDoc(PROJECT3));
 
-    userSession.login(USER1);
+    userSession.logIn(USER1);
     assertResults(new ProjectMeasuresQuery(), PROJECT1, PROJECT2);
   }
 
@@ -232,7 +232,7 @@ public class ProjectMeasuresIndexTest {
     indexForGroup(GROUP1, newDoc(PROJECT1), newDoc(PROJECT2));
     indexForGroup(GROUP2, newDoc(PROJECT3));
 
-    userSession.login().setGroups(GROUP1);
+    userSession.logIn().setGroups(GROUP1);
     assertResults(new ProjectMeasuresQuery(), PROJECT1, PROJECT2);
   }
 
@@ -241,7 +241,7 @@ public class ProjectMeasuresIndexTest {
     indexForUser(USER1, newDoc(PROJECT1), newDoc(PROJECT2));
     indexForGroup(GROUP1, newDoc(PROJECT3));
 
-    userSession.login(USER1).setGroups(GROUP1);
+    userSession.logIn(USER1).setGroups(GROUP1);
     assertResults(new ProjectMeasuresQuery(), PROJECT1, PROJECT2, PROJECT3);
   }
 
@@ -257,8 +257,8 @@ public class ProjectMeasuresIndexTest {
   @Test
   public void does_not_return_facet_when_no_facets_in_options() throws Exception {
     index(
-      newDoc(PROJECT1, NCLOC, 10d, COVERAGE_KEY, 30d, MAINTAINABILITY_RATING, 3d)
-        .setQualityGate(OK.name()));
+        newDoc(PROJECT1, NCLOC, 10d, COVERAGE_KEY, 30d, MAINTAINABILITY_RATING, 3d)
+            .setQualityGate(OK.name()));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions()).getFacets();
 
@@ -268,585 +268,585 @@ public class ProjectMeasuresIndexTest {
   @Test
   public void facet_ncloc() {
     index(
-      // 3 docs with ncloc<1K
-      newDoc(NCLOC, 0d),
-      newDoc(NCLOC, 0d),
-      newDoc(NCLOC, 999d),
-      // 2 docs with ncloc>=1K and ncloc<10K
-      newDoc(NCLOC, 1_000d),
-      newDoc(NCLOC, 9_999d),
-      // 4 docs with ncloc>=10K and ncloc<100K
-      newDoc(NCLOC, 10_000d),
-      newDoc(NCLOC, 10_000d),
-      newDoc(NCLOC, 11_000d),
-      newDoc(NCLOC, 99_000d),
-      // 2 docs with ncloc>=100K and ncloc<500K
-      newDoc(NCLOC, 100_000d),
-      newDoc(NCLOC, 499_000d),
-      // 5 docs with ncloc>= 500K
-      newDoc(NCLOC, 500_000d),
-      newDoc(NCLOC, 100_000_000d),
-      newDoc(NCLOC, 500_000d),
-      newDoc(NCLOC, 1_000_000d),
-      newDoc(NCLOC, 100_000_000_000d));
+        // 3 docs with ncloc<1K
+        newDoc(NCLOC, 0d),
+        newDoc(NCLOC, 0d),
+        newDoc(NCLOC, 999d),
+        // 2 docs with ncloc>=1K and ncloc<10K
+        newDoc(NCLOC, 1_000d),
+        newDoc(NCLOC, 9_999d),
+        // 4 docs with ncloc>=10K and ncloc<100K
+        newDoc(NCLOC, 10_000d),
+        newDoc(NCLOC, 10_000d),
+        newDoc(NCLOC, 11_000d),
+        newDoc(NCLOC, 99_000d),
+        // 2 docs with ncloc>=100K and ncloc<500K
+        newDoc(NCLOC, 100_000d),
+        newDoc(NCLOC, 499_000d),
+        // 5 docs with ncloc>= 500K
+        newDoc(NCLOC, 500_000d),
+        newDoc(NCLOC, 100_000_000d),
+        newDoc(NCLOC, 500_000d),
+        newDoc(NCLOC, 1_000_000d),
+        newDoc(NCLOC, 100_000_000_000d));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(NCLOC)).getFacets();
 
     assertThat(facets.get(NCLOC)).containsExactly(
-      entry("*-1000.0", 3L),
-      entry("1000.0-10000.0", 2L),
-      entry("10000.0-100000.0", 4L),
-      entry("100000.0-500000.0", 2L),
-      entry("500000.0-*", 5L));
+        entry("*-1000.0", 3L),
+        entry("1000.0-10000.0", 2L),
+        entry("10000.0-100000.0", 4L),
+        entry("100000.0-500000.0", 2L),
+        entry("500000.0-*", 5L));
   }
 
   @Test
   public void facet_ncloc_is_sticky() {
     index(
-      // 1 docs with ncloc<1K
-      newDoc(NCLOC, 999d, COVERAGE, 0d, DUPLICATION, 0d),
-      // 2 docs with ncloc>=1K and ncloc<10K
-      newDoc(NCLOC, 1_000d, COVERAGE, 10d, DUPLICATION, 0d),
-      newDoc(NCLOC, 9_999d, COVERAGE, 20d, DUPLICATION, 0d),
-      // 3 docs with ncloc>=10K and ncloc<100K
-      newDoc(NCLOC, 10_000d, COVERAGE, 31d, DUPLICATION, 0d),
-      newDoc(NCLOC, 11_000d, COVERAGE, 40d, DUPLICATION, 0d),
-      newDoc(NCLOC, 99_000d, COVERAGE, 50d, DUPLICATION, 0d),
-      // 2 docs with ncloc>=100K and ncloc<500K
-      newDoc(NCLOC, 100_000d, COVERAGE, 71d, DUPLICATION, 0d),
-      newDoc(NCLOC, 499_000d, COVERAGE, 80d, DUPLICATION, 0d),
-      // 1 docs with ncloc>= 500K
-      newDoc(NCLOC, 501_000d, COVERAGE, 81d, DUPLICATION, 20d));
+        // 1 docs with ncloc<1K
+        newDoc(NCLOC, 999d, COVERAGE, 0d, DUPLICATION, 0d),
+        // 2 docs with ncloc>=1K and ncloc<10K
+        newDoc(NCLOC, 1_000d, COVERAGE, 10d, DUPLICATION, 0d),
+        newDoc(NCLOC, 9_999d, COVERAGE, 20d, DUPLICATION, 0d),
+        // 3 docs with ncloc>=10K and ncloc<100K
+        newDoc(NCLOC, 10_000d, COVERAGE, 31d, DUPLICATION, 0d),
+        newDoc(NCLOC, 11_000d, COVERAGE, 40d, DUPLICATION, 0d),
+        newDoc(NCLOC, 99_000d, COVERAGE, 50d, DUPLICATION, 0d),
+        // 2 docs with ncloc>=100K and ncloc<500K
+        newDoc(NCLOC, 100_000d, COVERAGE, 71d, DUPLICATION, 0d),
+        newDoc(NCLOC, 499_000d, COVERAGE, 80d, DUPLICATION, 0d),
+        // 1 docs with ncloc>= 500K
+        newDoc(NCLOC, 501_000d, COVERAGE, 81d, DUPLICATION, 20d));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery()
-      .addMetricCriterion(new MetricCriterion(NCLOC, Operator.LT, 10_000d))
-      .addMetricCriterion(new MetricCriterion(DUPLICATION, Operator.LT, 10d)),
-      new SearchOptions().addFacets(NCLOC, COVERAGE)).getFacets();
+            .addMetricCriterion(new MetricCriterion(NCLOC, Operator.LT, 10_000d))
+            .addMetricCriterion(new MetricCriterion(DUPLICATION, Operator.LT, 10d)),
+        new SearchOptions().addFacets(NCLOC, COVERAGE)).getFacets();
 
     // Sticky facet on ncloc does not take into account ncloc filter
     assertThat(facets.get(NCLOC)).containsExactly(
-      entry("*-1000.0", 1L),
-      entry("1000.0-10000.0", 2L),
-      entry("10000.0-100000.0", 3L),
-      entry("100000.0-500000.0", 2L),
-      entry("500000.0-*", 0L));
+        entry("*-1000.0", 1L),
+        entry("1000.0-10000.0", 2L),
+        entry("10000.0-100000.0", 3L),
+        entry("100000.0-500000.0", 2L),
+        entry("500000.0-*", 0L));
     // But facet on coverage does well take into into filters
     assertThat(facets.get(COVERAGE)).containsExactly(
-      entry("*-30.0", 3L),
-      entry("30.0-50.0", 0L),
-      entry("50.0-70.0", 0L),
-      entry("70.0-80.0", 0L),
-      entry("80.0-*", 0L));
+        entry("*-30.0", 3L),
+        entry("30.0-50.0", 0L),
+        entry("50.0-70.0", 0L),
+        entry("70.0-80.0", 0L),
+        entry("80.0-*", 0L));
   }
 
   @Test
   public void facet_ncloc_contains_only_projects_authorized_for_user() throws Exception {
     // User can see these projects
     indexForUser(USER1,
-      // docs with ncloc<1K
-      newDoc(NCLOC, 0d),
-      newDoc(NCLOC, 100d),
-      newDoc(NCLOC, 999d),
-      // docs with ncloc>=1K and ncloc<10K
-      newDoc(NCLOC, 1_000d),
-      newDoc(NCLOC, 9_999d));
+        // docs with ncloc<1K
+        newDoc(NCLOC, 0d),
+        newDoc(NCLOC, 100d),
+        newDoc(NCLOC, 999d),
+        // docs with ncloc>=1K and ncloc<10K
+        newDoc(NCLOC, 1_000d),
+        newDoc(NCLOC, 9_999d));
 
     // User cannot see these projects
     indexForUser(USER2,
-      // doc with ncloc>=10K and ncloc<100K
-      newDoc(NCLOC, 11_000d),
-      // doc with ncloc>=100K and ncloc<500K
-      newDoc(NCLOC, 499_000d),
-      // doc with ncloc>= 500K
-      newDoc(NCLOC, 501_000d));
-
-    userSession.login(USER1);
+        // doc with ncloc>=10K and ncloc<100K
+        newDoc(NCLOC, 11_000d),
+        // doc with ncloc>=100K and ncloc<500K
+        newDoc(NCLOC, 499_000d),
+        // doc with ncloc>= 500K
+        newDoc(NCLOC, 501_000d));
+
+    userSession.logIn(USER1);
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(NCLOC)).getFacets();
 
     assertThat(facets.get(NCLOC)).containsExactly(
-      entry("*-1000.0", 3L),
-      entry("1000.0-10000.0", 2L),
-      entry("10000.0-100000.0", 0L),
-      entry("100000.0-500000.0", 0L),
-      entry("500000.0-*", 0L));
+        entry("*-1000.0", 3L),
+        entry("1000.0-10000.0", 2L),
+        entry("10000.0-100000.0", 0L),
+        entry("100000.0-500000.0", 0L),
+        entry("500000.0-*", 0L));
   }
 
   @Test
   public void facet_coverage() {
     index(
-      // 3 docs with coverage<30%
-      newDoc(COVERAGE, 0d),
-      newDoc(COVERAGE, 0d),
-      newDoc(COVERAGE, 29d),
-      // 2 docs with coverage>=30% and coverage<50%
-      newDoc(COVERAGE, 30d),
-      newDoc(COVERAGE, 49d),
-      // 4 docs with coverage>=50% and coverage<70%
-      newDoc(COVERAGE, 50d),
-      newDoc(COVERAGE, 60d),
-      newDoc(COVERAGE, 60d),
-      newDoc(COVERAGE, 69d),
-      // 2 docs with coverage>=70% and coverage<80%
-      newDoc(COVERAGE, 70d),
-      newDoc(COVERAGE, 79d),
-      // 5 docs with coverage>= 80%
-      newDoc(COVERAGE, 80d),
-      newDoc(COVERAGE, 80d),
-      newDoc(COVERAGE, 90d),
-      newDoc(COVERAGE, 90.5d),
-      newDoc(COVERAGE, 100d));
+        // 3 docs with coverage<30%
+        newDoc(COVERAGE, 0d),
+        newDoc(COVERAGE, 0d),
+        newDoc(COVERAGE, 29d),
+        // 2 docs with coverage>=30% and coverage<50%
+        newDoc(COVERAGE, 30d),
+        newDoc(COVERAGE, 49d),
+        // 4 docs with coverage>=50% and coverage<70%
+        newDoc(COVERAGE, 50d),
+        newDoc(COVERAGE, 60d),
+        newDoc(COVERAGE, 60d),
+        newDoc(COVERAGE, 69d),
+        // 2 docs with coverage>=70% and coverage<80%
+        newDoc(COVERAGE, 70d),
+        newDoc(COVERAGE, 79d),
+        // 5 docs with coverage>= 80%
+        newDoc(COVERAGE, 80d),
+        newDoc(COVERAGE, 80d),
+        newDoc(COVERAGE, 90d),
+        newDoc(COVERAGE, 90.5d),
+        newDoc(COVERAGE, 100d));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(COVERAGE)).getFacets();
 
     assertThat(facets.get(COVERAGE)).containsExactly(
-      entry("*-30.0", 3L),
-      entry("30.0-50.0", 2L),
-      entry("50.0-70.0", 4L),
-      entry("70.0-80.0", 2L),
-      entry("80.0-*", 5L));
+        entry("*-30.0", 3L),
+        entry("30.0-50.0", 2L),
+        entry("50.0-70.0", 4L),
+        entry("70.0-80.0", 2L),
+        entry("80.0-*", 5L));
   }
 
   @Test
   public void facet_coverage_is_sticky() {
     index(
-      // docs with coverage<30%
-      newDoc(NCLOC, 999d, COVERAGE, 0d, DUPLICATION, 0d),
-      newDoc(NCLOC, 1_000d, COVERAGE, 10d, DUPLICATION, 0d),
-      newDoc(NCLOC, 9_999d, COVERAGE, 20d, DUPLICATION, 0d),
-      // docs with coverage>=30% and coverage<50%
-      newDoc(NCLOC, 10_000d, COVERAGE, 31d, DUPLICATION, 0d),
-      newDoc(NCLOC, 11_000d, COVERAGE, 40d, DUPLICATION, 0d),
-      // docs with coverage>=50% and coverage<70%
-      newDoc(NCLOC, 99_000d, COVERAGE, 50d, DUPLICATION, 0d),
-      // docs with coverage>=70% and coverage<80%
-      newDoc(NCLOC, 100_000d, COVERAGE, 71d, DUPLICATION, 0d),
-      // docs with coverage>= 80%
-      newDoc(NCLOC, 499_000d, COVERAGE, 80d, DUPLICATION, 15d),
-      newDoc(NCLOC, 501_000d, COVERAGE, 810d, DUPLICATION, 20d));
+        // docs with coverage<30%
+        newDoc(NCLOC, 999d, COVERAGE, 0d, DUPLICATION, 0d),
+        newDoc(NCLOC, 1_000d, COVERAGE, 10d, DUPLICATION, 0d),
+        newDoc(NCLOC, 9_999d, COVERAGE, 20d, DUPLICATION, 0d),
+        // docs with coverage>=30% and coverage<50%
+        newDoc(NCLOC, 10_000d, COVERAGE, 31d, DUPLICATION, 0d),
+        newDoc(NCLOC, 11_000d, COVERAGE, 40d, DUPLICATION, 0d),
+        // docs with coverage>=50% and coverage<70%
+        newDoc(NCLOC, 99_000d, COVERAGE, 50d, DUPLICATION, 0d),
+        // docs with coverage>=70% and coverage<80%
+        newDoc(NCLOC, 100_000d, COVERAGE, 71d, DUPLICATION, 0d),
+        // docs with coverage>= 80%
+        newDoc(NCLOC, 499_000d, COVERAGE, 80d, DUPLICATION, 15d),
+        newDoc(NCLOC, 501_000d, COVERAGE, 810d, DUPLICATION, 20d));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery()
-      .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LT, 30d))
-      .addMetricCriterion(new MetricCriterion(DUPLICATION, Operator.LT, 10d)),
-      new SearchOptions().addFacets(COVERAGE, NCLOC)).getFacets();
+            .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LT, 30d))
+            .addMetricCriterion(new MetricCriterion(DUPLICATION, Operator.LT, 10d)),
+        new SearchOptions().addFacets(COVERAGE, NCLOC)).getFacets();
 
     // Sticky facet on coverage does not take into account coverage filter
     assertThat(facets.get(COVERAGE)).containsExactly(
-      entry("*-30.0", 3L),
-      entry("30.0-50.0", 2L),
-      entry("50.0-70.0", 1L),
-      entry("70.0-80.0", 1L),
-      entry("80.0-*", 0L));
+        entry("*-30.0", 3L),
+        entry("30.0-50.0", 2L),
+        entry("50.0-70.0", 1L),
+        entry("70.0-80.0", 1L),
+        entry("80.0-*", 0L));
     // But facet on ncloc does well take into into filters
     assertThat(facets.get(NCLOC)).containsExactly(
-      entry("*-1000.0", 1L),
-      entry("1000.0-10000.0", 2L),
-      entry("10000.0-100000.0", 0L),
-      entry("100000.0-500000.0", 0L),
-      entry("500000.0-*", 0L));
+        entry("*-1000.0", 1L),
+        entry("1000.0-10000.0", 2L),
+        entry("10000.0-100000.0", 0L),
+        entry("100000.0-500000.0", 0L),
+        entry("500000.0-*", 0L));
   }
 
   @Test
   public void facet_coverage_contains_only_projects_authorized_for_user() throws Exception {
     // User can see these projects
     indexForUser(USER1,
-      // docs with coverage<30%
-      newDoc(COVERAGE, 0d),
-      newDoc(COVERAGE, 0d),
-      newDoc(COVERAGE, 29d),
-      // docs with coverage>=30% and coverage<50%
-      newDoc(COVERAGE, 30d),
-      newDoc(COVERAGE, 49d));
+        // docs with coverage<30%
+        newDoc(COVERAGE, 0d),
+        newDoc(COVERAGE, 0d),
+        newDoc(COVERAGE, 29d),
+        // docs with coverage>=30% and coverage<50%
+        newDoc(COVERAGE, 30d),
+        newDoc(COVERAGE, 49d));
 
     // User cannot see these projects
     indexForUser(USER2,
-      // docs with coverage>=50% and coverage<70%
-      newDoc(COVERAGE, 50d),
-      // docs with coverage>=70% and coverage<80%
-      newDoc(COVERAGE, 70d),
-      // docs with coverage>= 80%
-      newDoc(COVERAGE, 80d));
-
-    userSession.login(USER1);
+        // docs with coverage>=50% and coverage<70%
+        newDoc(COVERAGE, 50d),
+        // docs with coverage>=70% and coverage<80%
+        newDoc(COVERAGE, 70d),
+        // docs with coverage>= 80%
+        newDoc(COVERAGE, 80d));
+
+    userSession.logIn(USER1);
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(COVERAGE)).getFacets();
 
     assertThat(facets.get(COVERAGE)).containsExactly(
-      entry("*-30.0", 3L),
-      entry("30.0-50.0", 2L),
-      entry("50.0-70.0", 0L),
-      entry("70.0-80.0", 0L),
-      entry("80.0-*", 0L));
+        entry("*-30.0", 3L),
+        entry("30.0-50.0", 2L),
+        entry("50.0-70.0", 0L),
+        entry("70.0-80.0", 0L),
+        entry("80.0-*", 0L));
   }
 
   @Test
   public void facet_duplicated_lines_density() {
     index(
-      // 3 docs with duplication<3%
-      newDoc(DUPLICATION, 0d),
-      newDoc(DUPLICATION, 0d),
-      newDoc(DUPLICATION, 2.9d),
-      // 2 docs with duplication>=3% and duplication<5%
-      newDoc(DUPLICATION, 3d),
-      newDoc(DUPLICATION, 4.9d),
-      // 4 docs with duplication>=5% and duplication<10%
-      newDoc(DUPLICATION, 5d),
-      newDoc(DUPLICATION, 6d),
-      newDoc(DUPLICATION, 6d),
-      newDoc(DUPLICATION, 9.9d),
-      // 2 docs with duplication>=10% and duplication<20%
-      newDoc(DUPLICATION, 10d),
-      newDoc(DUPLICATION, 19.9d),
-      // 5 docs with duplication>= 20%
-      newDoc(DUPLICATION, 20d),
-      newDoc(DUPLICATION, 20d),
-      newDoc(DUPLICATION, 50d),
-      newDoc(DUPLICATION, 80d),
-      newDoc(DUPLICATION, 100d));
+        // 3 docs with duplication<3%
+        newDoc(DUPLICATION, 0d),
+        newDoc(DUPLICATION, 0d),
+        newDoc(DUPLICATION, 2.9d),
+        // 2 docs with duplication>=3% and duplication<5%
+        newDoc(DUPLICATION, 3d),
+        newDoc(DUPLICATION, 4.9d),
+        // 4 docs with duplication>=5% and duplication<10%
+        newDoc(DUPLICATION, 5d),
+        newDoc(DUPLICATION, 6d),
+        newDoc(DUPLICATION, 6d),
+        newDoc(DUPLICATION, 9.9d),
+        // 2 docs with duplication>=10% and duplication<20%
+        newDoc(DUPLICATION, 10d),
+        newDoc(DUPLICATION, 19.9d),
+        // 5 docs with duplication>= 20%
+        newDoc(DUPLICATION, 20d),
+        newDoc(DUPLICATION, 20d),
+        newDoc(DUPLICATION, 50d),
+        newDoc(DUPLICATION, 80d),
+        newDoc(DUPLICATION, 100d));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(DUPLICATION)).getFacets();
 
     assertThat(facets.get(DUPLICATION)).containsExactly(
-      entry("*-3.0", 3L),
-      entry("3.0-5.0", 2L),
-      entry("5.0-10.0", 4L),
-      entry("10.0-20.0", 2L),
-      entry("20.0-*", 5L));
+        entry("*-3.0", 3L),
+        entry("3.0-5.0", 2L),
+        entry("5.0-10.0", 4L),
+        entry("10.0-20.0", 2L),
+        entry("20.0-*", 5L));
   }
 
   @Test
   public void facet_duplicated_lines_density_is_sticky() {
     index(
-      // docs with duplication<3%
-      newDoc(DUPLICATION, 0d, NCLOC, 999d, COVERAGE, 0d),
-      // docs with duplication>=3% and duplication<5%
-      newDoc(DUPLICATION, 3d, NCLOC, 5000d, COVERAGE, 0d),
-      newDoc(DUPLICATION, 4.9d, NCLOC, 6000d, COVERAGE, 0d),
-      // docs with duplication>=5% and duplication<10%
-      newDoc(DUPLICATION, 5d, NCLOC, 11000d, COVERAGE, 0d),
-      // docs with duplication>=10% and duplication<20%
-      newDoc(DUPLICATION, 10d, NCLOC, 120000d, COVERAGE, 10d),
-      newDoc(DUPLICATION, 19.9d, NCLOC, 130000d, COVERAGE, 20d),
-      // docs with duplication>= 20%
-      newDoc(DUPLICATION, 20d, NCLOC, 1000000d, COVERAGE, 40d));
+        // docs with duplication<3%
+        newDoc(DUPLICATION, 0d, NCLOC, 999d, COVERAGE, 0d),
+        // docs with duplication>=3% and duplication<5%
+        newDoc(DUPLICATION, 3d, NCLOC, 5000d, COVERAGE, 0d),
+        newDoc(DUPLICATION, 4.9d, NCLOC, 6000d, COVERAGE, 0d),
+        // docs with duplication>=5% and duplication<10%
+        newDoc(DUPLICATION, 5d, NCLOC, 11000d, COVERAGE, 0d),
+        // docs with duplication>=10% and duplication<20%
+        newDoc(DUPLICATION, 10d, NCLOC, 120000d, COVERAGE, 10d),
+        newDoc(DUPLICATION, 19.9d, NCLOC, 130000d, COVERAGE, 20d),
+        // docs with duplication>= 20%
+        newDoc(DUPLICATION, 20d, NCLOC, 1000000d, COVERAGE, 40d));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery()
-      .addMetricCriterion(new MetricCriterion(DUPLICATION, Operator.LT, 10d))
-      .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LT, 30d)),
-      new SearchOptions().addFacets(DUPLICATION, NCLOC)).getFacets();
+            .addMetricCriterion(new MetricCriterion(DUPLICATION, Operator.LT, 10d))
+            .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LT, 30d)),
+        new SearchOptions().addFacets(DUPLICATION, NCLOC)).getFacets();
 
     // Sticky facet on duplication does not take into account duplication filter
     assertThat(facets.get(DUPLICATION)).containsExactly(
-      entry("*-3.0", 1L),
-      entry("3.0-5.0", 2L),
-      entry("5.0-10.0", 1L),
-      entry("10.0-20.0", 2L),
-      entry("20.0-*", 0L));
+        entry("*-3.0", 1L),
+        entry("3.0-5.0", 2L),
+        entry("5.0-10.0", 1L),
+        entry("10.0-20.0", 2L),
+        entry("20.0-*", 0L));
     // But facet on ncloc does well take into into filters
     assertThat(facets.get(NCLOC)).containsExactly(
-      entry("*-1000.0", 1L),
-      entry("1000.0-10000.0", 2L),
-      entry("10000.0-100000.0", 1L),
-      entry("100000.0-500000.0", 0L),
-      entry("500000.0-*", 0L));
+        entry("*-1000.0", 1L),
+        entry("1000.0-10000.0", 2L),
+        entry("10000.0-100000.0", 1L),
+        entry("100000.0-500000.0", 0L),
+        entry("500000.0-*", 0L));
   }
 
   @Test
   public void facet_duplicated_lines_density_contains_only_projects_authorized_for_user() throws Exception {
     // User can see these projects
     indexForUser(USER1,
-      // docs with duplication<3%
-      newDoc(DUPLICATION, 0d),
-      newDoc(DUPLICATION, 0d),
-      newDoc(DUPLICATION, 2.9d),
-      // docs with duplication>=3% and duplication<5%
-      newDoc(DUPLICATION, 3d),
-      newDoc(DUPLICATION, 4.9d));
+        // docs with duplication<3%
+        newDoc(DUPLICATION, 0d),
+        newDoc(DUPLICATION, 0d),
+        newDoc(DUPLICATION, 2.9d),
+        // docs with duplication>=3% and duplication<5%
+        newDoc(DUPLICATION, 3d),
+        newDoc(DUPLICATION, 4.9d));
 
     // User cannot see these projects
     indexForUser(USER2,
-      // docs with duplication>=5% and duplication<10%
-      newDoc(DUPLICATION, 5d),
-      // docs with duplication>=10% and duplication<20%
-      newDoc(DUPLICATION, 10d),
-      // docs with duplication>= 20%
-      newDoc(DUPLICATION, 20d));
-
-    userSession.login(USER1);
+        // docs with duplication>=5% and duplication<10%
+        newDoc(DUPLICATION, 5d),
+        // docs with duplication>=10% and duplication<20%
+        newDoc(DUPLICATION, 10d),
+        // docs with duplication>= 20%
+        newDoc(DUPLICATION, 20d));
+
+    userSession.logIn(USER1);
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(DUPLICATION)).getFacets();
 
     assertThat(facets.get(DUPLICATION)).containsExactly(
-      entry("*-3.0", 3L),
-      entry("3.0-5.0", 2L),
-      entry("5.0-10.0", 0L),
-      entry("10.0-20.0", 0L),
-      entry("20.0-*", 0L));
+        entry("*-3.0", 3L),
+        entry("3.0-5.0", 2L),
+        entry("5.0-10.0", 0L),
+        entry("10.0-20.0", 0L),
+        entry("20.0-*", 0L));
   }
 
   @Test
   public void facet_maintainability_rating() {
     index(
-      // 3 docs with rating A
-      newDoc(MAINTAINABILITY_RATING, 1d),
-      newDoc(MAINTAINABILITY_RATING, 1d),
-      newDoc(MAINTAINABILITY_RATING, 1d),
-      // 2 docs with rating B
-      newDoc(MAINTAINABILITY_RATING, 2d),
-      newDoc(MAINTAINABILITY_RATING, 2d),
-      // 4 docs with rating C
-      newDoc(MAINTAINABILITY_RATING, 3d),
-      newDoc(MAINTAINABILITY_RATING, 3d),
-      newDoc(MAINTAINABILITY_RATING, 3d),
-      newDoc(MAINTAINABILITY_RATING, 3d),
-      // 2 docs with rating D
-      newDoc(MAINTAINABILITY_RATING, 4d),
-      newDoc(MAINTAINABILITY_RATING, 4d),
-      // 5 docs with rating E
-      newDoc(MAINTAINABILITY_RATING, 5d),
-      newDoc(MAINTAINABILITY_RATING, 5d),
-      newDoc(MAINTAINABILITY_RATING, 5d),
-      newDoc(MAINTAINABILITY_RATING, 5d),
-      newDoc(MAINTAINABILITY_RATING, 5d));
+        // 3 docs with rating A
+        newDoc(MAINTAINABILITY_RATING, 1d),
+        newDoc(MAINTAINABILITY_RATING, 1d),
+        newDoc(MAINTAINABILITY_RATING, 1d),
+        // 2 docs with rating B
+        newDoc(MAINTAINABILITY_RATING, 2d),
+        newDoc(MAINTAINABILITY_RATING, 2d),
+        // 4 docs with rating C
+        newDoc(MAINTAINABILITY_RATING, 3d),
+        newDoc(MAINTAINABILITY_RATING, 3d),
+        newDoc(MAINTAINABILITY_RATING, 3d),
+        newDoc(MAINTAINABILITY_RATING, 3d),
+        // 2 docs with rating D
+        newDoc(MAINTAINABILITY_RATING, 4d),
+        newDoc(MAINTAINABILITY_RATING, 4d),
+        // 5 docs with rating E
+        newDoc(MAINTAINABILITY_RATING, 5d),
+        newDoc(MAINTAINABILITY_RATING, 5d),
+        newDoc(MAINTAINABILITY_RATING, 5d),
+        newDoc(MAINTAINABILITY_RATING, 5d),
+        newDoc(MAINTAINABILITY_RATING, 5d));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(MAINTAINABILITY_RATING)).getFacets();
 
     assertThat(facets.get(MAINTAINABILITY_RATING)).containsExactly(
-      entry("1", 3L),
-      entry("2", 2L),
-      entry("3", 4L),
-      entry("4", 2L),
-      entry("5", 5L));
+        entry("1", 3L),
+        entry("2", 2L),
+        entry("3", 4L),
+        entry("4", 2L),
+        entry("5", 5L));
   }
 
   @Test
   public void facet_maintainability_rating_is_sticky() {
     index(
-      // docs with rating A
-      newDoc(MAINTAINABILITY_RATING, 1d, NCLOC, 100d, COVERAGE, 0d),
-      newDoc(MAINTAINABILITY_RATING, 1d, NCLOC, 200d, COVERAGE, 0d),
-      newDoc(MAINTAINABILITY_RATING, 1d, NCLOC, 999d, COVERAGE, 0d),
-      // docs with rating B
-      newDoc(MAINTAINABILITY_RATING, 2d, NCLOC, 2000d, COVERAGE, 0d),
-      newDoc(MAINTAINABILITY_RATING, 2d, NCLOC, 5000d, COVERAGE, 0d),
-      // docs with rating C
-      newDoc(MAINTAINABILITY_RATING, 3d, NCLOC, 20000d, COVERAGE, 0d),
-      newDoc(MAINTAINABILITY_RATING, 3d, NCLOC, 30000d, COVERAGE, 0d),
-      newDoc(MAINTAINABILITY_RATING, 3d, NCLOC, 40000d, COVERAGE, 0d),
-      newDoc(MAINTAINABILITY_RATING, 3d, NCLOC, 50000d, COVERAGE, 0d),
-      // docs with rating D
-      newDoc(MAINTAINABILITY_RATING, 4d, NCLOC, 120000d, COVERAGE, 0d),
-      // docs with rating E
-      newDoc(MAINTAINABILITY_RATING, 5d, NCLOC, 600000d, COVERAGE, 40d),
-      newDoc(MAINTAINABILITY_RATING, 5d, NCLOC, 700000d, COVERAGE, 50d),
-      newDoc(MAINTAINABILITY_RATING, 5d, NCLOC, 800000d, COVERAGE, 60d));
+        // docs with rating A
+        newDoc(MAINTAINABILITY_RATING, 1d, NCLOC, 100d, COVERAGE, 0d),
+        newDoc(MAINTAINABILITY_RATING, 1d, NCLOC, 200d, COVERAGE, 0d),
+        newDoc(MAINTAINABILITY_RATING, 1d, NCLOC, 999d, COVERAGE, 0d),
+        // docs with rating B
+        newDoc(MAINTAINABILITY_RATING, 2d, NCLOC, 2000d, COVERAGE, 0d),
+        newDoc(MAINTAINABILITY_RATING, 2d, NCLOC, 5000d, COVERAGE, 0d),
+        // docs with rating C
+        newDoc(MAINTAINABILITY_RATING, 3d, NCLOC, 20000d, COVERAGE, 0d),
+        newDoc(MAINTAINABILITY_RATING, 3d, NCLOC, 30000d, COVERAGE, 0d),
+        newDoc(MAINTAINABILITY_RATING, 3d, NCLOC, 40000d, COVERAGE, 0d),
+        newDoc(MAINTAINABILITY_RATING, 3d, NCLOC, 50000d, COVERAGE, 0d),
+        // docs with rating D
+        newDoc(MAINTAINABILITY_RATING, 4d, NCLOC, 120000d, COVERAGE, 0d),
+        // docs with rating E
+        newDoc(MAINTAINABILITY_RATING, 5d, NCLOC, 600000d, COVERAGE, 40d),
+        newDoc(MAINTAINABILITY_RATING, 5d, NCLOC, 700000d, COVERAGE, 50d),
+        newDoc(MAINTAINABILITY_RATING, 5d, NCLOC, 800000d, COVERAGE, 60d));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery()
-      .addMetricCriterion(new MetricCriterion(MAINTAINABILITY_RATING, Operator.LT, 3d))
-      .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LT, 30d)),
-      new SearchOptions().addFacets(MAINTAINABILITY_RATING, NCLOC)).getFacets();
+            .addMetricCriterion(new MetricCriterion(MAINTAINABILITY_RATING, Operator.LT, 3d))
+            .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LT, 30d)),
+        new SearchOptions().addFacets(MAINTAINABILITY_RATING, NCLOC)).getFacets();
 
     // Sticky facet on maintainability rating does not take into account maintainability rating filter
     assertThat(facets.get(MAINTAINABILITY_RATING)).containsExactly(
-      entry("1", 3L),
-      entry("2", 2L),
-      entry("3", 4L),
-      entry("4", 1L),
-      entry("5", 0L));
+        entry("1", 3L),
+        entry("2", 2L),
+        entry("3", 4L),
+        entry("4", 1L),
+        entry("5", 0L));
     // But facet on ncloc does well take into into filters
     assertThat(facets.get(NCLOC)).containsExactly(
-      entry("*-1000.0", 3L),
-      entry("1000.0-10000.0", 2L),
-      entry("10000.0-100000.0", 0L),
-      entry("100000.0-500000.0", 0L),
-      entry("500000.0-*", 0L));
+        entry("*-1000.0", 3L),
+        entry("1000.0-10000.0", 2L),
+        entry("10000.0-100000.0", 0L),
+        entry("100000.0-500000.0", 0L),
+        entry("500000.0-*", 0L));
   }
 
   @Test
   public void facet_maintainability_rating_contains_only_projects_authorized_for_user() throws Exception {
     // User can see these projects
     indexForUser(USER1,
-      // 3 docs with rating A
-      newDoc(MAINTAINABILITY_RATING, 1d),
-      newDoc(MAINTAINABILITY_RATING, 1d),
-      newDoc(MAINTAINABILITY_RATING, 1d),
-      // 2 docs with rating B
-      newDoc(MAINTAINABILITY_RATING, 2d),
-      newDoc(MAINTAINABILITY_RATING, 2d));
+        // 3 docs with rating A
+        newDoc(MAINTAINABILITY_RATING, 1d),
+        newDoc(MAINTAINABILITY_RATING, 1d),
+        newDoc(MAINTAINABILITY_RATING, 1d),
+        // 2 docs with rating B
+        newDoc(MAINTAINABILITY_RATING, 2d),
+        newDoc(MAINTAINABILITY_RATING, 2d));
 
     // User cannot see these projects
     indexForUser(USER2,
-      // docs with rating C
-      newDoc(MAINTAINABILITY_RATING, 3d),
-      // docs with rating D
-      newDoc(MAINTAINABILITY_RATING, 4d),
-      // docs with rating E
-      newDoc(MAINTAINABILITY_RATING, 5d));
-
-    userSession.login(USER1);
+        // docs with rating C
+        newDoc(MAINTAINABILITY_RATING, 3d),
+        // docs with rating D
+        newDoc(MAINTAINABILITY_RATING, 4d),
+        // docs with rating E
+        newDoc(MAINTAINABILITY_RATING, 5d));
+
+    userSession.logIn(USER1);
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(MAINTAINABILITY_RATING)).getFacets();
 
     assertThat(facets.get(MAINTAINABILITY_RATING)).containsExactly(
-      entry("1", 3L),
-      entry("2", 2L),
-      entry("3", 0L),
-      entry("4", 0L),
-      entry("5", 0L));
+        entry("1", 3L),
+        entry("2", 2L),
+        entry("3", 0L),
+        entry("4", 0L),
+        entry("5", 0L));
   }
 
   @Test
   public void facet_reliability_rating() {
     index(
-      // 3 docs with rating A
-      newDoc(RELIABILITY_RATING, 1d),
-      newDoc(RELIABILITY_RATING, 1d),
-      newDoc(RELIABILITY_RATING, 1d),
-      // 2 docs with rating B
-      newDoc(RELIABILITY_RATING, 2d),
-      newDoc(RELIABILITY_RATING, 2d),
-      // 4 docs with rating C
-      newDoc(RELIABILITY_RATING, 3d),
-      newDoc(RELIABILITY_RATING, 3d),
-      newDoc(RELIABILITY_RATING, 3d),
-      newDoc(RELIABILITY_RATING, 3d),
-      // 2 docs with rating D
-      newDoc(RELIABILITY_RATING, 4d),
-      newDoc(RELIABILITY_RATING, 4d),
-      // 5 docs with rating E
-      newDoc(RELIABILITY_RATING, 5d),
-      newDoc(RELIABILITY_RATING, 5d),
-      newDoc(RELIABILITY_RATING, 5d),
-      newDoc(RELIABILITY_RATING, 5d),
-      newDoc(RELIABILITY_RATING, 5d));
+        // 3 docs with rating A
+        newDoc(RELIABILITY_RATING, 1d),
+        newDoc(RELIABILITY_RATING, 1d),
+        newDoc(RELIABILITY_RATING, 1d),
+        // 2 docs with rating B
+        newDoc(RELIABILITY_RATING, 2d),
+        newDoc(RELIABILITY_RATING, 2d),
+        // 4 docs with rating C
+        newDoc(RELIABILITY_RATING, 3d),
+        newDoc(RELIABILITY_RATING, 3d),
+        newDoc(RELIABILITY_RATING, 3d),
+        newDoc(RELIABILITY_RATING, 3d),
+        // 2 docs with rating D
+        newDoc(RELIABILITY_RATING, 4d),
+        newDoc(RELIABILITY_RATING, 4d),
+        // 5 docs with rating E
+        newDoc(RELIABILITY_RATING, 5d),
+        newDoc(RELIABILITY_RATING, 5d),
+        newDoc(RELIABILITY_RATING, 5d),
+        newDoc(RELIABILITY_RATING, 5d),
+        newDoc(RELIABILITY_RATING, 5d));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(RELIABILITY_RATING)).getFacets();
 
     assertThat(facets.get(RELIABILITY_RATING)).containsExactly(
-      entry("1", 3L),
-      entry("2", 2L),
-      entry("3", 4L),
-      entry("4", 2L),
-      entry("5", 5L));
+        entry("1", 3L),
+        entry("2", 2L),
+        entry("3", 4L),
+        entry("4", 2L),
+        entry("5", 5L));
   }
 
   @Test
   public void facet_security_rating() {
     index(
-      // 3 docs with rating A
-      newDoc(SECURITY_RATING, 1.0d),
-      newDoc(SECURITY_RATING, 1.0d),
-      newDoc(SECURITY_RATING, 1.0d),
-      // 2 docs with rating B
-      newDoc(SECURITY_RATING, 2.0d),
-      newDoc(SECURITY_RATING, 2.0d),
-      // 4 docs with rating C
-      newDoc(SECURITY_RATING, 3.0d),
-      newDoc(SECURITY_RATING, 3.0d),
-      newDoc(SECURITY_RATING, 3.0d),
-      newDoc(SECURITY_RATING, 3.0d),
-      // 2 docs with rating D
-      newDoc(SECURITY_RATING, 4.0d),
-      newDoc(SECURITY_RATING, 4.0d),
-      // 5 docs with rating E
-      newDoc(SECURITY_RATING, 5.0d),
-      newDoc(SECURITY_RATING, 5.0d),
-      newDoc(SECURITY_RATING, 5.0d),
-      newDoc(SECURITY_RATING, 5.0d),
-      newDoc(SECURITY_RATING, 5.0d));
+        // 3 docs with rating A
+        newDoc(SECURITY_RATING, 1.0d),
+        newDoc(SECURITY_RATING, 1.0d),
+        newDoc(SECURITY_RATING, 1.0d),
+        // 2 docs with rating B
+        newDoc(SECURITY_RATING, 2.0d),
+        newDoc(SECURITY_RATING, 2.0d),
+        // 4 docs with rating C
+        newDoc(SECURITY_RATING, 3.0d),
+        newDoc(SECURITY_RATING, 3.0d),
+        newDoc(SECURITY_RATING, 3.0d),
+        newDoc(SECURITY_RATING, 3.0d),
+        // 2 docs with rating D
+        newDoc(SECURITY_RATING, 4.0d),
+        newDoc(SECURITY_RATING, 4.0d),
+        // 5 docs with rating E
+        newDoc(SECURITY_RATING, 5.0d),
+        newDoc(SECURITY_RATING, 5.0d),
+        newDoc(SECURITY_RATING, 5.0d),
+        newDoc(SECURITY_RATING, 5.0d),
+        newDoc(SECURITY_RATING, 5.0d));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(SECURITY_RATING)).getFacets();
 
     assertThat(facets.get(SECURITY_RATING)).containsExactly(
-      entry("1", 3L),
-      entry("2", 2L),
-      entry("3", 4L),
-      entry("4", 2L),
-      entry("5", 5L));
+        entry("1", 3L),
+        entry("2", 2L),
+        entry("3", 4L),
+        entry("4", 2L),
+        entry("5", 5L));
   }
 
   @Test
   public void facet_quality_gate() {
     index(
-      // 2 docs with QG OK
-      newDoc().setQualityGate(OK.name()),
-      newDoc().setQualityGate(OK.name()),
-      // 3 docs with QG WARN
-      newDoc().setQualityGate(WARN.name()),
-      newDoc().setQualityGate(WARN.name()),
-      newDoc().setQualityGate(WARN.name()),
-      // 4 docs with QG ERROR
-      newDoc().setQualityGate(ERROR.name()),
-      newDoc().setQualityGate(ERROR.name()),
-      newDoc().setQualityGate(ERROR.name()),
-      newDoc().setQualityGate(ERROR.name()));
+        // 2 docs with QG OK
+        newDoc().setQualityGate(OK.name()),
+        newDoc().setQualityGate(OK.name()),
+        // 3 docs with QG WARN
+        newDoc().setQualityGate(WARN.name()),
+        newDoc().setQualityGate(WARN.name()),
+        newDoc().setQualityGate(WARN.name()),
+        // 4 docs with QG ERROR
+        newDoc().setQualityGate(ERROR.name()),
+        newDoc().setQualityGate(ERROR.name()),
+        newDoc().setQualityGate(ERROR.name()),
+        newDoc().setQualityGate(ERROR.name()));
 
     LinkedHashMap<String, Long> result = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(ALERT_STATUS_KEY)).getFacets().get(ALERT_STATUS_KEY);
 
     assertThat(result).containsExactly(
-      entry(ERROR.name(), 4L),
-      entry(WARN.name(), 3L),
-      entry(OK.name(), 2L));
+        entry(ERROR.name(), 4L),
+        entry(WARN.name(), 3L),
+        entry(OK.name(), 2L));
   }
 
   @Test
   public void facet_quality_gate_is_sticky() {
     index(
-      // 2 docs with QG OK
-      newDoc(NCLOC, 10d, COVERAGE, 0d).setQualityGate(OK.name()),
-      newDoc(NCLOC, 10d, COVERAGE, 0d).setQualityGate(OK.name()),
-      // 3 docs with QG WARN
-      newDoc(NCLOC, 100d, COVERAGE, 0d).setQualityGate(WARN.name()),
-      newDoc(NCLOC, 100d, COVERAGE, 0d).setQualityGate(WARN.name()),
-      newDoc(NCLOC, 100d, COVERAGE, 0d).setQualityGate(WARN.name()),
-      // 4 docs with QG ERROR
-      newDoc(NCLOC, 100d, COVERAGE, 0d).setQualityGate(ERROR.name()),
-      newDoc(NCLOC, 5000d, COVERAGE, 40d).setQualityGate(ERROR.name()),
-      newDoc(NCLOC, 12000d, COVERAGE, 50d).setQualityGate(ERROR.name()),
-      newDoc(NCLOC, 13000d, COVERAGE, 60d).setQualityGate(ERROR.name()));
+        // 2 docs with QG OK
+        newDoc(NCLOC, 10d, COVERAGE, 0d).setQualityGate(OK.name()),
+        newDoc(NCLOC, 10d, COVERAGE, 0d).setQualityGate(OK.name()),
+        // 3 docs with QG WARN
+        newDoc(NCLOC, 100d, COVERAGE, 0d).setQualityGate(WARN.name()),
+        newDoc(NCLOC, 100d, COVERAGE, 0d).setQualityGate(WARN.name()),
+        newDoc(NCLOC, 100d, COVERAGE, 0d).setQualityGate(WARN.name()),
+        // 4 docs with QG ERROR
+        newDoc(NCLOC, 100d, COVERAGE, 0d).setQualityGate(ERROR.name()),
+        newDoc(NCLOC, 5000d, COVERAGE, 40d).setQualityGate(ERROR.name()),
+        newDoc(NCLOC, 12000d, COVERAGE, 50d).setQualityGate(ERROR.name()),
+        newDoc(NCLOC, 13000d, COVERAGE, 60d).setQualityGate(ERROR.name()));
 
     Facets facets = underTest.search(new ProjectMeasuresQuery()
-      .setQualityGateStatus(ERROR)
-      .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LT, 55d)),
-      new SearchOptions().addFacets(ALERT_STATUS_KEY, NCLOC)).getFacets();
+            .setQualityGateStatus(ERROR)
+            .addMetricCriterion(new MetricCriterion(COVERAGE, Operator.LT, 55d)),
+        new SearchOptions().addFacets(ALERT_STATUS_KEY, NCLOC)).getFacets();
 
     // Sticky facet on quality gate does not take into account quality gate filter
     assertThat(facets.get(ALERT_STATUS_KEY)).containsOnly(
-      entry(OK.name(), 2L),
-      entry(WARN.name(), 3L),
-      entry(ERROR.name(), 3L));
+        entry(OK.name(), 2L),
+        entry(WARN.name(), 3L),
+        entry(ERROR.name(), 3L));
     // But facet on ncloc does well take into into filters
     assertThat(facets.get(NCLOC)).containsExactly(
-      entry("*-1000.0", 1L),
-      entry("1000.0-10000.0", 1L),
-      entry("10000.0-100000.0", 1L),
-      entry("100000.0-500000.0", 0L),
-      entry("500000.0-*", 0L));
+        entry("*-1000.0", 1L),
+        entry("1000.0-10000.0", 1L),
+        entry("10000.0-100000.0", 1L),
+        entry("100000.0-500000.0", 0L),
+        entry("500000.0-*", 0L));
   }
 
   @Test
   public void facet_quality_gate_contains_only_projects_authorized_for_user() throws Exception {
     // User can see these projects
     indexForUser(USER1,
-      // 2 docs with QG OK
-      newDoc().setQualityGate(OK.name()),
-      newDoc().setQualityGate(OK.name()),
-      // 3 docs with QG WARN
-      newDoc().setQualityGate(WARN.name()),
-      newDoc().setQualityGate(WARN.name()),
-      newDoc().setQualityGate(WARN.name()));
+        // 2 docs with QG OK
+        newDoc().setQualityGate(OK.name()),
+        newDoc().setQualityGate(OK.name()),
+        // 3 docs with QG WARN
+        newDoc().setQualityGate(WARN.name()),
+        newDoc().setQualityGate(WARN.name()),
+        newDoc().setQualityGate(WARN.name()));
 
     // User cannot see these projects
     indexForUser(USER2,
-      // 4 docs with QG ERROR
-      newDoc().setQualityGate(ERROR.name()),
-      newDoc().setQualityGate(ERROR.name()),
-      newDoc().setQualityGate(ERROR.name()),
-      newDoc().setQualityGate(ERROR.name()));
+        // 4 docs with QG ERROR
+        newDoc().setQualityGate(ERROR.name()),
+        newDoc().setQualityGate(ERROR.name()),
+        newDoc().setQualityGate(ERROR.name()),
+        newDoc().setQualityGate(ERROR.name()));
 
-    userSession.login(USER1);
+    userSession.logIn(USER1);
     LinkedHashMap<String, Long> result = underTest.search(new ProjectMeasuresQuery(), new SearchOptions().addFacets(ALERT_STATUS_KEY)).getFacets().get(ALERT_STATUS_KEY);
 
     assertThat(result).containsExactly(
-      entry(ERROR.name(), 0L),
-      entry(WARN.name(), 3L),
-      entry(OK.name(), 2L));
+        entry(ERROR.name(), 0L),
+        entry(WARN.name(), 3L),
+        entry(OK.name(), 2L));
   }
 
   private void index(ProjectMeasuresDoc... docs) {
@@ -878,9 +878,9 @@ public class ProjectMeasuresIndexTest {
 
   private static ProjectMeasuresDoc newDoc(ComponentDto project) {
     return new ProjectMeasuresDoc()
-      .setId(project.uuid())
-      .setKey(project.key())
-      .setName(project.name());
+        .setId(project.uuid())
+        .setKey(project.key())
+        .setName(project.name());
   }
 
   private static ProjectMeasuresDoc newDoc() {
index dd5ea77177986b98c1c875e7cc0928816adfb052..0ab0f4ee561b493fd98e193961ddd436ac671324 100644 (file)
@@ -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();
 
index 7cc2347b0a3ecd8e7e118a3ade66f61efbc9f45d..d463407a3f5c8026ebcde745183663fd77077dd3 100644 (file)
@@ -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);
   }
index fdd2f2a96a9cdfd5621628d722270dfbed657ad3..144800c8aca0a00168ec689e5051bb590028232e 100644 (file)
@@ -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
index 0b6e2704b8f1b74bbc95da3e9aeb9580c78b6ff9..041c5f4351c70af6b59ee54e0297e8b99deb6e1e 100644 (file)
@@ -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);
 
index f7638ab2897e19407b31a0745a5c6cad0d9440e8..d47216630110de5f8338a060a9a3e7f231bf7cfe 100644 (file)
@@ -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")
index 90932fc086b1a598f55ac71007a72c6850a96940..a7647b15a1d1dc65606681ec994709092b54ecfa 100644 (file)
@@ -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();
   }
index 9fb2fb00fce14b71845824a30bb40d2a767e1bd5..e83a8121d028fa856c56d82fccdaa62d9c4a830c 100644 (file)
@@ -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();
   }
index e95c56fa38fa9a2cfe4d2235d064bfeb08f3b73e..2c1e9ed51ed5b149e746550733904ddbef59bdbb 100644 (file)
@@ -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();
index f04e27e5fb08edd95bcbd51f4337e5e482cf547f..a9437914cc1d15a39189266df6ab5c3036d6377c 100644 (file)
@@ -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();
index 74c53952bdff4177cbcbe0258d1bda7ac9adae9f..a5fa226879b39b049963420e6128b226f31feb49 100644 (file)
@@ -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();
index 142983cad979f8205486190966dfed4563c20683..02b3dde940feed71e4f7d98120d999946ca1becb 100644 (file)
@@ -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) {
index 047c42d5571a296b8a8aeaacaced0cdc0f18d096..5b49ab1177294abd4c00f468c6388e5d14e8572d 100644 (file)
@@ -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();
index e345ae6d5b224f075a1f93aabacee50a5cd064d7..faffa94e11f691733c0169588f9ac3a18a01b38c 100644 (file)
@@ -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) {
index 3f55fab877f88ca1ec9f81479a12bb64d14da7b8..216d8cfdfebe53001a95a87a62cf6ff6ed4deaa9 100644 (file)
@@ -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;
   }
 
index 0fb4b41325b7cf12048eefa3f78509e75abf61e3..ac5dac8211ebd0b1cfa873916c4efb3ab8849934 100644 (file)
@@ -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())
index 4279261457371e3f38e292508930c01ea61f9312..3634e569b26a078e033ff0a2d4124afc7467c175 100644 (file)
@@ -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())
index 565e55b090717fe20f84a7b41c845d8c447b319d..11f7ca930555a4169702dfd83eab20e72541b070 100644 (file)
@@ -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);
     }
index d5c1a8be0b5746e9b77d5cb94e99f74c1ee80292..485dc6b35ab48d0556a1ca7688defc23110f22af 100644 (file)
@@ -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();
index 4f22e7c5f2a20c73b61591dd76327452db0921dd..893d82828e1eccdd38626ea33aa6549b278ecfb3 100644 (file)
@@ -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())
index 77cfbb440dfb5569cb72fe5d499087cefe3c2b88..590870b978d99462f374a6e57133ebddcd96ad69 100644 (file)
@@ -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())
index a446984acf76226c1291a6a50fba82867fd687ba..2bb6e4985c30c39bba78c772f203ead302cf760d 100644 (file)
@@ -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);
 
index 6bc84b237a557c5f6a491fe0222b4e223b9462ff..3224ffc42da394a45462726c43dba85b08ce6fbf 100644 (file)
@@ -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);
 
index 7ee13f82ae3f2f4438cf27c0680d50780057a2f5..fd42bea18170171b19c3acaabf429c81123fd4d6 100644 (file)
@@ -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);
 
index 41c1947e548e21f7c767a99c46f3683c223560c1..a0c275b5326a94dff0b52574e6c0909fa34cfc10 100644 (file)
@@ -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);
 
index 1ab91d2574598b62c24fa4f1810b0b9719728584..e201f7beb72c167ef65ab8b2727100a0142f6b23 100644 (file)
@@ -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);
 
index 6a8c318fc6e342384885fe2f3e879ff004f85d17..c83e92a2957f17120fbbc96dbb52b3e174555aa9 100644 (file)
@@ -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);
 
index c5c44db347d61beeee95e40e7c26c23dbde9c4c1..a68a19d5ecb7fdba417aad32323c4c99f5966890 100644 (file)
@@ -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);
   }
index 19fb9e752fcc3e38dadef20ccf4e4345268889b7..1b541324c7ed634ffc193781914a7d2255edea70 100644 (file)
@@ -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);
 
index cf621f8e255e96445f5512fb82e1293ec7908b79..d6fbe605168b0d1d67169b8b3a29341a69a7a129 100644 (file)
@@ -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 {
index 4141a091c3421e309660efde2b32e8ae9255adfd..1fefd26d6368ded2d09c291650e9c2f6b26c0277 100644 (file)
@@ -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);
 
index 3b343a29bf4bc7b1c857e2b2f39fdd89c2387b88..64a693ae937062dde02bb13914f905aa01a5d710 100644 (file)
@@ -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)
index 2173a500b19103992185e18c3b2496ef523175fa..8e1de6c2122e7bd3a81d10941ed7c420dc1737c7 100644 (file)
@@ -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);
   }
index aee00390bff658207fc96fc1744a65cefe435a58..a5decef047c17b283ae98ed5d1db525f08c2ed4e 100644 (file)
@@ -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
index 04d2d4906a5092c85601f6f15d011f7fdfa4f85f..eec5cdd3f8cb46f2707ee9d65c558b66df9e9c17 100644 (file)
@@ -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);
 
index 420388766576f4d77e55a69c1f40d4d5e2c11ff5..fc235d339dfa830dc72fffb3dde171de22675585 100644 (file)
@@ -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);
 
index ea931caf6db37ac0ec69e095387791fe21f535e0..2964ad5f7c8de0008e900cfda4052976d07f1244 100644 (file)
@@ -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);
 
index 62e4b8f3bec3e35db5d4db2b48b910b6333ecc0e..b2db2f2e4f4d5bc118093f4f8a43962b34554dc3 100644 (file)
@@ -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);
 
index ca30fa204e7a72ba181da499fcf652538f3293ce..9727db9e4d7f7ad67973d78af81cd84de9cc2874 100644 (file)
@@ -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();
   }
 }
index 6b00f554096b575609e30cc69c813c61e0a160dd..b42e2ae194bcc6023f1e5d00b1097f1f89dcfe09 100644 (file)
@@ -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();
   }
 }
index a894e880bfa87120f3c63a31f35e34ac2a2f7697..5648a823613c34807139494cdaa28be720b87ed7 100644 (file)
@@ -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();
   }
 }
index 0002bd6126f68d1f1c8c46c3190a3f9bd7ceead8..058e46ac15caafdcbd8e800bcac7bac7e695dfce 100644 (file)
@@ -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();
 
index 7d6a4d5f6ded71bdc6f1cea0f335d1503993312b..af02be7dadc61bf7c026e5a0491365ad8f1fe5c0 100644 (file)
@@ -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();
   }
 
 }
index 32392970058f9e15652d1d82e607bceff5780752..b3c93fb46d81c9e36a2a2bd7cd0e9152f6bfdcc4 100644 (file)
@@ -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);
 
index bbc97675a2a21a1a9721dad39edb4f117c893e4f..f48451d88ea057bb57cc368b66884c038ae92d81 100644 (file)
@@ -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();
   }
 }
index 0c0e2c42a4b6b0a0455a22a8193ce126699f32ff..3fb2461b1c7556a9f332ada7d7d3dd4b6b5e9476 100644 (file)
@@ -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();
   }
 
 }
index 377e0cde0d765ba78735f181e92bef126904a691..e7a0bf5fae799f224dd9ac2d6383aa8e25b627a2 100644 (file)
@@ -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();
   }
 }
index ad9460853a7e36a8e8250a8002ae5642b12032f6..26f7afad8bd6cd148aa713b359887766083a6ff7 100644 (file)
@@ -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\": [" +
       "    {" +
index a91b1c81341c5b3377f919b69a8aaa1c2a255668..be04ca772eb04bc22c51f3ad7f43a2872951563f 100644 (file)
@@ -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();
   }
 
 }
index d6d6194e1c8d677bfde65296a9afe5d4eeba4133..d9b9079eb296846907cada29924d1e46b34fe78a 100644 (file)
@@ -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();
   }
 
 }
index 3150fc0851a825bdb10a9b240f559232fb454cd0..c7a991c94794b23d68583dceac93c7fbc73aaeb4 100644 (file)
@@ -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();
   }
 }
index a46fb7cc0d2c5808bb55a0b60b1d402ecd0db558..7a7411062e25b577174c89b0c1d3c08bf941f8ee 100644 (file)
@@ -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));
index 9e95d53f8c6a75e9187255d522e8ff3537ec40fa..4e9685fd48c1177569e813187b4edf067538ce1c 100644 (file)
@@ -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()));
index 6d352a59f03e67c8edf2d338f0659f31e0a727ba..43840703549cb37fce26f9df871ad2c56cdd31a2 100644 (file)
@@ -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'");
index f918edcebaed39234bc0a3c84f7587e3ca00ec38..d4e9f4bafcd466429ed2504753db8292b9bade16 100644 (file)
@@ -63,7 +63,7 @@ public class IndexActionTest {
   @Before
   public void setUp() {
     user = db.users().insertUser("john");
-    userSession.login(user);
+    userSession.logIn(user);
   }
 
   @Test
index ca542b2abdc19a10fe33036548529315988ed726..ffff04a81e616eca120e7aef6147852e192302ba 100644 (file)
@@ -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'");
index 21081972202e02482cb91721a16fc9a9f0b28c6c..c1cba0e5c76c706afbbfa0accd22303a23829588 100644 (file)
@@ -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();
 
index 36ac14209990d8ed2c070c680910cb9acf6cd7e9..9d7ae2cf65c563e8666b6a43017f569613c41c93 100644 (file)
@@ -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);
 
index c12051d91a54c65e38d5ad1c2d608777e7f0426a..f65eec209b8bdf4b124ced225e617e1a90c9fc80 100644 (file)
@@ -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());
index eec436988d650bab241eb35886d4e8de1d80b3c3..74021169580ae9a1e2b640612c65d9c124cd8ab3 100644 (file)
@@ -76,7 +76,7 @@ public class SearchActionTest {
     underTest = new SearchAction(dbClient, userSession, componentFinder);
     ws = new WsActionTester(underTest);
 
-    userSession.login("login").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("login").setGlobalPermissions(SYSTEM_ADMIN);
   }
 
   @Test
@@ -162,13 +162,13 @@ public class SearchActionTest {
 
   @Test
   public void global_admin() throws IOException {
-    userSession.login("login").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("login").setGlobalPermissions(SYSTEM_ADMIN);
     checkItWorks();
   }
 
   @Test
   public void project_admin() throws IOException {
-    userSession.login("login");
+    userSession.logIn("login");
     ComponentDto project = insertProject();
     userSession.addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
     checkItWorks(project);
@@ -176,7 +176,7 @@ public class SearchActionTest {
 
   @Test
   public void project_user() throws IOException {
-    userSession.login("login");
+    userSession.logIn("login");
     ComponentDto project = insertProject();
     userSession.addProjectUuidPermissions(UserRole.USER, project.uuid());
     checkItWorks(project);
index d650f922628fdd7f7f8cd63ad26b1616b4773ffa..36fbe7800dcba6d5ba19eeddca762a0ca5753abe 100644 (file)
@@ -393,7 +393,7 @@ public class IndexActionTest {
 
   @Test
   public void does_not_fail_when_user_has_not_project_browse_permission() throws Exception {
-    userSession.login("project-admin").addProjectUuidPermissions(CODEVIEWER, project.uuid());
+    userSession.logIn("project-admin").addProjectUuidPermissions(CODEVIEWER, project.uuid());
     definitions.addComponent(PropertyDefinition.builder("foo").build());
     propertyDb.insertProperties(newComponentPropertyDto(project).setKey("foo").setValue("one"));
 
@@ -466,19 +466,19 @@ public class IndexActionTest {
   }
 
   private void setAuthenticatedUser() {
-    userSession.login("user");
+    userSession.logIn("user");
   }
 
   private void setUserWithBrowsePermissionOnProject() {
-    userSession.login("user").addProjectUuidPermissions(USER, project.uuid());
+    userSession.logIn("user").addProjectUuidPermissions(USER, project.uuid());
   }
 
   private void setUserAsSystemAdmin() {
-    userSession.login("admin").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(SYSTEM_ADMIN);
   }
 
   private void setUserAsProjectAdmin() {
-    userSession.login("project-admin")
+    userSession.logIn("project-admin")
       .addProjectUuidPermissions(ADMIN, project.uuid())
       .addProjectUuidPermissions(USER, project.uuid());
   }
index 955061df4ddb971c12ddf18b7e4f55daeacf0bad..5e8b1c4f5cf5f64c0abba3998f963d5dacf9992f 100644 (file)
@@ -151,7 +151,7 @@ public class QgateProjectFinderTest {
     // User can only see project 1
     dbTester.users().insertProjectPermissionOnUser(user, UserRole.USER, project1);
 
-    userSession.login(user.getLogin()).setUserId(user.getId().intValue());
+    userSession.logIn(user.getLogin()).setUserId(user.getId().intValue());
     Association result = underTest.find(
       builder()
         .gateId(Long.toString(qGate.getId()))
index 3f9d5fc860f5553b2a161f6103f8e6dbfaf5c7e0..e76e7c6a17f5295827e7d6bd6847bb2869d9843a 100644 (file)
@@ -163,7 +163,7 @@ public class AppActionTest {
 
   @Test
   public void return_edit_to_false_when_not_quality_gate_permission() throws Exception {
-    userSession.login("not-admin").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
+    userSession.logIn("not-admin").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
 
     AppWsResponse response = executeRequest();
 
@@ -172,7 +172,7 @@ public class AppActionTest {
 
   @Test
   public void return_edit_to_true_when_quality_gate_permission() throws Exception {
-    userSession.login("admin").setGlobalPermissions(QUALITY_GATE_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(QUALITY_GATE_ADMIN);
 
     AppWsResponse response = executeRequest();
 
index 8c235df8c7dcc4ed1de9d87b756a7a68b6e58b26..b2123b9c4b845f8282acc3250b04f2daee97fd6d 100644 (file)
@@ -103,11 +103,11 @@ public class CreateActionTest {
   }
 
   private void setUserAsQualityGateAdmin() {
-    userSession.login("project-admin").setGlobalPermissions(QUALITY_GATE_ADMIN);
+    userSession.logIn("project-admin").setGlobalPermissions(QUALITY_GATE_ADMIN);
   }
 
   private void setUserAsNotQualityGateAdmin() {
-    userSession.login("not-admin").setGlobalPermissions(SCAN_EXECUTION);
+    userSession.logIn("not-admin").setGlobalPermissions(SCAN_EXECUTION);
   }
 
 }
index 09fd810d9b930cc8dde35c9f78280f61174b7799..1b838b480d56fd7804284a3a4b96075459fa0b80 100644 (file)
@@ -191,10 +191,10 @@ public class CreateConditionActionTest {
   }
 
   private void setUserAsQualityGateAdmin() {
-    userSession.login("project-admin").setGlobalPermissions(QUALITY_GATE_ADMIN);
+    userSession.logIn("project-admin").setGlobalPermissions(QUALITY_GATE_ADMIN);
   }
 
   private void setUserAsNotQualityGateAdmin() {
-    userSession.login("not-admin").setGlobalPermissions(SCAN_EXECUTION);
+    userSession.logIn("not-admin").setGlobalPermissions(SCAN_EXECUTION);
   }
 }
index e54508af9685b89bcb199866f75758aae4cf87f2..0147a42704d41c6f9876a412f6a6e63af7b16c98 100644 (file)
@@ -75,7 +75,7 @@ public class DeselectActionTest {
     underTest = new DeselectAction(qualityGates, dbClient, componentFinder);
     ws = new WsActionTester(underTest);
 
-    userSession.login("login").setGlobalPermissions(QUALITY_GATE_ADMIN);
+    userSession.logIn("login").setGlobalPermissions(QUALITY_GATE_ADMIN);
   }
 
   @Test
@@ -124,7 +124,7 @@ public class DeselectActionTest {
     String gateId = String.valueOf(gate.getId());
     associateProjectToQualityGate(project.getId(), gateId);
 
-    userSession.login("login").addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
+    userSession.logIn("login").addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
 
     callByKey(gateId, project.getKey());
 
@@ -138,7 +138,7 @@ public class DeselectActionTest {
     String gateId = String.valueOf(gate.getId());
     associateProjectToQualityGate(project.getId(), gateId);
 
-    userSession.login("login").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("login").setGlobalPermissions(SYSTEM_ADMIN);
 
     callByKey(gateId, project.getKey());
 
@@ -191,7 +191,7 @@ public class DeselectActionTest {
     QualityGateDto gate = insertQualityGate();
     String gateId = String.valueOf(gate.getId());
 
-    userSession.login("login").addProjectUuidPermissions(UserRole.ISSUE_ADMIN, project.uuid());
+    userSession.logIn("login").addProjectUuidPermissions(UserRole.ISSUE_ADMIN, project.uuid());
 
     expectedException.expect(ForbiddenException.class);
 
@@ -204,7 +204,7 @@ public class DeselectActionTest {
     QualityGateDto gate = insertQualityGate();
     String gateId = String.valueOf(gate.getId());
 
-    userSession.login("login").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
+    userSession.logIn("login").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
 
     expectedException.expect(ForbiddenException.class);
 
index 47c240ea118a2d1bf140d31ed65e0993c1fd1fe4..490891a3a24bf2f6086d5db0930500761330873e 100644 (file)
@@ -136,7 +136,7 @@ public class GetByProjectActionTest {
   @Test
   public void get_with_project_admin_permission() {
     ComponentDto project = componentDb.insertProject();
-    userSession.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
+    userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
     QualityGateDto dbQualityGate = insertQualityGate("Sonar way");
     setDefaultQualityGate(dbQualityGate.getId());
 
@@ -148,7 +148,7 @@ public class GetByProjectActionTest {
   @Test
   public void get_with_project_user_permission() {
     ComponentDto project = componentDb.insertProject();
-    userSession.login().addProjectUuidPermissions(UserRole.USER, project.uuid());
+    userSession.logIn().addProjectUuidPermissions(UserRole.USER, project.uuid());
     QualityGateDto dbQualityGate = insertQualityGate("Sonar way");
     setDefaultQualityGate(dbQualityGate.getId());
 
index 1e0892d433b57669887ad0aa764cf7ecb3913c82..c8b0e9daacea161cd4cfce10b24818e1e11b0c57 100644 (file)
@@ -67,7 +67,7 @@ public class SelectActionTest {
     underTest = new SelectAction(dbClient, userSession, componentFinder);
     ws = new WsActionTester(underTest);
 
-    userSession.login("login").setGlobalPermissions(QUALITY_GATE_ADMIN);
+    userSession.logIn("login").setGlobalPermissions(QUALITY_GATE_ADMIN);
   }
 
   @Test
@@ -108,7 +108,7 @@ public class SelectActionTest {
     QualityGateDto gate = insertQualityGate();
     String gateId = String.valueOf(gate.getId());
 
-    userSession.login("login").addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
+    userSession.logIn("login").addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
 
     callByKey(gateId, project.getKey());
     assertSelected(gateId, project.getId());
@@ -120,7 +120,7 @@ public class SelectActionTest {
     QualityGateDto gate = insertQualityGate();
     String gateId = String.valueOf(gate.getId());
 
-    userSession.login("login").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("login").setGlobalPermissions(SYSTEM_ADMIN);
 
     callByKey(gateId, project.getKey());
     assertSelected(gateId, project.getId());
@@ -171,7 +171,7 @@ public class SelectActionTest {
     QualityGateDto gate = insertQualityGate();
     String gateId = String.valueOf(gate.getId());
 
-    userSession.login("login").addProjectUuidPermissions(UserRole.ISSUE_ADMIN, project.uuid());
+    userSession.logIn("login").addProjectUuidPermissions(UserRole.ISSUE_ADMIN, project.uuid());
 
     expectedException.expect(ForbiddenException.class);
     callByKey(gateId, project.getKey());
@@ -183,7 +183,7 @@ public class SelectActionTest {
     QualityGateDto gate = insertQualityGate();
     String gateId = String.valueOf(gate.getId());
 
-    userSession.login("login").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
+    userSession.logIn("login").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
 
     expectedException.expect(ForbiddenException.class);
     callByKey(gateId, project.getKey());
index 9c8acdff094891260a9b4ca3cd7d1957cc51dc5e..3074e2861dfd001291ac84438a4e87575a03b0a2 100644 (file)
@@ -199,10 +199,10 @@ public class UpdateConditionActionTest {
   }
 
   private void setUserAsQualityGateAdmin() {
-    userSession.login("project-admin").setGlobalPermissions(QUALITY_GATE_ADMIN);
+    userSession.logIn("project-admin").setGlobalPermissions(QUALITY_GATE_ADMIN);
   }
 
   private void setUserAsNotQualityGateAdmin() {
-    userSession.login("not-admin").setGlobalPermissions(SCAN_EXECUTION);
+    userSession.logIn("not-admin").setGlobalPermissions(SCAN_EXECUTION);
   }
 }
index cf9f05cb26fbbc8f8eed7fdc0bdf5591972e6d6b..61f6443c65f68eaed930c079252aaa0b4f0e0270 100644 (file)
@@ -102,7 +102,7 @@ public class QProfileServiceMediumTest {
 
   @Test
   public void count_by_all_profiles() {
-    userSessionRule.login().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     service.activate(XOO_P1_KEY, new RuleActivation(RuleTesting.XOO_X1).setSeverity("BLOCKER"));
     service.activate(XOO_P2_KEY, new RuleActivation(RuleTesting.XOO_X1).setSeverity("BLOCKER"));
@@ -117,7 +117,7 @@ public class QProfileServiceMediumTest {
 
   @Test
   public void count_by_all_deprecated_profiles() {
-    userSessionRule.login().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     RuleDto xooRule2 = newXooX2().setStatus(RuleStatus.DEPRECATED);
     RuleDto xooRule3 = newXooX3().setStatus(RuleStatus.DEPRECATED);
@@ -143,7 +143,7 @@ public class QProfileServiceMediumTest {
 
   @Test
   public void stat_for_all_profiles() {
-    userSessionRule.login().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     service.activate(XOO_P1_KEY, new RuleActivation(RuleTesting.XOO_X1).setSeverity("MINOR"));
     service.activate(XOO_P2_KEY, new RuleActivation(RuleTesting.XOO_X1).setSeverity("BLOCKER"));
@@ -161,7 +161,7 @@ public class QProfileServiceMediumTest {
 
   @Test
   public void count_by_deprecated() {
-    userSessionRule.login().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     // create deprecated rule
     RuleDto deprecatedXooRule = RuleTesting.newDto(RuleKey.of("xoo", "deprecated1"))
index fe922d32ac5634618b38d1e8a318da735826fe31..d4b001543c17dc4b1aa008dc38a5464312da051d 100644 (file)
@@ -188,7 +188,7 @@ public class RuleActivatorMediumTest {
     activation.setSeverity(BLOCKER);
     activation.setParameter("max", "7");
     activation.setParameter("min", "3");
-    userSessionRule.login().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
+    userSessionRule.logIn().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
     List<ActiveRuleChange> changes = ruleActivator.activate(dbSession, activation, profileDto);
     dbSession.commit();
     dbSession.clearCache();
@@ -508,7 +508,7 @@ public class RuleActivatorMediumTest {
     RuleActivation activation = new RuleActivation(XOO_X1);
     activation.setSeverity(BLOCKER);
     activation.setParameter("max", "7");
-    userSessionRule.login();
+    userSessionRule.logIn();
     activate(activation, XOO_P1_KEY);
 
     // deactivation
@@ -614,7 +614,7 @@ public class RuleActivatorMediumTest {
   @Test
   public void propagate_activation_update_on_child_profiles() {
     createChildProfiles();
-    userSessionRule.login();
+    userSessionRule.logIn();
 
     // activate on root profile
     RuleActivation activation = new RuleActivation(XOO_X1);
index ff74681ba94a5a0fff24deb2650701672d957b93..595e9f0674cce8d4f2890b2702ef00984f561c97 100644 (file)
@@ -124,7 +124,7 @@ public class AddProjectActionTest {
   }
 
   private void setUserAsQualityProfileAdmin() {
-    userSession.login("admin").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
   }
 
   private void executeRequest(ComponentDto project, QualityProfileDto qualityProfile) {
index 4cfa2ac88c0aab667503729fe3e53104fdf648e1..3debf3309313ae9183ecbd91e15f4cf929432e4d 100644 (file)
@@ -77,7 +77,7 @@ public class ChangeParentActionMediumTest {
     ruleIndexer = tester.get(RuleIndexer.class);
     activeRuleIndexer = tester.get(ActiveRuleIndexer.class);
     ruleIndex = tester.get(RuleIndex.class);
-    userSessionRule.login("gandalf").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("gandalf").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
   }
 
   @After
@@ -293,7 +293,7 @@ public class ChangeParentActionMediumTest {
 
   @Test(expected = ForbiddenException.class)
   public void fail_if_missing_permission() throws Exception {
-    userSessionRule.login("anakin");
+    userSessionRule.logIn("anakin");
     wsTester.newPostRequest(QProfilesWs.API_ENDPOINT, "change_parent")
       .setParam(QProfileRef.PARAM_PROFILE_KEY, "polop")
       .setParam("parentKey", "pulup")
index 49c523d5234f26646eb17479ffae8f632f4f69ed..9a76da0e348cb902fb0fb34823b1b52924393b4a 100644 (file)
@@ -59,7 +59,7 @@ public class CopyActionTest {
 
   @Test
   public void copy_nominal() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     String fromProfileKey = "xoo-sonar-way-23456";
     String toName = "Other Sonar Way";
@@ -79,7 +79,7 @@ public class CopyActionTest {
 
   @Test
   public void copy_with_parent() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     String fromProfileKey = "xoo-sonar-way-23456";
     String toName = "Other Sonar Way";
@@ -100,7 +100,7 @@ public class CopyActionTest {
 
   @Test(expected = IllegalArgumentException.class)
   public void fail_on_missing_key() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "copy")
       .setParam("name", "Other Sonar Way")
@@ -109,7 +109,7 @@ public class CopyActionTest {
 
   @Test(expected = IllegalArgumentException.class)
   public void fail_on_missing_name() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "copy")
       .setParam("key", "sonar-way-xoo1-13245")
@@ -118,7 +118,7 @@ public class CopyActionTest {
 
   @Test(expected = ForbiddenException.class)
   public void fail_on_missing_permission() throws Exception {
-    userSessionRule.login("obiwan");
+    userSessionRule.logIn("obiwan");
 
     tester.newPostRequest("api/qualityprofiles", "copy")
       .setParam("key", "sonar-way-xoo1-13245")
index 0972fa2acf9aaaa0ab9c9a13624bd3b74d12e68a..00032dacf1bbbd2df8303599737674c844d17e1a 100644 (file)
@@ -195,7 +195,7 @@ public class CreateActionTest {
   }
 
   private void setUserAsQualityProfileAdmin() {
-    userSession.login("admin").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
   }
 
   private ProfileImporter[] createImporters() {
index 494c244d32730bbf5b65a03e133721133900316e..8174d1df71857ee2347af9b08014f4b94674028c 100644 (file)
@@ -92,7 +92,7 @@ public class DeleteActionTest {
     qualityProfileDao.insertProjectProfileAssociation(project.uuid(), profileKey, session);
     session.commit();
 
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "delete").setParam("profileKey", "sonar-way-xoo1-12345").execute().assertNoContent();
 
@@ -110,7 +110,7 @@ public class DeleteActionTest {
     qualityProfileDao.insertProjectProfileAssociation(project.uuid(), profileKey, session);
     session.commit();
 
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "delete").setParam("profileName", "Sonar way").setParam("language", xoo1.getKey()).execute().assertNoContent();
 
@@ -120,37 +120,37 @@ public class DeleteActionTest {
 
   @Test(expected = ForbiddenException.class)
   public void fail_on_missing_permission() throws Exception {
-    userSessionRule.login("obiwan");
+    userSessionRule.logIn("obiwan");
     tester.newPostRequest("api/qualityprofiles", "delete").execute();
   }
 
   @Test(expected = IllegalArgumentException.class)
   public void fail_on_missing_arguments() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
     tester.newPostRequest("api/qualityprofiles", "delete").execute();
   }
 
   @Test(expected = IllegalArgumentException.class)
   public void fail_on_missing_language() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
     tester.newPostRequest("api/qualityprofiles", "delete").setParam("profileName", "Polop").execute();
   }
 
   @Test(expected = IllegalArgumentException.class)
   public void fail_on_missing_name() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
     tester.newPostRequest("api/qualityprofiles", "delete").setParam("language", xoo1.getKey()).execute();
   }
 
   @Test(expected = IllegalArgumentException.class)
   public void fail_on_too_many_arguments() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
     tester.newPostRequest("api/qualityprofiles", "delete").setParam("profileName", "Polop").setParam("language", xoo1.getKey()).setParam("profileKey", "polop").execute();
   }
 
   @Test(expected = NotFoundException.class)
   public void fail_on_unexisting_profile() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
     tester.newPostRequest("api/qualityprofiles", "delete").setParam("profileName", "Polop").setParam("language", xoo1.getKey()).execute();
   }
 }
index 7a602f022dd2e156b8ca2a32dd98eaa6390a91d8..8d829f09fda83cfdd7af0f854721d1b6ecae8b14 100644 (file)
@@ -69,7 +69,7 @@ public class ProjectsActionTest {
   public void setUp() {
     organizationDto = db.organizations().insert();
     user = db.users().insertUser(UserTesting.newUserDto().setLogin("obiwan"));
-    userSessionRule.login("obiwan").setUserId(user.getId().intValue());
+    userSessionRule.logIn("obiwan").setUserId(user.getId().intValue());
 
     createProfiles();
 
index e8eea464b03d5f982c880df5e073823116e12fd3..460099ce0da8cd573e50c766bc8f481e7f7bc2a3 100644 (file)
@@ -69,7 +69,7 @@ public class QProfilesWsMediumTest {
 
   @Rule
   public UserSessionRule userSessionRule = UserSessionRule.forServerTester(tester)
-    .login("gandalf").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    .logIn("gandalf").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
   QProfilesWs ws;
   DbClient db;
index 6a90536fd2c27ea0fc2f7dc118c95a74ad5fc474..d03b7ef79330c03f746ea892476041e0eee89896 100644 (file)
@@ -79,7 +79,7 @@ public class RenameActionTest {
 
   @Test
   public void rename_nominal() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "rename")
       .setParam("key", "sonar-way-xoo2-23456")
@@ -91,7 +91,7 @@ public class RenameActionTest {
 
   @Test(expected = BadRequestException.class)
   public void do_nothing_on_conflict() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "rename")
       .setParam("key", "sonar-way-xoo2-23456")
@@ -101,7 +101,7 @@ public class RenameActionTest {
 
   @Test(expected = IllegalArgumentException.class)
   public void fail_on_missing_key() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "rename")
       .setParam("name", "Other Sonar Way")
@@ -110,7 +110,7 @@ public class RenameActionTest {
 
   @Test(expected = IllegalArgumentException.class)
   public void fail_on_missing_name() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "rename")
       .setParam("key", "sonar-way-xoo1-13245")
@@ -119,7 +119,7 @@ public class RenameActionTest {
 
   @Test(expected = ForbiddenException.class)
   public void fail_on_missing_permission() throws Exception {
-    userSessionRule.login("obiwan");
+    userSessionRule.logIn("obiwan");
 
     tester.newPostRequest("api/qualityprofiles", "rename")
       .setParam("key", "sonar-way-xoo1-13245")
@@ -129,7 +129,7 @@ public class RenameActionTest {
 
   @Test(expected = NotFoundException.class)
   public void fail_on_unknown_profile() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "rename")
       .setParam("key", "polop")
index 3e5f0d1f005e1886e684cab0a6119ccb4d425311..801621a34c82e368dff54e1fbc4fed18b845a9a4 100644 (file)
@@ -63,7 +63,7 @@ public class RestoreActionTest {
 
   @Test
   public void restore_profile() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     QualityProfileDto profile = QualityProfileDto.createFor("xoo-sonar-way-12345")
       .setDefault(false).setLanguage("xoo").setName("Sonar way");
@@ -77,14 +77,14 @@ public class RestoreActionTest {
 
   @Test(expected = IllegalArgumentException.class)
   public void fail_on_missing_backup() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "restore").execute();
   }
 
   @Test(expected = ForbiddenException.class)
   public void fail_on_misssing_permission() throws Exception {
-    userSessionRule.login("obiwan");
+    userSessionRule.logIn("obiwan");
 
     tester.newPostRequest("api/qualityprofiles", "restore").setParam("backup", "<polop><palap/></polop>").execute();
   }
index 7112747cabde571ba2d5a9f3781d9a57ee7ea76b..ae6eb73b5e5d90b394aed574a955689974fe5706 100644 (file)
@@ -50,7 +50,7 @@ public class RestoreBuiltInActionTest {
 
   @Test
   public void return_empty_result_when_no_info_or_warning() {
-    userSession.login("himself").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
+    userSession.logIn("himself").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
     TestResponse response = tester.newRequest().setParam("language", "xoo").execute();
 
     verify(reset).resetLanguage("xoo");
@@ -59,7 +59,7 @@ public class RestoreBuiltInActionTest {
 
   @Test
   public void fail_on_unknown_language() throws Exception {
-    userSession.login("himself").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
+    userSession.logIn("himself").setGlobalPermissions(QUALITY_PROFILE_ADMIN);
     expectedException.expect(IllegalArgumentException.class);
     tester.newRequest().setParam("language", "unknown").execute();
   }
index 240df6982bf1b89c5a0b5d4c41bdd89e1a7c5713..249bb4facb1cdff3be58b90eb2c1a127287c70a3 100644 (file)
@@ -81,7 +81,7 @@ public class SetDefaultActionTest {
 
   @Test
   public void set_default_profile_using_key() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     checkDefaultProfile(xoo1Key, "sonar-way-xoo1-12345");
     checkDefaultProfile(xoo2Key, "my-sonar-way-xoo2-34567");
@@ -101,7 +101,7 @@ public class SetDefaultActionTest {
 
   @Test
   public void set_default_profile_using_language_and_name() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     tester.newPostRequest("api/qualityprofiles", "set_default").setParam("language", xoo2Key).setParam("profileName", "Sonar way").execute().assertNoContent();
 
@@ -111,7 +111,7 @@ public class SetDefaultActionTest {
 
   @Test
   public void fail_to_set_default_profile_using_key() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     try {
       tester.newPostRequest("api/qualityprofiles", "set_default").setParam("profileKey", "unknown-profile-666").execute();
@@ -125,7 +125,7 @@ public class SetDefaultActionTest {
 
   @Test
   public void fail_to_set_default_profile_using_language_and_name() throws Exception {
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
     try {
       tester.newPostRequest("api/qualityprofiles", "set_default").setParam("language", xoo2Key).setParam("profileName", "Unknown").execute();
@@ -139,7 +139,7 @@ public class SetDefaultActionTest {
 
   @Test
   public void fail_on_missing_permission() throws Exception {
-    userSessionRule.login("obiwan");
+    userSessionRule.logIn("obiwan");
 
     try {
       tester.newPostRequest("api/qualityprofiles", "set_default").setParam("profileKey", "sonar-way-xoo2-23456").execute().assertNoContent();
index b3332b42f08657a72778dc7e790298e207f08009..34a097518c027010a627445ec01c73796cd11bd7 100644 (file)
@@ -79,7 +79,7 @@ public class SearchActionTest {
 
   @Test
   public void execute_fails_with_ForbiddenException_when_user_is_not_root() {
-    userSessionRule.login();
+    userSessionRule.logIn();
 
     expectInsufficientPrivilegesForbiddenException();
 
@@ -125,7 +125,7 @@ public class SearchActionTest {
   }
 
   private UserSessionRule makeAuthenticatedUserRoot() {
-    return userSessionRule.login().setRoot();
+    return userSessionRule.logIn().setRoot();
   }
 
   private List<WsRoot.Root> executeRequest() {
index 1115022205f7b1ea1fda34c6292560a400e102d6..09b8c83d865c57cfec08919f33d0dcfa1f1bffa4 100644 (file)
@@ -86,7 +86,7 @@ public class SetRootActionTest {
 
   @Test
   public void execute_fails_with_ForbiddenException_when_user_is_not_root() {
-    userSessionRule.login();
+    userSessionRule.logIn();
 
     expectInsufficientPrivilegesForbiddenException();
 
@@ -156,7 +156,7 @@ public class SetRootActionTest {
   }
 
   private void makeAuthenticatedUserRoot() {
-    userSessionRule.login().setRoot();
+    userSessionRule.logIn().setRoot();
   }
 
   private void expectInsufficientPrivilegesForbiddenException() {
index 4901f70f3cd0745c75d09c68446023cacaa3c041..32834244fc7267fe1559efc40fa3df0720058bd5 100644 (file)
@@ -87,7 +87,7 @@ public class UnsetRootActionTest {
 
   @Test
   public void execute_fails_with_ForbiddenException_when_user_is_not_root() {
-    userSessionRule.login();
+    userSessionRule.logIn();
 
     expectInsufficientPrivilegesForbiddenException();
 
@@ -187,7 +187,7 @@ public class UnsetRootActionTest {
   }
 
   private void makeAuthenticatedUserRoot() {
-    userSessionRule.login().setRoot();
+    userSessionRule.logIn().setRoot();
   }
 
   private void expectInsufficientPrivilegesForbiddenException() {
index 49b19ff033680bee228cc424b4c84d8d461a96e6..f4be04ddbec71d64513563f43b9657c2d7ce0497 100644 (file)
@@ -117,7 +117,7 @@ public class RegisterRulesMediumTest {
     });
 
     // Create a profile and activate rule
-    userSessionRule.login().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
     db.qualityProfileDao().insert(dbSession, QProfileTesting.newXooP1());
     dbSession.commit();
     dbSession.clearCache();
@@ -149,7 +149,7 @@ public class RegisterRulesMediumTest {
     register(rules);
 
     // create a profile and activate rule
-    userSessionRule.login().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
     db.qualityProfileDao().insert(dbSession, QProfileTesting.newXooP1());
     dbSession.commit();
     dbSession.clearCache();
@@ -184,7 +184,7 @@ public class RegisterRulesMediumTest {
     });
 
     // Create profile and activate rule
-    userSessionRule.login().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+    userSessionRule.logIn().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
     db.qualityProfileDao().insert(dbSession, QProfileTesting.newXooP1());
     dbSession.commit();
     dbSession.clearCache();
index 2e913fdd7ee9b7d8c33451c7f6f205aa1bc9f9a5..7c63882908ebacfdc875e8f518a668001b298e23 100644 (file)
@@ -121,7 +121,7 @@ public class RuleServiceMediumTest {
 
   @Test
   public void delete_throws_ForbiddenException_if_not_administrator() {
-    userSessionRule.login().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
+    userSessionRule.logIn().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
 
     expectedException.expect(ForbiddenException.class);
     expectedException.expectMessage("Insufficient privileges");
index a8945a6004a18348a36bff65f69b0cd24bdfafc4..dadbad39fb46bc501fdb338de36c552faef96f29 100644 (file)
@@ -129,7 +129,7 @@ public class RuleUpdaterMediumTest {
 
   @Test
   public void set_markdown_note() {
-    userSessionRule.login("me");
+    userSessionRule.logIn("me");
 
     ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY)
       .setNoteData(null)
index fe11b2ab303fcb7208c6d56e67e74056c5d47945..abec6d10127d6126bf84327410dfa496da713f34 100644 (file)
@@ -47,7 +47,7 @@ public class CreateActionMediumTest {
   public static ServerTester tester = new ServerTester().withEsIndexes();
 
   @Rule
-  public UserSessionRule userSessionRule = UserSessionRule.forServerTester(tester).login()
+  public UserSessionRule userSessionRule = UserSessionRule.forServerTester(tester).logIn()
     .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
   WsTester wsTester;
index afb33ed0334e37a87a2fd41fe011cd99f731d82c..69ed70338140711322d3833eabba4067c29ff16d 100644 (file)
@@ -59,7 +59,7 @@ public class ShowActionMediumTest {
   public static ServerTester tester = new ServerTester().withEsIndexes();
 
   @Rule
-  public UserSessionRule userSessionRule = UserSessionRule.forServerTester(tester).login()
+  public UserSessionRule userSessionRule = UserSessionRule.forServerTester(tester).logIn()
     .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
   WsTester wsTester;
index 6c6b39fbb98ffad901284e40abfcc1eb77555304..7669fb675d4ac476c7e7fe9c756633aa9c7df42d 100644 (file)
@@ -56,7 +56,7 @@ public class UpdateActionMediumTest {
   public static ServerTester tester = new ServerTester().withEsIndexes();
 
   @Rule
-  public UserSessionRule userSessionRule = UserSessionRule.forServerTester(tester).login().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
+  public UserSessionRule userSessionRule = UserSessionRule.forServerTester(tester).logIn().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
 
   WsTester wsTester;
 
index 87a280fcf70321957825c419598a13f37f54bb11..81e91415caaa85c1526bbaa671ab8c09f4c61314 100644 (file)
@@ -141,7 +141,7 @@ public class ShowActionTest {
 
   @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);
 
     expectedException.expect(ForbiddenException.class);
 
@@ -206,6 +206,6 @@ public class ShowActionTest {
   }
 
   private void setUserAsSystemAdmin() {
-    userSession.login("admin").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(SYSTEM_ADMIN);
   }
 }
index bec48087c4960767ee08b05596890709061e7bc5..6c1079d7c97c843f7f565b2e94035934ab2b4b3f 100644 (file)
@@ -384,7 +384,7 @@ public class ListDefinitionsActionTest {
 
   @Test
   public void fail_when_user_has_not_project_browse_permission() throws Exception {
-    userSession.login("project-admin").addProjectUuidPermissions(CODEVIEWER, project.uuid());
+    userSession.logIn("project-admin").addProjectUuidPermissions(CODEVIEWER, project.uuid());
     propertyDefinitions.addComponent(PropertyDefinition.builder("foo").build());
 
     expectedException.expect(ForbiddenException.class);
@@ -471,19 +471,19 @@ public class ListDefinitionsActionTest {
   }
 
   private void setAuthenticatedUser() {
-    userSession.login("user");
+    userSession.logIn("user");
   }
 
   private void setUserWithBrowsePermissionOnProject() {
-    userSession.login("user").addProjectUuidPermissions(USER, project.uuid());
+    userSession.logIn("user").addProjectUuidPermissions(USER, project.uuid());
   }
 
   private void setUserAsSystemAdmin() {
-    userSession.login("admin").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(SYSTEM_ADMIN);
   }
 
   private void setUserAsProjectAdmin() {
-    userSession.login("project-admin")
+    userSession.logIn("project-admin")
       .addProjectUuidPermissions(ADMIN, project.uuid())
       .addProjectUuidPermissions(USER, project.uuid());
   }
index c89cf43e6429a387ecab7ac708ba01143d3a0e76..21a0910f947b884799ba1d2350a7aee7a40c1e48 100644 (file)
@@ -225,7 +225,7 @@ public class ResetActionTest {
 
   @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);
@@ -235,7 +235,7 @@ public class ResetActionTest {
 
   @Test
   public void fail_when_not_project_admin() throws Exception {
-    userSession.login("project-admin").addProjectUuidPermissions(USER, project.uuid());
+    userSession.logIn("project-admin").addProjectUuidPermissions(USER, project.uuid());
     definitions.addComponent(PropertyDefinition.builder("foo").build());
 
     expectedException.expect(ForbiddenException.class);
@@ -305,11 +305,11 @@ public class ResetActionTest {
   }
 
   private void setUserAsSystemAdmin() {
-    userSession.login("admin").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(SYSTEM_ADMIN);
   }
 
   private void setUserAsProjectAdmin() {
-    userSession.login("project-admin").addProjectUuidPermissions(ADMIN, project.uuid());
+    userSession.logIn("project-admin").addProjectUuidPermissions(ADMIN, project.uuid());
   }
 
   private void assertGlobalPropertyDoesNotExist(String key) {
index abbe380e386a9e7756d8d9a81004625b8b64e67d..41a197bd28c074891b2d59561faa358b91d13dd4 100644 (file)
@@ -737,7 +737,7 @@ public class ValuesActionTest {
 
   @Test
   public void fail_when_user_has_not_project_browse_permission() throws Exception {
-    userSession.login("project-admin").addProjectUuidPermissions(CODEVIEWER, project.uuid());
+    userSession.logIn("project-admin").addProjectUuidPermissions(CODEVIEWER, project.uuid());
     definitions.addComponent(PropertyDefinition.builder("foo").build());
 
     expectedException.expect(ForbiddenException.class);
@@ -828,19 +828,19 @@ public class ValuesActionTest {
   }
 
   private void setAuthenticatedUser() {
-    userSession.login("user");
+    userSession.logIn("user");
   }
 
   private void setUserWithBrowsePermissionOnProject() {
-    userSession.login("user").addProjectUuidPermissions(USER, project.uuid());
+    userSession.logIn("user").addProjectUuidPermissions(USER, project.uuid());
   }
 
   private void setUserAsSystemAdmin() {
-    userSession.login("admin").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(SYSTEM_ADMIN);
   }
 
   private void setUserAsProjectAdmin() {
-    userSession.login("project-admin")
+    userSession.logIn("project-admin")
       .addProjectUuidPermissions(ADMIN, project.uuid())
       .addProjectUuidPermissions(USER, project.uuid());
   }
index f0184df9dd9754bf6f10614df7e49dc6d418ba81..e71715cd6f72f978c3d73cc96783bfcbbf1528a8 100644 (file)
@@ -62,7 +62,7 @@ public class HashActionTest {
   @Test
   public void show_hashes() throws Exception {
     db.prepareDbUnit(getClass(), "shared.xml");
-    userSessionRule.login("polop").addProjectUuidPermissions(UserRole.USER, PROJECT_UUID);
+    userSessionRule.logIn("polop").addProjectUuidPermissions(UserRole.USER, PROJECT_UUID);
 
     WsTester.TestRequest request = tester.newGetRequest("api/sources", "hash").setParam("key", COMPONENT_KEY);
     assertThat(request.execute().outputAsString()).isEqualTo("987654");
@@ -71,7 +71,7 @@ public class HashActionTest {
   @Test
   public void show_hashes_on_test_file() throws Exception {
     db.prepareDbUnit(getClass(), "show_hashes_on_test_file.xml");
-    userSessionRule.login("polop").addProjectUuidPermissions(UserRole.USER, PROJECT_UUID);
+    userSessionRule.logIn("polop").addProjectUuidPermissions(UserRole.USER, PROJECT_UUID);
 
     WsTester.TestRequest request = tester.newGetRequest("api/sources", "hash").setParam("key", "ActionTest.java");
     assertThat(request.execute().outputAsString()).isEqualTo("987654");
@@ -80,7 +80,7 @@ public class HashActionTest {
   @Test
   public void hashes_empty_if_no_source() throws Exception {
     db.prepareDbUnit(getClass(), "no_source.xml");
-    userSessionRule.login("polop").addProjectUuidPermissions(UserRole.USER, PROJECT_UUID);
+    userSessionRule.logIn("polop").addProjectUuidPermissions(UserRole.USER, PROJECT_UUID);
 
     WsTester.TestRequest request = tester.newGetRequest("api/sources", "hash").setParam("key", COMPONENT_KEY);
     request.execute().assertNoContent();
@@ -88,7 +88,7 @@ public class HashActionTest {
 
   @Test
   public void fail_to_show_hashes_if_file_does_not_exist() {
-    userSessionRule.login("polop").addProjectUuidPermissions(UserRole.USER, PROJECT_UUID);
+    userSessionRule.logIn("polop").addProjectUuidPermissions(UserRole.USER, PROJECT_UUID);
     try {
       WsTester.TestRequest request = tester.newGetRequest("api/sources", "hash").setParam("key", COMPONENT_KEY);
       request.execute();
@@ -102,7 +102,7 @@ public class HashActionTest {
   public void fail_on_missing_permission() throws Exception {
     db.prepareDbUnit(getClass(), "shared.xml");
 
-    userSessionRule.login("polop");
+    userSessionRule.logIn("polop");
     tester.newGetRequest("api/sources", "hash").setParam("key", COMPONENT_KEY).execute();
   }
 }
index 4fef632343e2d8dcbd36a6197ffa8caea89482e7..99c62f088a5350a2da5d072613c8a29ff44ffbbd 100644 (file)
@@ -147,7 +147,7 @@ public class LinesActionTest {
   public void should_check_permission() throws Exception {
     insertFileWithData(FileSourceTesting.newFakeData(1).build());
 
-    userSessionRule.login("login");
+    userSessionRule.logIn("login");
 
     wsTester.newGetRequest("api/sources", "lines")
       .setParam("uuid", FILE_UUID)
@@ -232,7 +232,7 @@ public class LinesActionTest {
   }
 
   private void setUserWithValidPermission() {
-    userSessionRule.login("login").addProjectUuidPermissions(UserRole.CODEVIEWER, PROJECT_UUID);
+    userSessionRule.logIn("login").addProjectUuidPermissions(UserRole.CODEVIEWER, PROJECT_UUID);
   }
 
   private void insertFile() throws IOException {
index 8ee31d506cce4c5c412f49676fab71f086f8a5c6..6f37f9dc0955d40486fa55f8d6f84012ce1b21eb 100644 (file)
@@ -74,8 +74,8 @@ import static com.google.common.base.Preconditions.checkState;
  * {@code UserSessionRule.standalone().anonymous()}.
  * </p>
  * <p>
- * To emulate an identified user, either use method {@link #login(String)} if you want to specify the user's login, or
- * method {@link #login()} which will do the same but using the value of {@link #DEFAULT_LOGIN} as the user's login
+ * To emulate an identified user, either use method {@link #logIn(String)} if you want to specify the user's login, or
+ * method {@link #logIn()} which will do the same but using the value of {@link #DEFAULT_LOGIN} as the user's login
  * (use the latest override if you don't care about the actual value of the login, it will save noise in your test).
  * </p>
  */
@@ -102,14 +102,14 @@ public class UserSessionRule implements TestRule, UserSession {
   /**
    * Log in with the default login {@link #DEFAULT_LOGIN}
    */
-  public UserSessionRule login() {
-    return login(DEFAULT_LOGIN);
+  public UserSessionRule logIn() {
+    return logIn(DEFAULT_LOGIN);
   }
 
   /**
    * Log in with the specified login
    */
-  public UserSessionRule login(String login) {
+  public UserSessionRule logIn(String login) {
     setCurrentUserSession(new MockUserSession(login));
     return this;
   }
@@ -117,7 +117,7 @@ public class UserSessionRule implements TestRule, UserSession {
   /**
    * Log in with the specified login
    */
-  public UserSessionRule login(UserDto userDto) {
+  public UserSessionRule logIn(UserDto userDto) {
     setCurrentUserSession(new MockUserSession(userDto));
     return this;
   }
index e349965caba1fc0b13e4efa308484114bc73d0d6..9e770214847a7258183209f04e841c72d060e23f 100644 (file)
@@ -155,7 +155,7 @@ public class ComponentActionTest {
     UserDto user = userDbTester.insertUser("obiwan");
     componentDbTester.insertComponent(project);
     propertyDbTester.insertProperty(new PropertyDto().setKey("favourite").setResourceId(project.getId()).setUserId(user.getId()));
-    userSessionRule.login(user).addProjectUuidPermissions(UserRole.USER, project.uuid());
+    userSessionRule.logIn(user).addProjectUuidPermissions(UserRole.USER, project.uuid());
 
     executeAndVerify(project.key(), "return_component_info_with_favourite.json");
   }
@@ -250,7 +250,7 @@ public class ComponentActionTest {
   public void return_configuration_for_admin() throws Exception {
     UserDto user = userDbTester.insertUser();
     componentDbTester.insertComponent(project);
-    userSessionRule.login(user)
+    userSessionRule.logIn(user)
       .addProjectUuidPermissions(UserRole.USER, "abcd")
       .addProjectUuidPermissions(UserRole.ADMIN, "abcd");
 
@@ -361,7 +361,7 @@ public class ComponentActionTest {
       createQProfile("qp2", "Sonar Way Xoo", "xoo"));
     QualityGateDto qualityGateDto = dbTester.qualityGates().insertQualityGate("Sonar way");
     dbTester.qualityGates().associateProjectToQualityGate(project, qualityGateDto);
-    userSessionRule.login(user)
+    userSessionRule.logIn(user)
       .addProjectUuidPermissions(UserRole.USER, project.uuid())
       .addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
 
index f246371b7c4b16abf262e031a4b3da0c134557d6..ce5fec92fc3c44e1368ba8615639d23ce4e52afc 100644 (file)
@@ -116,7 +116,7 @@ public class GlobalActionTest {
   @Test
   public void return_global_pages_for_user() throws Exception {
     init(createPages(), new ResourceTypeTree[] {});
-    userSessionRule.login("obiwan");
+    userSessionRule.logIn("obiwan");
 
     executeAndVerify("global_pages_for_user.json");
   }
@@ -124,7 +124,7 @@ public class GlobalActionTest {
   @Test
   public void return_global_pages_for_admin_user() throws Exception {
     init(createPages(), new ResourceTypeTree[] {});
-    userSessionRule.login("obiwan").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
+    userSessionRule.logIn("obiwan").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
 
     executeAndVerify("global_pages_for_admin.json");
   }
index 390c5a17ff0db1de97b4dbde8d5d06e17f5d0032..3db1e030d0141bb44a3b1a51704f6e47723bcac3 100644 (file)
@@ -78,7 +78,7 @@ public class OrganizationActionTest {
   public void verify_example() {
 
     OrganizationDto defaultOrganization = dbTester.getDefaultOrganization();
-    userSession.login().addOrganizationPermission(defaultOrganization.getUuid(), "admin");
+    userSession.logIn().addOrganizationPermission(defaultOrganization.getUuid(), "admin");
 
     TestResponse response = executeRequest(defaultOrganization);
 
@@ -95,7 +95,7 @@ public class OrganizationActionTest {
 
   @Test
   public void returns_non_admin_and_default_true_when_user_logged_in_but_not_admin_and_key_is_the_default_organization() {
-    userSession.login();
+    userSession.logIn();
 
     TestResponse response = executeRequest(dbTester.getDefaultOrganization());
 
@@ -105,7 +105,7 @@ public class OrganizationActionTest {
   @Test
   public void returns_admin_and_default_true_when_user_logged_in_and_admin_and_key_is_the_default_organization() {
     OrganizationDto defaultOrganization = dbTester.getDefaultOrganization();
-    userSession.login().addOrganizationPermission(defaultOrganization.getUuid(), "admin");
+    userSession.logIn().addOrganizationPermission(defaultOrganization.getUuid(), "admin");
 
     TestResponse response = executeRequest(defaultOrganization);
 
@@ -132,7 +132,7 @@ public class OrganizationActionTest {
   @Test
   public void returns_non_admin_and_default_false_when_user_logged_in_but_not_admin_and_key_is_not_the_default_organization() {
     OrganizationDto organization = dbTester.organizations().insert();
-    userSession.login();
+    userSession.logIn();
 
     TestResponse response = executeRequest(organization);
 
@@ -142,7 +142,7 @@ public class OrganizationActionTest {
   @Test
   public void returns_admin_and_default_false_when_user_logged_in_and_admin_and_key_is_not_the_default_organization() {
     OrganizationDto organization = dbTester.organizations().insert();
-    userSession.login().addOrganizationPermission(organization.getUuid(), "admin");
+    userSession.logIn().addOrganizationPermission(organization.getUuid(), "admin");
 
     TestResponse response = executeRequest(organization);
 
index 41163d4a98a49ae3bb5a9e1e649f3bc2bf1f1cd0..bc3087da5952bc0059563d204687879673c79f35 100644 (file)
@@ -125,7 +125,7 @@ public class UploadActionTest {
 
   @Test
   public void fail_if_not_system_admin() throws Exception {
-    userSession.login().setGlobalPermissions(PROVISIONING);
+    userSession.logIn().setGlobalPermissions(PROVISIONING);
 
     expectedException.expect(ForbiddenException.class);
     call(newInputStream(plugin.toPath()), PLUGIN_NAME);
@@ -138,7 +138,7 @@ public class UploadActionTest {
   }
 
   private void setSystemAdminUser() {
-    userSession.login().setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn().setGlobalPermissions(SYSTEM_ADMIN);
   }
 
   private void assertPluginIsUploaded(String pluginName) {
index 065e5ba001ea687f97e465c1efd322f1b699e953..1cc924de603b751345cd682b835b6bf956175b45 100644 (file)
@@ -67,7 +67,7 @@ public class ChangePasswordActionTest {
   public EsTester esTester = new EsTester(new UserIndexDefinition(settings));
 
   @Rule
-  public UserSessionRule userSessionRule = UserSessionRule.standalone().login("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
+  public UserSessionRule userSessionRule = UserSessionRule.standalone().logIn("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
 
   private WsTester tester;
   private DbClient dbClient;
@@ -101,7 +101,7 @@ public class ChangePasswordActionTest {
   public void fail_on_missing_permission() throws Exception {
     createUser();
 
-    userSessionRule.login("polop");
+    userSessionRule.logIn("polop");
     tester.newPostRequest("api/users", "change_password")
       .setParam("login", "john")
       .execute();
@@ -138,7 +138,7 @@ public class ChangePasswordActionTest {
     session.clearCache();
     String originalPassword = dbClient.userDao().selectOrFailByLogin(session, "john").getCryptedPassword();
 
-    userSessionRule.login("john");
+    userSessionRule.logIn("john");
     tester.newPostRequest("api/users", "change_password")
       .setParam("login", "john")
       .setParam("previousPassword", "Valar Dohaeris")
@@ -156,7 +156,7 @@ public class ChangePasswordActionTest {
     createUser();
     session.clearCache();
 
-    userSessionRule.login("john");
+    userSessionRule.logIn("john");
     tester.newPostRequest("api/users", "change_password")
       .setParam("login", "john")
       .setParam("password", "Valar Morghulis")
@@ -168,7 +168,7 @@ public class ChangePasswordActionTest {
     createUser();
     session.clearCache();
 
-    userSessionRule.login("john");
+    userSessionRule.logIn("john");
     tester.newPostRequest("api/users", "change_password")
       .setParam("login", "john")
       .setParam("previousPassword", "I dunno")
index ae939e0c799658fd7e79bc8083f65edd95a4f84a..983b62771b25c02bbf2ac63b691222597c8277da 100644 (file)
@@ -160,7 +160,7 @@ public class CreateActionTest {
 
   @Test
   public void reactivate_user() throws Exception {
-    userSessionRule.login("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
+    userSessionRule.logIn("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
 
     db.users().insertUser(newUserDto("john", "John", "john@email.com"));
     db.getDbClient().userDao().deactivateUserByLogin(db.getSession(), "john");
@@ -234,7 +234,7 @@ public class CreateActionTest {
 
   @Test(expected = ForbiddenException.class)
   public void fail_on_missing_permission() throws Exception {
-    userSessionRule.login("not_admin");
+    userSessionRule.logIn("not_admin");
 
     tester.newPostRequest("api/users", "create")
       .setParam("login", "john")
@@ -245,7 +245,7 @@ public class CreateActionTest {
   }
 
   private void authenticateAsAdmin() {
-    userSessionRule.login("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
+    userSessionRule.logIn("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
   }
 
   private void executeRequest(String login) throws Exception {
index 6b4b51ddd6826dcf6b088177f3b39bff7f32b2ce..505dd60c02b0cb19cfc049360744904c2ec6dae4 100644 (file)
@@ -53,7 +53,7 @@ public class CurrentActionTest {
 
   @Test
   public void json_example() throws Exception {
-    userSessionRule.login("obiwan.kenobi").setName("Obiwan Kenobi")
+    userSessionRule.logIn("obiwan.kenobi").setName("Obiwan Kenobi")
       .setGlobalPermissions(GlobalPermissions.ALL.toArray(new String[0]));
     UserDto obiwan = db.users().insertUser(
       newUserDto("obiwan.kenobi", "Obiwan Kenobi", "obiwan.kenobi@starwars.com")
index 6c4d8828714883527970278774d77a118d5831fe..fee8bc6c5dd10957b5ab609bffcf678ae4350986 100644 (file)
@@ -117,7 +117,7 @@ public class DeactivateActionTest {
   @Test
   public void cannot_deactivate_self() throws Exception {
     UserDto user = createUser();
-    userSession.login(user.getLogin()).setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn(user.getLogin()).setGlobalPermissions(SYSTEM_ADMIN);
 
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Self-deactivation is not possible");
@@ -137,7 +137,7 @@ public class DeactivateActionTest {
 
   @Test
   public void deactivation_requires_administrator_permission() throws Exception {
-    userSession.login();
+    userSession.logIn();
 
     expectedException.expect(ForbiddenException.class);
     expectedException.expectMessage("Insufficient privileges");
@@ -230,7 +230,7 @@ public class DeactivateActionTest {
   }
 
   private void loginAsAdmin() {
-    userSession.login("admin").setGlobalPermissions(SYSTEM_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(SYSTEM_ADMIN);
   }
 
   private TestResponse deactivate(String login) {
index 82a714de4483354165f2ed8f86ba8b63199e0163..c6d4690c18e4e31d13e7cc0b800584022ad44673 100644 (file)
@@ -69,7 +69,7 @@ public class GroupsActionTest {
     session.commit();
 
     tester = new WsTester(new UsersWs(new GroupsAction(dbClient, userSession)));
-    userSession.login("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
   }
 
   @After
@@ -85,7 +85,7 @@ public class GroupsActionTest {
 
   @Test(expected = ForbiddenException.class)
   public void fail_on_missing_permission() throws Exception {
-    userSession.login("not-admin");
+    userSession.logIn("not-admin");
     tester.newGetRequest("api/users", "groups")
       .setParam("login", "john").execute();
   }
index ce6d5ce19954ac3b5c067f411836c31497434b08..b1ce2579bbb467e0e51de492a0584ba00ff4fdf8 100644 (file)
@@ -261,11 +261,11 @@ public class SearchActionTest {
   }
 
   private void loginAsAdmin() {
-    userSession.login("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
+    userSession.logIn("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
   }
 
   private void loginAsSimpleUser() {
-    userSession.login("user");
+    userSession.logIn("user");
   }
 
 }
index f375c0de446f3d0b29c8bf1e15862cc0ae55e011..9bae14c8744f3051594914648fba11ea736a010f 100644 (file)
@@ -59,7 +59,7 @@ public class UpdateActionTest {
   @Rule
   public EsTester esTester = new EsTester(new UserIndexDefinition(settings));
   @Rule
-  public UserSessionRule userSessionRule = UserSessionRule.standalone().login("admin")
+  public UserSessionRule userSessionRule = UserSessionRule.standalone().logIn("admin")
     .setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
 
   private DbClient dbClient = dbTester.getDbClient();
@@ -83,7 +83,7 @@ public class UpdateActionTest {
   public void fail_on_missing_permission() throws Exception {
     createUser();
 
-    userSessionRule.login("polop");
+    userSessionRule.logIn("polop");
     tester.newPostRequest("api/users", "update")
       .setParam("login", "john")
       .execute();
index d46871959bfeddaaca890ea5a57d18bc8d8c1459..f54a552a7aa610480b255351cf572e01775130dd 100644 (file)
@@ -271,7 +271,7 @@ public class AddUserActionTest {
   }
 
   private void loginAsAdmin(OrganizationDto org) {
-    userSession.login().addOrganizationPermission(org.getUuid(), SYSTEM_ADMIN);
+    userSession.logIn().addOrganizationPermission(org.getUuid(), SYSTEM_ADMIN);
   }
 
   private GroupWsSupport newGroupWsSupport() {
index df87437fe3dc44251e951191cd8cd0c2da0dd617..6fe75f2dae3a0800c75e7a39e6f62f390a7294a9 100644 (file)
@@ -101,7 +101,7 @@ public class CreateActionTest {
 
   @Test
   public void fail_if_not_administrator() throws Exception {
-    userSession.login("not-admin");
+    userSession.logIn("not-admin");
 
     expectedException.expect(ForbiddenException.class);
 
@@ -219,7 +219,7 @@ public class CreateActionTest {
   }
 
   private void loginAsAdmin(OrganizationDto org) {
-    userSession.login().addOrganizationPermission(org.getUuid(), GlobalPermissions.SYSTEM_ADMIN);
+    userSession.logIn().addOrganizationPermission(org.getUuid(), GlobalPermissions.SYSTEM_ADMIN);
   }
 
   private GroupWsSupport newGroupWsSupport() {
index 9b252537d4d3f284080655230b1ec93478556b27..ce9147f1d9e221b26f5fa1a1450320a65635f63a 100644 (file)
@@ -369,7 +369,7 @@ public class DeleteActionTest {
   }
 
   private void loginAsAdmin(OrganizationDto org) {
-    userSession.login().addOrganizationPermission(org.getUuid(), GlobalPermissions.SYSTEM_ADMIN);
+    userSession.logIn().addOrganizationPermission(org.getUuid(), GlobalPermissions.SYSTEM_ADMIN);
   }
 
   private WsTester.TestRequest newRequest() {
index 618811e3441df44f9b19497b183424f9f8fa1c48..d5499d4d8802f7fb3ec6a4c963ff7300cc944d3b 100644 (file)
@@ -297,7 +297,7 @@ public class RemoveUserActionTest {
   }
 
   private void loginAsAdmin(OrganizationDto org) {
-    userSession.login("admin").addOrganizationPermission(org.getUuid(), GlobalPermissions.SYSTEM_ADMIN);
+    userSession.logIn("admin").addOrganizationPermission(org.getUuid(), GlobalPermissions.SYSTEM_ADMIN);
   }
 
   private void verifyUnchanged(UserDto user) {
index e50e676aee79cbd41c6314be0bbff460ac86a99a..951970176473a0867a37c56c5d437517954cd562 100644 (file)
@@ -191,7 +191,7 @@ public class SearchActionTest {
   }
 
   private void loginAsDefaultOrgAdmin() {
-    userSession.login("user").addOrganizationPermission(db.getDefaultOrganization().getUuid(), SYSTEM_ADMIN);
+    userSession.logIn("user").addOrganizationPermission(db.getDefaultOrganization().getUuid(), SYSTEM_ADMIN);
   }
 
   private GroupWsSupport newGroupWsSupport() {
index 0970f8c2052a7763946f8b4a771e980d131b6f1d..47db097c9c6e1655b1d9de613231eba64e9f8710 100644 (file)
@@ -170,7 +170,7 @@ public class UpdateActionTest {
   @Test
   public void require_admin_permission_on_organization() throws Exception {
     GroupDto group = db.users().insertGroup();
-    userSession.login("not-admin");
+    userSession.logIn("not-admin");
 
     expectedException.expect(ForbiddenException.class);
 
@@ -292,6 +292,6 @@ public class UpdateActionTest {
   }
 
   private void loginAsAdmin(OrganizationDto org) {
-    userSession.login().addOrganizationPermission(org.getUuid(), GlobalPermissions.SYSTEM_ADMIN);
+    userSession.logIn().addOrganizationPermission(org.getUuid(), GlobalPermissions.SYSTEM_ADMIN);
   }
 }
index 99e92aa08a5cb92ad013cf31c822ae45454a4bf4..fc8e631a37ed9879685106e03feda26691963f40 100644 (file)
@@ -78,7 +78,7 @@ public class UsersActionTest {
   @Test
   public void fail_if_not_admin_of_organization() throws Exception {
     GroupDto group = db.users().insertGroup();
-    userSession.login("not-admin");
+    userSession.logIn("not-admin");
 
     expectedException.expect(ForbiddenException.class);
 
@@ -273,6 +273,6 @@ public class UsersActionTest {
   }
 
   private void loginAsAdmin(OrganizationDto org) {
-    userSession.login().addOrganizationPermission(org.getUuid(), GlobalPermissions.SYSTEM_ADMIN);
+    userSession.logIn().addOrganizationPermission(org.getUuid(), GlobalPermissions.SYSTEM_ADMIN);
   }
 }
index 2bcf87df2fd704a5c306b218b13bb74a878d2cec..1949a38fc64fdf4bb321a8fef1f279eb355d6245 100644 (file)
@@ -71,7 +71,7 @@ public class GenerateActionTest {
     when(tokenGenerator.generate()).thenReturn("123456789");
     when(tokenGenerator.hash(anyString())).thenReturn("987654321");
     userSession
-      .login()
+      .logIn()
       .setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
     db.users().insertUser(newUserDto().setLogin(GRACE_HOPPER));
     db.users().insertUser(newUserDto().setLogin(ADA_LOVELACE));
@@ -93,7 +93,7 @@ public class GenerateActionTest {
 
   @Test
   public void a_user_can_generate_token_for_himself() {
-    userSession.login(GRACE_HOPPER).setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
+    userSession.logIn(GRACE_HOPPER).setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
 
     GenerateWsResponse response = newRequest(null, TOKEN_NAME);
 
@@ -145,7 +145,7 @@ public class GenerateActionTest {
 
   @Test
   public void fail_if_insufficient_privileges() {
-    userSession.login(ADA_LOVELACE).setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
+    userSession.logIn(ADA_LOVELACE).setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
     expectedException.expect(ForbiddenException.class);
 
     newRequest(GRACE_HOPPER, TOKEN_NAME);
index 9a25f4148fabaa771045ed1da291b85d66a3f806..40cf1aa3c341e585243ccf0d60e90eab798eeb6f 100644 (file)
@@ -60,7 +60,7 @@ public class RevokeActionTest {
   @Before
   public void setUp() {
     userSession
-      .login()
+      .logIn()
       .setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
 
     ws = new WsActionTester(
@@ -83,7 +83,7 @@ public class RevokeActionTest {
 
   @Test
   public void user_can_delete_its_own_tokens() {
-    userSession.login(GRACE_HOPPER).setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
+    userSession.logIn(GRACE_HOPPER).setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
     insertUserToken(newUserToken().setLogin(GRACE_HOPPER).setName("token-to-delete"));
 
     String response = newRequest(null, "token-to-delete");
@@ -101,7 +101,7 @@ public class RevokeActionTest {
 
   @Test
   public void fail_if_insufficient_privileges() {
-    userSession.login().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
+    userSession.logIn().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
     insertUserToken(newUserToken().setLogin(GRACE_HOPPER).setName(TOKEN_NAME));
     expectedException.expect(ForbiddenException.class);
 
index 61a408b51ee1fa509059f89bd471909927d71be3..551168baa3458e6894f702d2bb2dcb4ed03c87f0 100644 (file)
@@ -62,7 +62,7 @@ public class SearchActionTest {
 
   @Before
   public void setUp() {
-    userSession.login().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
+    userSession.logIn().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
     db.users().insertUser(newUserDto().setLogin(GRACE_HOPPER));
     db.users().insertUser(newUserDto().setLogin(ADA_LOVELACE));
   }
@@ -96,7 +96,7 @@ public class SearchActionTest {
 
   @Test
   public void a_user_can_search_its_own_token() {
-    userSession.login(GRACE_HOPPER).setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
+    userSession.logIn(GRACE_HOPPER).setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
     dbClient.userTokenDao().insert(dbSession, newUserToken()
       .setCreatedAt(1448523067221L)
       .setName("Project scan on Travis")
@@ -118,7 +118,7 @@ public class SearchActionTest {
 
   @Test
   public void fail_when_insufficient_privileges() {
-    userSession.login().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
+    userSession.logIn().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
     expectedException.expect(ForbiddenException.class);
 
     newRequest(GRACE_HOPPER);
index d8384fd115d7550100681ef7fff931cfd93aa338..6d137d7c9ae6c959d39d2226cf1c910bbc7db758 100644 (file)
@@ -83,7 +83,7 @@ public class WebhookDeliveriesActionTest {
 
   @Test
   public void search_by_component_and_return_no_records() throws Exception {
-    userSession.login().addProjectUuidPermissions(project.uuid(), UserRole.ADMIN);
+    userSession.logIn().addProjectUuidPermissions(project.uuid(), UserRole.ADMIN);
 
     Webhooks.DeliveriesWsResponse response = Webhooks.DeliveriesWsResponse.parseFrom(ws.newRequest()
       .setMediaType(MediaTypes.PROTOBUF)
@@ -96,7 +96,7 @@ public class WebhookDeliveriesActionTest {
 
   @Test
   public void search_by_task_and_return_no_records() throws Exception {
-    userSession.login().addProjectUuidPermissions(project.uuid(), UserRole.ADMIN);
+    userSession.logIn().addProjectUuidPermissions(project.uuid(), UserRole.ADMIN);
 
     Webhooks.DeliveriesWsResponse response = Webhooks.DeliveriesWsResponse.parseFrom(ws.newRequest()
       .setMediaType(MediaTypes.PROTOBUF)
@@ -121,7 +121,7 @@ public class WebhookDeliveriesActionTest {
       .setHttpStatus(200);
     dbClient.webhookDeliveryDao().insert(db.getSession(), dto);
     db.commit();
-    userSession.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
+    userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
 
     String json = ws.newRequest()
       .setParam("componentKey", project.getKey())
@@ -140,7 +140,7 @@ public class WebhookDeliveriesActionTest {
     dbClient.webhookDeliveryDao().insert(db.getSession(), dto2);
     dbClient.webhookDeliveryDao().insert(db.getSession(), dto3);
     db.commit();
-    userSession.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
+    userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
 
     Webhooks.DeliveriesWsResponse response = Webhooks.DeliveriesWsResponse.parseFrom(ws.newRequest()
       .setMediaType(MediaTypes.PROTOBUF)
@@ -157,7 +157,7 @@ public class WebhookDeliveriesActionTest {
       .setComponentUuid(project.uuid());
     dbClient.webhookDeliveryDao().insert(db.getSession(), dto);
     db.commit();
-    userSession.login().addProjectUuidPermissions(UserRole.USER, project.uuid());
+    userSession.logIn().addProjectUuidPermissions(UserRole.USER, project.uuid());
 
     expectedException.expect(ForbiddenException.class);
     expectedException.expectMessage("Insufficient privileges");
@@ -173,7 +173,7 @@ public class WebhookDeliveriesActionTest {
       .setComponentUuid(project.uuid());
     dbClient.webhookDeliveryDao().insert(db.getSession(), dto);
     db.commit();
-    userSession.login().addProjectUuidPermissions(UserRole.USER, project.uuid());
+    userSession.logIn().addProjectUuidPermissions(UserRole.USER, project.uuid());
 
     expectedException.expect(ForbiddenException.class);
     expectedException.expectMessage("Insufficient privileges");
@@ -185,7 +185,7 @@ public class WebhookDeliveriesActionTest {
 
   @Test
   public void throw_IAE_if_both_component_and_task_parameters_are_set() throws Exception {
-    userSession.login();
+    userSession.logIn();
 
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("Either parameter 'ceTaskId' or 'componentKey' must be defined");
index 53db850558418145263882f559aba00eaf6e9c0b..10d9290c493d47e34a6ff78813bf141f0793fbaa 100644 (file)
@@ -84,7 +84,7 @@ public class WebhookDeliveryActionTest {
 
   @Test
   public void return_404_if_delivery_does_not_exist() throws Exception {
-    userSession.login();
+    userSession.logIn();
 
     expectedException.expect(NotFoundException.class);
 
@@ -109,7 +109,7 @@ public class WebhookDeliveryActionTest {
       .setPayload("{\"status\"=\"SUCCESS\"}");
     dbClient.webhookDeliveryDao().insert(db.getSession(), dto);
     db.commit();
-    userSession.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
+    userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
 
     String json = ws.newRequest()
       .setParam("deliveryId", dto.getUuid())
@@ -129,7 +129,7 @@ public class WebhookDeliveryActionTest {
       .setErrorStacktrace("IOException -> can not connect");
     dbClient.webhookDeliveryDao().insert(db.getSession(), dto);
     db.commit();
-    userSession.login().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
+    userSession.logIn().addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
 
     Webhooks.DeliveryWsResponse response = Webhooks.DeliveryWsResponse.parseFrom(ws.newRequest()
       .setMediaType(MediaTypes.PROTOBUF)
@@ -149,7 +149,7 @@ public class WebhookDeliveryActionTest {
       .setComponentUuid(project.uuid());
     dbClient.webhookDeliveryDao().insert(db.getSession(), dto);
     db.commit();
-    userSession.login().addProjectUuidPermissions(UserRole.USER, project.uuid());
+    userSession.logIn().addProjectUuidPermissions(UserRole.USER, project.uuid());
 
     expectedException.expect(ForbiddenException.class);
     expectedException.expectMessage("Insufficient privileges");