]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11650 Remove usage of FILE_SOURCES#DATA_TYPE
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 1 Feb 2019 09:42:59 +0000 (10:42 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 11 Feb 2019 08:11:43 +0000 (09:11 +0100)
server/sonar-db-dao/src/main/java/org/sonar/db/source/FileSourceDao.java
server/sonar-db-dao/src/main/java/org/sonar/db/source/FileSourceMapper.java
server/sonar-db-dao/src/main/protobuf/db-file-sources.proto
server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml
server/sonar-db-dao/src/main/resources/org/sonar/db/source/FileSourceMapper.xml
server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceDaoTest.java
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteProject.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/source/FileSourceDaoTest/no_line_hashes_when_only_test_data.xml [deleted file]
server/sonar-db-dao/src/test/resources/org/sonar/db/source/FileSourceDaoTest/shared.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/source/FileSourceDaoTest/update-result.xml

index 3a1567ccb3cd935992c7725ae9825da02f6cfccf..1085b2c59e90c63618080bab36812be17d6ff1a5 100644 (file)
@@ -59,7 +59,7 @@ public class FileSourceDao implements Dao {
     PreparedStatement pstmt = null;
     ResultSet rs = null;
     try {
-      pstmt = connection.prepareStatement("SELECT line_hashes FROM file_sources WHERE file_uuid=? AND data_type='SOURCE'");
+      pstmt = connection.prepareStatement("SELECT line_hashes FROM file_sources WHERE file_uuid=?");
       pstmt.setString(1, fileUuid);
       rs = pstmt.executeQuery();
       if (rs.next()) {
@@ -93,7 +93,7 @@ public class FileSourceDao implements Dao {
     ResultSet rs = null;
     Reader reader = null;
     try {
-      pstmt = connection.prepareStatement("SELECT line_hashes FROM file_sources WHERE file_uuid=? AND data_type='SOURCE'");
+      pstmt = connection.prepareStatement("SELECT line_hashes FROM file_sources WHERE file_uuid=?");
       pstmt.setString(1, fileUuid);
       rs = pstmt.executeQuery();
       if (rs.next()) {
index 0da4f1980d998d48b79ef45d370d6bbbc4a97021..98de827933fc8cce842cb21491d29003f6d75541 100644 (file)
@@ -27,7 +27,7 @@ import org.apache.ibatis.session.ResultHandler;
 
 public interface FileSourceMapper {
 
-  List<FileSourceDto> selectHashesForProject(@Param("projectUuid") String projectUuid, @Param("dataType") String dataType);
+  List<FileSourceDto> selectHashesForProject(@Param("projectUuid") String projectUuid);
 
   @CheckForNull
   FileSourceDto selectByFileUuid(@Param("fileUuid") String fileUuid);
index bad663a92d05fc9cb57120867d79587b1ef73b01..5c073555fe3ba74533a46342c25b2eb9dd8058b9 100644 (file)
@@ -74,24 +74,3 @@ message Data {
   repeated Line lines = 1;
 }
 
-message Test {
-  optional string uuid = 1;
-  optional string name = 2;
-  optional TestStatus status = 3;
-  optional int64 execution_time_ms = 4;
-  optional string stacktrace = 5;
-  optional string msg = 6;
-  repeated CoveredFile covered_file = 7;
-
-  message CoveredFile {
-    optional string file_uuid = 1;
-    repeated int32 covered_line = 2 [packed = true];
-  }
-
-  enum TestStatus {
-    OK = 1;
-    FAILURE = 2;
-    ERROR = 3;
-    SKIPPED = 4;
-  }
-}
index 40ab818d93a3b3005d1a27ccab327f5bc505c86e..fc0a1a5cf3724188aa226cba6796412dbd9f2ce2 100644 (file)
       and p.scope='FIL'
     INNER JOIN file_sources fs ON
       fs.file_uuid=p.uuid
-      and fs.data_type='SOURCE'
     where
       root.uuid=#{projectUuid,jdbcType=VARCHAR}
   </select>
     FROM projects p
     INNER JOIN file_sources fs ON
       fs.file_uuid=p.uuid
-      and fs.data_type='SOURCE'
     <include refid="modulesTreeQuery"/>
   </select>
 
     from projects p
     inner join file_sources fs on
       fs.file_uuid = p.uuid
-      and fs.data_type = 'SOURCE'
     where
       p.project_uuid = #{projectUuid,jdbcType=VARCHAR}
       and p.enabled = ${_true}
index b45f1f1f6699ed619542c8c3d69229c1b3d5c1c8..7e017a68b8fd378875428b86ffb79924501af501 100644 (file)
@@ -22,7 +22,6 @@
       file_sources
     where
       file_uuid = #{fileUuid,jdbcType=VARCHAR}
-      and data_type = 'SOURCE'
   </select>
 
   <select id="selectHashesForProject" parameterType="map" resultType="org.sonar.db.source.FileSourceDto">
       src_hash as srcHash,
       revision,
       updated_at as updatedAt
-      from
+    from
       file_sources
     where
       project_uuid = #{projectUuid,jdbcType=VARCHAR}
-      and data_type = 'SOURCE'
   </select>
 
   <select id="scrollLineHashes" parameterType="map" resultType="org.sonar.db.source.LineHashesWithUuidDto" fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
@@ -48,7 +46,6 @@
     from projects p
     inner join file_sources fs on
       fs.file_uuid = p.uuid
-      and fs.data_type = 'SOURCE'
     where
       p.uuid in
       <foreach collection="fileUuids" item="fileUuid" open="(" close=")" separator=",">
@@ -64,7 +61,6 @@
       file_sources
     WHERE
       file_uuid = #{fileUuid,jdbcType=VARCHAR}
-      and data_type = 'SOURCE'
   </select>
 
   <insert id="insert" parameterType="org.sonar.db.source.FileSourceDto" useGeneratedKeys="false">
@@ -80,7 +76,6 @@
       line_count,
       data_hash,
       src_hash,
-      data_type,
       revision
     )
     values
@@ -95,7 +90,6 @@
       #{lineCount,jdbcType=INTEGER},
       #{dataHash,jdbcType=VARCHAR},
       #{srcHash,jdbcType=VARCHAR},
-      'SOURCE',
       #{revision,jdbcType=VARCHAR}
     )
   </insert>
index 0524b9e7234787222ce2d67fcf948c71efb3e16c..d62bb2757c9c7cd330fa6c51837dc46319c79c66 100644 (file)
@@ -96,16 +96,6 @@ public class FileSourceDaoTest {
     assertThat(fn.result).isNull();
   }
 
-  @Test
-  public void no_line_hashes_when_only_test_data() {
-    dbTester.prepareDbUnit(getClass(), "no_line_hashes_when_only_test_data.xml");
-
-    ReaderToStringConsumer fn = new ReaderToStringConsumer();
-    underTest.readLineHashesStream(dbSession, "FILE1_UUID", fn);
-
-    assertThat(fn.result).isNull();
-  }
-
   @Test
   public void insert() {
     FileSourceDto expected = new FileSourceDto()
index f0e0ed492188db4e391706efd67627cf35cacd38..11c383b63fd7f9386d51e91fac0fd2b7793cb3e8 100644 (file)
                 line_count="0"
                 data_hash="321654987"
                 created_at="123456789"
-                updated_at="123456789"
-                data_type="SOURCE"/>
+                updated_at="123456789"/>
 </dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/source/FileSourceDaoTest/no_line_hashes_when_only_test_data.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/source/FileSourceDaoTest/no_line_hashes_when_only_test_data.xml
deleted file mode 100644 (file)
index 01bc65a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<dataset>
-
-    <file_sources id="101" project_uuid="PRJ_UUID" file_uuid="FILE1_UUID"
-                  binary_data="abcde" data_hash="[null]"
-                  line_hashes="[null]"
-                  line_count="0"
-                  src_hash="[null]"
-                  line_hashes_version="[null]"
-                  created_at="1500000000000" updated_at="1500000000000"  data_type="TEST" />
-
-</dataset>
index 77d242162c6baea2f526907aeed849dac5857140..53556dae846c9f6db41d43711f59d59ccbf50c5b 100644 (file)
@@ -5,7 +5,7 @@
                   line_hashes="ABC\nDEF\nGHI"
                   line_count="3"
                   src_hash="FILE_HASH" revision="123456789"
-                  created_at="1500000000000" updated_at="1500000000000"  data_type="SOURCE"
+                  created_at="1500000000000" updated_at="1500000000000"
                   line_hashes_version="[null]"/>
 
 </dataset>
index e51106a4630283060f8ed4693f3045575d83228e..139656474e290df7bb5f641c5876fda6830289ae 100644 (file)
@@ -6,7 +6,7 @@
                 line_hashes="NEW_LINE_HASHES"
                 line_count="1"
                 src_hash="NEW_FILE_HASH" revision="987654321"
-                created_at="1500000000000" updated_at="1500000000002"  data_type="SOURCE"
+                created_at="1500000000000" updated_at="1500000000002"
                 line_hashes_version="1" />