From: Simon Brandhof Date: Wed, 28 Sep 2016 17:04:51 +0000 (+0200) Subject: SONAR-8134 add db column groups.organization_uuid X-Git-Tag: 6.2-RC1~455 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=702042d8bdf62c4ae5e541d7c22b07e8cdf5c70b;p=sonarqube.git SONAR-8134 add db column groups.organization_uuid --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/UserUpdater.java b/server/sonar-server/src/main/java/org/sonar/server/user/UserUpdater.java index 5c52cef1c23..94207c0b7ca 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/UserUpdater.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/UserUpdater.java @@ -419,7 +419,7 @@ public class UserUpdater { @Override public boolean apply(@Nullable GroupDto input) { - return input != null && input.getKey().equals(key); + return input != null && input.getName().equals(key); } } } diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1403_add_organization_uuid_to_groups.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1403_add_organization_uuid_to_groups.rb new file mode 100644 index 00000000000..d1a3dadd314 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1403_add_organization_uuid_to_groups.rb @@ -0,0 +1,29 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# SonarQube is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +# +# SonarQube 6.2 +# +class AddOrganizationUuidToGroups < ActiveRecord::Migration + + def self.up + execute_java_migration('org.sonar.db.version.v62.AddOrganizationUuidToGroups') + end +end diff --git a/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java b/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java index 03b1c582ca8..77e6178cfea 100644 --- a/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java +++ b/sonar-db/src/main/java/org/sonar/db/user/GroupDao.java @@ -44,19 +44,31 @@ public class GroupDao implements Dao { this.system = system; } - public GroupDto selectOrFailByName(DbSession session, String key) { - GroupDto group = selectByName(session, key); + /** + * @deprecated organization should be added as a parameter + */ + @Deprecated + public GroupDto selectOrFailByName(DbSession session, String name) { + GroupDto group = selectByName(session, name); if (group == null) { - throw new RowNotFoundException(String.format("Could not find a group with name '%s'", key)); + throw new RowNotFoundException(String.format("Could not find a group with name '%s'", name)); } return group; } + /** + * @deprecated organization should be added as a parameter + */ + @Deprecated @CheckForNull public GroupDto selectByName(DbSession session, String key) { return mapper(session).selectByKey(key); } + /** + * @deprecated organization should be added as a parameter + */ + @Deprecated public List selectByNames(DbSession session, Collection names) { return executeLargeInputs(names, mapper(session)::selectByNames); } diff --git a/sonar-db/src/main/java/org/sonar/db/user/GroupDto.java b/sonar-db/src/main/java/org/sonar/db/user/GroupDto.java index 84ebb0cdf4e..fc964ffc221 100644 --- a/sonar-db/src/main/java/org/sonar/db/user/GroupDto.java +++ b/sonar-db/src/main/java/org/sonar/db/user/GroupDto.java @@ -19,15 +19,26 @@ */ package org.sonar.db.user; +import java.util.Date; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.db.Dto; -public class GroupDto extends Dto { +public class GroupDto { private Long id; private String name; private String description; + private String organizationUuid; + private Date createdAt; + private Date updatedAt; + + public final Date getCreatedAt() { + return this.createdAt; + } + + public final Date getUpdatedAt() { + return this.updatedAt; + } public Long getId() { return id; @@ -57,9 +68,36 @@ public class GroupDto extends Dto { return this; } - @Override - public String getKey() { - return name; + public String getOrganizationUuid() { + return organizationUuid; + } + + public GroupDto setOrganizationUuid(String s) { + this.organizationUuid = s; + return this; } + public GroupDto setCreatedAt(Date d) { + this.createdAt = d; + return this; + } + + public GroupDto setUpdatedAt(Date d) { + this.updatedAt = d; + return this; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("GroupDto{"); + sb.append("id=").append(id); + sb.append(", name='").append(name).append('\''); + sb.append(", description='").append(description).append('\''); + sb.append(", organizationUuid='").append(organizationUuid).append('\''); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append('}'); + return sb.toString(); + } } diff --git a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java index 1ba8da19a94..d03bc6d1de4 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java +++ b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java @@ -37,7 +37,7 @@ public class DatabaseVersion { * versions must be previously upgraded to LTS version. * Note that the value can't be less than current LTS version. */ - public static final int MIN_UPGRADE_VERSION = 1152; + public static final int MIN_UPGRADE_VERSION = 1_152; /** * These tables are still involved in DB migrations, so potentially diff --git a/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java b/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java index e3ae06632f5..1de7f2384ab 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java +++ b/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java @@ -159,7 +159,11 @@ import org.sonar.db.version.v61.DropIsGlobalFromDashboards; import org.sonar.db.version.v61.PopulateTableProperties2; import org.sonar.db.version.v61.RemoveViewsDefinitionFromProperties; import org.sonar.db.version.v61.ShrinkModuleUuidPathOfProjects; +<<<<<<< HEAD import org.sonar.db.version.v62.AddIsRootColumnOnTableUsers; +======= +import org.sonar.db.version.v62.AddOrganizationUuidToGroups; +>>>>>>> SONAR-8134 add db column groups.organization_uuid import org.sonar.db.version.v62.CreateDefaultOrganization; import org.sonar.db.version.v62.CreateTableOrganizations; import org.sonar.db.version.v62.DeletePermissionShareDashboard; @@ -348,8 +352,13 @@ public class MigrationStepModule extends Module { CreateTableOrganizations.class, CreateDefaultOrganization.class, DeletePermissionShareDashboard.class, +<<<<<<< HEAD AddIsRootColumnOnTableUsers.class, PopulateIsRootColumnOnTableUsers.class, MakeRootColumnNotNullOnTableUsers.class); +======= + AddOrganizationUuidToGroups.class + ); +>>>>>>> SONAR-8134 add db column groups.organization_uuid } } diff --git a/sonar-db/src/main/java/org/sonar/db/version/v62/AddOrganizationUuidToGroups.java b/sonar-db/src/main/java/org/sonar/db/version/v62/AddOrganizationUuidToGroups.java new file mode 100644 index 00000000000..5453b32effc --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/db/version/v62/AddOrganizationUuidToGroups.java @@ -0,0 +1,45 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * 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.db.version.v62; + +import java.sql.SQLException; +import org.sonar.db.Database; +import org.sonar.db.version.AddColumnsBuilder; +import org.sonar.db.version.DdlChange; +import org.sonar.db.version.VarcharColumnDef; + +import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder; + +public class AddOrganizationUuidToGroups extends DdlChange { + + public AddOrganizationUuidToGroups(Database db) { + super(db); + } + + @Override + public void execute(Context context) throws SQLException { + VarcharColumnDef column = newVarcharColumnDefBuilder() + .setColumnName("organization_uuid") + .setIsNullable(true) + .setLimit(40) + .build(); + context.execute(new AddColumnsBuilder(getDialect(), "groups").addColumn(column).build()); + } +} diff --git a/sonar-db/src/main/resources/org/sonar/db/user/GroupMapper.xml b/sonar-db/src/main/resources/org/sonar/db/user/GroupMapper.xml index 650e144d630..062a999936f 100644 --- a/sonar-db/src/main/resources/org/sonar/db/user/GroupMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/user/GroupMapper.xml @@ -8,6 +8,7 @@ g.id as id, g.name as name, g.description as description, + g.organization_uuid as organizationUuid, g.created_at as "createdAt", g.updated_at as "updatedAt" @@ -38,14 +39,12 @@ - INSERT INTO groups (name, description, created_at, updated_at) - VALUES (#{name}, #{description}, #{createdAt}, #{updatedAt}) + insert into groups (organization_uuid, name, description, created_at, updated_at) + values ( + #{organizationUuid,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, + #{description,jdbcType=VARCHAR}, + #{createdAt}, + #{updatedAt} + ) diff --git a/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl b/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl index a7c3f3a2939..ce26a7e7691 100644 --- a/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl +++ b/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl @@ -59,6 +59,7 @@ CREATE TABLE "WIDGETS" ( CREATE TABLE "GROUPS" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + "ORGANIZATION_UUID" VARCHAR(40), "NAME" VARCHAR(500), "DESCRIPTION" VARCHAR(200), "CREATED_AT" TIMESTAMP, diff --git a/sonar-db/src/test/java/org/sonar/db/user/GroupDaoTest.java b/sonar-db/src/test/java/org/sonar/db/user/GroupDaoTest.java index 153aaefc849..baffd349b2d 100644 --- a/sonar-db/src/test/java/org/sonar/db/user/GroupDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/user/GroupDaoTest.java @@ -20,13 +20,15 @@ package org.sonar.db.user; import java.util.Collections; +import java.util.Date; import java.util.List; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; import org.sonar.db.DbSession; import org.sonar.db.DbTester; +import org.sonar.db.RowNotFoundException; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; @@ -38,44 +40,56 @@ import static org.sonar.db.user.GroupTesting.newGroupDto; public class GroupDaoTest { - @Rule - public DbTester db = DbTester.create(System2.INSTANCE); + private static final long NOW = 1_500_000L; - final DbSession dbSession = db.getSession(); - System2 system2 = mock(System2.class); + private System2 system2 = mock(System2.class); - GroupDao underTest = new GroupDao(system2); + @Rule + public DbTester db = DbTester.create(system2); + private final DbSession dbSession = db.getSession(); + private GroupDao underTest = new GroupDao(system2); + + // not static as group id is changed in each test + private final GroupDto aGroup = new GroupDto() + .setName("the-name") + .setDescription("the description") + .setOrganizationUuid("org1"); + + @Before + public void setUp() { + when(system2.now()).thenReturn(NOW); + } @Test - public void select_by_key() { - db.prepareDbUnit(getClass(), "select_by_key.xml"); + public void test_insert_and_selectOrFailByName() { + db.getDbClient().groupDao().insert(dbSession, aGroup); + + GroupDto group = underTest.selectOrFailByName(dbSession, aGroup.getName()); - GroupDto group = underTest.selectOrFailByName(dbSession, "sonar-users"); + assertThat(group.getId()).isNotNull(); + assertThat(group.getOrganizationUuid()).isEqualTo(aGroup.getOrganizationUuid()); + assertThat(group.getName()).isEqualTo(aGroup.getName()); + assertThat(group.getDescription()).isEqualTo(aGroup.getDescription()); + assertThat(group.getCreatedAt()).isEqualTo(new Date(NOW)); + assertThat(group.getUpdatedAt()).isEqualTo(new Date(NOW)); + } - assertThat(group).isNotNull(); - assertThat(group.getId()).isEqualTo(1L); - assertThat(group.getName()).isEqualTo("sonar-users"); - assertThat(group.getDescription()).isEqualTo("Sonar Users"); - assertThat(group.getCreatedAt()).isEqualTo(DateUtils.parseDate("2014-09-07")); - assertThat(group.getUpdatedAt()).isEqualTo(DateUtils.parseDate("2014-09-08")); + @Test(expected = RowNotFoundException.class) + public void selectOrFailByName_throws_NFE_if_not_found() { + underTest.selectOrFailByName(dbSession, "missing"); } @Test - public void select_by_id() { - db.prepareDbUnit(getClass(), "select_by_key.xml"); + public void selectOrFailById() { + db.getDbClient().groupDao().insert(dbSession, aGroup); - GroupDto group = underTest.selectOrFailById(dbSession, 1L); + GroupDto group = underTest.selectOrFailById(dbSession, aGroup.getId()); - assertThat(group).isNotNull(); - assertThat(group.getId()).isEqualTo(1L); - assertThat(group.getName()).isEqualTo("sonar-users"); - assertThat(group.getDescription()).isEqualTo("Sonar Users"); - assertThat(group.getCreatedAt()).isEqualTo(DateUtils.parseDate("2014-09-07")); - assertThat(group.getUpdatedAt()).isEqualTo(DateUtils.parseDate("2014-09-08")); + assertThat(group.getName()).isEqualTo(aGroup.getName()); } @Test - public void find_by_user_login() { + public void selectByUserLogin() { db.prepareDbUnit(getClass(), "find_by_user_login.xml"); assertThat(underTest.selectByUserLogin(dbSession, "john")).hasSize(2); @@ -83,50 +97,43 @@ public class GroupDaoTest { } @Test - public void select_by_names() { - underTest.insert(dbSession, new GroupDto().setName("group1")); - underTest.insert(dbSession, new GroupDto().setName("group2")); - underTest.insert(dbSession, new GroupDto().setName("group3")); + public void selectByNames() { + underTest.insert(dbSession, newGroupDto().setName("group1")); + underTest.insert(dbSession, newGroupDto().setName("group2")); + underTest.insert(dbSession, newGroupDto().setName("group3")); dbSession.commit(); assertThat(underTest.selectByNames(dbSession, asList("group1", "group2", "group3"))).hasSize(3); assertThat(underTest.selectByNames(dbSession, singletonList("group1"))).hasSize(1); assertThat(underTest.selectByNames(dbSession, asList("group1", "unknown"))).hasSize(1); - assertThat(underTest.selectByNames(dbSession, Collections.emptyList())).isEmpty(); - } - - @Test - public void insert() { - when(system2.now()).thenReturn(DateUtils.parseDate("2014-09-08").getTime()); - db.prepareDbUnit(getClass(), "empty.xml"); - GroupDto dto = new GroupDto() - .setId(1L) - .setName("sonar-users") - .setDescription("Sonar Users"); - - underTest.insert(dbSession, dto); - dbSession.commit(); - - db.assertDbUnit(getClass(), "insert-result.xml", "groups"); + assertThat(underTest.selectByNames(dbSession, Collections.emptyList())).isEmpty(); } @Test public void update() { - when(system2.now()).thenReturn(DateUtils.parseDate("2013-07-25").getTime()); - db.prepareDbUnit(getClass(), "update.xml"); + db.getDbClient().groupDao().insert(dbSession, aGroup); GroupDto dto = new GroupDto() - .setId(1L) + .setId(aGroup.getId()) .setName("new-name") - .setDescription("New Description"); + .setDescription("New description") + .setOrganizationUuid("another-org") + .setCreatedAt(new Date(NOW + 1_000L)); underTest.update(dbSession, dto); - dbSession.commit(); - db.assertDbUnit(getClass(), "update-result.xml", "groups"); + GroupDto reloaded = underTest.selectById(dbSession, aGroup.getId()); + + // verify mutable fields + assertThat(reloaded.getName()).isEqualTo("new-name"); + assertThat(reloaded.getDescription()).isEqualTo("New description"); + + // immutable fields --> to be ignored + assertThat(reloaded.getOrganizationUuid()).isEqualTo(aGroup.getOrganizationUuid()); + assertThat(reloaded.getCreatedAt()).isEqualTo(aGroup.getCreatedAt()); } @Test - public void select_by_query() { + public void selectByQuery() { db.prepareDbUnit(getClass(), "select_by_query.xml"); /* @@ -174,7 +181,7 @@ public class GroupDaoTest { } @Test - public void count_by_query() { + public void countByQuery() { db.prepareDbUnit(getClass(), "select_by_query.xml"); // Null query @@ -188,14 +195,12 @@ public class GroupDaoTest { } @Test - public void delete_by_id() { - db.prepareDbUnit(getClass(), "select_by_key.xml"); + public void deleteById() { + db.getDbClient().groupDao().insert(dbSession, aGroup); - GroupDao groupDao = underTest; - groupDao.deleteById(dbSession, 1L); - dbSession.commit(); + underTest.deleteById(dbSession, aGroup.getId()); - assertThat(groupDao.countByQuery(dbSession, null)).isZero(); + assertThat(db.countRowsOfTable(dbSession, "groups")).isEqualTo(0); } } diff --git a/sonar-db/src/test/java/org/sonar/db/user/GroupDtoTest.java b/sonar-db/src/test/java/org/sonar/db/user/GroupDtoTest.java deleted file mode 100644 index 96a803adb6c..00000000000 --- a/sonar-db/src/test/java/org/sonar/db/user/GroupDtoTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * 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.db.user; - -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class GroupDtoTest { - - @Test - public void getter_and_setter() { - GroupDto dto = new GroupDto() - .setId(1L) - .setName("sonar-users") - .setDescription("Sonar users"); - - assertThat(dto.getKey()).isEqualTo("sonar-users"); - assertThat(dto.getName()).isEqualTo("sonar-users"); - assertThat(dto.getId()).isEqualTo(1L); - assertThat(dto.getDescription()).isEqualTo("Sonar users"); - } - -} diff --git a/sonar-db/src/test/java/org/sonar/db/user/GroupTesting.java b/sonar-db/src/test/java/org/sonar/db/user/GroupTesting.java index 2fcf8eefae3..9291bffa9fb 100644 --- a/sonar-db/src/test/java/org/sonar/db/user/GroupTesting.java +++ b/sonar-db/src/test/java/org/sonar/db/user/GroupTesting.java @@ -26,12 +26,17 @@ import static org.apache.commons.lang.math.RandomUtils.nextLong; public class GroupTesting { + private GroupTesting() { + // only statics + } + public static GroupDto newGroupDto() { GroupDto group = new GroupDto() + .setOrganizationUuid(randomAlphanumeric(40)) .setName(randomAlphanumeric(255)) - .setDescription(randomAlphanumeric(200)); - group.setCreatedAt(new Date(nextLong())); - group.setUpdatedAt(new Date(nextLong())); + .setDescription(randomAlphanumeric(200)) + .setCreatedAt(new Date(nextLong())) + .setUpdatedAt(new Date(nextLong())); return group; } } diff --git a/sonar-db/src/test/java/org/sonar/db/version/v62/AddOrganizationUuidToGroupsTest.java b/sonar-db/src/test/java/org/sonar/db/version/v62/AddOrganizationUuidToGroupsTest.java new file mode 100644 index 00000000000..79590a1f681 --- /dev/null +++ b/sonar-db/src/test/java/org/sonar/db/version/v62/AddOrganizationUuidToGroupsTest.java @@ -0,0 +1,56 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * 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.db.version.v62; + +import java.sql.SQLException; +import java.sql.Types; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.sonar.api.utils.System2; +import org.sonar.db.DbTester; + + +public class AddOrganizationUuidToGroupsTest { + + @Rule + public final DbTester dbTester = DbTester.createForSchema(System2.INSTANCE, AddOrganizationUuidToGroupsTest.class, "previous-groups.sql"); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + private AddOrganizationUuidToGroups underTest = new AddOrganizationUuidToGroups(dbTester.database()); + + @Test + public void creates_table_on_empty_db() throws SQLException { + underTest.execute(); + + dbTester.assertColumnDefinition("groups", "organization_uuid", Types.VARCHAR, 40, true); + } + + @Test + public void migration_is_not_reentrant() throws SQLException { + underTest.execute(); + + expectedException.expect(IllegalStateException.class); + + underTest.execute(); + } +} diff --git a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/empty.xml b/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/empty.xml deleted file mode 100644 index a1c54e4625a..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/empty.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/find_by_user_login.xml b/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/find_by_user_login.xml index a7dda4cf789..6ceac57ea80 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/find_by_user_login.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/find_by_user_login.xml @@ -4,17 +4,20 @@ name="sonar-users" description="Sonar Users" created_at="2014-09-07" - updated_at="2014-09-08"/> + updated_at="2014-09-08" + organization_uuid="org1"/> + updated_at="2014-09-08" + organization_uuid="org1"/> + updated_at="2014-09-08" + organization_uuid="org1"/> @@ -27,7 +30,6 @@ email="jo@hn.com" created_at="1418215735482" updated_at="1418215735482" - active="[true]" - is_root="[false]"/> + active="[true]"/> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/insert-result.xml b/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/insert-result.xml deleted file mode 100644 index ebbd59a6b8d..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/insert-result.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/select_by_key.xml b/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/select_by_key.xml deleted file mode 100644 index e3ec0111eea..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/select_by_key.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/select_by_query.xml b/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/select_by_query.xml index 983f6ad9980..2df4e55073d 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/select_by_query.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/select_by_query.xml @@ -1,9 +1,34 @@ - - - - - + + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/update-result.xml b/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/update-result.xml deleted file mode 100644 index 7fdf00ca9d0..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/update-result.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/update.xml b/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/update.xml deleted file mode 100644 index df225b534d4..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/user/GroupDaoTest/update.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v62/AddOrganizationUuidToGroupsTest/previous-groups.sql b/sonar-db/src/test/resources/org/sonar/db/version/v62/AddOrganizationUuidToGroupsTest/previous-groups.sql new file mode 100644 index 00000000000..250a9a8f45b --- /dev/null +++ b/sonar-db/src/test/resources/org/sonar/db/version/v62/AddOrganizationUuidToGroupsTest/previous-groups.sql @@ -0,0 +1,7 @@ +CREATE TABLE "GROUPS" ( + "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + "NAME" VARCHAR(500), + "DESCRIPTION" VARCHAR(200), + "CREATED_AT" TIMESTAMP, + "UPDATED_AT" TIMESTAMP +);