]> source.dussan.org Git - sonarqube.git/commitdiff
Remove DbUnit from ComponentDaoTest
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 17 Aug 2017 16:07:19 +0000 (18:07 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 21 Aug 2017 09:46:27 +0000 (11:46 +0200)
19 files changed:
server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java
server/sonar-db-dao/src/test/java/org/sonar/db/DbTester.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDbTester.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentTesting.java
server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceTester.java [new file with mode: 0644]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete-result.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/empty.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/multi-modules.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/selectForIndexing.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_module_files_tree.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml [deleted file]

index bf9ccb18a7c477f9f03db2511743ad237c5842a8..8121fee14472eec87c31eb891e62e92f0e710fd4 100644 (file)
@@ -120,11 +120,11 @@ public class ComponentDao implements Dao {
     return countByQueryImpl(session, organizationUuid, query);
   }
 
-  public List<ComponentDto> selectSubProjectsByComponentUuids(DbSession session, Collection<String> keys) {
-    if (keys.isEmpty()) {
+  public List<ComponentDto> selectSubProjectsByComponentUuids(DbSession session, Collection<String> uuids) {
+    if (uuids.isEmpty()) {
       return emptyList();
     }
-    return mapper(session).selectSubProjectsByComponentUuids(keys);
+    return mapper(session).selectSubProjectsByComponentUuids(uuids);
   }
 
   public List<ComponentDto> selectDescendantModules(DbSession session, String rootComponentUuid) {
index cb707617cb6197853c02fb35c382c93e26bd1acb..6333deb7672a4dfa356371e30c84d0aec27f17f9 100644 (file)
@@ -42,6 +42,7 @@ import org.sonar.db.property.PropertyDbTester;
 import org.sonar.db.qualitygate.QualityGateDbTester;
 import org.sonar.db.qualityprofile.QualityProfileDbTester;
 import org.sonar.db.rule.RuleDbTester;
+import org.sonar.db.source.FileSourceTester;
 import org.sonar.db.user.RootFlagAssertions;
 import org.sonar.db.user.UserDbTester;
 
@@ -76,6 +77,7 @@ public class DbTester extends AbstractDbTester<TestDb> {
   private final RootFlagAssertions rootFlagAssertions;
   private final QualityProfileDbTester qualityProfileDbTester;
   private final MeasureDbTester measureDbTester;
+  private final FileSourceTester fileSourceTester;
 
   public DbTester(System2 system2, @Nullable String schemaPath) {
     super(TestDb.create(schemaPath));
@@ -96,6 +98,7 @@ public class DbTester extends AbstractDbTester<TestDb> {
     this.rootFlagAssertions = new RootFlagAssertions(this);
     this.qualityProfileDbTester = new QualityProfileDbTester(this);
     this.measureDbTester = new MeasureDbTester(this);
+    this.fileSourceTester = new FileSourceTester(this);
   }
 
   public static DbTester create() {
@@ -226,6 +229,10 @@ public class DbTester extends AbstractDbTester<TestDb> {
     return measureDbTester;
   }
 
+  public FileSourceTester fileSourceTester() {
+    return fileSourceTester;
+  }
+
   @Override
   protected void after() {
     if (session != null) {
index 1bcb0f0cba2084caa79665392acd701dffefcbaf..8bfea9a812ff33ef00295a47ef4b3482bf2ee444 100644 (file)
@@ -33,12 +33,12 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.sonar.api.resources.Qualifiers;
-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 org.sonar.db.organization.OrganizationDto;
+import org.sonar.db.source.FileSourceDto;
 
 import static com.google.common.collect.Lists.newArrayList;
 import static com.google.common.collect.Sets.newHashSet;
@@ -47,6 +47,7 @@ import static java.util.Collections.emptyList;
 import static java.util.Collections.emptySet;
 import static java.util.Collections.singletonList;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.tuple;
 import static org.assertj.guava.api.Assertions.assertThat;
 import static org.sonar.db.component.ComponentTesting.newDirectory;
 import static org.sonar.db.component.ComponentTesting.newFileDto;
@@ -84,24 +85,28 @@ public class ComponentDaoTest {
 
   @Test
   public void get_by_uuid() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    OrganizationDto organization = db.organizations().insert();
+    ComponentDto project = db.components().insertPrivateProject(organization, p -> p
+      .setDbKey("org.struts:struts")
+      .setName("Struts")
+      .setLongName("Apache Struts"));
+    ComponentDto anotherProject = db.components().insertPrivateProject(organization);
 
-    ComponentDto result = underTest.selectByUuid(dbSession, "U1").get();
+    ComponentDto result = underTest.selectByUuid(dbSession, project.uuid()).get();
     assertThat(result).isNotNull();
-    assertThat(result.getOrganizationUuid()).isEqualTo("org1");
-    assertThat(result.uuid()).isEqualTo("U1");
-    assertThat(result.getUuidPath()).isEqualTo("uuid_path_of_U1");
-    assertThat(result.moduleUuid()).isEqualTo("module_uuid_of_U1");
-    assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U1");
-    assertThat(result.getRootUuid()).isEqualTo("U1");
-    assertThat(result.projectUuid()).isEqualTo("U1");
+    assertThat(result.getOrganizationUuid()).isEqualTo(organization.getUuid());
+    assertThat(result.uuid()).isEqualTo(project.uuid());
+    assertThat(result.getUuidPath()).isEqualTo(".");
+    assertThat(result.moduleUuid()).isNull();
+    assertThat(result.moduleUuidPath()).isEqualTo("." + project.uuid() + ".");
+    assertThat(result.projectUuid()).isEqualTo(project.uuid());
     assertThat(result.getDbKey()).isEqualTo("org.struts:struts");
-    assertThat(result.path()).isEqualTo("path_of_U1");
+    assertThat(result.path()).isNull();
     assertThat(result.name()).isEqualTo("Struts");
     assertThat(result.longName()).isEqualTo("Apache Struts");
     assertThat(result.qualifier()).isEqualTo("TRK");
     assertThat(result.scope()).isEqualTo("PRJ");
-    assertThat(result.language()).isEqualTo("java");
+    assertThat(result.language()).isNull();
     assertThat(result.getCopyResourceUuid()).isNull();
     assertThat(result.getDeveloperUuid()).isNull();
     assertThat(result.isPrivate()).isTrue();
@@ -111,242 +116,226 @@ public class ComponentDaoTest {
 
   @Test
   public void get_by_uuid_on_technical_project_copy() {
-    db.prepareDbUnit(getClass(), "shared.xml");
-
-    ComponentDto result = underTest.selectByUuid(dbSession, "U7").get();
-    assertThat(result).isNotNull();
-    assertThat(result.uuid()).isEqualTo("U7");
-    assertThat(result.moduleUuid()).isEqualTo("module_uuid_of_U7");
-    assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U7");
-    assertThat(result.getRootUuid()).isEqualTo("root_uuid_of_U7");
-    assertThat(result.projectUuid()).isEqualTo("project_uuid_of_U7");
-    assertThat(result.getDbKey()).isEqualTo("DEV:anakin@skywalker.name:org.struts:struts");
+    ComponentDto view = db.components().insertView();
+    ComponentDto project = db.components().insertPublicProject(p -> p
+      .setDbKey("org.struts:struts")
+      .setName("Struts")
+      .setLongName("Apache Struts"));
+    ComponentDto projectCopy = db.components().insertComponent(newProjectCopy(project, view));
+    ComponentDto anotherProject = db.components().insertPrivateProject();
+    ComponentDto anotherProjectCopy = db.components().insertComponent(newProjectCopy(anotherProject, view));
+
+    ComponentDto result = underTest.selectByUuid(dbSession, projectCopy.uuid()).get();
+    assertThat(result.uuid()).isEqualTo(projectCopy.uuid());
+    assertThat(result.moduleUuid()).isEqualTo(view.uuid());
+    assertThat(result.moduleUuidPath()).isEqualTo("." + view.uuid() + ".");
+    assertThat(result.projectUuid()).isEqualTo(view.uuid());
+    assertThat(result.getDbKey()).isEqualTo(view.getDbKey() + project.getDbKey());
     assertThat(result.path()).isNull();
-    assertThat(result.name()).isEqualTo("Apache Struts");
+    assertThat(result.name()).isEqualTo("Struts");
     assertThat(result.longName()).isEqualTo("Apache Struts");
-    assertThat(result.qualifier()).isEqualTo("DEV_PRJ");
-    assertThat(result.scope()).isEqualTo("PRJ");
+    assertThat(result.qualifier()).isEqualTo("TRK");
+    assertThat(result.scope()).isEqualTo("FIL");
     assertThat(result.language()).isNull();
-    assertThat(result.getCopyResourceUuid()).isEqualTo("U1");
-    assertThat(result.getDeveloperUuid()).isEqualTo("developer_uuid_of_U7");
+    assertThat(result.getCopyResourceUuid()).isEqualTo(project.uuid());
     assertThat(result.isPrivate()).isFalse();
   }
 
-  @Test
-  public void selectByUuidon_developer_project_copy() {
-    db.prepareDbUnit(getClass(), "shared.xml");
-
-    ComponentDto result = underTest.selectByUuid(dbSession, "U7").get();
-    assertThat(result.getDeveloperUuid()).isEqualTo("developer_uuid_of_U7");
-  }
-
   @Test
   public void selectByUuid_on_disabled_component() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    ComponentDto enabledProject = db.components().insertPublicProject(p -> p.setEnabled(true));
+    ComponentDto disabledProject = db.components().insertPublicProject(p -> p.setEnabled(false));
 
-    ComponentDto result = underTest.selectByUuid(dbSession, "U5").get();
+    ComponentDto result = underTest.selectByUuid(dbSession, disabledProject.uuid()).get();
     assertThat(result).isNotNull();
-    assertThat(result.uuid()).isEqualTo("U5");
     assertThat(result.isEnabled()).isFalse();
   }
 
   @Test
   public void selectOrFailByUuid_fails_when_component_not_found() {
-    expectedException.expect(RowNotFoundException.class);
+    db.components().insertPublicProject();
 
-    db.prepareDbUnit(getClass(), "shared.xml");
+    expectedException.expect(RowNotFoundException.class);
 
     underTest.selectOrFailByUuid(dbSession, "unknown");
   }
 
   @Test
   public void selectByKey() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    OrganizationDto organization = db.organizations().insert();
+    ComponentDto project = db.components().insertPrivateProject(organization);
+    ComponentDto directory = db.components().insertComponent(newDirectory(project, "src"));
+    ComponentDto file = db.components().insertComponent(newFileDto(directory)
+      .setName("RequestContext.java")
+      .setLongName("org.struts.RequestContext")
+      .setLanguage("java")
+      .setPath("src/RequestContext.java"));
 
-    Optional<ComponentDto> optional = underTest.selectByKey(dbSession, "org.struts:struts-core:src/org/struts/RequestContext.java");
-    assertThat(optional).isPresent();
+    Optional<ComponentDto> optional = underTest.selectByKey(dbSession, file.getDbKey());
 
     ComponentDto result = optional.get();
-    assertThat(result.getOrganizationUuid()).isEqualTo("org1");
-    assertThat(result.uuid()).isEqualTo("U4");
-    assertThat(result.getDbKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
-    assertThat(result.path()).isEqualTo("path_of_U4");
+    assertThat(result.getOrganizationUuid()).isEqualTo(organization.getUuid());
+    assertThat(result.uuid()).isEqualTo(file.uuid());
+    assertThat(result.getDbKey()).isEqualTo(file.getDbKey());
+    assertThat(result.path()).isEqualTo("src/RequestContext.java");
     assertThat(result.name()).isEqualTo("RequestContext.java");
     assertThat(result.longName()).isEqualTo("org.struts.RequestContext");
     assertThat(result.qualifier()).isEqualTo("FIL");
     assertThat(result.scope()).isEqualTo("FIL");
     assertThat(result.language()).isEqualTo("java");
-    assertThat(result.getRootUuid()).isEqualTo("U1");
+    assertThat(result.projectUuid()).isEqualTo(project.uuid());
 
     assertThat(underTest.selectByKey(dbSession, "unknown")).isAbsent();
   }
 
   @Test
   public void selectOrFailByKey_fails_when_component_not_found() {
-    expectedException.expect(RowNotFoundException.class);
+    db.components().insertPrivateProject();
 
-    db.prepareDbUnit(getClass(), "shared.xml");
+    expectedException.expect(RowNotFoundException.class);
 
     underTest.selectOrFailByKey(dbSession, "unknown");
   }
 
   @Test
   public void get_by_key_on_disabled_component() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    ComponentDto project = db.components().insertPrivateProject(p -> p.setEnabled(false));
+
+    ComponentDto result = underTest.selectOrFailByKey(dbSession, project.getKey());
 
-    ComponentDto result = underTest.selectOrFailByKey(dbSession, "org.disabled.project");
     assertThat(result.isEnabled()).isFalse();
   }
 
   @Test
   public void get_by_key_on_a_root_project() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    ComponentDto project = db.components().insertPrivateProject();
 
-    ComponentDto result = underTest.selectOrFailByKey(dbSession, "org.struts:struts");
-    assertThat(result.getDbKey()).isEqualTo("org.struts:struts");
-    assertThat(result.uuid()).isEqualTo("U1");
-    assertThat(result.getUuidPath()).isEqualTo("uuid_path_of_U1");
-    assertThat(result.deprecatedKey()).isEqualTo("org.struts:struts");
-    assertThat(result.path()).isEqualToIgnoringCase("path_of_U1");
-    assertThat(result.name()).isEqualTo("Struts");
-    assertThat(result.longName()).isEqualTo("Apache Struts");
-    assertThat(result.description()).isEqualTo("the description");
-    assertThat(result.qualifier()).isEqualTo("TRK");
-    assertThat(result.scope()).isEqualTo("PRJ");
-    assertThat(result.getRootUuid()).isEqualTo("U1");
-    assertThat(result.projectUuid()).isEqualTo("U1");
+    ComponentDto result = underTest.selectOrFailByKey(dbSession, project.getKey());
+
+    assertThat(result.getDbKey()).isEqualTo(project.getDbKey());
+    assertThat(result.uuid()).isEqualTo(project.uuid());
+    assertThat(result.getUuidPath()).isEqualTo(project.getUuidPath());
+    assertThat(result.getRootUuid()).isEqualTo(project.uuid());
+    assertThat(result.projectUuid()).isEqualTo(project.uuid());
   }
 
   @Test
   public void get_by_keys() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    ComponentDto project1 = db.components().insertPrivateProject();
+    ComponentDto project2 = db.components().insertPrivateProject();
 
-    List<ComponentDto> results = underTest.selectByKeys(dbSession, singletonList("org.struts:struts-core:src/org/struts/RequestContext.java"));
-    assertThat(results).hasSize(1);
+    List<ComponentDto> results = underTest.selectByKeys(dbSession, asList(project1.getKey(), project2.getKey()));
 
-    ComponentDto result = results.get(0);
-    assertThat(result).isNotNull();
-    assertThat(result.getDbKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
-    assertThat(result.path()).isEqualTo("path_of_U4");
-    assertThat(result.name()).isEqualTo("RequestContext.java");
-    assertThat(result.longName()).isEqualTo("org.struts.RequestContext");
-    assertThat(result.qualifier()).isEqualTo("FIL");
-    assertThat(result.scope()).isEqualTo("FIL");
-    assertThat(result.language()).isEqualTo("java");
-    assertThat(result.getRootUuid()).isEqualTo("U1");
+    assertThat(results)
+      .extracting(ComponentDto::uuid, ComponentDto::getKey)
+      .containsExactlyInAnyOrder(
+        tuple(project1.uuid(), project1.getKey()),
+        tuple(project2.uuid(), project2.getKey()));
 
     assertThat(underTest.selectByKeys(dbSession, singletonList("unknown"))).isEmpty();
   }
 
   @Test
   public void get_by_ids() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    ComponentDto project1 = db.components().insertPrivateProject();
+    ComponentDto project2 = db.components().insertPrivateProject();
 
-    List<ComponentDto> results = underTest.selectByIds(dbSession, newArrayList(4L));
-    assertThat(results).hasSize(1);
+    List<ComponentDto> results = underTest.selectByIds(dbSession, asList(project1.getId(), project2.getId()));
 
-    ComponentDto result = results.get(0);
-    assertThat(result).isNotNull();
-    assertThat(result.getDbKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
-    assertThat(result.path()).isEqualTo("path_of_U4");
-    assertThat(result.name()).isEqualTo("RequestContext.java");
-    assertThat(result.longName()).isEqualTo("org.struts.RequestContext");
-    assertThat(result.qualifier()).isEqualTo("FIL");
-    assertThat(result.scope()).isEqualTo("FIL");
-    assertThat(result.language()).isEqualTo("java");
-    assertThat(result.getRootUuid()).isEqualTo("U1");
+    assertThat(results)
+      .extracting(ComponentDto::uuid, ComponentDto::getKey)
+      .containsExactlyInAnyOrder(
+        tuple(project1.uuid(), project1.getKey()),
+        tuple(project2.uuid(), project2.getKey()));
 
-    assertThat(underTest.selectByIds(dbSession, newArrayList(555L))).isEmpty();
+    assertThat(underTest.selectByIds(dbSession, singletonList(0L))).isEmpty();
   }
 
   @Test
   public void get_by_uuids() {
-    db.prepareDbUnit(getClass(), "shared.xml");
-
-    List<ComponentDto> results = underTest.selectByUuids(dbSession, newArrayList("U4"));
-    assertThat(results).hasSize(1);
-
-    ComponentDto result = results.get(0);
-    assertThat(result.getOrganizationUuid()).isEqualTo("org1");
-    assertThat(result.uuid()).isEqualTo("U4");
-    assertThat(result.moduleUuid()).isEqualTo("module_uuid_of_U4");
-    assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U4");
-    assertThat(result.getRootUuid()).isEqualTo("U1");
-    assertThat(result.projectUuid()).isEqualTo("U1");
-    assertThat(result.getDbKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
-    assertThat(result.path()).isEqualTo("path_of_U4");
-    assertThat(result.name()).isEqualTo("RequestContext.java");
-    assertThat(result.longName()).isEqualTo("org.struts.RequestContext");
-    assertThat(result.qualifier()).isEqualTo("FIL");
-    assertThat(result.scope()).isEqualTo("FIL");
-    assertThat(result.language()).isEqualTo("java");
+    ComponentDto project1 = db.components().insertPrivateProject();
+    ComponentDto project2 = db.components().insertPrivateProject();
 
-    assertThat(underTest.selectByUuids(dbSession, newArrayList("unknown"))).isEmpty();
+    List<ComponentDto> results = underTest.selectByUuids(dbSession, asList(project1.uuid(), project2.uuid()));
+
+    assertThat(results)
+      .extracting(ComponentDto::uuid, ComponentDto::getKey)
+      .containsExactlyInAnyOrder(
+        tuple(project1.uuid(), project1.getKey()),
+        tuple(project2.uuid(), project2.getKey()));
+
+    assertThat(underTest.selectByUuids(dbSession, singletonList("unknown"))).isEmpty();
   }
 
   @Test
   public void get_by_uuids_on_removed_components() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    ComponentDto project1 = db.components().insertPrivateProject();
+    ComponentDto project2 = db.components().insertPrivateProject(p -> p.setEnabled(false));
 
-    List<ComponentDto> results = underTest.selectByUuids(dbSession, newArrayList("U5"));
-    assertThat(results).hasSize(1);
+    List<ComponentDto> results = underTest.selectByUuids(dbSession, asList(project1.uuid(), project2.uuid()));
 
-    ComponentDto result = results.get(0);
-    assertThat(result).isNotNull();
-    assertThat(result.uuid()).isEqualTo("U5");
-    assertThat(result.isEnabled()).isFalse();
+    assertThat(results)
+      .extracting(ComponentDto::getKey, ComponentDto::isEnabled)
+      .containsExactlyInAnyOrder(
+        tuple(project1.getDbKey(), true),
+        tuple(project2.getDbKey(), false));
   }
 
   @Test
   public void select_existing_uuids() {
-    db.prepareDbUnit(getClass(), "shared.xml");
-
-    List<String> results = underTest.selectExistingUuids(dbSession, newArrayList("U4"));
-    assertThat(results).containsOnly("U4");
+    ComponentDto project1 = db.components().insertPrivateProject();
+    ComponentDto project2 = db.components().insertPrivateProject(p -> p.setEnabled(false));
 
-    assertThat(underTest.selectExistingUuids(dbSession, newArrayList("U4", "unknown"))).hasSize(1);
-    assertThat(underTest.selectExistingUuids(dbSession, newArrayList("unknown"))).isEmpty();
+    assertThat(underTest.selectExistingUuids(dbSession, asList(project1.uuid(), project2.uuid()))).containsExactlyInAnyOrder(project1.uuid(), project2.uuid());
+    assertThat(underTest.selectExistingUuids(dbSession, asList(project1.uuid(), "unknown"))).containsExactlyInAnyOrder(project1.uuid());
+    assertThat(underTest.selectExistingUuids(dbSession, singletonList("unknown"))).isEmpty();
   }
 
   @Test
   public void get_by_id() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    ComponentDto project = db.components().insertPrivateProject();
 
-    assertThat(underTest.selectOrFailById(dbSession, 4L)).isNotNull();
+    assertThat(underTest.selectOrFailById(dbSession, project.getId())).isNotNull();
   }
 
   @Test
   public void get_by_id_on_disabled_component() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    ComponentDto enabledProject = db.components().insertPrivateProject();
+    ComponentDto disabledProject = db.components().insertPrivateProject(p -> p.setEnabled(false));
 
-    Optional<ComponentDto> result = underTest.selectById(dbSession, 10L);
+    Optional<ComponentDto> result = underTest.selectById(dbSession, disabledProject.getId());
     assertThat(result).isPresent();
     assertThat(result.get().isEnabled()).isFalse();
   }
 
-  @Test(expected = RowNotFoundException.class)
+  @Test
   public void fail_to_get_by_id_when_project_not_found() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    ComponentDto project = db.components().insertPrivateProject();
 
-    underTest.selectOrFailById(dbSession, 111L);
+    expectedException.expect(RowNotFoundException.class);
+
+    underTest.selectOrFailById(dbSession, 0L);
   }
 
   @Test
   public void get_nullable_by_id() {
-    db.prepareDbUnit(getClass(), "shared.xml");
+    ComponentDto project = db.components().insertPrivateProject();
 
-    assertThat(underTest.selectById(dbSession, 4L)).isPresent();
-    assertThat(underTest.selectById(dbSession, 111L)).isAbsent();
+    assertThat(underTest.selectById(dbSession, project.getId())).isPresent();
+    assertThat(underTest.selectById(dbSession, 0L)).isAbsent();
   }
 
   @Test
   public void select_component_keys_by_qualifiers() {
-    db.prepareDbUnit(getClass(), "shared.xml");
-
-    assertThat(underTest.selectComponentsByQualifiers(dbSession, newHashSet("TRK"))).extracting("kee").containsOnly("org.struts:struts", "org.disabled.project");
-    assertThat(underTest.selectComponentsByQualifiers(dbSession, newHashSet("BRC"))).extracting("kee").containsOnly("org.struts:struts-core");
-    assertThat(underTest.selectComponentsByQualifiers(dbSession, newHashSet("DIR"))).extracting("kee").containsOnly("org.struts:struts-core:src/org/struts");
-    assertThat(underTest.selectComponentsByQualifiers(dbSession, newHashSet("FIL"))).extracting("kee").containsOnly("org.struts:struts-core:src/org/struts/RequestContext.java");
+    ComponentDto project = db.components().insertPrivateProject();
+    ComponentDto module = db.components().insertComponent(newModuleDto(project));
+    ComponentDto directory = db.components().insertComponent(newDirectory(module, "src"));
+    ComponentDto file = db.components().insertComponent(newFileDto(directory));
+
+    assertThat(underTest.selectComponentsByQualifiers(dbSession, newHashSet("TRK"))).extracting(ComponentDto::getDbKey).containsExactlyInAnyOrder(project.getDbKey());
+    assertThat(underTest.selectComponentsByQualifiers(dbSession, newHashSet("BRC"))).extracting(ComponentDto::getDbKey).containsExactlyInAnyOrder(module.getDbKey());
+    assertThat(underTest.selectComponentsByQualifiers(dbSession, newHashSet("DIR"))).extracting(ComponentDto::getDbKey).containsExactlyInAnyOrder(directory.getDbKey());
+    assertThat(underTest.selectComponentsByQualifiers(dbSession, newHashSet("FIL"))).extracting(ComponentDto::getDbKey).containsExactlyInAnyOrder(file.getDbKey());
     assertThat(underTest.selectComponentsByQualifiers(dbSession, newHashSet("unknown"))).isEmpty();
   }
 
@@ -355,156 +344,225 @@ public class ComponentDaoTest {
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("Qualifiers cannot be empty");
 
-    db.prepareDbUnit(getClass(), "shared.xml");
     underTest.selectComponentsByQualifiers(dbSession, Collections.emptySet());
   }
 
   @Test
   public void find_sub_projects_by_component_keys() {
-    db.prepareDbUnit(getClass(), "multi-modules.xml");
+    ComponentDto project = db.components().insertPrivateProject();
+    ComponentDto removedProject = db.components().insertPrivateProject(p -> p.setEnabled(false));
+    ComponentDto module = db.components().insertComponent(newModuleDto(project));
+    ComponentDto removedModule = db.components().insertComponent(newModuleDto(project).setEnabled(false));
+    ComponentDto subModule = db.components().insertComponent(newModuleDto(module));
+    ComponentDto removedSubModule = db.components().insertComponent(newModuleDto(module).setEnabled(false));
+    ComponentDto directory = db.components().insertComponent(newDirectory(subModule, "src"));
+    ComponentDto removedDirectory = db.components().insertComponent(newDirectory(subModule, "src2").setEnabled(false));
+    ComponentDto file = db.components().insertComponent(newFileDto(subModule, directory));
+    ComponentDto removedFile = db.components().insertComponent(newFileDto(subModule, directory).setEnabled(false));
 
     // Sub project of a file
-    List<ComponentDto> results = underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("HIJK"));
-    assertThat(results).hasSize(1);
-    assertThat(results.get(0).getDbKey()).isEqualTo("org.struts:struts-data");
+    assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, singletonList(file.uuid())))
+      .extracting(ComponentDto::getDbKey)
+      .containsExactlyInAnyOrder(subModule.getDbKey());
 
     // Sub project of a directory
-    results = underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("GHIJ"));
-    assertThat(results).hasSize(1);
-    assertThat(results.get(0).getDbKey()).isEqualTo("org.struts:struts-data");
+    assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, singletonList(directory.uuid())))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(subModule.uuid());
 
     // Sub project of a sub module
