Commit 4b32afcd authored by Antoine Mottier's avatar Antoine Mottier
Browse files

Fix fetchMKTMetrics to use dynamic project name instead of ASM

The SQL query in `fetchMKTMetrics` method was using hard-coded project name (`asm`) instead of using the `DatasetFactory` `project` attribute.

Also update JUnit and MariaDB version.
parent 2d5717ba
Pipeline #11083 passed with stages
in 4 minutes and 53 seconds
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
<!-- Jetty target version (Debian package) is 9.4 <!-- Jetty target version (Debian package) is 9.4
So we need to use Java EE 7 features and Servlet version 3.1 --> So we need to use Java EE 7 features and Servlet version 3.1 -->
<servlet.version>3.1.0</servlet.version> <servlet.version>3.1.0</servlet.version>
<maria.db.jdbc.driver.version>2.7.1</maria.db.jdbc.driver.version> <maria.db.jdbc.driver.version>2.7.2</maria.db.jdbc.driver.version>
<junit.version>5.7.0</junit.version> <junit.version>5.7.1</junit.version>
<icar.json.version>1.0.0</icar.json.version> <icar.json.version>1.0.0</icar.json.version>
<slf4j.version>1.7.30</slf4j.version> <slf4j.version>1.7.30</slf4j.version>
<logback.classic.version>1.2.3</logback.classic.version> <logback.classic.version>1.2.3</logback.classic.version>
......
...@@ -185,7 +185,7 @@ public class DatasetFactory { ...@@ -185,7 +185,7 @@ public class DatasetFactory {
Connection connection = DatasetFactory.connectDB(); Connection connection = DatasetFactory.connectDB();
try (Statement statement = connection.createStatement()) { try (Statement statement = connection.createStatement()) {
ResultSet resultSet = statement.executeQuery("SELECT * FROM (SELECT Project, Date, MetricName, Value, row_number() over(partition by MetricName order by Date desc) AS rn " + ResultSet resultSet = statement.executeQuery("SELECT * FROM (SELECT Project, Date, MetricName, Value, row_number() over(partition by MetricName order by Date desc) AS rn " +
"FROM RawData WHERE Project = 'asm' AND MetricName LIKE 'MKT_%') t WHERE t.rn = 1;"); "FROM RawData WHERE Project = '" + project + "' AND MetricName LIKE 'MKT_%') t WHERE t.rn = 1;");
while (resultSet.next()) { while (resultSet.next()) {
Metric m = new Metric(project, resultSet.getString("MetricName"), resultSet.getDouble("Value")); Metric m = new Metric(project, resultSet.getString("MetricName"), resultSet.getDouble("Value"));
metrics.putIfAbsent(m.getName(), m); metrics.putIfAbsent(m.getName(), m);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment