]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13999 remove organizations from user WS
authorMichal Duda <michal.duda@sonarsource.com>
Mon, 14 Dec 2020 20:18:50 +0000 (21:18 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 22 Dec 2020 20:09:36 +0000 (20:09 +0000)
47 files changed:
server/sonar-db-dao/src/main/java/org/sonar/db/user/UserGroupDao.java
server/sonar-db-dao/src/main/java/org/sonar/db/user/UserGroupMapper.java
server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserGroupMapper.xml
server/sonar-db-dao/src/test/java/org/sonar/db/user/UserGroupDaoTest.java
server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java
server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java
server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/HttpHeadersAuthenticationTest.java
server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java
server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java
server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java
server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterUpdateTest.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/AddMemberAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/QProfileWsSupport.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/DeactivateAction.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ActivateRuleActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ActivateRulesActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/AddGroupActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/AddProjectActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/AddUserActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangeParentActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/CopyActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/DeactivateRuleActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/DeactivateRulesActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/DeleteActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/QProfileWsSupportTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RemoveGroupActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RemoveProjectActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RemoveUserActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RenameActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/SearchGroupsActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/SearchUsersActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ShowActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/CreateActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/CurrentActionHomepageTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/CurrentActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/SetHomepageActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/UpdateActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/UpdateLoginActionTest.java
sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java

index 73247cd9155d4d2a3ae182f3d6841a78825b82d4..9add82f0b9d288fb27ec57d9e336c62bc44e8dea 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonar.db.user;
 
+import java.util.Set;
 import org.sonar.db.Dao;
 import org.sonar.db.DbSession;
 
@@ -29,6 +30,10 @@ public class UserGroupDao implements Dao {
     return dto;
   }
 
+  public Set<String> selectUserUuidsInGroup(DbSession session, String groupUuid) {
+    return mapper(session).selectUserUuidsInGroup(groupUuid);
+  }
+
   public void delete(DbSession session, String groupUuid, String userUuid) {
     mapper(session).delete(groupUuid, userUuid);
   }
index 9e67fd7c6aa1a1d10ed30b09140946d3e6e9e0ea..58a7848f6f876c0aea35ce07ff9daba2d24b2e98 100644 (file)
  */
 package org.sonar.db.user;
 
+import java.util.Set;
 import org.apache.ibatis.annotations.Param;
 
 public interface UserGroupMapper {
 
   void insert(UserGroupDto dto);
 
+  Set<String> selectUserUuidsInGroup(@Param("groupUuid") String groupUuid);
+
   void delete(@Param("groupUuid") String groupUuid, @Param("userUuid") String userUuid);
 
   void deleteByGroupUuid(@Param("groupUuid") String groupUuid);
index 9e98f945e5fac9c8f1c20734a764ec9a7533e71d..8151f29ea8360bfc6841d501b0fec5bfcb787809 100644 (file)
     )
   </insert>
 
+  <select id="selectUserUuidsInGroup" resultType="String">
+    select gu.user_uuid
+    from groups_users gu
+    where gu.group_uuid=#{groupUuid,jdbcType=VARCHAR}
+  </select>
+
   <delete id="delete" parameterType="map">
     delete from groups_users
     where user_uuid = #{userUuid,jdbcType=VARCHAR} and
index af3333241a100f5a9f7421a920eca177ee2187f4..2fe88a7dff0965e00e234cd0b6c0e4a69e5de208 100644 (file)
  */
 package org.sonar.db.user;
 
+import java.util.Set;
 import org.junit.Rule;
 import org.junit.Test;
 import org.sonar.api.utils.System2;
-import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
 import org.sonar.db.DbTester;
 
@@ -32,10 +32,9 @@ public class UserGroupDaoTest {
 
   @Rule
   public DbTester dbTester = DbTester.create(System2.INSTANCE);
-  private DbClient dbClient = dbTester.getDbClient();
-  private DbSession dbSession = dbTester.getSession();
 
-  private UserGroupDao underTest = dbTester.getDbClient().userGroupDao();
+  private final DbSession dbSession = dbTester.getSession();
+  private final UserGroupDao underTest = dbTester.getDbClient().userGroupDao();
 
   @Test
   public void insert() {
@@ -49,6 +48,40 @@ public class UserGroupDaoTest {
     assertThat(dbTester.getDbClient().groupMembershipDao().selectGroupUuidsByUserUuid(dbTester.getSession(), user.getUuid())).containsOnly(group.getUuid());
   }
 
+  @Test
+  public void select_user_uuids_in_group() {
+    UserDto user1 = dbTester.users().insertUser();
+    UserDto user2 = dbTester.users().insertUser();
+    UserDto user3 = dbTester.users().insertUser();
+    GroupDto group1 = dbTester.users().insertGroup();
+    GroupDto group2 = dbTester.users().insertGroup();
+    UserGroupDto userGroupDto1 = new UserGroupDto().setUserUuid(user1.getUuid()).setGroupUuid(group1.getUuid());
+    UserGroupDto userGroupDto2 = new UserGroupDto().setUserUuid(user2.getUuid()).setGroupUuid(group2.getUuid());
+    UserGroupDto userGroupDto3 = new UserGroupDto().setUserUuid(user3.getUuid()).setGroupUuid(group2.getUuid());
+    underTest.insert(dbSession, userGroupDto1);
+    underTest.insert(dbSession, userGroupDto2);
+    underTest.insert(dbSession, userGroupDto3);
+    dbTester.getSession().commit();
+
+    Set<String> userUuids = underTest.selectUserUuidsInGroup(dbTester.getSession(), group2.getUuid());
+
+    assertThat(userUuids).containsExactlyInAnyOrder(user2.getUuid(), user3.getUuid());
+  }
+
+  @Test
+  public void select_user_uuids_in_group_returns_empty_set_when_nothing_found() {
+    UserDto user1 = dbTester.users().insertUser();
+    GroupDto group1 = dbTester.users().insertGroup();
+    GroupDto group2 = dbTester.users().insertGroup();
+    UserGroupDto userGroupDto1 = new UserGroupDto().setUserUuid(user1.getUuid()).setGroupUuid(group1.getUuid());
+    underTest.insert(dbSession, userGroupDto1);
+    dbTester.getSession().commit();
+
+    Set<String> userUuids = underTest.selectUserUuidsInGroup(dbTester.getSession(), group2.getUuid());
+
+    assertThat(userUuids).isEmpty();
+  }
+
   @Test
   public void delete_members_by_group_uuid() {
     UserDto user1 = dbTester.users().insertUser();
index f24d55a9cc0f5b60388c23603c67f11f7c725bff..63c66c7e3344fe1a7efec569ac14e598f1405fb7 100644 (file)
@@ -28,7 +28,6 @@ import org.sonar.db.DbSession;
 import org.sonar.db.alm.ALM;
 import org.sonar.db.alm.OrganizationAlmBindingDto;
 import org.sonar.db.organization.OrganizationDto;
-import org.sonar.db.organization.OrganizationMemberDto;
 import org.sonar.db.user.UserDto;
 import org.sonar.db.user.UserGroupDto;
 import org.sonar.server.user.index.UserIndexer;
@@ -56,12 +55,12 @@ public class MemberUpdater {
     this.userIndexer = userIndexer;
   }
 
-  public void addMember(DbSession dbSession, OrganizationDto organization, UserDto user) {
-    addMembers(dbSession, organization, singletonList(user));
+  public void addMember(DbSession dbSession, UserDto user) {
+    addMembers(dbSession, singletonList(user));
   }
 
-  public void addMembers(DbSession dbSession, OrganizationDto organization, List<UserDto> users) {
-    Set<String> currentMemberUuids = new HashSet<>(dbClient.organizationMemberDao().selectUserUuidsByOrganizationUuid(dbSession, organization.getUuid()));
+  public void addMembers(DbSession dbSession, List<UserDto> users) {
+    Set<String> currentMemberUuids = dbClient.userGroupDao().selectUserUuidsInGroup(dbSession, defaultGroupFinder.findDefaultGroup(dbSession).getUuid());
     List<UserDto> usersToAdd = users.stream()
       .filter(UserDto::isActive)
       .filter(u -> !currentMemberUuids.contains(u.getUuid()))
@@ -69,22 +68,21 @@ public class MemberUpdater {
     if (usersToAdd.isEmpty()) {
       return;
     }
-    usersToAdd.forEach(u -> addMemberInDb(dbSession, organization, u));
+    usersToAdd.forEach(u -> addMemberInDb(dbSession, u));
     userIndexer.commitAndIndex(dbSession, usersToAdd);
   }
 
-  private void addMemberInDb(DbSession dbSession, OrganizationDto organization, UserDto user) {
-    dbClient.organizationMemberDao().insert(dbSession, new OrganizationMemberDto()
-      .setOrganizationUuid(organization.getUuid())
-      .setUserUuid(user.getUuid()));
+  private void addMemberInDb(DbSession dbSession, UserDto user) {
     dbClient.userGroupDao().insert(dbSession,
       new UserGroupDto().setGroupUuid(defaultGroupFinder.findDefaultGroup(dbSession).getUuid()).setUserUuid(user.getUuid()));
   }
 
+  // TODO remove org param like it was removed from addMembers
   public void removeMember(DbSession dbSession, OrganizationDto organization, UserDto user) {
     removeMembers(dbSession, organization, singletonList(user));
   }
 
+  // TODO remove org param like it was removed from addMembers
   public void removeMembers(DbSession dbSession, OrganizationDto organization, List<UserDto> users) {
     Set<String> currentMemberIds = new HashSet<>(dbClient.organizationMemberDao().selectUserUuidsByOrganizationUuid(dbSession, organization.getUuid()));
     List<UserDto> usersToRemove = users.stream()
@@ -126,7 +124,7 @@ public class MemberUpdater {
 
     allOrganizationsByUuid.entrySet().stream()
       .filter(entry -> organizationUuidsToBeAdded.contains(entry.getKey()))
-      .forEach(entry -> addMemberInDb(dbSession, entry.getValue(), user));
+      .forEach(entry -> addMemberInDb(dbSession, user));
     allOrganizationsByUuid.entrySet().stream()
       .filter(entry -> organizationUuidsToBeRemoved.contains(entry.getKey()))
       .forEach(entry -> removeMemberInDb(dbSession, entry.getValue(), user));
index ba996626e594707db84315fc81fc3b361a53395f..bce94f4ee314a4f05a711b2005bdc515d7489c13 100644 (file)
@@ -35,12 +35,10 @@ import org.sonar.api.platform.NewUserHandler;
 import org.sonar.api.server.ServerSide;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
-import org.sonar.db.organization.OrganizationMemberDto;
 import org.sonar.db.user.GroupDto;
 import org.sonar.db.user.UserDto;
 import org.sonar.db.user.UserGroupDto;
 import org.sonar.server.authentication.CredentialsLocalAuthentication;
-import org.sonar.server.organization.DefaultOrganizationProvider;
 import org.sonar.server.user.index.UserIndexer;
 import org.sonar.server.usergroups.DefaultGroupFinder;
 import org.sonar.server.util.Validation;
@@ -75,18 +73,15 @@ public class UserUpdater {
   private final NewUserNotifier newUserNotifier;
   private final DbClient dbClient;
   private final UserIndexer userIndexer;
-  private final DefaultOrganizationProvider defaultOrganizationProvider;
   private final DefaultGroupFinder defaultGroupFinder;
   private final Configuration config;
   private final CredentialsLocalAuthentication localAuthentication;
 
-  public UserUpdater(NewUserNotifier newUserNotifier, DbClient dbClient, UserIndexer userIndexer,
-    DefaultOrganizationProvider defaultOrganizationProvider, DefaultGroupFinder defaultGroupFinder, Configuration config,
+  public UserUpdater(NewUserNotifier newUserNotifier, DbClient dbClient, UserIndexer userIndexer, DefaultGroupFinder defaultGroupFinder, Configuration config,
     CredentialsLocalAuthentication localAuthentication) {
     this.newUserNotifier = newUserNotifier;
     this.dbClient = dbClient;
     this.userIndexer = userIndexer;
-    this.defaultOrganizationProvider = defaultOrganizationProvider;
     this.defaultGroupFinder = defaultGroupFinder;
     this.config = config;
     this.localAuthentication = localAuthentication;
@@ -120,7 +115,7 @@ public class UserUpdater {
     setOnboarded(reactivatedUser);
     updateDto(dbSession, updateUser, reactivatedUser);
     updateUser(dbSession, reactivatedUser);
-    addUserToDefaultOrganizationAndDefaultGroup(dbSession, reactivatedUser);
+    addUserToDefaultGroup(dbSession, reactivatedUser);
   }
 
   public void updateAndCommit(DbSession dbSession, UserDto dto, UpdateUser updateUser, Consumer<UserDto> beforeCommit, UserDto... otherUsersToIndex) {
@@ -416,7 +411,7 @@ public class UserUpdater {
   private UserDto saveUser(DbSession dbSession, UserDto userDto) {
     userDto.setActive(true);
     UserDto res = dbClient.userDao().insert(dbSession, userDto);
-    addUserToDefaultOrganizationAndDefaultGroup(dbSession, userDto);
+    addUserToDefaultGroup(dbSession, userDto);
     return res;
   }
 
@@ -437,16 +432,10 @@ public class UserUpdater {
     return userGroups.stream().anyMatch(group -> defaultGroup.getUuid().equals(group.getUuid()));
   }
 
-  private void addUserToDefaultOrganizationAndDefaultGroup(DbSession dbSession, UserDto userDto) {
-    addUserToDefaultOrganization(dbSession, userDto);
+  private void addUserToDefaultGroup(DbSession dbSession, UserDto userDto) {
     addDefaultGroup(dbSession, userDto);
   }
 
-  private void addUserToDefaultOrganization(DbSession dbSession, UserDto userDto) {
-    String defOrgUuid = defaultOrganizationProvider.get().getUuid();
-    dbClient.organizationMemberDao().insert(dbSession, new OrganizationMemberDto().setOrganizationUuid(defOrgUuid).setUserUuid(userDto.getUuid()));
-  }
-
   private void addDefaultGroup(DbSession dbSession, UserDto userDto) {
     List<GroupDto> userGroups = dbClient.groupDao().selectByUserLogin(dbSession, userDto.getLogin());
     GroupDto defaultGroup = defaultGroupFinder.findDefaultGroup(dbSession);
index c97df1924a51bd2d1896835e5a1bd25ac619c44f..c5daa4ab3050b27eef0ac85e3375adae647b1319 100644 (file)
@@ -40,8 +40,6 @@ import org.sonar.db.user.UserDto;
 import org.sonar.server.authentication.event.AuthenticationEvent;
 import org.sonar.server.authentication.event.AuthenticationEvent.Source;
 import org.sonar.server.es.EsTester;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.user.NewUserNotifier;
 import org.sonar.server.user.UserUpdater;
 import org.sonar.server.user.index.UserIndexer;
@@ -63,7 +61,7 @@ import static org.sonar.server.authentication.event.AuthenticationExceptionMatch
 
 public class HttpHeadersAuthenticationTest {
 
-  private MapSettings settings = new MapSettings();
+  private final MapSettings settings = new MapSettings();
 
   @Rule
   public ExpectedException expectedException = none();
@@ -93,24 +91,20 @@ public class HttpHeadersAuthenticationTest {
   private GroupDto group2;
   private GroupDto sonarUsers;
 
-  private System2 system2 = mock(System2.class);
-  private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
-  private CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
+  private final System2 system2 = mock(System2.class);
+  private final CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
 
-  private UserIndexer userIndexer = new UserIndexer(db.getDbClient(), es.client());
+  private final UserIndexer userIndexer = new UserIndexer(db.getDbClient(), es.client());
 
   private final DefaultGroupFinder defaultGroupFinder = new DefaultGroupFinder(db.getDbClient());
-  private final UserRegistrarImpl userIdentityAuthenticator = new UserRegistrarImpl(
-    db.getDbClient(),
-    new UserUpdater(mock(NewUserNotifier.class), db.getDbClient(), userIndexer, defaultOrganizationProvider, defaultGroupFinder, settings.asConfig(),
-      localAuthentication),
+  private final UserRegistrarImpl userIdentityAuthenticator = new UserRegistrarImpl(db.getDbClient(),
+    new UserUpdater(mock(NewUserNotifier.class), db.getDbClient(), userIndexer, defaultGroupFinder, settings.asConfig(), localAuthentication),
     defaultGroupFinder);
-
-  private HttpServletResponse response = mock(HttpServletResponse.class);
-  private JwtHttpHandler jwtHttpHandler = mock(JwtHttpHandler.class);
-  private AuthenticationEvent authenticationEvent = mock(AuthenticationEvent.class);
-
-  private HttpHeadersAuthentication underTest = new HttpHeadersAuthentication(system2, settings.asConfig(), userIdentityAuthenticator, jwtHttpHandler, authenticationEvent);
+  private final HttpServletResponse response = mock(HttpServletResponse.class);
+  private final JwtHttpHandler jwtHttpHandler = mock(JwtHttpHandler.class);
+  private final AuthenticationEvent authenticationEvent = mock(AuthenticationEvent.class);
+  private final HttpHeadersAuthentication underTest = new HttpHeadersAuthentication(system2, settings.asConfig(), userIdentityAuthenticator, jwtHttpHandler,
+    authenticationEvent);
 
   @Before
   public void setUp() {
index f73873bc8144d491f979d52b0e75afe7cc9c6007..438361bd3584fc387e6dfbc75751047c64eb48b7 100644 (file)
@@ -37,8 +37,6 @@ import org.sonar.server.authentication.event.AuthenticationEvent;
 import org.sonar.server.authentication.event.AuthenticationEvent.Source;
 import org.sonar.server.authentication.exception.EmailAlreadyExistsRedirectionException;
 import org.sonar.server.es.EsTester;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.user.NewUserNotifier;
 import org.sonar.server.user.UserUpdater;
 import org.sonar.server.user.index.UserIndexer;
@@ -54,22 +52,22 @@ import static org.sonar.server.authentication.event.AuthenticationEvent.Method.B
 import static org.sonar.server.authentication.event.AuthenticationExceptionMatcher.authenticationException;
 
 public class UserRegistrarImplTest {
-  private static String USER_LOGIN = "johndoo";
+  private static final String USER_LOGIN = "johndoo";
 
-  private static UserIdentity USER_IDENTITY = UserIdentity.builder()
+  private static final UserIdentity USER_IDENTITY = UserIdentity.builder()
     .setProviderId("ABCD")
     .setProviderLogin("johndoo")
     .setName("John")
     .setEmail("john@email.com")
     .build();
 
-  private static TestIdentityProvider IDENTITY_PROVIDER = new TestIdentityProvider()
+  private static final TestIdentityProvider IDENTITY_PROVIDER = new TestIdentityProvider()
     .setKey("github")
     .setName("name of github")
     .setEnabled(true)
     .setAllowsUsersToSignUp(true);
 
-  private MapSettings settings = new MapSettings();
+  private final MapSettings settings = new MapSettings();
 
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
@@ -77,20 +75,18 @@ public class UserRegistrarImplTest {
   public DbTester db = DbTester.create(new AlwaysIncreasingSystem2());
   @Rule
   public EsTester es = EsTester.create();
-  private UserIndexer userIndexer = new UserIndexer(db.getDbClient(), es.client());
-  private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
-  private CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
+  private final UserIndexer userIndexer = new UserIndexer(db.getDbClient(), es.client());
+  private final CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
   private final DefaultGroupFinder groupFinder = new DefaultGroupFinder(db.getDbClient());
-  private UserUpdater userUpdater = new UserUpdater(
+  private final UserUpdater userUpdater = new UserUpdater(
     mock(NewUserNotifier.class),
     db.getDbClient(),
     userIndexer,
-    defaultOrganizationProvider,
     groupFinder,
     settings.asConfig(),
     localAuthentication);
 
-  private UserRegistrarImpl underTest = new UserRegistrarImpl(db.getDbClient(), userUpdater, groupFinder);
+  private final UserRegistrarImpl underTest = new UserRegistrarImpl(db.getDbClient(), userUpdater, groupFinder);
   private GroupDto defaultGroup;
 
   @Before
index 897f737c37f28d3699823556208e31b0d18e1c5f..b2c279063ef18cca06a6f13a8d559f580454316b 100644 (file)
@@ -41,8 +41,6 @@ import org.sonar.server.authentication.CredentialsLocalAuthentication;
 import org.sonar.server.authentication.CredentialsLocalAuthentication.HashMethod;
 import org.sonar.server.es.EsTester;
 import org.sonar.server.exceptions.BadRequestException;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.user.index.UserIndexDefinition;
 import org.sonar.server.user.index.UserIndexer;
 import org.sonar.server.usergroups.DefaultGroupFinder;
@@ -62,7 +60,7 @@ public class UserUpdaterCreateTest {
 
   private static final String DEFAULT_LOGIN = "marius";
 
-  private System2 system2 = new AlwaysIncreasingSystem2();
+  private final System2 system2 = new AlwaysIncreasingSystem2();
 
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
@@ -71,16 +69,14 @@ public class UserUpdaterCreateTest {
   @Rule
   public DbTester db = DbTester.create(system2);
 
-  private DbClient dbClient = db.getDbClient();
-  private NewUserNotifier newUserNotifier = mock(NewUserNotifier.class);
-  private ArgumentCaptor<NewUserHandler.Context> newUserHandler = ArgumentCaptor.forClass(NewUserHandler.Context.class);
-  private DbSession session = db.getSession();
-  private UserIndexer userIndexer = new UserIndexer(dbClient, es.client());
-  private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
-  private MapSettings settings = new MapSettings();
-  private CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
-
-  private UserUpdater underTest = new UserUpdater(newUserNotifier, dbClient, userIndexer, defaultOrganizationProvider,
+  private final DbClient dbClient = db.getDbClient();
+  private final NewUserNotifier newUserNotifier = mock(NewUserNotifier.class);
+  private final ArgumentCaptor<NewUserHandler.Context> newUserHandler = ArgumentCaptor.forClass(NewUserHandler.Context.class);
+  private final DbSession session = db.getSession();
+  private final UserIndexer userIndexer = new UserIndexer(dbClient, es.client());
+  private final MapSettings settings = new MapSettings();
+  private final CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
+  private final UserUpdater underTest = new UserUpdater(newUserNotifier, dbClient, userIndexer,
     new DefaultGroupFinder(dbClient), settings.asConfig(), localAuthentication);
 
   @Test
@@ -300,7 +296,7 @@ public class UserUpdaterCreateTest {
   }
 
   @Test
-  public void does_not_set_notifications_readDate_setting_when_creating_user_when_not_on_and_organization_disabled() {
+  public void does_not_set_notifications_readDate_setting_when_creating_user_when_not_on() {
     createDefaultGroup();
 
     UserDto user = underTest.createAndCommit(db.getSession(), NewUser.builder()
@@ -589,21 +585,6 @@ public class UserUpdaterCreateTest {
       });
   }
 
-  @Test
-  public void add_user_as_member_of_default_organization_when_creating_user_and_organizations_are_disabled() {
-    createDefaultGroup();
-
-    UserDto dto = underTest.createAndCommit(db.getSession(), NewUser.builder()
-      .setLogin("user")
-      .setName("User")
-      .setEmail("user@mail.com")
-      .setPassword("PASSWORD")
-      .build(), u -> {
-      });
-
-    assertThat(dbClient.organizationMemberDao().select(db.getSession(), defaultOrganizationProvider.get().getUuid(), dto.getUuid())).isPresent();
-  }
-
   private GroupDto createDefaultGroup() {
     return db.users().insertDefaultGroup();
   }
index f64f25069a86f92b565f6e0bef1bb7e46934d054..98ba2cac36c43dd7576decf7cde9b89c9f2893cc 100644 (file)
@@ -35,8 +35,6 @@ import org.sonar.db.user.UserDto;
 import org.sonar.server.authentication.CredentialsLocalAuthentication;
 import org.sonar.server.authentication.CredentialsLocalAuthentication.HashMethod;
 import org.sonar.server.es.EsTester;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.user.index.UserIndexer;
 import org.sonar.server.usergroups.DefaultGroupFinder;
 
@@ -61,10 +59,9 @@ public class UserUpdaterReactivateTest {
   private final NewUserNotifier newUserNotifier = mock(NewUserNotifier.class);
   private final DbSession session = db.getSession();
   private final UserIndexer userIndexer = new UserIndexer(dbClient, es.client());
-  private final DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
   private final MapSettings settings = new MapSettings();
   private final CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
-  private final UserUpdater underTest = new UserUpdater(newUserNotifier, dbClient, userIndexer, defaultOrganizationProvider,
+  private final UserUpdater underTest = new UserUpdater(newUserNotifier, dbClient, userIndexer,
     new DefaultGroupFinder(dbClient),
     settings.asConfig(), localAuthentication);
 
index 63995f29ce7c67c0539a782ba5a3f4b974958b91..f195d3d4ca436235cbbb320404c2e5f197df82dd 100644 (file)
@@ -39,8 +39,6 @@ import org.sonar.db.user.UserDto;
 import org.sonar.server.authentication.CredentialsLocalAuthentication;
 import org.sonar.server.es.EsTester;
 import org.sonar.server.exceptions.BadRequestException;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.user.index.UserIndexDefinition;
 import org.sonar.server.user.index.UserIndexer;
 import org.sonar.server.usergroups.DefaultGroupFinder;
@@ -63,21 +61,20 @@ public class UserUpdaterUpdateTest {
   private static final Consumer<UserDto> EMPTY_USER_CONSUMER = userDto -> {
   };
 
-  private System2 system2 = new AlwaysIncreasingSystem2();
+  private final System2 system2 = new AlwaysIncreasingSystem2();
 
   @Rule
   public EsTester es = EsTester.create();
   @Rule
   public DbTester db = DbTester.create(system2);
 
-  private DbClient dbClient = db.getDbClient();
-  private NewUserNotifier newUserNotifier = mock(NewUserNotifier.class);
-  private DbSession session = db.getSession();
-  private UserIndexer userIndexer = new UserIndexer(dbClient, es.client());
-  private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
-  private MapSettings settings = new MapSettings();
-  private CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
-  private UserUpdater underTest = new UserUpdater(newUserNotifier, dbClient, userIndexer, defaultOrganizationProvider,
+  private final DbClient dbClient = db.getDbClient();
+  private final NewUserNotifier newUserNotifier = mock(NewUserNotifier.class);
+  private final DbSession session = db.getSession();
+  private final UserIndexer userIndexer = new UserIndexer(dbClient, es.client());
+  private final MapSettings settings = new MapSettings();
+  private final CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
+  private final UserUpdater underTest = new UserUpdater(newUserNotifier, dbClient, userIndexer,
     new DefaultGroupFinder(dbClient), settings.asConfig(), localAuthentication);
 
   @Test
index 514981585ccf1610c4236002e9de38e10252bd0c..c044754a4a0eb4d4fc6656ed5bb1d9dd219cfdfd 100644 (file)
@@ -45,6 +45,8 @@ import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_ORGA
 import static org.sonar.server.ws.KeyExamples.KEY_ORG_EXAMPLE_001;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 
+//TODO remove when getting rid of organizations
+@Deprecated
 public class AddMemberAction implements OrganizationsWsAction {
   private final DbClient dbClient;
   private final UserSession userSession;
@@ -96,7 +98,7 @@ public class AddMemberAction implements OrganizationsWsAction {
       userSession.checkPermission(GlobalPermission.ADMINISTER);
       wsSupport.checkMemberSyncIsDisabled(dbSession, organization);
       UserDto user = checkFound(dbClient.userDao().selectByLogin(dbSession, login), "User '%s' is not found", login);
-      memberUpdater.addMember(dbSession, organization, user);
+      memberUpdater.addMember(dbSession, user);
 
       int groups = dbClient.groupMembershipDao().countGroups(dbSession, GroupMembershipQuery.builder().membership(IN).build(), user.getUuid());
       AddMemberWsResponse wsResponse = buildResponse(user, groups);
index fe2e4e5d92ab187eefe404be179b9823500c494b..ce8eece577c6074f0e7328ba3eb724812e0c7c7b 100644 (file)
@@ -24,16 +24,13 @@ import org.sonar.api.rule.RuleKey;
 import org.sonar.api.server.ServerSide;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
-import org.sonar.db.organization.OrganizationDto;
 import org.sonar.db.permission.GlobalPermission;
 import org.sonar.db.qualityprofile.QProfileDto;
 import org.sonar.db.rule.RuleDefinitionDto;
 import org.sonar.db.user.GroupDto;
 import org.sonar.db.user.UserDto;
-import org.sonar.server.organization.DefaultOrganizationProvider;
 import org.sonar.server.user.UserSession;
 
-import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkState;
 import static org.sonar.server.exceptions.BadRequestException.checkRequest;
 import static org.sonar.server.exceptions.NotFoundException.checkFound;
@@ -45,18 +42,10 @@ public class QProfileWsSupport {
 
   private final DbClient dbClient;
   private final UserSession userSession;
-  private final DefaultOrganizationProvider defaultOrganizationProvider;
 
-  public QProfileWsSupport(DbClient dbClient, UserSession userSession, DefaultOrganizationProvider defaultOrganizationProvider) {
+  public QProfileWsSupport(DbClient dbClient, UserSession userSession) {
     this.dbClient = dbClient;
     this.userSession = userSession;
-    this.defaultOrganizationProvider = defaultOrganizationProvider;
-  }
-
-  public OrganizationDto getDefaultOrganization(DbSession dbSession) {
-    String organizationOrDefaultKey = defaultOrganizationProvider.get().getKey();
-    return checkFoundWithOptional(dbClient.organizationDao().selectByKey(dbSession, organizationOrDefaultKey),
-      "No organization with key '%s'", organizationOrDefaultKey);
   }
 
   public RuleDefinitionDto getRule(DbSession dbSession, RuleKey ruleKey) {
@@ -92,7 +81,6 @@ public class QProfileWsSupport {
   public UserDto getUser(DbSession dbSession, String login) {
     UserDto user = dbClient.userDao().selectActiveUserByLogin(dbSession, login);
     checkFound(user, "User with login '%s' is not found'", login);
-    checkMembership(dbSession, getDefaultOrganization(dbSession), user);
     return user;
   }
 
@@ -126,12 +114,4 @@ public class QProfileWsSupport {
   void checkNotBuiltIn(QProfileDto profile) {
     checkRequest(!profile.isBuiltIn(), "Operation forbidden for built-in Quality Profile '%s' with language '%s'", profile.getName(), profile.getLanguage());
   }
-
-  private void checkMembership(DbSession dbSession, OrganizationDto organization, UserDto user) {
-    checkArgument(isMember(dbSession, organization, user.getUuid()), "User '%s' is not member of organization '%s'", user.getLogin(), organization.getKey());
-  }
-
-  private boolean isMember(DbSession dbSession, OrganizationDto organization, String userUuid) {
-    return dbClient.organizationMemberDao().select(dbSession, organization.getUuid(), userUuid).isPresent();
-  }
 }
index 402a2be68d93bacb6fccab8cbbbad1a111accd81..da2bc3ee57bca8f67d5ec8307fa76d6562293452 100644 (file)
@@ -92,7 +92,6 @@ public class DeactivateAction implements UsersWsAction {
       dbClient.userPermissionDao().deleteByUserUuid(dbSession, userUuid);
       dbClient.permissionTemplateDao().deleteUserPermissionsByUserUuid(dbSession, userUuid);
       dbClient.qProfileEditUsersDao().deleteByUser(dbSession, user);
-      dbClient.organizationMemberDao().deleteByUserUuid(dbSession, userUuid);
       dbClient.userPropertiesDao().deleteByUser(dbSession, user);
       dbClient.almPatDao().deleteByUser(dbSession, user);
       dbClient.sessionTokensDao().deleteByUser(dbSession, user);
index cb18e7d7b0e64b856e69106d679a892d820bf34a..e07057725f0abe7838527c0abc66be51ab5bd75e 100644 (file)
@@ -41,7 +41,6 @@ import org.sonar.db.user.UserDto;
 import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.UnauthorizedException;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QProfileRules;
 import org.sonar.server.qualityprofile.RuleActivation;
 import org.sonar.server.tester.UserSessionRule;
@@ -71,7 +70,7 @@ public class ActivateRuleActionTest {
   private ArgumentCaptor<Collection<RuleActivation>> ruleActivationCaptor = ArgumentCaptor.forClass(Collection.class);
   private DbClient dbClient = db.getDbClient();
   private QProfileRules qProfileRules = mock(QProfileRules.class);
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession, TestDefaultOrganizationProvider.from(db));
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession);
 
   private WsActionTester ws = new WsActionTester(new ActivateRuleAction(dbClient, qProfileRules, userSession, wsSupport));
 
index f82e13b13734dcbcd0f726ccbfaac7304da0f0dc..5fb445e6d53d6cc292829e3915b78572d1076000 100644 (file)
@@ -34,7 +34,6 @@ import org.sonar.db.user.UserDto;
 import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.UnauthorizedException;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QProfileRules;
 import org.sonar.server.rule.ws.RuleQueryFactory;
 import org.sonar.server.tester.UserSessionRule;
@@ -60,7 +59,7 @@ public class ActivateRulesActionTest {
   public ExpectedException expectedException = ExpectedException.none();
 
   private DbClient dbClient = db.getDbClient();
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession, TestDefaultOrganizationProvider.from(db));
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession);
   private RuleQueryFactory ruleQueryFactory = mock(RuleQueryFactory.class, Mockito.RETURNS_MOCKS);
 
   private QProfileRules qProfileRules = mock(QProfileRules.class, Mockito.RETURNS_DEEP_STUBS);
index 896f4d8e6553d7f146a699767ef6f72b5b6927eb..3c4e0549aa14634bbe5cb56b2dfbf1d5e8cae815 100644 (file)
@@ -36,7 +36,6 @@ import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.TestResponse;
 import org.sonar.server.ws.WsActionTester;
@@ -59,7 +58,7 @@ public class AddGroupActionTest {
   @Rule
   public DbTester db = DbTester.create();
 
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db));
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession);
   private UuidFactory uuidFactory = UuidFactoryFast.getInstance();
 
   private WsActionTester ws = new WsActionTester(new AddGroupAction(db.getDbClient(), uuidFactory, wsSupport, LANGUAGES));
index 112f4c2e754697917b54f491d6082c27b4a84b13..8b7aa5a1505d927bf24a957f3beffe85f4e400ce 100644 (file)
@@ -38,7 +38,6 @@ import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.exceptions.UnauthorizedException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.TestRequest;
 import org.sonar.server.ws.TestResponse;
@@ -62,7 +61,7 @@ public class AddProjectActionTest {
 
   private DbClient dbClient = db.getDbClient();
   private Languages languages = LanguageTesting.newLanguages(LANGUAGE_1, LANGUAGE_2);
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession, TestDefaultOrganizationProvider.from(db));
+  private QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession);
   private AddProjectAction underTest = new AddProjectAction(dbClient, userSession, languages, TestComponentFinder.from(db), wsSupport);
   private WsActionTester tester = new WsActionTester(underTest);
 
index c36a555fb3aadabe9781c9cf7b0e5469f2174629..93ba68ee5b8f2c2bd9b5711e3ff84b32be4d77ab 100644 (file)
@@ -35,7 +35,6 @@ import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.TestResponse;
 import org.sonar.server.ws.WsActionTester;
@@ -59,7 +58,7 @@ public class AddUserActionTest {
   @Rule
   public DbTester db = DbTester.create();
 
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db));
+  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession);
   private UuidFactory uuidFactory = UuidFactoryFast.getInstance();
 
   private WsActionTester ws = new WsActionTester(new AddUserAction(db.getDbClient(), uuidFactory, wsSupport, LANGUAGES));
index ff66282af449892d399a21b22e4a9d1f5ba80846..340394bc72dccb5d0cf4ebd8b0ddef21fdddceff 100644 (file)
@@ -27,8 +27,6 @@ import org.sonar.api.server.ws.WebService.Param;
 import org.sonar.db.DbTester;
 import org.sonar.db.qualityprofile.QProfileDto;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QProfileBackuper;
 import org.sonar.server.qualityprofile.QProfileBackuperImpl;
 import org.sonar.server.qualityprofile.QProfileParser;
@@ -50,8 +48,7 @@ public class BackupActionTest {
   public UserSessionRule userSession = UserSessionRule.standalone();
 
   private QProfileBackuper backuper = new QProfileBackuperImpl(db.getDbClient(), null, null, null, new QProfileParser());
-  private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession, defaultOrganizationProvider);
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession);
   private Languages languages = LanguageTesting.newLanguages(A_LANGUAGE);
   private WsActionTester tester = new WsActionTester(new BackupAction(db.getDbClient(), backuper, wsSupport, languages));
 
index 36824bb6093695506add4e5dd3b6bf6b2de627ec..59f80628c2981ea9fcf25469cfd7a32db54d7b21 100644 (file)
@@ -49,7 +49,6 @@ import org.sonar.server.es.SearchOptions;
 import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QProfileTreeImpl;
 import org.sonar.server.qualityprofile.RuleActivator;
 import org.sonar.server.qualityprofile.index.ActiveRuleIndexer;
@@ -108,8 +107,7 @@ public class ChangeParentActionTest {
       new Languages(),
       new QProfileWsSupport(
         dbClient,
-        userSession,
-        TestDefaultOrganizationProvider.from(db)),
+        userSession),
       userSession);
 
     ws = new WsActionTester(underTest);
index 6ef77454d935740bfa0063f6f73978a915ecbae1..cd800af8792b2cee6aa881bddfd2638de6f2c4cf 100644 (file)
@@ -37,8 +37,6 @@ import org.sonar.db.qualityprofile.QProfileChangeDto;
 import org.sonar.db.qualityprofile.QProfileDto;
 import org.sonar.db.rule.RuleDefinitionDto;
 import org.sonar.db.user.UserDto;
-import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.ActiveRuleChange;
 import org.sonar.server.qualityprofile.ActiveRuleInheritance;
 import org.sonar.server.tester.UserSessionRule;
@@ -63,7 +61,7 @@ public class ChangelogActionTest {
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
 
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db));
+  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession);
   private WsActionTester ws = new WsActionTester(new ChangelogAction(wsSupport, new Languages(), db.getDbClient()));
 
   @Test
@@ -232,16 +230,16 @@ public class ChangelogActionTest {
       .setParam(PARAM_SINCE, "2011-04-25T01:15:42+0100")
       .execute()
       .getInput()).isSimilarTo("{\n" +
-      "  \"events\": [\n" +
-      "    {\n" +
-      "      \"date\": \"2011-04-25T01:15:42+0100\",\n" +
-      "      \"authorLogin\": \"" + user.getLogin() + "\",\n" +
-      "      \"action\": \"ACTIVATED\",\n" +
-      "      \"ruleKey\": \"" + rule.getKey() + "\",\n" +
-      "      \"ruleName\": \"" + rule.getName() + "\",\n" +
-      "    }\n" +
-      "  ]\n" +
-      "}");
+        "  \"events\": [\n" +
+        "    {\n" +
+        "      \"date\": \"2011-04-25T01:15:42+0100\",\n" +
+        "      \"authorLogin\": \"" + user.getLogin() + "\",\n" +
+        "      \"action\": \"ACTIVATED\",\n" +
+        "      \"ruleKey\": \"" + rule.getKey() + "\",\n" +
+        "      \"ruleName\": \"" + rule.getName() + "\",\n" +
+        "    }\n" +
+        "  ]\n" +
+        "}");
 
     assertJson(ws.newRequest()
       .setParam(PARAM_LANGUAGE, qualityProfile.getLanguage())
@@ -249,8 +247,8 @@ public class ChangelogActionTest {
       .setParam(PARAM_SINCE, "2011-04-25T01:15:43+0100")
       .execute()
       .getInput()).isSimilarTo("{\n" +
-      "  \"events\": []\n" +
-      "}");
+        "  \"events\": []\n" +
+        "}");
   }
 
   @Test
index b4ffa852c7c75b2aa4aebd285b98334cc2220a5a..8b0ef3fb3dff7d59d7e3d5767b1c354a6495eda9 100644 (file)
@@ -37,8 +37,6 @@ import org.sonar.db.qualityprofile.QProfileDto;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.UnauthorizedException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QProfileBackuper;
 import org.sonar.server.qualityprofile.QProfileCopier;
 import org.sonar.server.qualityprofile.QProfileFactory;
@@ -66,15 +64,14 @@ public class CopyActionTest {
   public UserSessionRule userSession = UserSessionRule.standalone();
   @Rule
   public JUnitTempFolder tempDir = new JUnitTempFolder();
-  private ActiveRuleIndexer activeRuleIndexer = mock(ActiveRuleIndexer.class);
-  private TestBackuper backuper = new TestBackuper();
-  private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
-  private QProfileFactory profileFactory = new QProfileFactoryImpl(db.getDbClient(), new SequenceUuidFactory(), System2.INSTANCE, activeRuleIndexer);
-  private QProfileCopier profileCopier = new QProfileCopier(db.getDbClient(), profileFactory, backuper);
-  private Languages languages = LanguageTesting.newLanguages(A_LANGUAGE);
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession, defaultOrganizationProvider);
-  private CopyAction underTest = new CopyAction(db.getDbClient(), profileCopier, languages, userSession, wsSupport);
-  private WsActionTester tester = new WsActionTester(underTest);
+  private final ActiveRuleIndexer activeRuleIndexer = mock(ActiveRuleIndexer.class);
+  private final TestBackuper backuper = new TestBackuper();
+  private final QProfileFactory profileFactory = new QProfileFactoryImpl(db.getDbClient(), new SequenceUuidFactory(), System2.INSTANCE, activeRuleIndexer);
+  private final QProfileCopier profileCopier = new QProfileCopier(db.getDbClient(), profileFactory, backuper);
+  private final Languages languages = LanguageTesting.newLanguages(A_LANGUAGE);
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession);
+  private final CopyAction underTest = new CopyAction(db.getDbClient(), profileCopier, languages, userSession, wsSupport);
+  private final WsActionTester tester = new WsActionTester(underTest);
 
   @Test
   public void test_definition() {
@@ -295,7 +292,8 @@ public class CopyActionTest {
       throw new UnsupportedOperationException();
     }
 
-    @Override public QProfileRestoreSummary copy(DbSession dbSession, QProfileDto from, QProfileDto to) {
+    @Override
+    public QProfileRestoreSummary copy(DbSession dbSession, QProfileDto from, QProfileDto to) {
       this.copiedProfile = from;
       this.toProfile = to;
       return null;
index 9b4c64f02e044cbe610579c9db032358cae8a532..78a907c433877c6ce59bd549de65a5b5f372ae7a 100644 (file)
@@ -39,7 +39,6 @@ import org.sonar.db.rule.RuleTesting;
 import org.sonar.db.user.UserDto;
 import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.UnauthorizedException;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QProfileRules;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.TestRequest;
@@ -67,7 +66,7 @@ public class DeactivateRuleActionTest {
   private ArgumentCaptor<Collection<String>> ruleUuidsCaptor = ArgumentCaptor.forClass(Collection.class);
   private DbClient dbClient = db.getDbClient();
   private QProfileRules qProfileRules = mock(QProfileRules.class);
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession, TestDefaultOrganizationProvider.from(db));
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession);
   private DeactivateRuleAction underTest = new DeactivateRuleAction(dbClient, qProfileRules, userSession, wsSupport);
   private WsActionTester ws = new WsActionTester(underTest);
 
index 3d90ac7226af9901d82ac5fddd9926adf5fea49a..217d6d1b289ac336150aac0f216e8403d7d03f39 100644 (file)
@@ -31,7 +31,6 @@ import org.sonar.db.user.UserDto;
 import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.UnauthorizedException;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QProfileRules;
 import org.sonar.server.rule.ws.RuleQueryFactory;
 import org.sonar.server.tester.UserSessionRule;
@@ -60,7 +59,7 @@ public class DeactivateRulesActionTest {
 
   private DbClient dbClient = db.getDbClient();
   private QProfileRules qProfileRules = mock(QProfileRules.class, RETURNS_DEEP_STUBS);
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession, TestDefaultOrganizationProvider.from(db));
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession);
   private RuleQueryFactory ruleQueryFactory = mock(RuleQueryFactory.class, RETURNS_DEEP_STUBS);
   private DeactivateRulesAction underTest = new DeactivateRulesAction(ruleQueryFactory, userSession, qProfileRules, wsSupport, dbClient);
   private WsActionTester ws = new WsActionTester(underTest);
index d8482f295d3bd2c5ab886fd115f473c7b8032b5b..85f27004939258ed1c007c9104c05e826a0dbd29 100644 (file)
@@ -39,7 +39,6 @@ import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.exceptions.UnauthorizedException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QProfileFactoryImpl;
 import org.sonar.server.qualityprofile.index.ActiveRuleIndexer;
 import org.sonar.server.tester.UserSessionRule;
@@ -71,7 +70,7 @@ public class DeleteActionTest {
   private DeleteAction underTest = new DeleteAction(
     new Languages(LanguageTesting.newLanguage(A_LANGUAGE)),
     new QProfileFactoryImpl(dbClient, UuidFactoryFast.getInstance(), System2.INSTANCE, activeRuleIndexer), dbClient, userSession,
-    new QProfileWsSupport(dbClient, userSession, TestDefaultOrganizationProvider.from(db)));
+    new QProfileWsSupport(dbClient, userSession));
   private WsActionTester ws = new WsActionTester(underTest);
 
   @Test
index 8e47d987fe1dd5f0a5380403d7d72cdfb1acede8..92aa1e75a7e9e7758e46b4cd2820316de5150d59 100644 (file)
@@ -42,7 +42,6 @@ import org.sonar.db.rule.RuleTesting;
 import org.sonar.server.es.EsClient;
 import org.sonar.server.es.EsTester;
 import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QProfileRules;
 import org.sonar.server.qualityprofile.QProfileRulesImpl;
 import org.sonar.server.qualityprofile.QProfileTree;
@@ -89,7 +88,7 @@ public class InheritanceActionTest {
 
   private WsActionTester ws = new WsActionTester(new InheritanceAction(
     dbClient,
-    new QProfileWsSupport(dbClient, userSession, TestDefaultOrganizationProvider.from(db)),
+    new QProfileWsSupport(dbClient, userSession),
     new Languages()));
 
   @Test
index 8bace09eaf8445c616b0b7bdf3563eea372d2b68..df6615c65bc6418ae0dfe34f646f01e1aff29da6 100644 (file)
@@ -28,8 +28,6 @@ import org.sonar.db.qualityprofile.QualityProfileTesting;
 import org.sonar.db.rule.RuleDefinitionDto;
 import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 
 import static java.lang.String.format;
@@ -44,8 +42,7 @@ public class QProfileWsSupportTest {
   @Rule
   public UserSessionRule userSession = UserSessionRule.standalone();
 
-  private DefaultOrganizationProvider defaultOrgProvider = TestDefaultOrganizationProvider.from(db);
-  private QProfileWsSupport underTest = new QProfileWsSupport(db.getDbClient(), userSession, defaultOrgProvider);
+  private final QProfileWsSupport underTest = new QProfileWsSupport(db.getDbClient(), userSession);
 
   @Test
   public void getProfile_returns_the_profile_specified_by_key() {
index 16e3dfd4fc8c91f5198108ff241b90aeb3056fa7..ea77a357e523ed306405e99d10ca49cc5d7edf91 100644 (file)
@@ -22,7 +22,6 @@ package org.sonar.server.qualityprofile.ws;
 import com.google.common.collect.ImmutableSet;
 import java.util.Collections;
 import java.util.Optional;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.sonar.api.rule.RuleKey;
@@ -33,7 +32,6 @@ import org.sonar.api.utils.System2;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
 import org.sonar.db.DbTester;
-import org.sonar.db.organization.OrganizationDto;
 import org.sonar.db.qualityprofile.ActiveRuleDto;
 import org.sonar.db.qualityprofile.ActiveRuleKey;
 import org.sonar.db.qualityprofile.QProfileDto;
@@ -42,8 +40,6 @@ import org.sonar.db.rule.RuleTesting;
 import org.sonar.server.es.EsTester;
 import org.sonar.server.es.SearchOptions;
 import org.sonar.server.exceptions.BadRequestException;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QProfileName;
 import org.sonar.server.qualityprofile.QProfileRules;
 import org.sonar.server.qualityprofile.QProfileRulesImpl;
@@ -88,20 +84,13 @@ public class QProfilesWsMediumTest {
   private TypeValidations typeValidations = new TypeValidations(emptyList());
   private RuleActivator ruleActivator = new RuleActivator(System2.INSTANCE, dbClient, typeValidations, userSessionRule);
   private QProfileRules qProfileRules = new QProfileRulesImpl(dbClient, ruleActivator, ruleIndex, activeRuleIndexer);
-  private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(dbTester);
-  private QProfileWsSupport qProfileWsSupport = new QProfileWsSupport(dbClient, userSessionRule, defaultOrganizationProvider);
-  private RuleQueryFactory ruleQueryFactory = new RuleQueryFactory(dbClient);
-  private OrganizationDto organization;
-
-  private WsActionTester wsDeactivateRule = new WsActionTester(new DeactivateRuleAction(dbClient, qProfileRules, userSessionRule, qProfileWsSupport));
-  private WsActionTester wsDeactivateRules = new WsActionTester(new DeactivateRulesAction(ruleQueryFactory, userSessionRule, qProfileRules, qProfileWsSupport, dbClient));
-  private WsActionTester wsActivateRule = new WsActionTester(new ActivateRuleAction(dbClient, qProfileRules, userSessionRule, qProfileWsSupport));
-  private WsActionTester wsActivateRules = new WsActionTester(new ActivateRulesAction(ruleQueryFactory, userSessionRule, qProfileRules, qProfileWsSupport, dbClient));
-
-  @Before
-  public void setUp() {
-    organization = dbTester.organizations().insert();
-  }
+  private final QProfileWsSupport qProfileWsSupport = new QProfileWsSupport(dbClient, userSessionRule);
+  private final RuleQueryFactory ruleQueryFactory = new RuleQueryFactory(dbClient);
+
+  private final WsActionTester wsDeactivateRule = new WsActionTester(new DeactivateRuleAction(dbClient, qProfileRules, userSessionRule, qProfileWsSupport));
+  private final WsActionTester wsDeactivateRules = new WsActionTester(new DeactivateRulesAction(ruleQueryFactory, userSessionRule, qProfileRules, qProfileWsSupport, dbClient));
+  private final WsActionTester wsActivateRule = new WsActionTester(new ActivateRuleAction(dbClient, qProfileRules, userSessionRule, qProfileWsSupport));
+  private final WsActionTester wsActivateRules = new WsActionTester(new ActivateRulesAction(ruleQueryFactory, userSessionRule, qProfileRules, qProfileWsSupport, dbClient));
 
   @Test
   public void deactivate_rule() {
index 3f977a4150a7d77defec6f824d955101912e6fd7..85fc13c707c4f81a7fa0a23a310b216f7d5c79fa 100644 (file)
@@ -33,7 +33,6 @@ import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.TestResponse;
 import org.sonar.server.ws.WsActionTester;
@@ -56,7 +55,7 @@ public class RemoveGroupActionTest {
   @Rule
   public DbTester db = DbTester.create();
 
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db));
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession);
 
   private WsActionTester ws = new WsActionTester(new RemoveGroupAction(db.getDbClient(), wsSupport, LANGUAGES));
 
index 5a9658a68ac08e39e667141370ac420849023003..046269a7b5feec9958b6561fd76ee2d7221bb647 100644 (file)
@@ -39,7 +39,6 @@ import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.exceptions.UnauthorizedException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.TestRequest;
 import org.sonar.server.ws.TestResponse;
@@ -62,7 +61,7 @@ public class RemoveProjectActionTest {
 
   private DbClient dbClient = db.getDbClient();
   private Languages languages = LanguageTesting.newLanguages(LANGUAGE_1, LANGUAGE_2);
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession, TestDefaultOrganizationProvider.from(db));
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession);
 
   private RemoveProjectAction underTest = new RemoveProjectAction(dbClient, userSession, languages,
     new ComponentFinder(dbClient, new ResourceTypesRule().setRootQualifiers(Qualifiers.PROJECT)), wsSupport);
index 7155fdc6a516e578f822b9f21a6b544ca0013f68..efb6b5f8a30e3268ecab12978aa4eb507aae8568 100644 (file)
@@ -33,7 +33,6 @@ import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.TestResponse;
 import org.sonar.server.ws.WsActionTester;
@@ -57,7 +56,7 @@ public class RemoveUserActionTest {
   @Rule
   public DbTester db = DbTester.create();
 
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db));
+  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession);
 
   private WsActionTester ws = new WsActionTester(new RemoveUserAction(db.getDbClient(), wsSupport, LANGUAGES));
 
index a03220b768ff96b316e96764d5ac969ffdcecf0a..13479a45d914dd6529598266fb922af88f7b96eb 100644 (file)
@@ -29,7 +29,6 @@ import org.sonar.api.server.ws.WebService.Param;
 import org.sonar.api.utils.System2;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbTester;
-import org.sonar.db.organization.OrganizationDto;
 import org.sonar.db.qualityprofile.QProfileDto;
 import org.sonar.db.qualityprofile.QualityProfileTesting;
 import org.sonar.db.user.UserDto;
@@ -37,7 +36,6 @@ import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.exceptions.UnauthorizedException;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.TestRequest;
 import org.sonar.server.ws.WsActionTester;
@@ -62,16 +60,13 @@ public class RenameActionTest {
 
   private String xoo1Key = "xoo1";
   private String xoo2Key = "xoo2";
-  private OrganizationDto organization;
 
   @Before
   public void setUp() {
-    TestDefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
-    QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession, defaultOrganizationProvider);
+    QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession);
     RenameAction underTest = new RenameAction(dbClient, userSession, wsSupport);
     ws = new WsActionTester(underTest);
 
-    organization = db.organizations().getDefaultOrganization();
     createProfiles();
   }
 
index 5418bf2e24655b9a53de2b54bbc4153e52a85ef9..319cc795a37cdb0bff1d281aa0efebd685bcb6a4 100644 (file)
@@ -32,7 +32,6 @@ import org.sonar.db.user.UserDto;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.WsActionTester;
 import org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse;
@@ -63,7 +62,7 @@ public class SearchGroupsActionTest {
   @Rule
   public DbTester db = DbTester.create();
 
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db));
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession);
 
   private WsActionTester ws = new WsActionTester(new SearchGroupsAction(db.getDbClient(), wsSupport, LANGUAGES));
 
index 25060043424842e7c5f0f28ed8e0e0642da11b80..0e8a5abbcc6c6a866ed04761eefc9ee58b862b90 100644 (file)
@@ -35,7 +35,6 @@ import org.sonar.server.issue.AvatarResolver;
 import org.sonar.server.issue.AvatarResolverImpl;
 import org.sonar.server.issue.FakeAvatarResolver;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.WsActionTester;
 import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse;
@@ -66,7 +65,7 @@ public class SearchUsersActionTest {
   @Rule
   public DbTester db = DbTester.create();
 
-  private QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db));
+  private final QProfileWsSupport wsSupport = new QProfileWsSupport(db.getDbClient(), userSession);
   private AvatarResolver avatarResolver = new FakeAvatarResolver();
 
   private WsActionTester ws = new WsActionTester(new SearchUsersAction(db.getDbClient(), wsSupport, LANGUAGES, avatarResolver));
index 731db2f19660a3e6ed6168a220f8e2d3d177b13c..7b7ef93bd137bcac38691d12d7bedf871593014c 100644 (file)
@@ -28,15 +28,12 @@ import org.sonar.api.server.ws.WebService;
 import org.sonar.api.server.ws.WebService.Param;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbTester;
-import org.sonar.db.organization.OrganizationDto;
 import org.sonar.db.qualityprofile.QProfileDto;
 import org.sonar.db.qualityprofile.QualityProfileTesting;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.exceptions.UnauthorizedException;
 import org.sonar.server.language.LanguageTesting;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.TestResponse;
 import org.sonar.server.ws.WsActionTester;
@@ -59,14 +56,12 @@ public class SetDefaultActionTest {
   @Rule
   public UserSessionRule userSessionRule = UserSessionRule.standalone();
 
-  private DefaultOrganizationProvider defaultOrganizationProvider;
   private DbClient dbClient;
   private QProfileWsSupport wsSupport;
 
   private SetDefaultAction underTest;
   private WsActionTester ws;
 
-  private OrganizationDto organization;
   /** Single, default quality profile for language xoo1 */
   private QProfileDto xoo1Profile;
   /** Parent quality profile for language xoo2 (not a default) */
@@ -76,10 +71,8 @@ public class SetDefaultActionTest {
 
   @Before
   public void setUp() {
-    defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
     dbClient = db.getDbClient();
-    wsSupport = new QProfileWsSupport(dbClient, userSessionRule, defaultOrganizationProvider);
-    organization = db.organizations().getDefaultOrganization();
+    wsSupport = new QProfileWsSupport(dbClient, userSessionRule);
     underTest = new SetDefaultAction(LanguageTesting.newLanguages(XOO_1_KEY, XOO_2_KEY), dbClient, userSessionRule, wsSupport);
 
     xoo1Profile = QualityProfileTesting.newQualityProfileDto().setLanguage(XOO_1_KEY);
index bc1ad771512c312b01b37e03023cee40226db35f..c4b615ab451b990c02eb50b3781387375fd22834 100644 (file)
@@ -34,7 +34,6 @@ import org.sonar.db.rule.RuleDefinitionDto;
 import org.sonar.db.user.UserDto;
 import org.sonar.server.es.EsTester;
 import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.index.ActiveRuleIndexer;
 import org.sonar.server.rule.index.RuleIndex;
 import org.sonar.server.rule.index.RuleIndexer;
@@ -75,7 +74,7 @@ public class ShowActionTest {
   private RuleIndex ruleIndex = new RuleIndex(es.client(), System2.INSTANCE);
 
   private WsActionTester ws = new WsActionTester(
-    new ShowAction(db.getDbClient(), new QProfileWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db)), LANGUAGES, ruleIndex));
+    new ShowAction(db.getDbClient(), new QProfileWsSupport(db.getDbClient(), userSession), LANGUAGES, ruleIndex));
 
   @Test
   public void profile_info() {
@@ -172,7 +171,7 @@ public class ShowActionTest {
     CompareToSonarWay result = call(ws.newRequest()
       .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"))
-      .getCompareToSonarWay();
+        .getCompareToSonarWay();
 
     assertThat(result)
       .extracting(CompareToSonarWay::getProfile, CompareToSonarWay::getProfileName, CompareToSonarWay::getMissingRuleCount)
@@ -192,7 +191,7 @@ public class ShowActionTest {
     CompareToSonarWay result = call(ws.newRequest()
       .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"))
-      .getCompareToSonarWay();
+        .getCompareToSonarWay();
 
     assertThat(result)
       .extracting(CompareToSonarWay::getProfile, CompareToSonarWay::getProfileName, CompareToSonarWay::getMissingRuleCount)
@@ -255,7 +254,7 @@ public class ShowActionTest {
     CompareToSonarWay result = call(ws.newRequest()
       .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"))
-      .getCompareToSonarWay();
+        .getCompareToSonarWay();
 
     assertThat(result)
       .extracting(CompareToSonarWay::getProfile, CompareToSonarWay::getProfileName)
@@ -271,7 +270,7 @@ public class ShowActionTest {
     CompareToSonarWay result = call(ws.newRequest()
       .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"))
-      .getCompareToSonarWay();
+        .getCompareToSonarWay();
 
     assertThat(result)
       .extracting(CompareToSonarWay::getProfile, CompareToSonarWay::getProfileName)
@@ -335,7 +334,7 @@ public class ShowActionTest {
       .forEach(project -> db.qualityProfiles().associateWithProject(project, profile));
 
     ws = new WsActionTester(
-      new ShowAction(db.getDbClient(), new QProfileWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db)), new Languages(cs), ruleIndex));
+      new ShowAction(db.getDbClient(), new QProfileWsSupport(db.getDbClient(), userSession), new Languages(cs), ruleIndex));
     String result = ws.newRequest().setParam(PARAM_KEY, profile.getKee()).execute().getInput();
 
     assertJson(result).ignoreFields("rulesUpdatedAt", "lastUsed", "userUpdatedAt").isSimilarTo(ws.getDef().responseExampleAsString());
index 9b8dbc14ba56eaddb4860f992bcf5d2d4500073b..2be63c683265e71d7a76d0bd1f82e2f8a4ce0004 100644 (file)
@@ -31,7 +31,6 @@ import org.sonar.server.es.EsTester;
 import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.user.NewUserNotifier;
 import org.sonar.server.user.UserUpdater;
@@ -56,17 +55,13 @@ public class ChangePasswordActionTest {
   @Rule
   public UserSessionRule userSessionRule = UserSessionRule.standalone().logIn();
 
-  private TestDefaultOrganizationProvider testDefaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
+  private final CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
 
-  private CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
+  private final UserUpdater userUpdater = new UserUpdater(mock(NewUserNotifier.class), db.getDbClient(),
+    new UserIndexer(db.getDbClient(), es.client()), new DefaultGroupFinder(db.getDbClient()),
+    new MapSettings().asConfig(), localAuthentication);
 
-  private UserUpdater userUpdater = new UserUpdater(
-    mock(NewUserNotifier.class), db.getDbClient(), new UserIndexer(db.getDbClient(), es.client()), testDefaultOrganizationProvider,
-    new DefaultGroupFinder(db.getDbClient()),
-    new MapSettings().asConfig(),
-    localAuthentication);
-
-  private WsActionTester tester = new WsActionTester(new ChangePasswordAction(db.getDbClient(), userUpdater, userSessionRule, localAuthentication));
+  private final WsActionTester tester = new WsActionTester(new ChangePasswordAction(db.getDbClient(), userUpdater, userSessionRule, localAuthentication));
 
   @Before
   public void setUp() {
index 4ecf507e70138f59e0cf1d34be660c1dc3bb7ace..93cc9c5a80b0dfb3240f6964f518516d971e43fe 100644 (file)
@@ -29,7 +29,6 @@ import org.sonar.api.config.internal.MapSettings;
 import org.sonar.api.impl.utils.AlwaysIncreasingSystem2;
 import org.sonar.api.server.ws.WebService;
 import org.sonar.api.utils.System2;
-import org.sonar.core.config.CorePropertyDefinitions;
 import org.sonar.db.DbTester;
 import org.sonar.db.user.GroupDto;
 import org.sonar.db.user.UserDto;
@@ -37,8 +36,6 @@ import org.sonar.server.authentication.CredentialsLocalAuthentication;
 import org.sonar.server.es.EsClient;
 import org.sonar.server.es.EsTester;
 import org.sonar.server.exceptions.ForbiddenException;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.user.NewUserNotifier;
 import org.sonar.server.user.UserUpdater;
@@ -66,8 +63,8 @@ import static org.sonar.server.user.index.UserIndexDefinition.FIELD_SCM_ACCOUNTS
 
 public class CreateActionTest {
 
-  private MapSettings settings = new MapSettings();
-  private System2 system2 = new AlwaysIncreasingSystem2();
+  private final MapSettings settings = new MapSettings();
+  private final System2 system2 = new AlwaysIncreasingSystem2();
 
   @Rule
   public DbTester db = DbTester.create(system2);
@@ -78,15 +75,11 @@ public class CreateActionTest {
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
 
-  private UserIndexer userIndexer = new UserIndexer(db.getDbClient(), es.client());
+  private final UserIndexer userIndexer = new UserIndexer(db.getDbClient(), es.client());
   private GroupDto defaultGroup;
-  private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
-  private CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
-  private WsActionTester tester = new WsActionTester(new CreateAction(
-    db.getDbClient(),
-    new UserUpdater(mock(NewUserNotifier.class), db.getDbClient(), userIndexer, defaultOrganizationProvider,
-      new DefaultGroupFinder(db.getDbClient()), settings.asConfig(), localAuthentication),
-    userSessionRule));
+  private final CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
+  private final WsActionTester tester = new WsActionTester(new CreateAction(db.getDbClient(), new UserUpdater(mock(NewUserNotifier.class),
+    db.getDbClient(), userIndexer, new DefaultGroupFinder(db.getDbClient()), settings.asConfig(), localAuthentication), userSessionRule));
 
   @Before
   public void setUp() {
@@ -124,7 +117,7 @@ public class CreateActionTest {
     assertThat(dbUser).isPresent();
     assertThat(dbUser.get().isRoot()).isFalse();
 
-    // member of default group in default organization
+    // member of default group
     assertThat(db.users().selectGroupUuidsOfUser(dbUser.get())).containsOnly(defaultGroup.getUuid());
   }
 
@@ -376,8 +369,4 @@ public class CreateActionTest {
     return request.executeProtobuf(CreateWsResponse.class);
   }
 
-  private void enableCreatePersonalOrg(boolean flag) {
-    settings.setProperty(CorePropertyDefinitions.ORGANIZATIONS_CREATE_PERSONAL_ORG, flag);
-  }
-
 }
index 0c4fb6883857b2d83f7a32b20e4e606d2c06da86..12f1ffef7725d1062f9bc96d4137d54198463a0b 100644 (file)
@@ -86,7 +86,7 @@ public class CurrentActionHomepageTest {
   @UseDataProvider("enterpriseAndAbove")
   public void return_homepage_when_set_to_a_portfolio(EditionProvider.Edition edition) {
     setPlatformEdition(edition);
-    ComponentDto portfolio = db.components().insertPrivatePortfolio(db.getDefaultOrganization());
+    ComponentDto portfolio = db.components().insertPrivatePortfolio();
     UserDto user = db.users().insertUser(u -> u.setHomepageType("PORTFOLIO").setHomepageParameter(portfolio.uuid()));
     userSessionRule.logIn(user).addProjectPermission(USER, portfolio);
 
@@ -101,7 +101,7 @@ public class CurrentActionHomepageTest {
   @UseDataProvider("enterpriseAndAbove")
   public void return_default_when_set_to_a_portfolio_but_no_rights_on_this_portfolio(EditionProvider.Edition edition) {
     setPlatformEdition(edition);
-    ComponentDto portfolio = db.components().insertPrivatePortfolio(db.getDefaultOrganization());
+    ComponentDto portfolio = db.components().insertPrivatePortfolio();
     UserDto user = db.users().insertUser(u -> u.setHomepageType("PORTFOLIO").setHomepageParameter(portfolio.uuid()));
     userSessionRule.logIn(user);
 
@@ -116,7 +116,7 @@ public class CurrentActionHomepageTest {
   @UseDataProvider("enterpriseAndAbove")
   public void return_homepage_when_set_to_an_application(EditionProvider.Edition edition) {
     setPlatformEdition(edition);
-    ComponentDto application = db.components().insertPrivateApplication(db.getDefaultOrganization());
+    ComponentDto application = db.components().insertPrivateApplication();
     UserDto user = db.users().insertUser(u -> u.setHomepageType("APPLICATION").setHomepageParameter(application.uuid()));
     userSessionRule.logIn(user).addProjectPermission(USER, application);
 
@@ -131,7 +131,7 @@ public class CurrentActionHomepageTest {
   @UseDataProvider("enterpriseAndAbove")
   public void return_default_homepage_when_set_to_an_application_but_no_rights_on_this_application(EditionProvider.Edition edition) {
     setPlatformEdition(edition);
-    ComponentDto application = db.components().insertPrivateApplication(db.getDefaultOrganization());
+    ComponentDto application = db.components().insertPrivateApplication();
     UserDto user = db.users().insertUser(u -> u.setHomepageType("APPLICATION").setHomepageParameter(application.uuid()));
     userSessionRule.logIn(user);
 
@@ -211,7 +211,7 @@ public class CurrentActionHomepageTest {
   @Test
   public void fallback_when_edition_is_null() {
     setPlatformEdition(null);
-    ComponentDto application = db.components().insertPrivateApplication(db.getDefaultOrganization());
+    ComponentDto application = db.components().insertPrivateApplication();
     UserDto user = db.users().insertUser(u -> u.setHomepageType("APPLICATION").setHomepageParameter(application.uuid()));
     userSessionRule.logIn(user.getLogin());
 
@@ -237,7 +237,7 @@ public class CurrentActionHomepageTest {
   @UseDataProvider("belowEnterprise")
   public void fallback_when_user_homepage_application_and_edition_below_enterprise(EditionProvider.Edition edition) {
     setPlatformEdition(edition);
-    ComponentDto application = db.components().insertPrivateApplication(db.getDefaultOrganization());
+    ComponentDto application = db.components().insertPrivateApplication();
     UserDto user = db.users().insertUser(u -> u.setHomepageType("APPLICATION").setHomepageParameter(application.uuid()));
     userSessionRule.logIn(user.getLogin());
 
index 0c1422130cec93008b66707a0820fe06f1b7df58..1373c02974c609d8c42aef70e57cbc54637595af 100644 (file)
@@ -140,7 +140,6 @@ public class CurrentActionTest {
     UserDto user = db.users().insertUser();
     userSession
       .logIn(user)
-      // permissions on default organization
       .addPermission(SCAN)
       .addPermission(ADMINISTER_QUALITY_PROFILES);
 
index ae1e40c757767dd14f8b635d0de46a27286c37c2..27732d657872eafcb2fc64ff5482ef6dd6272ca0 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.server.user.ws;
 
 import java.util.Optional;
 import javax.annotation.Nullable;
-import org.elasticsearch.action.search.SearchRequest;
 import org.elasticsearch.search.builder.SearchSourceBuilder;
 import org.junit.Rule;
 import org.junit.Test;
@@ -34,7 +33,6 @@ import org.sonar.db.DbTester;
 import org.sonar.db.alm.setting.AlmSettingDto;
 import org.sonar.db.ce.CeTaskMessageType;
 import org.sonar.db.component.ComponentDto;
-import org.sonar.db.organization.OrganizationDto;
 import org.sonar.db.permission.template.PermissionTemplateDto;
 import org.sonar.db.permission.template.PermissionTemplateUserDto;
 import org.sonar.db.project.ProjectDto;
@@ -220,22 +218,6 @@ public class DeactivateActionTest {
     assertThat(db.getDbClient().propertiesDao().selectByQuery(PropertyQuery.builder().build(), db.getSession())).extracting(PropertyDto::getKey).containsOnly("other");
   }
 
-  @Test
-  public void deactivate_user_deletes_his_organization_membership() {
-    createAdminUser();
-    logInAsSystemAdministrator();
-    UserDto user = db.users().insertUser();
-    OrganizationDto organization = db.organizations().insert();
-    db.organizations().addMember(organization, user);
-    OrganizationDto anotherOrganization = db.organizations().insert();
-    db.organizations().addMember(anotherOrganization, user);
-
-    deactivate(user.getLogin());
-
-    assertThat(dbClient.organizationMemberDao().select(db.getSession(), organization.getUuid(), user.getUuid())).isNotPresent();
-    assertThat(dbClient.organizationMemberDao().select(db.getSession(), anotherOrganization.getUuid(), user.getUuid())).isNotPresent();
-  }
-
   @Test
   public void deactivate_user_deletes_his_user_settings() {
     createAdminUser();
@@ -389,7 +371,8 @@ public class DeactivateActionTest {
 
   @Test
   public void administrators_can_be_deactivated_if_there_are_still_other_administrators() {
-    UserDto admin = createAdminUser();;
+    UserDto admin = createAdminUser();
+    ;
     UserDto anotherAdmin = createAdminUser();
     logInAsSystemAdministrator();
 
index e6c5801bdfd2484b58fc79c34e0c0d53dc05fbfb..3f33878786184ed863afea18a0d4cebb7b35e97a 100644 (file)
@@ -26,7 +26,6 @@ import org.sonar.api.server.ws.WebService;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbTester;
 import org.sonar.db.component.ComponentDto;
-import org.sonar.db.organization.OrganizationDto;
 import org.sonar.db.user.UserDto;
 import org.sonar.server.component.TestComponentFinder;
 import org.sonar.server.exceptions.UnauthorizedException;
@@ -50,9 +49,8 @@ public class SetHomepageActionTest {
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
 
-  private DbClient dbClient = db.getDbClient();
-
-  private WsActionTester ws = new WsActionTester(new SetHomepageAction(userSession, dbClient, TestComponentFinder.from(db)));
+  private final DbClient dbClient = db.getDbClient();
+  private final WsActionTester ws = new WsActionTester(new SetHomepageAction(userSession, dbClient, TestComponentFinder.from(db)));
 
   @Test
   public void verify_definition() {
@@ -82,8 +80,7 @@ public class SetHomepageActionTest {
 
   @Test
   public void set_project_homepage() {
-    OrganizationDto organization = db.organizations().insert();
-    ComponentDto project = db.components().insertPrivateProject(organization);
+    ComponentDto project = db.components().insertPrivateProject();
 
     UserDto user = db.users().insertUser();
     userSession.logIn(user);
@@ -102,8 +99,7 @@ public class SetHomepageActionTest {
 
   @Test
   public void set_branch_homepage() {
-    OrganizationDto organization = db.organizations().insert();
-    ComponentDto project = db.components().insertPublicProject(organization);
+    ComponentDto project = db.components().insertPublicProject();
     ComponentDto branch = db.components().insertProjectBranch(project);
     UserDto user = db.users().insertUser();
     userSession.logIn(user);
@@ -172,8 +168,7 @@ public class SetHomepageActionTest {
 
   @Test
   public void set_portfolio_homepage() {
-    OrganizationDto organization = db.organizations().insert();
-    ComponentDto portfolio = db.components().insertPrivatePortfolio(organization);
+    ComponentDto portfolio = db.components().insertPrivatePortfolio();
     UserDto user = db.users().insertUser();
     userSession.logIn(user);
 
@@ -191,8 +186,7 @@ public class SetHomepageActionTest {
 
   @Test
   public void set_application_homepage() {
-    OrganizationDto organization = db.organizations().insert();
-    ComponentDto application = db.components().insertPrivateApplication(organization);
+    ComponentDto application = db.components().insertPrivateApplication();
     UserDto user = db.users().insertUser();
     userSession.logIn(user);
 
index 7578d98ce920067dc08772155672ea0ee9822927..609b797ef4805e36e8ac4c5784b2bdbd154f87b3 100644 (file)
@@ -35,8 +35,6 @@ import org.sonar.server.authentication.CredentialsLocalAuthentication;
 import org.sonar.server.es.EsTester;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.user.NewUserNotifier;
 import org.sonar.server.user.UserUpdater;
@@ -52,8 +50,8 @@ import static org.sonar.db.user.UserTesting.newUserDto;
 
 public class UpdateActionTest {
 
-  private MapSettings settings = new MapSettings();
-  private System2 system2 = new System2();
+  private final MapSettings settings = new MapSettings();
+  private final System2 system2 = new System2();
 
   @Rule
   public DbTester db = DbTester.create(system2);
@@ -64,15 +62,12 @@ public class UpdateActionTest {
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
 
-  private DbClient dbClient = db.getDbClient();
-  private DbSession dbSession = db.getSession();
-  private UserIndexer userIndexer = new UserIndexer(dbClient, es.client());
-  private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
-  private CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
-
-  private WsActionTester ws = new WsActionTester(new UpdateAction(
-    new UserUpdater(mock(NewUserNotifier.class), dbClient, userIndexer, defaultOrganizationProvider,
-      new DefaultGroupFinder(db.getDbClient()), settings.asConfig(), localAuthentication),
+  private final DbClient dbClient = db.getDbClient();
+  private final DbSession dbSession = db.getSession();
+  private final UserIndexer userIndexer = new UserIndexer(dbClient, es.client());
+  private final CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
+  private final WsActionTester ws = new WsActionTester(new UpdateAction(
+    new UserUpdater(mock(NewUserNotifier.class), dbClient, userIndexer, new DefaultGroupFinder(db.getDbClient()), settings.asConfig(), localAuthentication),
     userSession, new UserJsonWriter(userSession), dbClient));
 
   @Before
index 80ab15224a3a94f1e316b957a9fab4d7e5fb2b6f..1e9e5157ce0976bde197f201a0a938b9dc6a7c27 100644 (file)
@@ -44,7 +44,7 @@ import static org.mockito.Mockito.mock;
 
 public class UpdateLoginActionTest {
 
-  private System2 system2 = new System2();
+  private final System2 system2 = new System2();
 
   @Rule
   public DbTester db = DbTester.create(system2);
@@ -55,9 +55,8 @@ public class UpdateLoginActionTest {
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
 
-  private WsActionTester ws = new WsActionTester(new UpdateLoginAction(db.getDbClient(), userSession,
-    new UserUpdater(mock(NewUserNotifier.class), db.getDbClient(), new UserIndexer(db.getDbClient(), es.client()),
-      null,null, null, null)));
+  private final WsActionTester ws = new WsActionTester(new UpdateLoginAction(db.getDbClient(), userSession,
+    new UserUpdater(mock(NewUserNotifier.class), db.getDbClient(), new UserIndexer(db.getDbClient(), es.client()), null, null, null)));
 
   @Test
   public void update_login_from_sonarqube_account_when_user_is_local() {
index b473fe63ffcff575fc90629ff1e9b8780f66c103..398c934a60179e5e3dc5a90cf902598fbf5224ff 100644 (file)
@@ -36,7 +36,13 @@ public class CorePropertyDefinitions {
   public static final String SONAR_ANALYSIS = "sonar.analysis.";
 
   private static final String CATEGORY_ORGANIZATIONS = "organizations";
+
+  //TODO remove
+  @Deprecated
   public static final String ORGANIZATIONS_ANYONE_CAN_CREATE = "sonar.organizations.anyoneCanCreate";
+
+  //TODO remove
+  @Deprecated
   public static final String ORGANIZATIONS_CREATE_PERSONAL_ORG = "sonar.organizations.createPersonalOrg";
   public static final String DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES = "sonar.builtInQualityProfiles.disableNotificationOnUpdate";
 
@@ -184,13 +190,6 @@ public class CorePropertyDefinitions {
         .category(CATEGORY_ORGANIZATIONS)
         .type(BOOLEAN)
         .hidden()
-        .build(),
-      PropertyDefinition.builder(ORGANIZATIONS_CREATE_PERSONAL_ORG)
-        .name("Create an organization for each new user.")
-        .defaultValue(Boolean.toString(false))
-        .category(CATEGORY_ORGANIZATIONS)
-        .type(BOOLEAN)
-        .hidden()
         .build()));
     return defs;
   }
index 234a374ca599f4f384836dc1eda72eb6430c913f..9140420216adfa1387616841a4fd4ccdc5bad8bd 100644 (file)
@@ -30,7 +30,7 @@ public class CorePropertyDefinitionsTest {
   @Test
   public void all() {
     List<PropertyDefinition> defs = CorePropertyDefinitions.all();
-    assertThat(defs).hasSize(56);
+    assertThat(defs).hasSize(55);
   }
 
   @Test