-    results = underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("FGHI"));
-    assertThat(results).hasSize(1);
-    assertThat(results.get(0).getDbKey()).isEqualTo("org.struts:struts");
+    assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, singletonList(subModule.uuid())))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(module.uuid());
 
     // Sub project of a module
-    results = underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("EFGH"));
-    assertThat(results).hasSize(1);
-    assertThat(results.get(0).getDbKey()).isEqualTo("org.struts:struts");
+    assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, singletonList(module.uuid())))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(project.uuid());
 
     // Sub project of a project
-    assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("ABCD"))).extracting("uuid").containsOnly("ABCD");
+    assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, singletonList(project.uuid())))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(project.uuid());
 
     // SUb projects of a component and a sub module
-    assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("HIJK", "FGHI"))).hasSize(2);
+    assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, asList(file.uuid(), subModule.uuid())))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(subModule.uuid(), module.uuid());
 
-    assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("unknown"))).isEmpty();
+    assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, singletonList("unknown"))).isEmpty();
 
     assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, Collections.emptyList())).isEmpty();
   }
 
   @Test
   public void select_enabled_modules_tree() {
-    db.prepareDbUnit(getClass(), "multi-modules.xml");
+    ComponentDto project = db.components().insertPrivateProject();
+    ComponentDto removedProject = db.components().insertPrivateProject(p -> p.setEnabled(false));
+    ComponentDto module = db.components().insertComponent(newModuleDto(project));
+    ComponentDto removedModule = db.components().insertComponent(newModuleDto(project).setEnabled(false));
+    ComponentDto subModule = db.components().insertComponent(newModuleDto(module));
+    ComponentDto removedSubModule = db.components().insertComponent(newModuleDto(module).setEnabled(false));
+    ComponentDto directory = db.components().insertComponent(newDirectory(subModule, "src"));
+    ComponentDto removedDirectory = db.components().insertComponent(newDirectory(subModule, "src2").setEnabled(false));
+    ComponentDto file = db.components().insertComponent(newFileDto(subModule, directory));
+    ComponentDto removedFile = db.components().insertComponent(newFileDto(subModule, directory).setEnabled(false));
 
     // From root project
-    List<ComponentDto> modules = underTest.selectEnabledDescendantModules(dbSession, "ABCD");
-    assertThat(modules).extracting("uuid").containsOnly("ABCD", "EFGH", "FGHI");
+    assertThat(underTest.selectEnabledDescendantModules(dbSession, project.uuid()))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(project.uuid(), module.uuid(), subModule.uuid())
+      .doesNotContain(removedModule.uuid(), removedSubModule.uuid());
 
     // From module
-    modules = underTest.selectEnabledDescendantModules(dbSession, "EFGH");
-    assertThat(modules).extracting("uuid").containsOnly("EFGH", "FGHI");
+    assertThat(underTest.selectEnabledDescendantModules(dbSession, module.uuid()))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(module.uuid(), subModule.uuid())
+      .doesNotContain(removedModule.uuid(), removedModule.uuid());
 
     // From sub module
-    modules = underTest.selectEnabledDescendantModules(dbSession, "FGHI");
-    assertThat(modules).extracting("uuid").containsOnly("FGHI");
+    assertThat(underTest.selectEnabledDescendantModules(dbSession, subModule.uuid()))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(subModule.uuid());
 
     // Folder
-    assertThat(underTest.selectEnabledDescendantModules(dbSession, "GHIJ")).isEmpty();
+    assertThat(underTest.selectEnabledDescendantModules(dbSession, directory.uuid())).isEmpty();
     assertThat(underTest.selectEnabledDescendantModules(dbSession, "unknown")).isEmpty();
   }
 
   @Test
   public void select_all_modules_tree() {
-    db.prepareDbUnit(getClass(), "multi-modules.xml");
+    ComponentDto project = db.components().insertPrivateProject();
+    ComponentDto removedProject = db.components().insertPrivateProject(p -> p.setEnabled(false));
+    ComponentDto module = db.components().insertComponent(newModuleDto(project));
+    ComponentDto removedModule = db.components().insertComponent(newModuleDto(project).setEnabled(false));
+    ComponentDto subModule = db.components().insertComponent(newModuleDto(module));
+    ComponentDto removedSubModule = db.components().insertComponent(newModuleDto(module).setEnabled(false));
+    ComponentDto directory = db.components().insertComponent(newDirectory(subModule, "src"));
+    ComponentDto removedDirectory = db.components().insertComponent(newDirectory(subModule, "src2").setEnabled(false));
+    ComponentDto file = db.components().insertComponent(newFileDto(subModule, directory));
+    ComponentDto removedFile = db.components().insertComponent(newFileDto(subModule, directory).setEnabled(false));
 
     // From root project, disabled sub module is returned
-    List<ComponentDto> modules = underTest.selectDescendantModules(dbSession, "ABCD");
-    assertThat(modules).extracting("uuid").containsOnly("ABCD", "EFGH", "FGHI", "IHGF");
+    assertThat(underTest.selectDescendantModules(dbSession, project.uuid()))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(project.uuid(), module.uuid(), removedModule.uuid(), subModule.uuid(), removedSubModule.uuid());
 
     // From module, disabled sub module is returned
-    modules = underTest.selectDescendantModules(dbSession, "EFGH");
-    assertThat(modules).extracting("uuid").containsOnly("EFGH", "FGHI", "IHGF");
+    assertThat(underTest.selectDescendantModules(dbSession, module.uuid()))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(module.uuid(), subModule.uuid(), removedSubModule.uuid());
 
     // From removed sub module -> should not be returned
-    assertThat(underTest.selectDescendantModules(dbSession, "IHGF")).isEmpty();
+    assertThat(underTest.selectDescendantModules(dbSession, removedSubModule.uuid())).isEmpty();
   }
 
   @Test
   public void select_enabled_module_files_tree_from_module() {
-    db.prepareDbUnit(getClass(), "select_module_files_tree.xml");
+    ComponentDto project = db.components().insertPrivateProject();
+    ComponentDto module = db.components().insertComponent(newModuleDto(project));
+    ComponentDto fileDirectlyOnModule = db.components().insertComponent(newFileDto(module));
+    FileSourceDto fileSourceDirectlyOnModule = db.fileSourceTester().insertFileSource(fileDirectlyOnModule);
+    ComponentDto subModule = db.components().insertComponent(newModuleDto(module));
+    ComponentDto directory = db.components().insertComponent(newDirectory(subModule, "src"));
+    ComponentDto file = db.components().insertComponent(newFileDto(subModule, directory));
+    FileSourceDto fileSource = db.fileSourceTester().insertFileSource(file);
 
     // From root project
-    List<FilePathWithHashDto> files = underTest.selectEnabledDescendantFiles(dbSession, "ABCD");
-    assertThat(files).extracting("uuid").containsOnly("EFGHI", "HIJK");
-    assertThat(files).extracting("moduleUuid").containsOnly("EFGH", "FGHI");
-    assertThat(files).extracting("srcHash").containsOnly("srcEFGHI", "srcHIJK");
-    assertThat(files).extracting("path").containsOnly("src/org/struts/pom.xml", "src/org/struts/RequestContext.java");
-    assertThat(files).extracting("revision").containsOnly("123456789");
+    assertThat(underTest.selectEnabledDescendantFiles(dbSession, project.uuid()))
+      .extracting(FilePathWithHashDto::getUuid, FilePathWithHashDto::getModuleUuid, FilePathWithHashDto::getSrcHash, FilePathWithHashDto::getPath, FilePathWithHashDto::getRevision)
+      .containsExactlyInAnyOrder(
+        tuple(fileDirectlyOnModule.uuid(), module.uuid(), fileSourceDirectlyOnModule.getSrcHash(), fileDirectlyOnModule.path(), fileSourceDirectlyOnModule.getRevision()),
+        tuple(file.uuid(), subModule.uuid(), fileSource.getSrcHash(), file.path(), fileSource.getRevision()));
 
     // From module
-    files = underTest.selectEnabledDescendantFiles(dbSession, "EFGH");
-    assertThat(files).extracting("uuid").containsOnly("EFGHI", "HIJK");
-    assertThat(files).extracting("moduleUuid").containsOnly("EFGH", "FGHI");
-    assertThat(files).extracting("srcHash").containsOnly("srcEFGHI", "srcHIJK");
-    assertThat(files).extracting("path").containsOnly("src/org/struts/pom.xml", "src/org/struts/RequestContext.java");
-    assertThat(files).extracting("revision").containsOnly("123456789");
+    assertThat(underTest.selectEnabledDescendantFiles(dbSession, module.uuid()))
+      .extracting(FilePathWithHashDto::getUuid, FilePathWithHashDto::getModuleUuid, FilePathWithHashDto::getSrcHash, FilePathWithHashDto::getPath, FilePathWithHashDto::getRevision)
+      .containsExactlyInAnyOrder(
+        tuple(fileDirectlyOnModule.uuid(), module.uuid(), fileSourceDirectlyOnModule.getSrcHash(), fileDirectlyOnModule.path(), fileSourceDirectlyOnModule.getRevision()),
+        tuple(file.uuid(), subModule.uuid(), fileSource.getSrcHash(), file.path(), fileSource.getRevision()));
 
     // From sub module
-    files = underTest.selectEnabledDescendantFiles(dbSession, "FGHI");
-    assertThat(files).extracting("uuid").containsOnly("HIJK");
-    assertThat(files).extracting("moduleUuid").containsOnly("FGHI");
-    assertThat(files).extracting("srcHash").containsOnly("srcHIJK");
-    assertThat(files).extracting("path").containsOnly("src/org/struts/RequestContext.java");
-    assertThat(files).extracting("revision").containsOnly("123456789");
+    assertThat(underTest.selectEnabledDescendantFiles(dbSession, subModule.uuid()))
+      .extracting(FilePathWithHashDto::getUuid, FilePathWithHashDto::getModuleUuid, FilePathWithHashDto::getSrcHash, FilePathWithHashDto::getPath, FilePathWithHashDto::getRevision)
+      .containsExactlyInAnyOrder(
+        tuple(file.uuid(), subModule.uuid(), fileSource.getSrcHash(), file.path(), fileSource.getRevision()));
 
     // From directory
-    assertThat(underTest.selectEnabledDescendantFiles(dbSession, "GHIJ")).isEmpty();
+    assertThat(underTest.selectEnabledDescendantFiles(dbSession, directory.uuid())).isEmpty();
 
     assertThat(underTest.selectEnabledDescendantFiles(dbSession, "unknown")).isEmpty();
   }
 
   @Test
   public void select_enabled_module_files_tree_from_project() {
-    db.prepareDbUnit(getClass(), "select_module_files_tree.xml");
+    ComponentDto project = db.components().insertPrivateProject();
+    ComponentDto module = db.components().insertComponent(newModuleDto(project));
+    ComponentDto fileDirectlyOnModule = db.components().insertComponent(newFileDto(module));
+    FileSourceDto fileSourceDirectlyOnModule = db.fileSourceTester().insertFileSource(fileDirectlyOnModule);
+    ComponentDto subModule = db.components().insertComponent(newModuleDto(module));
+    ComponentDto directory = db.components().insertComponent(newDirectory(subModule, "src"));
+    ComponentDto file = db.components().insertComponent(newFileDto(subModule, directory));
+    FileSourceDto fileSource = db.fileSourceTester().insertFileSource(file);
 
     // From root project
-    List<FilePathWithHashDto> files = underTest.selectEnabledFilesFromProject(dbSession, "ABCD");
-    assertThat(files).extracting("uuid").containsOnly("EFGHI", "HIJK");
-    assertThat(files).extracting("moduleUuid").containsOnly("EFGH", "FGHI");
-    assertThat(files).extracting("srcHash").containsOnly("srcEFGHI", "srcHIJK");
-    assertThat(files).extracting("path").containsOnly("src/org/struts/pom.xml", "src/org/struts/RequestContext.java");
+    assertThat(underTest.selectEnabledFilesFromProject(dbSession, project.uuid()))
+      .extracting(FilePathWithHashDto::getUuid, FilePathWithHashDto::getModuleUuid, FilePathWithHashDto::getSrcHash, FilePathWithHashDto::getPath, FilePathWithHashDto::getRevision)
+      .containsExactlyInAnyOrder(
+        tuple(fileDirectlyOnModule.uuid(), module.uuid(), fileSourceDirectlyOnModule.getSrcHash(), fileDirectlyOnModule.path(), fileSourceDirectlyOnModule.getRevision()),
+        tuple(file.uuid(), subModule.uuid(), fileSource.getSrcHash(), file.path(), fileSource.getRevision()));
 
     // From module
-    assertThat(underTest.selectEnabledFilesFromProject(dbSession, "EFGH")).isEmpty();
+    assertThat(underTest.selectEnabledFilesFromProject(dbSession, module.uuid())).isEmpty();
 
     // From sub module
-    assertThat(underTest.selectEnabledFilesFromProject(dbSession, "FGHI")).isEmpty();
+    assertThat(underTest.selectEnabledFilesFromProject(dbSession, subModule.uuid())).isEmpty();
 
     // From directory
-    assertThat(underTest.selectEnabledFilesFromProject(dbSession, "GHIJ")).isEmpty();
+    assertThat(underTest.selectEnabledFilesFromProject(dbSession, directory.uuid())).isEmpty();
 
     assertThat(underTest.selectEnabledFilesFromProject(dbSession, "unknown")).isEmpty();
   }
 
   @Test
   public void select_all_components_from_project() {
-    db.prepareDbUnit(getClass(), "multi-modules.xml");
+    ComponentDto project = db.components().insertPrivateProject();
+    ComponentDto removedProject = db.components().insertPrivateProject(p -> p.setEnabled(false));
+    ComponentDto module = db.components().insertComponent(newModuleDto(project));
+    ComponentDto removedModule = db.components().insertComponent(newModuleDto(project).setEnabled(false));
+    ComponentDto subModule = db.components().insertComponent(newModuleDto(module));
+    ComponentDto removedSubModule = db.components().insertComponent(newModuleDto(module).setEnabled(false));
+    ComponentDto directory = db.components().insertComponent(newDirectory(subModule, "src"));
+    ComponentDto removedDirectory = db.components().insertComponent(newDirectory(subModule, "src2").setEnabled(false));
+    ComponentDto file = db.components().insertComponent(newFileDto(subModule, directory));
+    ComponentDto removedFile = db.components().insertComponent(newFileDto(subModule, directory).setEnabled(false));
 
-    List<ComponentDto> components = underTest.selectAllComponentsFromProjectKey(dbSession, "org.struts:struts");
     // Removed components are included
-    assertThat(components).hasSize(8);
+    assertThat(underTest.selectAllComponentsFromProjectKey(dbSession, project.getDbKey()))
+      .extracting(ComponentDto::getDbKey)
+      .containsExactlyInAnyOrder(project.getDbKey(), module.getDbKey(), removedModule.getDbKey(), subModule.getDbKey(), removedSubModule.getDbKey(),
+        directory.getDbKey(), removedDirectory.getDbKey(), file.getDbKey(), removedFile.getDbKey());
 
     assertThat(underTest.selectAllComponentsFromProjectKey(dbSession, "UNKNOWN")).isEmpty();
   }
 
   @Test
