aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db/src/test
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-02-07 17:10:21 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-02-08 17:18:43 +0100
commit8f66d37bf9687f52532816e1842eda36a19078c4 (patch)
treefc58edef4d58e8c8c0305689f7f52353b7bd6021 /sonar-db/src/test
parentd78f3f2f8796789926f298565d3f0ca077175b44 (diff)
downloadsonarqube-8f66d37bf9687f52532816e1842eda36a19078c4.tar.gz
sonarqube-8f66d37bf9687f52532816e1842eda36a19078c4.zip
Remove some instantiations of ComponentDbTester
Diffstat (limited to 'sonar-db/src/test')
-rw-r--r--sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java77
-rw-r--r--sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java15
-rw-r--r--sonar-db/src/test/java/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest.java5
-rw-r--r--sonar-db/src/test/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java45
-rw-r--r--sonar-db/src/test/java/org/sonar/db/user/RoleDaoTest.java6
5 files changed, 68 insertions, 80 deletions
diff --git a/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java
index 2ac7254b0ce..23f0afc361d 100644
--- a/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java
@@ -74,7 +74,6 @@ public class ComponentDaoTest {
@Rule
public DbTester db = DbTester.create(System2.INSTANCE);
- private ComponentDbTester componentDb = new ComponentDbTester(db);
private DbSession dbSession = db.getSession();
private ComponentDao underTest = new ComponentDao();
@@ -527,21 +526,23 @@ public class ComponentDaoTest {
public void select_projects() {
OrganizationDto organization = db.organizations().insert();
ComponentDto provisionedProject = db.components().insertProject();
- ComponentDto provisionedView = db.components().insertView(organization, (dto) -> {});
+ ComponentDto provisionedView = db.components().insertView(organization, (dto) -> {
+ });
String projectUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newProjectDto(organization)).getComponentUuid();
String disabledProjectUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newProjectDto(organization).setEnabled(false)).getComponentUuid();
String viewUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newView(organization)).getComponentUuid();
assertThat(underTest.selectProjects(dbSession))
- .extracting(ComponentDto::uuid)
- .containsOnly(provisionedProject.uuid(), projectUuid);
+ .extracting(ComponentDto::uuid)
+ .containsOnly(provisionedProject.uuid(), projectUuid);
}
@Test
public void select_provisioned() {
OrganizationDto organization = db.organizations().insert();
ComponentDto provisionedProject = db.components().insertComponent(newProjectDto(organization).setKey("provisioned.project").setName("Provisioned Project"));
- ComponentDto provisionedView = db.components().insertView(organization, (dto) -> {});
+ ComponentDto provisionedView = db.components().insertView(organization, (dto) -> {
+ });
String projectUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newProjectDto(organization)).getComponentUuid();
String disabledProjectUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newProjectDto(organization).setEnabled(false)).getComponentUuid();
String viewUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newView(organization)).getComponentUuid();
@@ -824,8 +825,8 @@ public class ComponentDaoTest {
@Test
public void delete() throws Exception {
- ComponentDto project1 = componentDb.insertProject(db.getDefaultOrganization(), (t) -> t.setKey("PROJECT_1"));
- componentDb.insertProject(db.getDefaultOrganization(), (t) -> t.setKey("PROJECT_2"));
+ ComponentDto project1 = db.components().insertProject(db.getDefaultOrganization(), (t) -> t.setKey("PROJECT_1"));
+ db.components().insertProject(db.getDefaultOrganization(), (t) -> t.setKey("PROJECT_2"));
underTest.delete(dbSession, project1.getId());
dbSession.commit();
@@ -853,11 +854,11 @@ public class ComponentDaoTest {
@Test
public void selectByQuery_with_paging_query_and_qualifiers() {
OrganizationDto organizationDto = db.organizations().insert();
- componentDb.insertProjectAndSnapshot(newProjectDto(organizationDto).setName("aaaa-name"));
- componentDb.insertProjectAndSnapshot(newView(organizationDto));
- componentDb.insertProjectAndSnapshot(newDeveloper(organizationDto, "project-name"));
+ db.components().insertProjectAndSnapshot(newProjectDto(organizationDto).setName("aaaa-name"));
+ db.components().insertProjectAndSnapshot(newView(organizationDto));
+ db.components().insertProjectAndSnapshot(newDeveloper(organizationDto, "project-name"));
for (int i = 9; i >= 1; i--) {
- componentDb.insertProjectAndSnapshot(newProjectDto(organizationDto).setName("project-" + i));
+ db.components().insertProjectAndSnapshot(newProjectDto(organizationDto).setName("project-" + i));
}
ComponentQuery query = ComponentQuery.builder().setNameOrKeyQuery("oJect").setQualifiers(Qualifiers.PROJECT).build();
@@ -874,8 +875,8 @@ public class ComponentDaoTest {
public void selectByQuery_with_organization_filters_on_specified_organization() {
OrganizationDto organization1 = db.organizations().insert();
OrganizationDto organization2 = db.organizations().insert();
- ComponentDto project1 = componentDb.insertProject(organization1);
- ComponentDto project2 = componentDb.insertProject(organization2);
+ ComponentDto project1 = db.components().insertProject(organization1);
+ ComponentDto project2 = db.components().insertProject(organization2);
assertThat(underTest.selectByQuery(dbSession, ALL_PROJECTS_COMPONENT_QUERY, 0, 2))
.extracting(ComponentDto::uuid)
@@ -894,8 +895,8 @@ public class ComponentDaoTest {
public void countByQuery_with_organization_filters_on_specified_organization() {
OrganizationDto organization1 = db.organizations().insert();
OrganizationDto organization2 = db.organizations().insert();
- ComponentDto project1 = componentDb.insertProject(organization1);
- ComponentDto project2 = componentDb.insertProject(organization2);
+ ComponentDto project1 = db.components().insertProject(organization1);
+ ComponentDto project2 = db.components().insertProject(organization2);
assertThat(underTest.countByQuery(dbSession, ALL_PROJECTS_COMPONENT_QUERY))
.isEqualTo(2);
@@ -909,7 +910,7 @@ public class ComponentDaoTest {
@Test
public void selectByQuery_name_with_special_characters() {
- componentDb.insertProjectAndSnapshot(newProjectDto(db.getDefaultOrganization()).setName("project-\\_%/-name"));
+ db.components().insertProjectAndSnapshot(newProjectDto(db.getDefaultOrganization()).setName("project-\\_%/-name"));
ComponentQuery query = ComponentQuery.builder().setNameOrKeyQuery("-\\_%/-").setQualifiers(Qualifiers.PROJECT).build();
List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10);
@@ -920,7 +921,7 @@ public class ComponentDaoTest {
@Test
public void selectByQuery_key_with_special_characters() {
- componentDb.insertProjectAndSnapshot(newProjectDto(db.organizations().insert()).setKey("project-_%-key"));
+ db.components().insertProjectAndSnapshot(newProjectDto(db.organizations().insert()).setKey("project-_%-key"));
ComponentQuery query = ComponentQuery.builder().setNameOrKeyQuery("project-_%-key").setQualifiers(Qualifiers.PROJECT).build();
List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10);
@@ -931,8 +932,8 @@ public class ComponentDaoTest {
@Test
public void selectByQuery_filter_on_language() {
- componentDb.insertComponent(newProjectDto(db.getDefaultOrganization()).setKey("java-project-key").setLanguage("java"));
- componentDb.insertComponent(newProjectDto(db.getDefaultOrganization()).setKey("cpp-project-key").setLanguage("cpp"));
+ db.components().insertComponent(newProjectDto(db.getDefaultOrganization()).setKey("java-project-key").setLanguage("java"));
+ db.components().insertComponent(newProjectDto(db.getDefaultOrganization()).setKey("cpp-project-key").setLanguage("cpp"));
ComponentQuery query = ComponentQuery.builder().setLanguage("java").setQualifiers(Qualifiers.PROJECT).build();
List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10);
@@ -954,9 +955,9 @@ public class ComponentDaoTest {
@Test
public void selectByQuery_on_component_ids() {
OrganizationDto organizationDto = db.organizations().insert();
- ComponentDto sonarqube = componentDb.insertComponent(newProjectDto(organizationDto));
- ComponentDto jdk8 = componentDb.insertComponent(newProjectDto(organizationDto));
- ComponentDto cLang = componentDb.insertComponent(newProjectDto(organizationDto));
+ ComponentDto sonarqube = db.components().insertComponent(newProjectDto(organizationDto));
+ ComponentDto jdk8 = db.components().insertComponent(newProjectDto(organizationDto));
+ ComponentDto cLang = db.components().insertComponent(newProjectDto(organizationDto));
ComponentQuery query = ComponentQuery.builder().setQualifiers(Qualifiers.PROJECT)
.setComponentIds(newHashSet(sonarqube.getId(), jdk8.getId())).build();
@@ -973,11 +974,11 @@ public class ComponentDaoTest {
OrganizationDto organization = db.organizations().insert();
// project -> module -> file
ComponentDto project = newProjectDto(organization, PROJECT_UUID);
- componentDb.insertProjectAndSnapshot(project);
+ db.components().insertProjectAndSnapshot(project);
ComponentDto module = newModuleDto(MODULE_UUID, project);
- componentDb.insertComponent(module);
+ db.components().insertComponent(module);
ComponentDto file = newFileDto(module, null, FILE_1_UUID);
- componentDb.insertComponent(file);
+ db.components().insertComponent(file);
db.commit();
// ancestors of root
@@ -997,15 +998,15 @@ public class ComponentDaoTest {
public void select_descendants_with_children_stragegy() {
// project has 2 children: module and file 1. Other files are part of module.
ComponentDto project = newProjectDto(db.organizations().insert(), PROJECT_UUID);
- componentDb.insertProjectAndSnapshot(project);
+ db.components().insertProjectAndSnapshot(project);
ComponentDto module = newModuleDto(MODULE_UUID, project);
- componentDb.insertComponent(module);
+ db.components().insertComponent(module);
ComponentDto file1 = newFileDto(project, null, FILE_1_UUID).setKey("file-key-1").setName("File One");
- componentDb.insertComponent(file1);
+ db.components().insertComponent(file1);
ComponentDto file2 = newFileDto(module, null, FILE_2_UUID).setKey("file-key-2").setName("File Two");
- componentDb.insertComponent(file2);
+ db.components().insertComponent(file2);
ComponentDto file3 = newFileDto(module, null, FILE_3_UUID).setKey("file-key-3").setName("File Three");
- componentDb.insertComponent(file3);
+ db.components().insertComponent(file3);
db.commit();
// test children of root
@@ -1062,10 +1063,10 @@ public class ComponentDaoTest {
@Test
public void select_descendants_with_leaves_strategy() {
ComponentDto project = newProjectDto(db.getDefaultOrganization(), PROJECT_UUID);
- componentDb.insertProjectAndSnapshot(project);
- componentDb.insertComponent(newModuleDto("module-1-uuid", project));
- componentDb.insertComponent(newFileDto(project, null, "file-1-uuid"));
- componentDb.insertComponent(newFileDto(project, null, "file-2-uuid"));
+ db.components().insertProjectAndSnapshot(project);
+ db.components().insertComponent(newModuleDto("module-1-uuid", project));
+ db.components().insertComponent(newFileDto(project, null, "file-1-uuid"));
+ db.components().insertComponent(newFileDto(project, null, "file-2-uuid"));
db.commit();
ComponentTreeQuery query = newTreeQuery(PROJECT_UUID).setStrategy(LEAVES).build();
@@ -1086,14 +1087,14 @@ public class ComponentDaoTest {
public void select_descendants_of_a_view_and_filter_by_name() {
OrganizationDto organizationDto = db.organizations().insert();
ComponentDto view = newView(organizationDto, A_VIEW_UUID);
- componentDb.insertViewAndSnapshot(view);
+ db.components().insertViewAndSnapshot(view);
// one subview
ComponentDto subView = newSubView(view, "subview-uuid", "subview-key").setName("subview name");
- componentDb.insertComponent(subView);
+ db.components().insertComponent(subView);
// one project and its copy linked to the view
ComponentDto project = newProjectDto(organizationDto, PROJECT_UUID).setName("project name");
- componentDb.insertProjectAndSnapshot(project);
- componentDb.insertComponent(newProjectCopy("project-copy-uuid", project, view));
+ db.components().insertProjectAndSnapshot(project);
+ db.components().insertComponent(newProjectCopy("project-copy-uuid", project, view));
ComponentTreeQuery dbQuery = newTreeQuery(A_VIEW_UUID).setNameOrKeyQuery("name").setStrategy(CHILDREN).build();
List<ComponentDto> components = underTest.selectDescendants(dbSession, dbQuery);
diff --git a/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
index faf2c5e4d2a..dce25875e67 100644
--- a/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
@@ -47,14 +47,13 @@ public class SnapshotDaoTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
-
@Rule
public DbTester db = DbTester.create(System2.INSTANCE);
- ComponentDbTester componentDb = new ComponentDbTester(db);
- DbClient dbClient = db.getDbClient();
- DbSession dbSession = db.getSession();
- SnapshotDao underTest = dbClient.snapshotDao();
+ private DbClient dbClient = db.getDbClient();
+ private DbSession dbSession = db.getSession();
+
+ private SnapshotDao underTest = dbClient.snapshotDao();
@Test
public void test_selectByUuid() {
@@ -136,12 +135,12 @@ public class SnapshotDaoTest {
@Test
public void selectLastSnapshotsByRootComponentUuids_returns_snapshots_flagged_as_last() {
- ComponentDto firstProject = componentDb.insertComponent(newProjectDto(db.getDefaultOrganization(), "PROJECT_UUID_1"));
+ ComponentDto firstProject = db.components().insertComponent(newProjectDto(db.getDefaultOrganization(), "PROJECT_UUID_1"));
dbClient.snapshotDao().insert(dbSession, newAnalysis(firstProject).setLast(false));
SnapshotDto lastSnapshotOfFirstProject = dbClient.snapshotDao().insert(dbSession, newAnalysis(firstProject).setLast(true));
- ComponentDto secondProject = componentDb.insertComponent(newProjectDto(db.getDefaultOrganization(), "PROJECT_UUID_2"));
+ ComponentDto secondProject = db.components().insertComponent(newProjectDto(db.getDefaultOrganization(), "PROJECT_UUID_2"));
SnapshotDto lastSnapshotOfSecondProject = dbClient.snapshotDao().insert(dbSession, newAnalysis(secondProject).setLast(true));
- componentDb.insertProjectAndSnapshot(newProjectDto(db.getDefaultOrganization()));
+ db.components().insertProjectAndSnapshot(newProjectDto(db.getDefaultOrganization()));
List<SnapshotDto> result = underTest.selectLastAnalysesByRootComponentUuids(dbSession, newArrayList(firstProject.uuid(), secondProject.uuid()));
diff --git a/sonar-db/src/test/java/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest.java b/sonar-db/src/test/java/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest.java
index d77350c7bb9..df5823737eb 100644
--- a/sonar-db/src/test/java/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest.java
@@ -27,19 +27,16 @@ 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.component.ComponentDbTester;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.property.PropertyDto;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.db.component.ComponentTesting.newProjectDto;
public class ProjectQgateAssociationDaoTest {
@Rule
public DbTester db = DbTester.create(System2.INSTANCE);
- private ComponentDbTester componentDb = new ComponentDbTester(db);
private DbClient dbClient = db.getDbClient();
private DbSession dbSession = db.getSession();
private ProjectQgateAssociationDao underTest = db.getDbClient().projectQgateAssociationDao();
@@ -91,7 +88,7 @@ public class ProjectQgateAssociationDaoTest {
@Test
public void select_qgate_id_is_absent() {
- ComponentDto project = componentDb.insertComponent(newProjectDto(db.getDefaultOrganization()));
+ ComponentDto project = db.components().insertProject();
Optional<Long> result = underTest.selectQGateIdByComponentId(dbSession, project.getId());
diff --git a/sonar-db/src/test/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java b/sonar-db/src/test/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java
index 6ff569a7eb0..953965fe44d 100644
--- a/sonar-db/src/test/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java
@@ -28,7 +28,6 @@ import org.sonar.api.utils.System2;
import org.sonar.core.util.UtcDateUtils;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
-import org.sonar.db.component.ComponentDbTester;
import org.sonar.db.component.ComponentDto;
import static com.google.common.collect.ImmutableList.of;
@@ -43,17 +42,14 @@ import static org.sonar.db.qualityprofile.QualityProfileTesting.newQualityProfil
public class QualityProfileDaoTest {
- System2 system = mock(System2.class);
+ private System2 system = mock(System2.class);
@Rule
public DbTester dbTester = DbTester.create(system);
- DbSession dbSession = dbTester.getSession();
-
- QualityProfileDbTester qualityProfileDb = new QualityProfileDbTester(dbTester);
- ComponentDbTester componentDbTester = new ComponentDbTester(dbTester);
-
- QualityProfileDao underTest = dbTester.getDbClient().qualityProfileDao();
+ private DbSession dbSession = dbTester.getSession();
+ private QualityProfileDbTester qualityProfileDb = new QualityProfileDbTester(dbTester);
+ private QualityProfileDao underTest = dbTester.getDbClient().qualityProfileDao();
@Before
public void before() {
@@ -70,7 +66,7 @@ public class QualityProfileDaoTest {
underTest.insert(dto);
- dbTester.assertDbUnit(getClass(), "insert-result.xml", new String[]{"created_at", "updated_at", "rules_updated_at"}, "rules_profiles");
+ dbTester.assertDbUnit(getClass(), "insert-result.xml", new String[] {"created_at", "updated_at", "rules_updated_at"}, "rules_profiles");
}
@Test
@@ -87,7 +83,7 @@ public class QualityProfileDaoTest {
underTest.update(dbSession, dto);
dbSession.commit();
- dbTester.assertDbUnit(getClass(), "update-result.xml", new String[]{"created_at", "updated_at", "rules_updated_at"}, "rules_profiles");
+ dbTester.assertDbUnit(getClass(), "update-result.xml", new String[] {"created_at", "updated_at", "rules_updated_at"}, "rules_profiles");
}
@Test
@@ -300,9 +296,9 @@ public class QualityProfileDaoTest {
@Test
public void select_selected_projects() throws Exception {
- ComponentDto project1 = componentDbTester.insertProject((t) -> t.setName("Project1 name"));
- ComponentDto project2 = componentDbTester.insertProject((t) -> t.setName("Project2 name"));
- ComponentDto project3 = componentDbTester.insertProject((t) -> t.setName("Project3 name"));
+ ComponentDto project1 = dbTester.components().insertProject((t) -> t.setName("Project1 name"));
+ ComponentDto project2 = dbTester.components().insertProject((t) -> t.setName("Project2 name"));
+ ComponentDto project3 = dbTester.components().insertProject((t) -> t.setName("Project3 name"));
QualityProfileDto profile1 = newQualityProfileDto();
qualityProfileDb.insertQualityProfiles(profile1);
@@ -317,8 +313,7 @@ public class QualityProfileDaoTest {
.extracting("projectId", "projectUuid", "projectKey", "projectName", "profileKey")
.containsOnly(
tuple(project1.getId(), project1.uuid(), project1.key(), project1.name(), profile1.getKey()),
- tuple(project2.getId(), project2.uuid(), project2.key(), project2.name(), profile1.getKey())
- );
+ tuple(project2.getId(), project2.uuid(), project2.key(), project2.name(), profile1.getKey()));
assertThat(underTest.selectSelectedProjects(profile1.getKey(), "ect1", dbSession)).hasSize(1);
assertThat(underTest.selectSelectedProjects("unknown", null, dbSession)).isEmpty();
@@ -326,9 +321,9 @@ public class QualityProfileDaoTest {
@Test
public void select_deselected_projects() throws Exception {
- ComponentDto project1 = componentDbTester.insertProject((t) -> t.setName("Project1 name"));
- ComponentDto project2 = componentDbTester.insertProject((t) -> t.setName("Project2 name"));
- ComponentDto project3 = componentDbTester.insertProject((t) -> t.setName("Project3 name"));
+ ComponentDto project1 = dbTester.components().insertProject((t) -> t.setName("Project1 name"));
+ ComponentDto project2 = dbTester.components().insertProject((t) -> t.setName("Project2 name"));
+ ComponentDto project3 = dbTester.components().insertProject((t) -> t.setName("Project3 name"));
QualityProfileDto profile1 = newQualityProfileDto();
qualityProfileDb.insertQualityProfiles(profile1);
@@ -342,8 +337,7 @@ public class QualityProfileDaoTest {
.extracting("projectId", "projectUuid", "projectKey", "projectName", "profileKey")
.containsOnly(
tuple(project2.getId(), project2.uuid(), project2.key(), project2.name(), null),
- tuple(project3.getId(), project3.uuid(), project3.key(), project3.name(), null)
- );
+ tuple(project3.getId(), project3.uuid(), project3.key(), project3.name(), null));
assertThat(underTest.selectDeselectedProjects(profile1.getKey(), "ect2", dbSession)).hasSize(1);
assertThat(underTest.selectDeselectedProjects("unknown", null, dbSession)).hasSize(3);
@@ -351,9 +345,9 @@ public class QualityProfileDaoTest {
@Test
public void select_project_associations() throws Exception {
- ComponentDto project1 = componentDbTester.insertProject((t) -> t.setName("Project1 name"));
- ComponentDto project2 = componentDbTester.insertProject((t) -> t.setName("Project2 name"));
- ComponentDto project3 = componentDbTester.insertProject((t) -> t.setName("Project3 name"));
+ ComponentDto project1 = dbTester.components().insertProject((t) -> t.setName("Project1 name"));
+ ComponentDto project2 = dbTester.components().insertProject((t) -> t.setName("Project2 name"));
+ ComponentDto project3 = dbTester.components().insertProject((t) -> t.setName("Project3 name"));
QualityProfileDto profile1 = newQualityProfileDto();
qualityProfileDb.insertQualityProfiles(profile1);
@@ -368,8 +362,7 @@ public class QualityProfileDaoTest {
.containsOnly(
tuple(project1.getId(), project1.uuid(), project1.key(), project1.name(), profile1.getKey()),
tuple(project2.getId(), project2.uuid(), project2.key(), project2.name(), null),
- tuple(project3.getId(), project3.uuid(), project3.key(), project3.name(), null)
- );
+ tuple(project3.getId(), project3.uuid(), project3.key(), project3.name(), null));
assertThat(underTest.selectProjectAssociations(profile1.getKey(), "ect2", dbSession)).hasSize(1);
assertThat(underTest.selectProjectAssociations("unknown", null, dbSession)).hasSize(3);
@@ -377,7 +370,7 @@ public class QualityProfileDaoTest {
@Test
public void update_project_profile_association() {
- ComponentDto project = componentDbTester.insertProject();
+ ComponentDto project = dbTester.components().insertProject();
QualityProfileDto profile1Language1 = insertQualityProfileDto("profile1", "Profile 1", "xoo");
QualityProfileDto profile2Language2 = insertQualityProfileDto("profile2", "Profile 2", "xoo2");
QualityProfileDto profile3Language1 = insertQualityProfileDto("profile3", "Profile 3", "xoo");
diff --git a/sonar-db/src/test/java/org/sonar/db/user/RoleDaoTest.java b/sonar-db/src/test/java/org/sonar/db/user/RoleDaoTest.java
index 7190db6203a..18efab675ff 100644
--- a/sonar-db/src/test/java/org/sonar/db/user/RoleDaoTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/user/RoleDaoTest.java
@@ -28,7 +28,6 @@ import org.sonar.api.web.UserRole;
import org.sonar.core.permission.GlobalPermissions;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
-import org.sonar.db.component.ComponentDbTester;
import org.sonar.db.component.ComponentDto;
import static org.assertj.core.api.Assertions.assertThat;
@@ -50,9 +49,8 @@ public class RoleDaoTest {
public void setUp() throws Exception {
user1 = db.users().insertUser();
user2 = db.users().insertUser();
- ComponentDbTester componentDbTester = new ComponentDbTester(db);
- project1 = componentDbTester.insertProject();
- project2 = componentDbTester.insertProject();
+ project1 = db.components().insertProject();
+ project2 = db.components().insertProject();
}
@Test