]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10131 purge test files when purging project history
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 28 Nov 2017 09:28:32 +0000 (10:28 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 20 Dec 2017 10:10:08 +0000 (11:10 +0100)
server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentTreeQuery.java
server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeConfiguration.java
server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml
server/sonar-db-dao/src/main/resources/org/sonar/db/measure/MeasureMapper.xml
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeConfigurationTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml

index 6119f3cb9ae1844034579187491ea59e986b5c19..a60992500074304af194a34d7dee1f4099e2e55d 100644 (file)
@@ -42,12 +42,15 @@ public class ComponentTreeQuery {
   // SONAR-7681 a public implementation of List must be used in MyBatis - potential concurrency exceptions otherwise
   @CheckForNull
   private final ArrayList<String> qualifiers;
+  @CheckForNull
+  private final ArrayList<String> scopes;
   private final String baseUuid;
   private final Strategy strategy;
 
   private ComponentTreeQuery(Builder builder) {
     this.nameOrKeyQuery = builder.nameOrKeyQuery;
     this.qualifiers = builder.qualifiers == null ? null : newArrayList(builder.qualifiers);
+    this.scopes = builder.scopes == null ? null : newArrayList(builder.scopes);
     this.baseUuid = builder.baseUuid;
     this.strategy = requireNonNull(builder.strategy);
   }
@@ -57,6 +60,11 @@ public class ComponentTreeQuery {
     return qualifiers;
   }
 
+  @CheckForNull
+  public Collection<String> getScopes() {
+    return scopes;
+  }
+
   @CheckForNull
   public String getNameOrKeyQuery() {
     return nameOrKeyQuery;
@@ -98,6 +106,8 @@ public class ComponentTreeQuery {
     private String nameOrKeyQuery;
     @CheckForNull
     private Collection<String> qualifiers;
+    @CheckForNull
+    private Collection<String> scopes;
     private String baseUuid;
     private Strategy strategy;
 
@@ -120,6 +130,11 @@ public class ComponentTreeQuery {
       return this;
     }
 
+    public Builder setScopes(Collection<String> scopes) {
+      this.scopes = scopes;
+      return this;
+    }
+
     public Builder setBaseUuid(String uuid) {
       this.baseUuid = uuid;
       return this;
index c9d903f883fc974ac5fb240820d78f2a054fc207..15fc642e8423ac8f24f908db072e8d633d99642c 100644 (file)
@@ -30,16 +30,19 @@ import org.sonar.api.resources.Scopes;
 import org.sonar.api.utils.System2;
 import org.sonar.core.config.PurgeConstants;
 
+import static java.util.Arrays.asList;
+import static java.util.Collections.singletonList;
+
 public class PurgeConfiguration {
 
   private final IdUuidPair rootProjectIdUuid;
-  private final String[] scopesWithoutHistoricalData;
+  private final Collection<String> scopesWithoutHistoricalData;
   private final int maxAgeInDaysOfClosedIssues;
   private final Optional<Integer> maxAgeInDaysOfInactiveShortLivingBranches;
   private final System2 system2;
   private final Collection<String> disabledComponentUuids;
 
-  public PurgeConfiguration(IdUuidPair rootProjectId, String[] scopesWithoutHistoricalData, int maxAgeInDaysOfClosedIssues,
+  public PurgeConfiguration(IdUuidPair rootProjectId, Collection<String> scopesWithoutHistoricalData, int maxAgeInDaysOfClosedIssues,
     Optional<Integer> maxAgeInDaysOfInactiveShortLivingBranches, System2 system2, Collection<String> disabledComponentUuids) {
     this.rootProjectIdUuid = rootProjectId;
     this.scopesWithoutHistoricalData = scopesWithoutHistoricalData;
@@ -50,11 +53,11 @@ public class PurgeConfiguration {
   }
 
   public static PurgeConfiguration newDefaultPurgeConfiguration(Configuration config, IdUuidPair idUuidPair, Collection<String> disabledComponentUuids) {
-    String[] scopes = new String[] {Scopes.FILE};
+    Collection<String> scopesWithoutHistoricalData = singletonList(Scopes.FILE);
     if (config.getBoolean(PurgeConstants.PROPERTY_CLEAN_DIRECTORY).orElse(false)) {
-      scopes = new String[] {Scopes.DIRECTORY, Scopes.FILE};
+      scopesWithoutHistoricalData = asList(Scopes.FILE, Scopes.DIRECTORY);
     }
-    return new PurgeConfiguration(idUuidPair, scopes, config.getInt(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES).get(),
+    return new PurgeConfiguration(idUuidPair, scopesWithoutHistoricalData, config.getInt(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES).get(),
       config.getInt(PurgeConstants.DAYS_BEFORE_DELETING_INACTIVE_SHORT_LIVING_BRANCHES), System2.INSTANCE, disabledComponentUuids);
   }
 
@@ -62,7 +65,7 @@ public class PurgeConfiguration {
     return rootProjectIdUuid;
   }
 
-  public String[] scopesWithoutHistoricalData() {
+  public Collection<String> getScopesWithoutHistoricalData() {
     return scopesWithoutHistoricalData;
   }
 
index de29166e268ba435fb0ec3f0964bc585b7c4fe19..05cb3aee82b2a3f02bd9e629deafd67f60e04941 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.db.purge;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
@@ -64,7 +63,7 @@ public class PurgeDao implements Dao {
     PurgeCommands commands = new PurgeCommands(session, mapper, profiler);
     String rootUuid = conf.rootProjectIdUuid().getUuid();
     deleteAbortedAnalyses(rootUuid, commands);
-    deleteDataOfComponentsWithoutHistoricalData(session, rootUuid, conf.scopesWithoutHistoricalData(), commands);
+    deleteDataOfComponentsWithoutHistoricalData(session, rootUuid, conf.getScopesWithoutHistoricalData(), commands);
     purgeAnalyses(commands, rootUuid);
     purgeDisabledComponents(session, conf, listener);
     deleteOldClosedIssues(conf, mapper, listener);
@@ -119,8 +118,8 @@ public class PurgeDao implements Dao {
     commands.deleteAnalyses(query);
   }
 
-  private void deleteDataOfComponentsWithoutHistoricalData(DbSession dbSession, String rootUuid, String[] scopesWithoutHistoricalData, PurgeCommands purgeCommands) {
-    if (scopesWithoutHistoricalData.length == 0) {
+  private void deleteDataOfComponentsWithoutHistoricalData(DbSession dbSession, String rootUuid, Collection<String> scopesWithoutHistoricalData, PurgeCommands purgeCommands) {
+    if (scopesWithoutHistoricalData.isEmpty()) {
       return;
     }
 
@@ -134,7 +133,7 @@ public class PurgeDao implements Dao {
         dbSession,
         ComponentTreeQuery.builder()
           .setBaseUuid(rootUuid)
-          .setQualifiers(Arrays.asList(scopesWithoutHistoricalData))
+          .setScopes(scopesWithoutHistoricalData)
           .setStrategy(Strategy.LEAVES)
           .build())
       .stream().map(ComponentDto::uuid)
index 5d7e051032f5821c144c7f79d364225136d36b31..b22881f4b643e3c2f92f67d59538df910c305ca4 100644 (file)
         #{qualifier,jdbcType=VARCHAR}
       </foreach>
     </if>
+    <if test="query.scopes != null">
+      and p.scope in
+      <foreach collection="query.scopes" item="scope" open="(" close=")" separator=",">
+        #{scope,jdbcType=VARCHAR}
+      </foreach>
+    </if>
     <if test="query.nameOrKeyQuery != null">
       and (
         p.kee = #{query.nameOrKeyQuery,jdbcType=VARCHAR}
index 860b4e73f47e34ccf7c871e0363c09d13ff709e2..d29bcf17665d8de25762a9b94f9049aa82318179 100644 (file)
         and pm.person_id is null
       </otherwise>
     </choose>
-    <include refid="org.sonar.db.component.ComponentMapper.selectDescendantsFilters"/>
+    and p.enabled = ${_true}
+    <if test="query.qualifiers != null">
+      and p.qualifier in
+      <foreach collection="query.qualifiers" item="qualifier" open="(" close=")" separator=",">
+        #{qualifier,jdbcType=VARCHAR}
+      </foreach>
+    </if>
+    <if test="query.nameOrKeyQuery != null">
+      and (
+      p.kee = #{query.nameOrKeyQuery,jdbcType=VARCHAR}
+      or
+      upper(p.name) like #{query.nameOrKeyUpperLikeQuery,jdbcType=VARCHAR} escape '/'
+      )
+    </if>
   </sql>
 
   <select id="selectPastMeasuresOnSingleAnalysis" parameterType="map" resultType="org.sonar.db.measure.PastMeasureDto">
index 140a3a0bfd3d2ba784afb429e56389c825ffe942..dc110414f9ffa60f33bc9fed4c5547ae662c2bef 100644 (file)
@@ -34,6 +34,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.sonar.api.resources.Qualifiers;
+import org.sonar.api.resources.Scopes;
 import org.sonar.api.utils.System2;
 import org.sonar.db.DbSession;
 import org.sonar.db.DbTester;
@@ -1281,18 +1282,18 @@ public class ComponentDaoTest {
   }
 
   @Test
-  public void select_descendants_with_children_stragegy() {
+  public void select_descendants_with_children_strategy() {
     // project has 2 children: module and file 1. Other files are part of module.
     ComponentDto project = newPrivateProjectDto(db.organizations().insert(), PROJECT_UUID);
     db.components().insertProjectAndSnapshot(project);
     ComponentDto module = newModuleDto(MODULE_UUID, project);
     db.components().insertComponent(module);
-    ComponentDto file1 = newFileDto(project, null, FILE_1_UUID).setDbKey("file-key-1").setName("File One");
-    db.components().insertComponent(file1);
-    ComponentDto file2 = newFileDto(module, null, FILE_2_UUID).setDbKey("file-key-2").setName("File Two");
-    db.components().insertComponent(file2);
-    ComponentDto file3 = newFileDto(module, null, FILE_3_UUID).setDbKey("file-key-3").setName("File Three");
-    db.components().insertComponent(file3);
+    ComponentDto fileInProject = newFileDto(project, null, FILE_1_UUID).setDbKey("file-key-1").setName("File One");
+    db.components().insertComponent(fileInProject);
+    ComponentDto file1InModule = newFileDto(module, null, FILE_2_UUID).setDbKey("file-key-2").setName("File Two");
+    db.components().insertComponent(file1InModule);
+    ComponentDto file2InModule = newFileDto(module, null, FILE_3_UUID).setDbKey("file-key-3").setName("File Three");
+    db.components().insertComponent(file2InModule);
     db.commit();
 
     // test children of root
@@ -1344,6 +1345,16 @@ public class ComponentDaoTest {
     // test children of leaf component (file here), matching name
     query = newTreeQuery(FILE_1_UUID).setNameOrKeyQuery("Foo").build();
     assertThat(underTest.selectDescendants(dbSession, query)).isEmpty();
+
+    // test filtering by scope
+    query = newTreeQuery(project.uuid()).setScopes(asList(Scopes.FILE)).build();
+    assertThat(underTest.selectDescendants(dbSession, query))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(fileInProject.uuid());
+    query = newTreeQuery(project.uuid()).setScopes(asList(Scopes.PROJECT)).build();
+    assertThat(underTest.selectDescendants(dbSession, query))
+      .extracting(ComponentDto::uuid)
+      .containsExactlyInAnyOrder(module.uuid());
   }
 
   @Test
index a55713eb7348a0439f8bb13c836b7358c78eab32..1e0dc38b671b9b5ec5b6cfa6dd76453818635788 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.db.purge;
 
-import java.util.Collections;
 import java.util.Date;
 import java.util.Optional;
 import org.junit.Test;
@@ -31,15 +30,16 @@ import org.sonar.api.utils.System2;
 import org.sonar.core.config.PurgeConstants;
 import org.sonar.core.config.PurgeProperties;
 
+import static java.util.Collections.emptyList;
 import static org.assertj.core.api.Assertions.assertThat;
 
 public class PurgeConfigurationTest {
   @Test
   public void should_delete_all_closed_issues() {
-    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 0, Optional.empty(), System2.INSTANCE, Collections.emptyList());
+    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), emptyList(), 0, Optional.empty(), System2.INSTANCE, emptyList());
     assertThat(conf.maxLiveDateOfClosedIssues()).isNull();
 
-    conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], -1, Optional.empty(), System2.INSTANCE, Collections.emptyList());
+    conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), emptyList(), -1, Optional.empty(), System2.INSTANCE, emptyList());
     assertThat(conf.maxLiveDateOfClosedIssues()).isNull();
   }
 
@@ -47,7 +47,7 @@ public class PurgeConfigurationTest {
   public void should_delete_only_old_closed_issues() {
     Date now = DateUtils.parseDate("2013-05-18");
 
-    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 30, Optional.empty(), System2.INSTANCE, Collections.emptyList());
+    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), emptyList(), 30, Optional.empty(), System2.INSTANCE, emptyList());
     Date toDate = conf.maxLiveDateOfClosedIssues(now);
 
     assertThat(toDate.getYear()).isEqualTo(113);// =2013
@@ -57,7 +57,7 @@ public class PurgeConfigurationTest {
 
   @Test
   public void should_have_empty_branch_purge_date() {
-    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 30, Optional.of(10), System2.INSTANCE, Collections.emptyList());
+    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), emptyList(), 30, Optional.of(10), System2.INSTANCE, emptyList());
     assertThat(conf.maxLiveDateOfInactiveShortLivingBranches()).isNotEmpty();
     long tenDaysAgo = DateUtils.addDays(new Date(System2.INSTANCE.now()), -10).getTime();
     assertThat(conf.maxLiveDateOfInactiveShortLivingBranches().get().getTime()).isBetween(tenDaysAgo - 5000, tenDaysAgo + 5000);
@@ -65,31 +65,32 @@ public class PurgeConfigurationTest {
 
   @Test
   public void should_calculate_branch_purge_date() {
-    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 30, Optional.empty(), System2.INSTANCE, Collections.emptyList());
+    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), emptyList(), 30, Optional.empty(), System2.INSTANCE, emptyList());
     assertThat(conf.maxLiveDateOfInactiveShortLivingBranches()).isEmpty();
   }
 
   @Test
-  public void do_not_delete_directory_by_default() {
+  public void delete_files_but_not_directories_by_default() {
     MapSettings settings = new MapSettings(new PropertyDefinitions(PurgeProperties.all()));
     settings.setProperty(PurgeConstants.PROPERTY_CLEAN_DIRECTORY, false);
     settings.setProperty(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES, 5);
     Date now = new Date();
 
-    PurgeConfiguration underTest = PurgeConfiguration.newDefaultPurgeConfiguration(settings.asConfig(), new IdUuidPair(42L, "any-uuid"), Collections.emptyList());
+    PurgeConfiguration underTest = PurgeConfiguration.newDefaultPurgeConfiguration(settings.asConfig(), new IdUuidPair(42L, "any-uuid"), emptyList());
 
-    assertThat(underTest.scopesWithoutHistoricalData()).contains(Scopes.FILE)
-      .doesNotContain(Scopes.DIRECTORY);
+    assertThat(underTest.getScopesWithoutHistoricalData())
+      .containsExactlyInAnyOrder(Scopes.FILE);
     assertThat(underTest.maxLiveDateOfClosedIssues(now)).isEqualTo(DateUtils.addDays(now, -5));
   }
 
   @Test
-  public void delete_directory_if_in_settings() {
+  public void delete_directory_if_enabled_in_settings() {
     MapSettings settings = new MapSettings(new PropertyDefinitions(PurgeProperties.all()));
     settings.setProperty(PurgeConstants.PROPERTY_CLEAN_DIRECTORY, true);
 
-    PurgeConfiguration underTest = PurgeConfiguration.newDefaultPurgeConfiguration(settings.asConfig(), new IdUuidPair(42L, "any-uuid"), Collections.emptyList());
+    PurgeConfiguration underTest = PurgeConfiguration.newDefaultPurgeConfiguration(settings.asConfig(), new IdUuidPair(42L, "any-uuid"), emptyList());
 
-    assertThat(underTest.scopesWithoutHistoricalData()).contains(Scopes.DIRECTORY, Scopes.FILE);
+    assertThat(underTest.getScopesWithoutHistoricalData())
+      .containsExactlyInAnyOrder(Scopes.DIRECTORY, Scopes.FILE);
   }
 }
index e48f5c90b704371e2243146454c3b37b3865aaba..00be4cb27f63b4107c71581313d26f086d92a758 100644 (file)
@@ -54,6 +54,7 @@ import org.sonar.db.property.PropertyDto;
 import org.sonar.db.rule.RuleDefinitionDto;
 
 import static java.util.Arrays.asList;
+import static java.util.Collections.emptyList;
 import static java.util.Collections.singletonList;
 import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
 import static org.assertj.core.api.Assertions.assertThat;
@@ -132,13 +133,13 @@ public class PurgeDaoTest {
   @Test
   public void shouldDeleteHistoricalDataOfDirectoriesAndFiles() {
     dbTester.prepareDbUnit(getClass(), "shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml");
-    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(THE_PROJECT_ID, "ABCD"), new String[] {Scopes.DIRECTORY, Scopes.FILE},
+    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(THE_PROJECT_ID, "PROJECT_UUID"), asList(Scopes.DIRECTORY, Scopes.FILE),
       30, Optional.of(30), System2.INSTANCE, Collections.emptyList());
 
     underTest.purge(dbSession, conf, PurgeListener.EMPTY, new PurgeProfiler());
     dbSession.commit();
 
-    dbTester.assertDbUnit(getClass(), "shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml", "projects", "snapshots");
+    dbTester.assertDbUnit(getClass(), "shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml", "projects", "snapshots", "project_measures");
   }
 
   @Test
@@ -357,7 +358,7 @@ public class PurgeDaoTest {
   @Test
   public void should_delete_all_closed_issues() {
     dbTester.prepareDbUnit(getClass(), "should_delete_all_closed_issues.xml");
-    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(THE_PROJECT_ID, "1"), new String[0],
+    PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(THE_PROJECT_ID, "1"), emptyList(),
       0, Optional.empty(), System2.INSTANCE, Collections.emptyList());
     underTest.purge(dbSession, conf, PurgeListener.EMPTY, new PurgeProfiler());
     dbSession.commit();
@@ -627,11 +628,11 @@ public class PurgeDaoTest {
   }
 
   private static PurgeConfiguration newConfigurationWith30Days() {
-    return new PurgeConfiguration(new IdUuidPair(THE_PROJECT_ID, THE_PROJECT_UUID), new String[0], 30, Optional.of(30), System2.INSTANCE, Collections.emptyList());
+    return new PurgeConfiguration(new IdUuidPair(THE_PROJECT_ID, THE_PROJECT_UUID), emptyList(), 30, Optional.of(30), System2.INSTANCE, Collections.emptyList());
   }
 
   private static PurgeConfiguration newConfigurationWith30Days(System2 system2, String rootProjectUuid, String... disabledComponentUuids) {
-    return new PurgeConfiguration(new IdUuidPair(THE_PROJECT_ID, rootProjectUuid), new String[0], 30, Optional.of(30), system2, asList(disabledComponentUuids));
+    return new PurgeConfiguration(new IdUuidPair(THE_PROJECT_ID, rootProjectUuid), emptyList(), 30, Optional.of(30), system2, asList(disabledComponentUuids));
   }
 
 }
index 3e6532b606a4dfeca470adb8e3e67a2124ae3e7d..e84a82ff99e2ab403e66f9b64c34417b352f947b 100644 (file)
@@ -1,16 +1,10 @@
-<!--
-
-What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6 (DIR/FIL) are deleted
-
--->
-
 <dataset>
 
   <!-- the project -->
   <projects organization_uuid="org1"
-            uuid="ABCD"
+            uuid="PROJECT_UUID"
             uuid_path="."
-            project_uuid="ABCD"
+            project_uuid="PROJECT_UUID"
             module_uuid="[null]"
             module_uuid_path="."
             main_branch_project_uuid="[null]"
@@ -22,7 +16,6 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
             name="project"
             description="[null]"
             private="[false]"
-            tags="[null]"
             language="java"
             copy_component_uuid="[null]"
             developer_uuid="[null]"
@@ -31,7 +24,8 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
             authorization_updated_at="[null]"
             id="1"
             enabled="[true]"
-            root_uuid="ABCD"
+            root_uuid="PROJECT_UUID"
+            tags="[null]"
             b_changed="[false]"
             b_copy_component_uuid="[null]"
             b_description="[null]"
@@ -48,10 +42,10 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
 
   <!-- the directory -->
   <projects organization_uuid="org1"
-            uuid="EFGH"
-            uuid_path=".ABCD."
-            project_uuid="ABCD"
-            module_uuid="ABCD"
+            uuid="DIR_UUID"
+            uuid_path=".PROJECT_UUID."
+            project_uuid="PROJECT_UUID"
+            module_uuid="PROJECT_UUID"
             module_uuid_path="."
             main_branch_project_uuid="[null]"
             created_at="[null]"
@@ -62,7 +56,6 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
             name="my/dir"
             description="[null]"
             private="[false]"
-            tags="[null]"
             language="java"
             copy_component_uuid="[null]"
             developer_uuid="[null]"
@@ -71,7 +64,8 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
             authorization_updated_at="[null]"
             id="2"
             enabled="[true]"
-            root_uuid="ABCD"
+            root_uuid="PROJECT_UUID"
+            tags="[null]"
             b_changed="[false]"
             b_copy_component_uuid="[null]"
             b_description="[null]"
@@ -88,11 +82,11 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
 
   <!-- the file -->
   <projects organization_uuid="org1"
-            uuid="GHIJ"
-            uuid_path=".ABCD.EFGH."
-            project_uuid="ABCD"
-            module_uuid="ABCD"
-            module_uuid_path=".ABCD."
+            uuid="FILE_UUID"
+            uuid_path=".PROJECT_UUID.DIR_UUID."
+            project_uuid="PROJECT_UUID"
+            module_uuid="PROJECT_UUID"
+            module_uuid_path=".PROJECT_UUID."
             main_branch_project_uuid="[null]"
             created_at="[null]"
             long_name="[null]"
@@ -102,7 +96,6 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
             name="my/dir/File.java"
             description="[null]"
             private="[false]"
-            tags="[null]"
             language="java"
             copy_component_uuid="[null]"
             developer_uuid="[null]"
@@ -111,7 +104,48 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
             authorization_updated_at="[null]"
             id="3"
             enabled="[true]"
-            root_uuid="ABCD"
+            root_uuid="PROJECT_UUID"
+            tags="[null]"
+            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]"
+  />
+
+  <!-- unit test file -->
+  <projects organization_uuid="org1"
+            uuid="TEST_FILE_UUID"
+            uuid_path=".PROJECT_UUID.DIR_UUID."
+            project_uuid="PROJECT_UUID"
+            module_uuid="PROJECT_UUID"
+            module_uuid_path=".PROJECT_UUID."
+            main_branch_project_uuid="[null]"
+            created_at="[null]"
+            long_name="[null]"
+            scope="FIL"
+            qualifier="UTS"
+            kee="project:my/dir/FileTest.java"
+            name="my/dir/FileTest.java"
+            description="[null]"
+            private="[false]"
+            language="java"
+            copy_component_uuid="[null]"
+            developer_uuid="[null]"
+            path="[null]"
+            deprecated_kee="[null]"
+            authorization_updated_at="[null]"
+            id="4"
+            enabled="[true]"
+            root_uuid="PROJECT_UUID"
+            tags="[null]"
             b_changed="[false]"
             b_copy_component_uuid="[null]"
             b_description="[null]"
@@ -129,7 +163,7 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
   <!-- do not purge last snapshots -->
   <snapshots id="1"
              uuid="u1"
-             component_uuid="ABCD"
+             component_uuid="PROJECT_UUID"
              status="P"
              islast="[true]"
              purge_status="[null]"
@@ -153,10 +187,75 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
              version="[null]"
   />
 
+  <project_measures id="1"
+                    analysis_uuid="u1"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="PROJECT_UUID"/>
+  <project_measures id="2"
+                    analysis_uuid="u1"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="DIR_UUID"/>
+  <project_measures id="3"
+                    analysis_uuid="u1"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="FILE_UUID"/>
+  <project_measures id="4"
+                    analysis_uuid="u1"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="TEST_FILE_UUID"/>
+
   <!-- snapshots to be purged -->
   <snapshots id="4"
-             uuid="u4"
-             component_uuid="ABCD"
+             uuid="u2"
+             component_uuid="PROJECT_UUID"
              status="P"
              islast="[false]"
              purge_status="1"
@@ -180,4 +279,69 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
              version="[null]"
   />
 
+  <project_measures id="5"
+                    analysis_uuid="u2"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="PROJECT_UUID"/>
+  <!--<project_measures id="6"-->
+                    <!--analysis_uuid="u2"-->
+                    <!--metric_id="10"-->
+                    <!--value="[null]"-->
+                    <!--text_value="[null]"-->
+                    <!--measure_data="[null]"-->
+                    <!--variation_value_1="[null]"-->
+                    <!--variation_value_2="[null]"-->
+                    <!--variation_value_3="[null]"-->
+                    <!--variation_value_4="[null]"-->
+                    <!--variation_value_5="[null]"-->
+                    <!--alert_status="[null]"-->
+                    <!--alert_text="[null]"-->
+                    <!--person_id="[null]"-->
+                    <!--description="[null]"-->
+                    <!--component_uuid="DIR_UUID"/>-->
+  <!--<project_measures id="7"-->
+                    <!--analysis_uuid="u2"-->
+                    <!--metric_id="10"-->
+                    <!--value="[null]"-->
+                    <!--text_value="[null]"-->
+                    <!--measure_data="[null]"-->
+                    <!--variation_value_1="[null]"-->
+                    <!--variation_value_2="[null]"-->
+                    <!--variation_value_3="[null]"-->
+                    <!--variation_value_4="[null]"-->
+                    <!--variation_value_5="[null]"-->
+                    <!--alert_status="[null]"-->
+                    <!--alert_text="[null]"-->
+                    <!--person_id="[null]"-->
+                    <!--description="[null]"-->
+                    <!--component_uuid="FILE_UUID"/>-->
+  <!--<project_measures id="8"-->
+                    <!--analysis_uuid="u2"-->
+                    <!--metric_id="10"-->
+                    <!--value="[null]"-->
+                    <!--text_value="[null]"-->
+                    <!--measure_data="[null]"-->
+                    <!--variation_value_1="[null]"-->
+                    <!--variation_value_2="[null]"-->
+                    <!--variation_value_3="[null]"-->
+                    <!--variation_value_4="[null]"-->
+                    <!--variation_value_5="[null]"-->
+                    <!--alert_status="[null]"-->
+                    <!--alert_text="[null]"-->
+                    <!--person_id="[null]"-->
+                    <!--description="[null]"-->
+                    <!--component_uuid="TEST_FILE_UUID"/>-->
+
 </dataset>
index c6f8da44917be129b7799298034315430c381f1f..ff62231bcb5ebee5dda1843d0cbe535a488a1902 100644 (file)
@@ -2,9 +2,9 @@
 
   <!-- the project -->
   <projects organization_uuid="org1"
-            uuid="ABCD"
+            uuid="PROJECT_UUID"
             uuid_path="."
-            project_uuid="ABCD"
+            project_uuid="PROJECT_UUID"
             module_uuid="[null]"
             module_uuid_path="."
             main_branch_project_uuid="[null]"
             authorization_updated_at="[null]"
             id="1"
             enabled="[true]"
-            root_uuid="ABCD"
+            root_uuid="PROJECT_UUID"
+            tags="[null]"
             b_changed="[false]"
+            b_copy_component_uuid="[null]"
             b_description="[null]"
             b_enabled="[false]"
             b_uuid_path="[null]"
 
   <!-- the directory -->
   <projects organization_uuid="org1"
-            uuid="EFGH"
-            uuid_path=".ABCD."
-            project_uuid="ABCD"
-            module_uuid="ABCD"
+            uuid="DIR_UUID"
+            uuid_path=".PROJECT_UUID."
+            project_uuid="PROJECT_UUID"
+            module_uuid="PROJECT_UUID"
             module_uuid_path="."
             main_branch_project_uuid="[null]"
             created_at="[null]"
             authorization_updated_at="[null]"
             id="2"
             enabled="[true]"
-            root_uuid="ABCD"
+            root_uuid="PROJECT_UUID"
+            tags="[null]"
             b_changed="[false]"
+            b_copy_component_uuid="[null]"
             b_description="[null]"
             b_enabled="[false]"
             b_uuid_path="[null]"
 
   <!-- the file -->
   <projects organization_uuid="org1"
-            uuid="GHIJ"
-            uuid_path=".ABCD.EFGH."
-            project_uuid="ABCD"
-            module_uuid="ABCD"
-            module_uuid_path=".ABCD."
+            uuid="FILE_UUID"
+            uuid_path=".PROJECT_UUID.DIR_UUID."
+            project_uuid="PROJECT_UUID"
+            module_uuid="PROJECT_UUID"
+            module_uuid_path=".PROJECT_UUID."
             main_branch_project_uuid="[null]"
             created_at="[null]"
             long_name="[null]"
             authorization_updated_at="[null]"
             id="3"
             enabled="[true]"
-            root_uuid="ABCD"
+            root_uuid="PROJECT_UUID"
+            tags="[null]"
             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]"
+  />
+
+  <!-- unit test file -->
+  <projects organization_uuid="org1"
+            uuid="TEST_FILE_UUID"
+            uuid_path=".PROJECT_UUID.DIR_UUID."
+            project_uuid="PROJECT_UUID"
+            module_uuid="PROJECT_UUID"
+            module_uuid_path=".PROJECT_UUID."
+            main_branch_project_uuid="[null]"
+            created_at="[null]"
+            long_name="[null]"
+            scope="FIL"
+            qualifier="UTS"
+            kee="project:my/dir/FileTest.java"
+            name="my/dir/FileTest.java"
+            description="[null]"
+            private="[false]"
+            language="java"
+            copy_component_uuid="[null]"
+            developer_uuid="[null]"
+            path="[null]"
+            deprecated_kee="[null]"
+            authorization_updated_at="[null]"
+            id="4"
+            enabled="[true]"
+            root_uuid="PROJECT_UUID"
+            tags="[null]"
+            b_changed="[false]"
+            b_copy_component_uuid="[null]"
             b_description="[null]"
             b_enabled="[false]"
             b_uuid_path="[null]"
   <!-- do not purge last snapshots -->
   <snapshots id="1"
              uuid="u1"
-             component_uuid="ABCD"
+             component_uuid="PROJECT_UUID"
              status="P"
              islast="[true]"
              purge_status="[null]"
              version="[null]"
   />
 
+  <project_measures id="1"
+                    analysis_uuid="u1"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="PROJECT_UUID"/>
+  <project_measures id="2"
+                    analysis_uuid="u1"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="DIR_UUID"/>
+  <project_measures id="3"
+                    analysis_uuid="u1"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="FILE_UUID"/>
+  <project_measures id="4"
+                    analysis_uuid="u1"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="TEST_FILE_UUID"/>
+
   <!-- snapshots to be purged -->
   <snapshots id="4"
-             uuid="u4"
-             component_uuid="ABCD"
+             uuid="u2"
+             component_uuid="PROJECT_UUID"
              status="P"
              islast="[false]"
              purge_status="[null]"
              version="[null]"
   />
 
+  <project_measures id="5"
+                    analysis_uuid="u2"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="PROJECT_UUID"/>
+  <project_measures id="6"
+                    analysis_uuid="u2"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="DIR_UUID"/>
+  <project_measures id="7"
+                    analysis_uuid="u2"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="FILE_UUID"/>
+  <project_measures id="8"
+                    analysis_uuid="u2"
+                    metric_id="10"
+                    value="[null]"
+                    text_value="[null]"
+                    measure_data="[null]"
+                    variation_value_1="[null]"
+                    variation_value_2="[null]"
+                    variation_value_3="[null]"
+                    variation_value_4="[null]"
+                    variation_value_5="[null]"
+                    alert_status="[null]"
+                    alert_text="[null]"
+                    person_id="[null]"
+                    description="[null]"
+                    component_uuid="TEST_FILE_UUID"/>
+
 </dataset>