-  public void select_modules_from_project() {
-    db.prepareDbUnit(getClass(), "multi-modules.xml");
-
-    List<ComponentDto> components = underTest.selectEnabledModulesFromProjectKey(dbSession, "org.struts:struts");
-    assertThat(components).hasSize(3);
+  public void select_enabled_modules_from_project() {
+    ComponentDto project = db.components().insertPrivateProject();
+    ComponentDto removedProject = db.components().insertPrivateProject(p -> p.setEnabled(false));
+    ComponentDto module = db.components().insertComponent(newModuleDto(project));
+    ComponentDto removedModule = db.components().insertComponent(newModuleDto(project).setEnabled(false));
+    ComponentDto subModule = db.components().insertComponent(newModuleDto(module));
+    ComponentDto removedSubModule = db.components().insertComponent(newModuleDto(module).setEnabled(false));
+    ComponentDto directory = db.components().insertComponent(newDirectory(subModule, "src"));
+    ComponentDto removedDirectory = db.components().insertComponent(newDirectory(subModule, "src2").setEnabled(false));
+    ComponentDto file = db.components().insertComponent(newFileDto(subModule, directory));
+    ComponentDto removedFile = db.components().insertComponent(newFileDto(subModule, directory).setEnabled(false));
+
+    // Removed modules are not included
+    assertThat(underTest.selectEnabledModulesFromProjectKey(dbSession, project.getDbKey()))
+      .extracting(ComponentDto::getDbKey)
+      .containsExactlyInAnyOrder(project.getDbKey(), module.getDbKey(), subModule.getDbKey());
 
     assertThat(underTest.selectEnabledModulesFromProjectKey(dbSession, "UNKNOWN")).isEmpty();
   }
@@ -521,17 +579,25 @@ public class ComponentDaoTest {
     assertThat(underTest.selectAllViewsAndSubViews(dbSession)).extracting(UuidWithProjectUuidDto::getUuid)
       .containsExactlyInAnyOrder("ABCD", "EFGH", "FGHI", "IJKL", application.uuid());
     assertThat(underTest.selectAllViewsAndSubViews(dbSession)).extracting(UuidWithProjectUuidDto::getProjectUuid)
-      .containsOnly("ABCD", "EFGH", "IJKL", application.projectUuid());
+      .containsExactlyInAnyOrder("ABCD", "EFGH", "EFGH", "IJKL", application.projectUuid());
   }
 
   @Test
   public void select_projects_from_view() {
-    db.prepareDbUnit(getClass(), "shared_views.xml");
-
-    assertThat(underTest.selectProjectsFromView(dbSession, "ABCD", "ABCD")).containsOnly("JKLM");
-    assertThat(underTest.selectProjectsFromView(dbSession, "EFGH", "EFGH")).containsOnly("KLMN", "JKLM");
-    assertThat(underTest.selectProjectsFromView(dbSession, "FGHI", "EFGH")).containsOnly("JKLM");
-    assertThat(underTest.selectProjectsFromView(dbSession, "IJKL", "IJKL")).isEmpty();
+    ComponentDto project1 = db.components().insertPrivateProject();
+    ComponentDto project2 = db.components().insertPrivateProject();
+    ComponentDto view = db.components().insertView();
+    db.components().insertComponent(newProjectCopy(project1, view));
+    ComponentDto viewWithSubView = db.components().insertView();
+    db.components().insertComponent(newProjectCopy(project2, viewWithSubView));
+    ComponentDto subView = db.components().insertSubView(viewWithSubView);
+    db.components().insertComponent(newProjectCopy(project1, subView));
+    ComponentDto viewWithoutProject = db.components().insertView();
+
+    assertThat(underTest.selectProjectsFromView(dbSession, view.uuid(), view.uuid())).containsExactlyInAnyOrder(project1.uuid());
+    assertThat(underTest.selectProjectsFromView(dbSession, viewWithSubView.uuid(), viewWithSubView.uuid())).containsExactlyInAnyOrder(project1.uuid(), project2.uuid());
+    assertThat(underTest.selectProjectsFromView(dbSession, subView.uuid(), viewWithSubView.uuid())).containsExactlyInAnyOrder(project1.uuid());
+    assertThat(underTest.selectProjectsFromView(dbSession, viewWithoutProject.uuid(), viewWithoutProject.uuid())).isEmpty();
     assertThat(underTest.selectProjectsFromView(dbSession, "Unknown", "Unknown")).isEmpty();
   }
 
@@ -553,7 +619,8 @@ public class ComponentDaoTest {
   @Test
   public void select_provisioned() {
     OrganizationDto organization = db.organizations().insert();
-    ComponentDto provisionedProject = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organization).setDbKey("provisioned.project").setName("Provisioned Project"));
+    ComponentDto provisionedProject = db.components()
+      .insertComponent(ComponentTesting.newPrivateProjectDto(organization).setDbKey("provisioned.project").setName("Provisioned Project"));
     ComponentDto provisionedView = db.components().insertView(organization);
     String projectUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(organization)).getComponentUuid();
     String disabledProjectUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(organization).setEnabled(false)).getComponentUuid();
