aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao
diff options
context:
space:
mode:
authorJacek <52388493+jacek-poreda-sonarsource@users.noreply.github.com>2019-09-18 17:15:59 +0200
committerSonarTech <sonartech@sonarsource.com>2019-09-18 20:21:04 +0200
commit0443794329122f49b910eb58cb505349ab116414 (patch)
treee58d091258efe9e7eba593caba557deb2f6783c6 /server/sonar-db-dao
parent708344c0051c6d0c0f93b644dc92892a13d7cb89 (diff)
downloadsonarqube-0443794329122f49b910eb58cb505349ab116414.tar.gz
sonarqube-0443794329122f49b910eb58cb505349ab116414.zip
Fix mssql CE activity query and incorrect usage of AlwaysIncreasingSystem2 (#2077)
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml4
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java9
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QualityProfileExportDaoTest.java2
3 files changed, 4 insertions, 11 deletions
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml
index 9881bbb28af..29cab52cdd6 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml
@@ -68,14 +68,14 @@
<select id="selectByQuery" parameterType="map" resultType="org.sonar.db.ce.CeActivityDto" databaseId="mssql">
select * from (
- select row_number() over(order by id desc) as number,
+ select row_number() over(order by ca.created_at desc, id desc) as number,
<include refid="columns"/>,
<include refid="countWarnings"/>
<include refid="sqlSelectByQuery" />
) as query
where
query.number between #{pagination.startRowNumber,jdbcType=INTEGER} and #{pagination.endRowNumber,jdbcType=INTEGER}
- order by created_at desc, id desc
+ order by createdAt desc, id desc
</select>
<select id="selectByQuery" parameterType="map" resultType="org.sonar.db.ce.CeActivityDto" databaseId="oracle">
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
index 3cb838ff773..c323c4099ad 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
@@ -97,7 +97,7 @@ public class ComponentDaoTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
- private System2 system2 = AlwaysIncreasingSystem2.INSTANCE;
+ private System2 system2 = new AlwaysIncreasingSystem2(1000L);
@Rule
public DbTester db = DbTester.create(system2);
@@ -1199,13 +1199,6 @@ public class ComponentDaoTest {
project2.uuid(),
project3.uuid()
);
- assertThat(results)
- .extracting(ComponentDto::getCreatedAt)
- .containsExactly(
- firstDate,
- secondDate,
- thirdDate
- );
}
@Test
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QualityProfileExportDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QualityProfileExportDaoTest.java
index 7b33fb41526..beed341c565 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QualityProfileExportDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QualityProfileExportDaoTest.java
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class QualityProfileExportDaoTest {
@Rule
- public DbTester db = DbTester.create(AlwaysIncreasingSystem2.INSTANCE);
+ public DbTester db = DbTester.create(new AlwaysIncreasingSystem2());
private DbSession dbSession = db.getSession();
private QualityProfileExportDao underTest = db.getDbClient().qualityProfileExportDao();