@@ -647,11 +714,22 @@ public class ComponentDaoTest {
 
   @Test
   public void selectByProjectUuid() {
-    db.prepareDbUnit(getClass(), "shared.xml");
-
-    List<ComponentDto> components = underTest.selectByProjectUuid("U1", dbSession);
-
-    assertThat(components).extracting("id").containsOnly(1L, 2L, 3L, 4L);
+    ComponentDto project = db.components().insertPrivateProject();
+    ComponentDto removedProject = db.components().insertPrivateProject(p -> p.setEnabled(false));
+    ComponentDto module = db.components().insertComponent(newModuleDto(project));
+    ComponentDto removedModule = db.components().insertComponent(newModuleDto(project).setEnabled(false));
+    ComponentDto subModule = db.components().insertComponent(newModuleDto(module));
+    ComponentDto removedSubModule = db.components().insertComponent(newModuleDto(module).setEnabled(false));
+    ComponentDto directory = db.components().insertComponent(newDirectory(subModule, "src"));
+    ComponentDto removedDirectory = db.components().insertComponent(newDirectory(subModule, "src2").setEnabled(false));
+    ComponentDto file = db.components().insertComponent(newFileDto(subModule, directory));
+    ComponentDto removedFile = db.components().insertComponent(newFileDto(subModule, directory).setEnabled(false));
+
+    assertThat(underTest.selectByProjectUuid(project.uuid(), dbSession))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(project.uuid(), module.uuid(), removedModule.uuid(), subModule.uuid(), removedSubModule.uuid(), directory.uuid(), removedDirectory.uuid(),
+        file.uuid(),
+        removedFile.uuid());
   }
 
   @Test
@@ -659,7 +737,7 @@ public class ComponentDaoTest {
     assertSelectForIndexing(null)
       .doesNotContain("DIS7")
       .doesNotContain("COPY8")
-      .containsOnly("U1", "U2", "U3", "U4", "U5", "U6");
+      .containsExactlyInAnyOrder("U1", "U2", "U3", "U4", "U5", "U6", "VW1");
   }
 
   @Test
@@ -667,81 +745,31 @@ public class ComponentDaoTest {
     assertSelectForIndexing("U1")
       .doesNotContain("DIS7")
       .doesNotContain("COPY8")
-      .containsOnly("U1", "U2", "U3", "U4");
+      .containsExactlyInAnyOrder("U1", "U2", "U3", "U4");
   }
 
   private ListAssert<String> assertSelectForIndexing(@Nullable String projectUuid) {
-    db.prepareDbUnit(getClass(), "selectForIndexing.xml");
+    OrganizationDto organization = db.organizations().insert();
+    ComponentDto project = db.components().insertPrivateProject(organization, "U1");
+    ComponentDto removedProject = db.components().insertPrivateProject(organization, p -> p.setEnabled(false));
+    ComponentDto module = db.components().insertComponent(newModuleDto("U2", project));
+    ComponentDto removedModule = db.components().insertComponent(newModuleDto(project).setEnabled(false));
+    ComponentDto directory = db.components().insertComponent(newDirectory(module, "U3", "src"));
+    ComponentDto removedDirectory = db.components().insertComponent(newDirectory(module, "src2").setEnabled(false));
+    ComponentDto file = db.components().insertComponent(newFileDto(module, directory, "U4"));
+    ComponentDto removedFile = db.components().insertComponent(newFileDto(module, directory).setEnabled(false));
+
+    ComponentDto view = db.components().insertView(organization, "VW1");
+    db.components().insertComponent(newProjectCopy("COPY8", project, view));
+
+    ComponentDto project2 = db.components().insertPrivateProject(organization, "U5");
+    ComponentDto moduleOnProject2 = db.components().insertComponent(newModuleDto("U6", project2));
 
     List<ComponentDto> components = new ArrayList<>();
     underTest.scrollForIndexing(dbSession, projectUuid, context -> components.add(context.getResultObject()));
     return assertThat(components).extracting(ComponentDto::uuid);
   }
 
-  @Test
-  public void insert() {
-    db.prepareDbUnit(getClass(), "empty.xml");
-
-    ComponentDto componentDto = new ComponentDto()
-      .setOrganizationUuid("org1")
-      .setUuid("GHIJ")
-      .setUuidPath("ABCD.EFGH.GHIJ.")
-      .setProjectUuid("ABCD")
-      .setModuleUuid("EFGH")
-      .setModuleUuidPath(".ABCD.EFGH.")
-      .setDbKey("org.struts:struts-core:src/org/struts/RequestContext.java")
-      .setDeprecatedKey("org.struts:struts-core:src/org/struts/RequestContext.java")
-      .setName("RequestContext.java")
-      .setLongName("org.struts.RequestContext")
-      .setQualifier("FIL")
-      .setScope("FIL")
-      .setLanguage("java")
-      .setDescription("description")
-      .setPath("src/org/struts/RequestContext.java")
-      .setRootUuid("uuid_3")
-      .setCopyComponentUuid("uuid_5")
-      .setDeveloperUuid("uuid_7")
-      .setEnabled(true)
-      .setCreatedAt(DateUtils.parseDate("2014-06-18"))
-      .setTags(newArrayList("platform", "analyzers"));
-
-    underTest.insert(dbSession, componentDto);
-    dbSession.commit();
-
-    assertThat(componentDto.getId()).isNotNull();
-    db.assertDbUnit(getClass(), "insert-result.xml", "projects");
-  }
-
-  @Test
-  public void insert_disabled_component() {
-    db.prepareDbUnit(getClass(), "empty.xml");
-
-    ComponentDto componentDto = new ComponentDto()
-      .setOrganizationUuid("org1")
-      .setId(1L)
-      .setUuid("GHIJ")
-      .setUuidPath("ABCD.EFGH.GHIJ.")
-      .setProjectUuid("ABCD")
-      .setModuleUuid("EFGH")
-      .setModuleUuidPath(".ABCD.EFGH.")
-      .setDbKey("org.struts:struts-core:src/org/struts/RequestContext.java")
-      .setName("RequestContext.java")
-      .setLongName("org.struts.RequestContext")
-      .setQualifier("FIL")
-      .setScope("FIL")
-      .setLanguage("java")
-      .setPath("src/org/struts/RequestContext.java")
-      .setRootUuid("uuid_3")
-      .setEnabled(false)
-      .setCreatedAt(DateUtils.parseDate("2014-06-18"));
-
-    underTest.insert(dbSession, componentDto);
-    dbSession.commit();
-
-    assertThat(componentDto.getId()).isNotNull();
-    db.assertDbUnit(getClass(), "insert_disabled_component-result.xml", "projects");
-  }
-
   @Test
   public void update() {
     db.components().insertPrivateProject(db.getDefaultOrganization(), "U1");
@@ -1202,4 +1230,5 @@ public class ComponentDaoTest {
   private boolean privateFlagOfUuid(String uuid) {
     return underTest.selectByUuid(db.getSession(), uuid).get().isPrivate();
   }
+
 }
index 799352afe4a44861a17e9843e5cf1161eee0ad5c..450ee8770bcb8b2e4198512054c69b8616a65c08 100644 (file)
@@ -147,6 +147,11 @@ public class ComponentDbTester {
     return insertComponentImpl(newSubView(view), false, dtoPopulator);
   }
 
+  @SafeVarargs
+  public final ComponentDto insertSubView(ComponentDto view, Consumer<ComponentDto>... dtoPopulators) {
+    return insertComponentImpl(newSubView(view), false, dtoPopulators);
+  }
+
   private static <T> Consumer<T> noExtraConfiguration() {
     return (t) -> {
     };
index f7f32ea38147bb2c8ec1807ed3dea566d146ad80..98c6f8f339e4f3a7c77680e3833d5b1c0c161565 100644 (file)
@@ -166,7 +166,6 @@ public class ComponentTesting {
   public static ComponentDto newProjectCopy(String uuid, ComponentDto project, ComponentDto view) {
     checkNotNull(project.getId(), "The project need to be persisted before creating this technical project.");
     return newChildComponent(uuid, view, view)
-      .setUuid(uuid)
       .setDbKey(view.getDbKey() + project.getDbKey())
       .setName(project.name())
       .setLongName(project.longName())
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceTester.java b/server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceTester.java
new file mode 100644 (file)
index 0000000..d53e2d1
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info 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.source;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.function.Consumer;
+import org.apache.commons.lang.math.RandomUtils;
+import org.sonar.db.DbTester;
+import org.sonar.db.component.ComponentDto;
+import org.sonar.db.protobuf.DbFileSources;
+
+import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
+
+public class FileSourceTester {
+
+  private final DbTester db;
+
+  public FileSourceTester(DbTester db) {
+    this.db = db;
+  }
+
+  @SafeVarargs
+  public final FileSourceDto insertFileSource(ComponentDto file, Consumer<FileSourceDto>... dtoPopulators) {
+    FileSourceDto dto = new FileSourceDto()
+      .setProjectUuid(file.projectUuid())
+      .setFileUuid(file.uuid())
+      .setSrcHash(randomAlphanumeric(50))
+      .setDataHash(randomAlphanumeric(50))
+      .setLineHashes(randomAlphanumeric(50))
+      .setRevision(randomAlphanumeric(100))
+      .setSourceData(newRandomData(3).build())
+      .setCreatedAt(new Date().getTime())
+      .setUpdatedAt(new Date().getTime());
+    Arrays.stream(dtoPopulators).forEach(c -> c.accept(dto));
+    db.getDbClient().fileSourceDao().insert(db.getSession(), dto);
+    db.commit();
+    return dto;
+  }
+
+  private static DbFileSources.Data.Builder newRandomData(int numberOfLines) {
+    DbFileSources.Data.Builder dataBuilder = DbFileSources.Data.newBuilder();
+    for (int i = 1; i <= numberOfLines; i++) {
+      dataBuilder.addLinesBuilder()
+        .setLine(i)
+        .setScmRevision(randomAlphanumeric(15))
+        .setScmAuthor(randomAlphanumeric(10))
+        .setScmDate(RandomUtils.nextLong())
+        .setSource(randomAlphanumeric(20))
+        .setLineHits(RandomUtils.nextInt(4))
+        .setConditions(RandomUtils.nextInt(4))
+        .setCoveredConditions(RandomUtils.nextInt(4))
+        .setHighlighting(randomAlphanumeric(40))
+        .setSymbols(randomAlphanumeric(30))
+        .addAllDuplication(Arrays.asList(RandomUtils.nextInt(200), RandomUtils.nextInt(200)))
+        .build();
+    }
+    return dataBuilder;
+  }
+}
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete-result.xml
deleted file mode 100644 (file)
index 0aa6bc0..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<dataset>
-
-  <!-- module -->
-  <projects organization_uuid="org1"
-            id="2"
-            root_id="1"
-            kee="org.struts:struts-core"
-            name="Struts Core"
-            uuid="EFGH"
-            uuid_path="ABCDE.EFGH."
-            project_uuid="ABCD"
-            module_uuid="[null]"
-            module_uuid_path=".ABCD.EFGH."
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Struts Core"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_resource_id="[null]"
-            person_id="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- directory -->
-  <projects organization_uuid="org1"
-            long_name="org.struts"
-            id="3"
-            scope="DIR"
-            qualifier="DIR"
-            kee="org.struts:struts-core:src/org/struts"
-            uuid="GHIJ"
-            uuid_path="ABCDE.EFGH.GHIJ."
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH."
-            name="src/org/struts"
-            root_id="2"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_resource_id="[null]"
-            person_id="[null]"
-            path="src/org/struts"
-            authorization_updated_at="[null]"/>
-
-  <!-- file -->
-  <projects organization_uuid="org1"
-            long_name="org.struts.RequestContext"
-            id="4"
-            scope="FIL"
-            qualifier="FIL"
-            kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="KLMN"
-            uuid_path="ABCDE.EFGH.GHIJ.KLMN."
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH."
-            name="RequestContext.java"
-            root_id="2"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="java"
-            copy_resource_id="[null]"
-            person_id="[null]"
-            path="src/org/struts/RequestContext.java"
-            authorization_updated_at="[null]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml
deleted file mode 100644 (file)
index 94d7126..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-<dataset>
-
-  <!-- root project -->
-  <projects organization_uuid="org1"
-            id="1"
-            root_id="[null]"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.struts:struts"
-            deprecated_kee="org.struts:struts"
-            name="Struts"
-            uuid="ABCD"
-            uuid_path="ABCD."
-            project_uuid="ABCD"
-            module_uuid="[null]"
-            module_uuid_path=".ABCD."
-            description="the description"
-            private="[false]"
-            long_name="Apache Struts"
-            enabled="[true]"
-            language="[null]"
-            copy_resource_id="[null]"
-            person_id="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- module -->
-  <projects organization_uuid="org1"
-            id="2"
-            root_id="1"
-            kee="org.struts:struts-core"
-            name="Struts Core"
-            uuid="EFGH"
-            uuid_path="ABCDE.EFGH."
-            project_uuid="ABCD"
-            module_uuid="[null]"
-            module_uuid_path=".ABCD.EFGH."
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Struts Core"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_resource_id="[null]"
-            person_id="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- directory -->
-  <projects organization_uuid="org1"
-            long_name="org.struts"
-            id="3"
-            scope="DIR"
-            qualifier="DIR"
-            kee="org.struts:struts-core:src/org/struts"
-            uuid="GHIJ"
-            uuid_path="ABCDE.EFGH.GHIJ."
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH."
-            name="src/org/struts"
-            root_id="2"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_resource_id="[null]"
-            person_id="[null]"
-            path="src/org/struts"
-            authorization_updated_at="[null]"/>
-
-  <!-- file -->
-  <projects organization_uuid="org1"
-            long_name="org.struts.RequestContext"
-            id="4"
-            scope="FIL"
-            qualifier="FIL"
-            kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="KLMN"
-            uuid_path="ABCDE.EFGH.GHIJ.KLMN."
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH."
-            name="RequestContext.java"
-            root_id="2"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="java"
-            copy_resource_id="[null]"
-            person_id="[null]"
-            path="src/org/struts/RequestContext.java"
-            authorization_updated_at="[null]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/empty.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/empty.xml
deleted file mode 100644 (file)
index 871dedc..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<dataset>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml
deleted file mode 100644 (file)
index 2eecae1..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<dataset>
-
-  <projects organization_uuid="org1"
-            id="1"
-            kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            deprecated_kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            name="RequestContext.java"
-            long_name="org.struts.RequestContext"
-            uuid="GHIJ"
-            uuid_path="ABCD.EFGH.GHIJ."
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH."
-            qualifier="FIL"
-            scope="FIL"
-            language="java"
-            path="src/org/struts/RequestContext.java"
-            root_uuid="uuid_3"
-            description="description"
-            private="[false]"
-            tags="platform,analyzers"
-            enabled="[true]"
-            copy_component_uuid="uuid_5"
-            developer_uuid="uuid_7"
-            authorization_updated_at="[null]"
-            created_at="2014-06-18"
-            b_changed="[false]"
-            b_copy_component_uuid="[null]"
-            b_description="[null]"
-            b_enabled="[false]"
-            b_uuid_path="[null]"
-            b_language="[null]"
-            b_long_name="[null]"
-            b_module_uuid="[null]"
-            b_module_uuid_path="[null]"
-            b_name="[null]"
-            b_path="[null]"
-            b_qualifier="[null]"
-  />
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml
deleted file mode 100644 (file)
index 46a6410..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<dataset>
-
-  <projects organization_uuid="org1"
-            id="1"
-            kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            name="RequestContext.java"
-            long_name="org.struts.RequestContext"
-            uuid="GHIJ"
-            uuid_path="ABCD.EFGH.GHIJ."
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH."
-            qualifier="FIL"
-            scope="FIL"
-            language="java"
-            path="src/org/struts/RequestContext.java"
-            root_uuid="uuid_3"
-            description="[null]"
-            private="[false]"
-            tags="[null]"
-            enabled="[false]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            deprecated_kee="[null]"
-            authorization_updated_at="[null]"
-            created_at="2014-06-18"
-            b_changed="[false]"
-            b_copy_component_uuid="[null]"
-            b_description="[null]"
-            b_enabled="[false]"
-            b_uuid_path="[null]"
-            b_language="[null]"
-            b_long_name="[null]"
-            b_module_uuid="[null]"
-            b_module_uuid_path="[null]"
-            b_name="[null]"
-            b_path="[null]"
-            b_qualifier="[null]"
-  />
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/multi-modules.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/multi-modules.xml
deleted file mode 100644 (file)
index 8141e41..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-<dataset>
-
-  <!-- root project -->
-  <projects organization_uuid="org1"
-            id="1"
-            root_uuid="ABCD"
-            kee="org.struts:struts"
-            name="Struts"
-            uuid="ABCD"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="[null]"
-            module_uuid_path=".ABCD."
-            scope="PRJ"
-            qualifier="TRK"
-            long_name="Apache Struts"
-            description="the description"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-  <snapshots id="1"
-             uuid="u1"
-             component_uuid="ABCD"
-             islast="[true]"
-             />
-  <snapshots id="10"
-             uuid="u10"
-             component_uuid="ABCD"
-             islast="[false]"
-             />
-
-  <!-- module -->
-  <projects organization_uuid="org1"
-            id="2"
-            root_uuid="ABCD"
-            kee="org.struts:struts-core"
-            name="Struts Core"
-            uuid="EFGH"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="[null]"
-            module_uuid_path=".ABCD.EFGH."
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Struts Core"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            authorization_updated_at="[null]"/>
-  <snapshots id="2"
-             uuid="u2"
-             component_uuid="EFGH"
-             islast="[true]"
-             />
-
-  <!-- sub module -->
-  <projects organization_uuid="org1"
-            id="3"
-            root_uuid="ABCD"
-            kee="org.struts:struts-data"
-            name="Struts Data"
-            uuid="FGHI"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH.FGHI."
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Struts Data"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            authorization_updated_at="[null]"/>
-  <snapshots id="3"
-             uuid="u3"
-             component_uuid="FGHI"
-             islast="[true]"
-             />
-
-  <!-- directory -->
-  <projects organization_uuid="org1"
-            id="4"
-            root_uuid="FGHI"
-            scope="DIR"
-            qualifier="DIR"
-            kee="org.struts:struts-core:src/org/struts"
-            uuid="GHIJ"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="FGHI"
-            module_uuid_path=".ABCD.EFGH.FGHI."
-            name="src/org/struts"
-            long_name="org.struts"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts"
-            authorization_updated_at="[null]"/>
-  <snapshots id="4"
-             uuid="u4"
-             component_uuid="GHIJ"
-             islast="[true]"
-             />
-
-  <!-- file -->
-  <projects organization_uuid="org1"
-            id="5"
-            root_uuid="FGHI"
-            scope="FIL"
-            qualifier="FIL"
-            kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="HIJK"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="FGHI"
-            module_uuid_path=".ABCD.EFGH.FGHI."
-            name="RequestContext.java"
-            long_name="org.struts.RequestContext"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="java"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts/RequestContext.java"
-            authorization_updated_at="[null]"/>
-  <snapshots id="5"
-             uuid="u5"
-             component_uuid="HIJK"
-             islast="[true]"
-  />
-
-  <!-- removed sub module -->
-  <projects organization_uuid="org1"
-            id="10"
-            root_uuid="ABCD"
-            kee="org.struts:struts-data-removed"
-            name="Struts Data Removed"
-            uuid="IHGF"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH.IHGF."
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Struts Data"
-            description="[null]"
-            private="[false]"
-            enabled="[false]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- removed directory -->
-  <projects organization_uuid="org1"
-            id="11"
-            root_uuid="IHGF"
-            scope="DIR"
-            qualifier="DIR"
-            kee="org.struts:struts-core:src/org/struts-removed"
-            uuid="JIHG"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="FGHI"
-            module_uuid_path=".ABCD.EFGH.IHGF."
-            name="src/org/struts"
-            long_name="org.struts"
-            description="[null]"
-            private="[false]"
-            enabled="[false]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts"
-            authorization_updated_at="[null]"/>
-
-  <!-- removed file -->
-  <projects organization_uuid="org1"
-            id="12"
-            root_uuid="IHGF"
-            scope="FIL"
-            qualifier="FIL"
-            kee="org.struts:struts-core:src/org/struts/RequestContextRemoved.java"
-            uuid="KJIH"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="FGHI"
-            module_uuid_path=".ABCD.EFGH.IHGF."
-            name="RequestContext.java"
-            long_name="org.struts.RequestContext"
-            description="[null]"
-            private="[false]"
-            enabled="[false]"
-            language="java"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts/RequestContext.java"
-            authorization_updated_at="[null]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/selectForIndexing.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/selectForIndexing.xml
deleted file mode 100644 (file)
index a66dddb..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-<dataset>
-
-  <organizations uuid="org1"
-                 kee="org1_key"
-                 name="org1_name"
-                 guarded="[false]"
-                 new_project_private="[false]"
-                 created_at="1000"
-                 updated_at="1000"/>
-
-  <!-- root project -->
-  <projects organization_uuid="org1"
-            id="1"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.struts:struts"
-            deprecated_kee="org.struts:struts"
-            name="Struts"
-            uuid="U1"
-            uuid_path="uuid_path_of_U1"
-            root_uuid="U1"
-            project_uuid="U1"
-            module_uuid="module_uuid_of_U1"
-            module_uuid_path="module_uuid_path_of_U1"
-            description="the description"
-            private="[false]"
-            long_name="Apache Struts"
-            enabled="[true]"
-            language="java"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="path_of_U1"
-            authorization_updated_at="[null]"/>
-
-  <!-- module -->
-  <projects organization_uuid="org1"
-            id="2"
-            kee="org.struts:struts-core"
-            name="Struts Core"
-            uuid="U2"
-            uuid_path="uuid_path_of_U2"
-            project_uuid="U1"
-            root_uuid="U1"
-            module_uuid="[null]"
-            module_uuid_path="module_uuid_path_of_U2"
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Struts Core"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- directory -->
-  <projects organization_uuid="org1"
-            long_name="org.struts"
-            id="3"
-            scope="DIR"
-            qualifier="DIR"
-            kee="org.struts:struts-core:src/org/struts"
-            uuid="U3"
-            uuid_path="uuid_path_of_U3"
-            project_uuid="U1"
-            root_uuid="U1"
-            module_uuid="module_uuid_of_U3"
-            module_uuid_path="module_uuid_path_of_U3"
-            name="src/org/struts"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts"
-            authorization_updated_at="[null]"/>
-
-  <!-- file -->
-  <projects organization_uuid="org1"
-            long_name="org.struts.RequestContext"
-            id="4"
-            scope="FIL"
-            qualifier="FIL"
-            kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="U4"
-            uuid_path="uuid_path_of_U4"
-            project_uuid="U1"
-            root_uuid="U1"
-            module_uuid="module_uuid_of_U4"
-            module_uuid_path="module_uuid_path_of_U4"
-            name="RequestContext.java"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="java"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="path_of_U4"
-            authorization_updated_at="[null]"/>
-            
-  <!-- root project -->
-  <projects organization_uuid="org1"
-            id="5"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.paper:paper"
-            deprecated_kee="org.paper:paper"
-            name="Paper"
-            uuid="U5"
-            uuid_path="uuid_path_of_U5"
-            root_uuid="U5"
-            project_uuid="U5"
-            module_uuid="module_uuid_of_U5"
-            module_uuid_path="module_uuid_path_of_U5"
-            description="the description"
-            private="[false]"
-            long_name="Some Paper"
-            enabled="[true]"
-            language="java"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="path_of_U5"
-            authorization_updated_at="[null]"/>
-
-  <!-- module -->
-  <projects organization_uuid="org1"
-            id="6"
-            kee="org.paper:paper-core"
-            name="Paper Core"
-            uuid="U6"
-            uuid_path="uuid_path_of_U6"
-            project_uuid="U5"
-            root_uuid="U5"
-            module_uuid="[null]"
-            module_uuid_path="module_uuid_path_of_U6"
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Paper Core"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- Disabled projects -->
-  <projects organization_uuid="org1"
-            id="7"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.disabled.project"
-            name="Disabled Project"
-            uuid="DIS7"
-            uuid_path="uuid_path_of_DIS7"
-            project_uuid="project_uuid_of_DIS7"
-            root_uuid="root_uuid_of_DIS7"
-            module_uuid="[null]"
-            module_uuid_path="module_uuid_path_of_DIS7"
-            description="the description"
-            private="[false]"
-            long_name="Disabled project"
-            enabled="[false]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-            
-  <!-- copy component projects -->
-  <projects organization_uuid="org1"
-            id="8"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.copy.project"
-            name="Copy Project"
-            uuid="COPY8"
-            uuid_path="uuid_path_of_COPY8"
-            project_uuid="project_uuid_of_COPY8"
-            root_uuid="root_uuid_of_COPY8"
-            module_uuid="[null]"
-            module_uuid_path="module_uuid_path_of_COPY8"
-            description="the description"
-            private="[false]"
-            long_name="Copy project"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="U1"
-            developer_uuid="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_module_files_tree.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_module_files_tree.xml
deleted file mode 100644 (file)
index 963ec86..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-<dataset>
-
-  <!-- root project -->
-  <projects organization_uuid="org1"
-            id="1"
-            root_uuid="ABCD"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.struts:struts"
-            name="Struts"
-            uuid="ABCD"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="[null]"
-            module_uuid_path=".ABCD."
-            description="the description"
-            private="[false]"
-            long_name="Apache Struts"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- module -->
-  <projects organization_uuid="org1"
-            id="2"
-            root_uuid="ABCD"
-            kee="org.struts:struts-core"
-            name="Struts Core"
-            uuid="EFGH"
-            project_uuid="ABCD"
-            uuid_path="NOT_USED"
-            module_uuid="[null]"
-            module_uuid_path=".ABCD.EFGH."
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Struts Core"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- file attached directly on module -->
-  <projects organization_uuid="org1"
-            id="3"
-            scope="FIL"
-            qualifier="FIL"
-            kee="org.struts:struts-core:pom.xml"
-            uuid="EFGHI"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH."
-            name="pom.xml"
-            long_name="pom.xml"
-            root_uuid="EFGHI"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="java"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts/pom.xml"
-            authorization_updated_at="[null]"/>
-
-  <file_sources id="101"
-                project_uuid="ABCD"
-                file_uuid="EFGHI"
-                binary_data=",,,,,,,,,,,,,,,unchanged&#13;&#10;,,,,,,,,,,,,,,,content&#13;&#10;"
-                line_hashes="lineEFGHI"
-                data_hash="dataEFGHI"
-                src_hash="srcEFGHI"
-                revision="123456789"
-                created_at="1412952242000"
-                updated_at="1412952242000"
-                data_type="SOURCE"/>
-
-  <!-- sub module -->
-  <projects organization_uuid="org1"
-            id="4"
-            root_uuid="ABCD"
-            kee="org.struts:struts-data"
-            name="Struts Data"
-            uuid="FGHI"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH.FGHI."
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Struts Data"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- directory -->
-  <projects organization_uuid="org1"
-            id="5"
-            scope="DIR"
-            qualifier="DIR"
-            kee="org.struts:struts-core:src/org/struts"
-            uuid="GHIJ"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="FGHI"
-            module_uuid_path=".ABCD.EFGH.FGHI."
-            name="src/org/struts"
-            long_name="org.struts"
-            root_uuid="EFGHI"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts"
-            authorization_updated_at="[null]"/>
-
-  <!-- file -->
-  <projects organization_uuid="org1"
-            id="6"
-            scope="FIL"
-            qualifier="FIL"
-            kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="HIJK"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="FGHI"
-            module_uuid_path=".ABCD.EFGH.FGHI."
-            name="RequestContext.java"
-            long_name="org.struts.RequestContext"
-            root_uuid="EFGHI"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="java"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts/RequestContext.java"
-            authorization_updated_at="[null]"/>
-
-  <file_sources id="102"
-                project_uuid="ABCD"
-                file_uuid="HIJK"
-                binary_data=",,,,,,,,,,,,,,,unchanged&#13;&#10;,,,,,,,,,,,,,,,content&#13;&#10;"
-                line_hashes="lineHIJK"
-                data_hash="dataHIJK"
-                src_hash="srcHIJK"
-                revision="123456789"
-                created_at="1412952242000"
-                updated_at="1412952242000"
-                data_type="SOURCE"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml
deleted file mode 100644 (file)
index 4b5d4ba..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-<dataset>
-
-  <!-- Struts projects is authorized for all user -->
-  <group_roles id="1"
-               group_id="[null]"
-               resource_id="1"
-               role="user"
-               organization_uuid="org1"/>
-
-  <!-- Provisioned project -->
-  <projects organization_uuid="org1"
-            id="42"
-            root_uuid="PPAA"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.provisioned.project"
-            name="Provisioned Project"
-            uuid="PPAA"
-            uuid_path="NOT_USED"
-            project_uuid="PPAA"
-            module_uuid="[null]"
-            module_uuid_path="."
-            description="the description"
-            private="[false]"
-            long_name="Provisioned Project"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- root project -->
-  <projects organization_uuid="org1"
-            id="1"
-            root_uuid="ABCD"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.struts:struts"
-            deprecated_kee="org.struts:struts"
-            name="Struts"
-            uuid="ABCD"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="[null]"
-            module_uuid_path=".ABCD."
-            description="the description"
-            private="[false]"
-            long_name="Apache Struts"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-  <snapshots id="1"
-             uuid="u1"
-             component_uuid="ABCD"
-             status="P"
-             islast="[true]"
-             purge_status="[null]"
-             period1_mode="[null]"
-             period1_param="[null]"
-             period1_date="[null]"
-             period2_mode="[null]"
-             period2_param="[null]"
-             period2_date="[null]"
-             period3_mode="[null]"
-             period3_param="[null]"
-             period3_date="[null]"
-             period4_mode="[null]"
-             period4_param="[null]"
-             period4_date="[null]"
-             period5_mode="[null]"
-             period5_param="[null]"
-             period5_date="[null]"
-             created_at="1228222680000"
-             build_date="1228222680000"
-             version="[null]"
-             />
-  <snapshots id="10"
-             uuid="u10"
-             component_uuid="ABCD"
-             status="P"
-             islast="[false]"
-             purge_status="[null]"
-             period1_mode="[null]"
-             period1_param="[null]"
-             period1_date="[null]"
-             period2_mode="[null]"
-             period2_param="[null]"
-             period2_date="[null]"
-             period3_mode="[null]"
-             period3_param="[null]"
-             period3_date="[null]"
-             period4_mode="[null]"
-             period4_param="[null]"
-             period4_date="[null]"
-             period5_mode="[null]"
-             period5_param="[null]"
-             period5_date="[null]"
-             created_at="1228136280000"
-             build_date="1228136280000"
-             version="[null]"
-             />
-
-  <!-- module -->
-  <projects organization_uuid="org1"
-            id="2"
-            root_uuid="ABCD"
-            kee="org.struts:struts-core"
-            name="Struts Core"
-            uuid="EFGH"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="[null]"
-            module_uuid_path=".ABCD.EFGH."
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Struts Core"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            authorization_updated_at="[null]"/>
-  <snapshots id="2"
-             uuid="u2"
-             component_uuid="EFGH"
-             status="P"
-             islast="[true]"
-             purge_status="[null]"
-             period1_mode="[null]"
-             period1_param="[null]"
-             period1_date="[null]"
-             period2_mode="[null]"
-             period2_param="[null]"
-             period2_date="[null]"
-             period3_mode="[null]"
-             period3_param="[null]"
-             period3_date="[null]"
-             period4_mode="[null]"
-             period4_param="[null]"
-             period4_date="[null]"
-             period5_mode="[null]"
-             period5_param="[null]"
-             period5_date="[null]"
-             created_at="1228222680000"
-             build_date="1228222680000"
-             version="[null]"
-             />
-
-  <!-- directory -->
-  <projects organization_uuid="org1"
-            long_name="org.struts"
-            id="3"
-            scope="DIR"
-            qualifier="DIR"
-            kee="org.struts:struts-core:src/org/struts"
-            uuid="GHIJ"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH."
-            name="src/org/struts"
-            root_uuid="EFGH"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts"
-            authorization_updated_at="[null]"/>
-  <snapshots id="3"
-             uuid="u3"
-             component_uuid="GHIJ"
-             status="P"
-             islast="[true]"
-             purge_status="[null]"
-             period1_mode="[null]"
-             period1_param="[null]"
-             period1_date="[null]"
-             period2_mode="[null]"
-             period2_param="[null]"
-             period2_date="[null]"
-             period3_mode="[null]"
-             period3_param="[null]"
-             period3_date="[null]"
-             period4_mode="[null]"
-             period4_param="[null]"
-             period4_date="[null]"
-             period5_mode="[null]"
-             period5_param="[null]"
-             period5_date="[null]"
-             created_at="1228222680000"
-             build_date="1228222680000"
-             version="[null]"
-             />
-
-  <!-- file -->
-  <projects organization_uuid="org1"
-            long_name="org.struts.RequestContext"
-            id="4"
-            scope="FIL"
-            qualifier="FIL"
-            kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="KLMN"
-            uuid_path="NOT_USED"
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH."
-            name="RequestContext.java"
-            root_uuid="EFGH"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="java"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts/RequestContext.java"
-            authorization_updated_at="[null]"/>
-
-  <snapshots id="4"
-             uuid="u4"
-             component_uuid="KLMN"
-             status="P"
-             islast="[true]"
-             purge_status="[null]"
-             period1_mode="[null]"
-             period1_param="[null]"
-             period1_date="[null]"
-             period2_mode="[null]"
-             period2_param="[null]"
-             period2_date="[null]"
-             period3_mode="[null]"
-             period3_param="[null]"
-             period3_date="[null]"
-             period4_mode="[null]"
-             period4_param="[null]"
-             period4_date="[null]"
-             period5_mode="[null]"
-             period5_param="[null]"
-             period5_date="[null]"
-             created_at="1228222680000"
-             build_date="1228222680000"
-             version="[null]"
-             />
-
-  <!-- Disabled projects -->
-  <projects organization_uuid="org1"
-            id="10"
-            root_uuid="DCBA"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.disabled.project"
-            name="Disabled Project"
-            uuid="DCBA"
-            uuid_path="NOT_USED"
-            project_uuid="DCBA"
-            module_uuid="[null]"
-            module_uuid_path="."
-            description="the description"
-            private="[false]"
-            long_name="Disabled project"
-            enabled="[false]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- Developer and technical project copy -->
-  <projects organization_uuid="org1"
-            id="11"
-            root_uuid="OPQR"
-            scope="PRJ"
-            qualifier="DEV"
-            kee="DEV:anakin@skywalker.name"
-            name="Anakin Skywalker"
-            uuid="OPQR"
-            uuid_path="NOT_USED"
-            project_uuid="OPQR"
-            module_uuid="[null]"
-            module_uuid_path=".OPQR."
-            description="the description"
-            private="[false]"
-            long_name="Anakin Skywalker"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-  <projects organization_uuid="org1"
-            id="12"
-            root_uuid="OPQR"
-            scope="PRJ"
-            qualifier="DEV_PRJ"
-            kee="DEV:anakin@skywalker.name:org.struts:struts"
-            name="Apache Struts"
-            uuid="STUV"
-            uuid_path="NOT_USED"
-            project_uuid="OPQR"
-            module_uuid="OPQR"
-            module_uuid_path=".OPQR."
-            description="the description"
-            private="[false]"
-            long_name="Apache Struts"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="ABCD"
-            developer_uuid="OPQR"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml
deleted file mode 100644 (file)
index fa6ce4f..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-<dataset>
-
-  <organizations uuid="org1"
-                 kee="org1_key"
-                 name="org1_name"
-                 guarded="[false]"
-                 new_project_private="[false]"
-                 created_at="1000"
-                 updated_at="1000"/>
-
-  <!-- Struts projects is authorized for all user -->
-  <group_roles id="1"
-               group_id="[null]"
-               resource_id="1"
-               role="user"
-               organization_uuid="org1"/>
-
-  <!-- root project -->
-  <projects organization_uuid="org1"
-            id="1"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.struts:struts"
-            deprecated_kee="org.struts:struts"
-            name="Struts"
-            uuid="U1"
-            uuid_path="uuid_path_of_U1"
-            root_uuid="U1"
-            project_uuid="U1"
-            module_uuid="module_uuid_of_U1"
-            module_uuid_path="module_uuid_path_of_U1"
-            description="the description"
-            private="[true]"
-            long_name="Apache Struts"
-            enabled="[true]"
-            language="java"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="path_of_U1"
-            authorization_updated_at="[null]"/>
-  <snapshots id="1"
-             uuid="u1"
-             component_uuid="ABCD"
-             status="P"
-             islast="[true]"
-             purge_status="[null]"
-             period1_mode="[null]"
-             period1_param="[null]"
-             period1_date="[null]"
-             period2_mode="[null]"
-             period2_param="[null]"
-             period2_date="[null]"
-             period3_mode="[null]"
-             period3_param="[null]"
-             period3_date="[null]"
-             period4_mode="[null]"
-             period4_param="[null]"
-             period4_date="[null]"
-             period5_mode="[null]"
-             period5_param="[null]"
-             period5_date="[null]"
-             created_at="1228222680000"
-             build_date="1228222680000"
-             version="[null]"
-  />
-  <snapshots id="10"
-             uuid="u10"
-             component_uuid="ABCD"
-             status="P"
-             islast="[false]"
-             purge_status="[null]"
-             period1_mode="[null]"
-             period1_param="[null]"
-             period1_date="[null]"
-             period2_mode="[null]"
-             period2_param="[null]"
-             period2_date="[null]"
-             period3_mode="[null]"
-             period3_param="[null]"
-             period3_date="[null]"
-             period4_mode="[null]"
-             period4_param="[null]"
-             period4_date="[null]"
-             period5_mode="[null]"
-             period5_param="[null]"
-             period5_date="[null]"
-             created_at="1228136280000"
-             build_date="1228136280000"
-             version="[null]"
-  />
-
-  <!-- module -->
-  <projects organization_uuid="org1"
-            id="2"
-            kee="org.struts:struts-core"
-            name="Struts Core"
-            uuid="U2"
-            uuid_path="uuid_path_of_U2"
-            project_uuid="U1"
-            root_uuid="U1"
-            module_uuid="[null]"
-            module_uuid_path="module_uuid_path_of_U2"
-            scope="PRJ"
-            qualifier="BRC"
-            long_name="Struts Core"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            authorization_updated_at="[null]"/>
-  <snapshots id="2"
-             uuid="u2"
-             component_uuid="EFGH"
-             status="P"
-             islast="[true]"
-             purge_status="[null]"
-             period1_mode="[null]"
-             period1_param="[null]"
-             period1_date="[null]"
-             period2_mode="[null]"
-             period2_param="[null]"
-             period2_date="[null]"
-             period3_mode="[null]"
-             period3_param="[null]"
-             period3_date="[null]"
-             period4_mode="[null]"
-             period4_param="[null]"
-             period4_date="[null]"
-             period5_mode="[null]"
-             period5_param="[null]"
-             period5_date="[null]"
-             created_at="1228222680000"
-             build_date="1228222680000"
-             version="[null]"
-  />
-
-  <!-- directory -->
-  <projects organization_uuid="org1"
-            long_name="org.struts"
-            id="3"
-            scope="DIR"
-            qualifier="DIR"
-            kee="org.struts:struts-core:src/org/struts"
-            uuid="U3"
-            uuid_path="uuid_path_of_U3"
-            project_uuid="U1"
-            root_uuid="U1"
-            module_uuid="module_uuid_of_U3"
-            module_uuid_path="module_uuid_path_of_U3"
-            name="src/org/struts"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="src/org/struts"
-            authorization_updated_at="[null]"/>
-  <snapshots id="3"
-             uuid="u3"
-             component_uuid="GHIJ"
-             status="P"
-             islast="[true]"
-             purge_status="[null]"
-             period1_mode="[null]"
-             period1_param="[null]"
-             period1_date="[null]"
-             period2_mode="[null]"
-             period2_param="[null]"
-             period2_date="[null]"
-             period3_mode="[null]"
-             period3_param="[null]"
-             period3_date="[null]"
-             period4_mode="[null]"
-             period4_param="[null]"
-             period4_date="[null]"
-             period5_mode="[null]"
-             period5_param="[null]"
-             period5_date="[null]"
-             created_at="1228222680000"
-             build_date="1228222680000"
-             version="[null]"
-  />
-
-  <!-- file -->
-  <projects organization_uuid="org1"
-            long_name="org.struts.RequestContext"
-            id="4"
-            scope="FIL"
-            qualifier="FIL"
-            kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            uuid="U4"
-            uuid_path="uuid_path_of_U4"
-            project_uuid="U1"
-            root_uuid="U1"
-            module_uuid="module_uuid_of_U4"
-            module_uuid_path="module_uuid_path_of_U4"
-            name="RequestContext.java"
-            description="[null]"
-            private="[false]"
-            enabled="[true]"
-            language="java"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="path_of_U4"
-            authorization_updated_at="[null]"/>
-
-  <snapshots id="4"
-             uuid="u4"
-             component_uuid="KLMN"
-             status="P"
-             islast="[true]"
-             purge_status="[null]"
-             period1_mode="[null]"
-             period1_param="[null]"
-             period1_date="[null]"
-             period2_mode="[null]"
-             period2_param="[null]"
-             period2_date="[null]"
-             period3_mode="[null]"
-             period3_param="[null]"
-             period3_date="[null]"
-             period4_mode="[null]"
-             period4_param="[null]"
-             period4_date="[null]"
-             period5_mode="[null]"
-             period5_param="[null]"
-             period5_date="[null]"
-             created_at="1228222680000"
-             build_date="1228222680000"
-             version="[null]"
-  />
-
-  <!-- Disabled projects -->
-  <projects organization_uuid="org1"
-            id="10"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.disabled.project"
-            name="Disabled Project"
-            uuid="U5"
-            uuid_path="uuid_path_of_U5"
-            project_uuid="project_uuid_of_U5"
-            root_uuid="root_uuid_of_U5"
-            module_uuid="[null]"
-            module_uuid_path="module_uuid_path_of_U5"
-            description="the description"
-            private="[false]"
-            long_name="Disabled project"
-            enabled="[false]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-
-  <!-- Developer and technical project copy -->
-  <projects organization_uuid="org1"
-            id="11"
-            scope="PRJ"
-            qualifier="DEV"
-            kee="DEV:anakin@skywalker.name"
-            name="Anakin Skywalker"
-            uuid="U6"
-            uuid_path="uuid_path_of_U6"
-            project_uuid="project_uuid_of_U6"
-            root_uuid="root_uuid_of_U6"
-            module_uuid="[null]"
-            module_uuid_path="module_uuid_path_of_U6"
-            description="the description"
-            private="[false]"
-            long_name="Anakin Skywalker"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="[null]"
-            developer_uuid="[null]"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-  <projects organization_uuid="org1"
-            id="12"
-            scope="PRJ"
-            qualifier="DEV_PRJ"
-            kee="DEV:anakin@skywalker.name:org.struts:struts"
-            name="Apache Struts"
-            uuid="U7"
-            uuid_path="uuid_path_of_U7"
-            project_uuid="project_uuid_of_U7"
-            root_uuid="root_uuid_of_U7"
-            module_uuid="module_uuid_of_U7"
-            module_uuid_path="module_uuid_path_of_U7"
-            description="the description"
-            private="[false]"
-            long_name="Apache Struts"
-            enabled="[true]"
-            language="[null]"
-            copy_component_uuid="U1"
-            developer_uuid="developer_uuid_of_U7"
-            path="[null]"
-            authorization_updated_at="[null]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml
deleted file mode 100644 (file)
index 33195a0..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-<dataset>
-
-  <!-- Simple View -->
-  <projects organization_uuid="org1"
-            id="10"
-            uuid="ABCD"
-            uuid_path="ABCD."
-            root_uuid="ABCD"
-            project_uuid="ABCD"
-            module_uuid="[null]"
-            module_uuid_path=".ABCD."
-            copy_component_uuid="[null]"
-            enabled="[true]"
-            private="[false]"
-            kee="MASTER_PROJECT"
-            scope="PRJ"
-            qualifier="VW"
-            name="All projects"
-            path="[null]"/>
-
-  <projects organization_uuid="org1"
-            id="110"
-            uuid="BCDE"
-            uuid_path="ABCD.BCDE."
-            root_uuid="ABCD"
-            project_uuid="ABCD"
-            module_uuid="ABCD"
-            module_uuid_path=".ABCD."
-            copy_component_uuid="JKLM"
-            enabled="[true]"
-            private="[false]"
-            kee="MASTER_PROJECTorg.struts:struts"
-            scope="FIL"
-            qualifier="TRK"
-            name="Struts"
-            path="[null]"/>
-
-  <!-- View with sub view -->
-  <projects organization_uuid="org1"
-            id="11"
-            uuid="EFGH"
-            uuid_path="EFGH."
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="[null]"
-            module_uuid_path=".EFGH."
-            copy_component_uuid="[null]"
-            enabled="[true]"
-            private="[false]"
-            kee="LANGUAGE_VIEW"
-            scope="PRJ"
-            qualifier="VW"
-            name="By Language"
-            path="[null]"/>
-  <projects organization_uuid="org1"
-            id="112"
-            uuid="GHIJ"
-            uuid_path="EFGH.GHIJ."
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="EFGH"
-            module_uuid_path=".EFGH."
-            copy_component_uuid="KLMN"
-            enabled="[true]"
-            private="[false]"
-            kee="VIEW2org.elasticsearch:elasticsearch"
-            scope="FIL"
-            qualifier="TRK"
-            name="SSLR"
-            path="[null]"/>
-
-  <!-- Sub view -->
-  <projects organization_uuid="org1"
-            id="13"
-            uuid="FGHI"
-            uuid_path="EFGH.FGHI."
-            root_uuid="FGHI"
-            project_uuid="EFGH"
-            module_uuid="EFGH"
-            module_uuid_path=".EFGH.FGHI."
-            copy_component_uuid="[null]"
-            enabled="[true]"
-            private="[false]"
-            kee="JAVA_PROJECTS"
-            scope="PRJ"
-            qualifier="SVW"
-            name="Java projects"
-            path="[null]"/>
-
-  <projects organization_uuid="org1"
-            id="113"
-            uuid="HIJK"
-            uuid_path="EFGH.FGHI.HIJK."
-            root_uuid="EFGH"
-            project_uuid="EFGH"
-            module_uuid="FGHI"
-            module_uuid_path=".EFGH.FGHI."
-            copy_component_uuid="JKLM"
-            enabled="[true]"
-            private="[false]"
-            kee="VIEW2org.struts:struts"
-            scope="FIL"
-            qualifier="TRK"
-            name="Struts"
-            path="[null]"/>
-
-  <!-- View without project -->
-  <projects organization_uuid="org1"
-            id="14"
-            uuid="IJKL"
-            uuid_path="IJKL.."
-            root_uuid="IJKL"
-            project_uuid="IJKL"
-            module_uuid="[null]"
-            module_uuid_path=".IJKL."
-            copy_component_uuid="[null]"
-            enabled="[true]"
-            private="[false]"
-            kee="OTHER"
-            scope="PRJ"
-            qualifier="VW"
-            name="Other projects"
-            path="[null]"/>
-
-  <!-- Real projects -->
-  <projects organization_uuid="org1"
-            id="100"
-            uuid="JKLM"
-            uuid_path="JKLM."
-            root_uuid="JKLM"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.struts:struts"
-            name="Struts"
-            project_uuid="JKLM"
-            module_uuid="[null]"
-            module_uuid_path=".JKLM."
-            enabled="[true]"
-            private="[false]"
-            copy_component_uuid="[null]"
-            path="[null]"/>
-  <projects organization_uuid="org1"
-            id="101"
-            uuid="KLMN"
-            uuid_path="KLMN."
-            root_uuid="KLMN"
-            scope="PRJ"
-            qualifier="TRK"
-            kee="org.elasticsearch:elasticsearch"
-            name="Elasticsearch"
-            project_uuid="KLMN"
-            module_uuid="[null]"
-            module_uuid_path=".KLMN."
-            enabled="[true]"
-            private="[false]"
-            copy_component_uuid="[null]"
-            path="[null]"/>
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml
deleted file mode 100644 (file)
index a3f5e6f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<dataset>
-
-  <projects organization_uuid="org1"
-            id="1"
-            kee="org.struts:struts-core:src/org/struts/RequestContext2.java"
-            deprecated_kee="org.struts:struts-core:src/org/struts/RequestContext2.java"
-            name="RequestContext2.java"
-            long_name="org.struts.RequestContext2"
-            uuid="GHIJ"
-            uuid_path="GHIJ."
-            project_uuid="DCBA"
-            module_uuid="HGFE"
-            module_uuid_path=".DCBA.HGFE."
-            qualifier="LIF"
-            scope="LIF"
-            language="java2"
-            path="src/org/struts/RequestContext2.java"
-            root_uuid="uuid_4"
-            description="description2"
-            private="[false]"
-            enabled="[false]"
-            copy_component_uuid="uuid_6"
-            developer_uuid="uuid_9"
-            authorization_updated_at="[null]"
-            created_at="2014-06-18"
-  />
-
-</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml
deleted file mode 100644 (file)
index 7cb7764..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<dataset>
-
-  <projects organization_uuid="org1"
-            id="1"
-            kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            deprecated_kee="org.struts:struts-core:src/org/struts/RequestContext.java"
-            name="RequestContext.java"
-            long_name="org.struts.RequestContext"
-            uuid="GHIJ"
-            uuid_path="GHIJ."
-            project_uuid="ABCD"
-            module_uuid="EFGH"
-            module_uuid_path=".ABCD.EFGH."
-            qualifier="FIL"
-            scope="FIL"
-            language="java"
-            path="src/org/struts/RequestContext.java"
-            root_uuid="uuid_3"
-            description="description"
-            private="[false]"
-            enabled="[true]"
-            copy_component_uuid="uuid_5"
-            developer_uuid="[null]"
-            authorization_updated_at="[null]"
-            created_at="2014-06-18"
-  />
-
-</dataset>