Skip to content

Commit

Permalink
Merge pull request #4 from rtr-nettest/feature/historyAndSettingsAdap…
Browse files Browse the repository at this point in the history
…tions

Add open_test_uuid in history request
  • Loading branch information
cproof authored Apr 23, 2024
2 parents e5c38de + e376154 commit 244c72c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Server test

on:
push:
branches: [ feature/war, master ]
branches: [ feature/war, master, feature/*, dev ]
jobs:
build:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: WAR build

on:
push:
branches: [ feature/war, feature/jakarta-upgrade, master ]
branches: [ feature/war, feature/jakarta-upgrade, master, feature/*, dev ]
jobs:
build:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class TestHistoryMapperImpl implements TestHistoryMapper {
public HistoryItemResponse testHistoryToHistoryItemResponse(TestHistory testHistory, Integer classificationCount, Locale locale) {
HistoryItemResponse.HistoryItemResponseBuilder historyItemResponseBuilder = HistoryItemResponse.builder()
.testUUID(testHistory.getUuid())
.openTestUuid(testHistory.getOpenTestUuid() != null ? "O" + testHistory.getOpenTestUuid() : null)
.time(testHistory.getTime().getTime())
.timezone(testHistory.getTimezone())
.timeString(TimeUtils.getTimeString(testHistory.getTime(), TimeZone.getTimeZone(testHistory.getTimezone()), locale))
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/at/rtr/rmbt/model/TestHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class TestHistory {
@Column(name = "uuid")
private UUID uuid;

@Column(name = "open_test_uuid")
private UUID openTestUuid;

@Column(name = "time")
private Date time;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class TestHistoryRepositoryImpl implements TestHistoryRepository {

private final JdbcTemplate jdbcTemplate;
private final static String GET_TEST_HISTORY = "SELECT DISTINCT"
+ " t.uuid, time, timezone, speed_upload, speed_download, ping_median, lte_rsrp, signal_strength, dual_sim, sim_count, network_type, nt.group_name network_type_group_name, l.loop_uuid loop_uuid,"
+ " t.uuid, t.open_test_uuid, time, timezone, speed_upload, speed_download, ping_median, lte_rsrp, signal_strength, dual_sim, sim_count, network_type, nt.group_name network_type_group_name, l.loop_uuid loop_uuid,"
+ " COALESCE(adm.fullname, t.model) model"
+ " FROM test t"
+ " LEFT JOIN device_map adm ON adm.codename=t.model"
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/at/rtr/rmbt/response/HistoryItemResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public class HistoryItemResponse {
@JsonProperty(value = "test_uuid")
private final UUID testUUID;

@Schema(description = "Open Test UUID")
@JsonProperty(value = "open_test_uuid")
private final String openTestUuid;

@Schema(description = "Time of the test in millis")
@JsonProperty(value = "time")
private final Long time;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/at/rtr/rmbt/TestConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ public interface TestConstants {
String DEFAULT_FORMATTED_PING = "58";
String DEFAULT_FORMATTED_PING_SHORTEST = "58";
String DEFAULT_HISTORY_RESPONSE_ITEM_LOOP_UUID = "L2458713e-9362-11eb-a8b3-0242ac130003";
String DEFAULT_TEST_HISTORY_FINAL_QUERY = "SELECT DISTINCT t.uuid, time, timezone, speed_upload, speed_download, ping_median, lte_rsrp, signal_strength, dual_sim, sim_count, network_type, nt.group_name network_type_group_name, l.loop_uuid loop_uuid, COALESCE(adm.fullname, t.model) model FROM test t LEFT JOIN device_map adm ON adm.codename=t.model LEFT JOIN network_type nt ON t.network_type=nt.uid LEFT JOIN test_loopmode l ON (l.test_uuid = t.uuid) WHERE t.deleted = false AND t.implausible = false AND t.status = 'FINISHED' AND client_id = 2 AND (COALESCE(adm.fullname, t.model) IN ('DEFAULT_DEVICE')) AND nt.group_name IN ('2G (GSM)') ORDER BY time DESC LIMIT 1 OFFSET 2";
String DEFAULT_TEST_HISTORY_FINAL_QUERY_CLIENT_SYNCED = "SELECT DISTINCT t.uuid, time, timezone, speed_upload, speed_download, ping_median, lte_rsrp, signal_strength, dual_sim, sim_count, network_type, nt.group_name network_type_group_name, l.loop_uuid loop_uuid, COALESCE(adm.fullname, t.model) model FROM test t LEFT JOIN device_map adm ON adm.codename=t.model LEFT JOIN network_type nt ON t.network_type=nt.uid LEFT JOIN test_loopmode l ON (l.test_uuid = t.uuid) WHERE t.deleted = false AND t.implausible = false AND t.status = 'FINISHED' AND (t.client_id IN (SELECT 2 UNION SELECT uid FROM client WHERE sync_group_id = 5 )) AND (COALESCE(adm.fullname, t.model) IN ('DEFAULT_DEVICE')) AND nt.group_name IN ('2G (GSM)') ORDER BY time DESC LIMIT 1 OFFSET 2";
String DEFAULT_TEST_HISTORY_FINAL_QUERY = "SELECT DISTINCT t.uuid, t.open_test_uuid, time, timezone, speed_upload, speed_download, ping_median, lte_rsrp, signal_strength, dual_sim, sim_count, network_type, nt.group_name network_type_group_name, l.loop_uuid loop_uuid, COALESCE(adm.fullname, t.model) model FROM test t LEFT JOIN device_map adm ON adm.codename=t.model LEFT JOIN network_type nt ON t.network_type=nt.uid LEFT JOIN test_loopmode l ON (l.test_uuid = t.uuid) WHERE t.deleted = false AND t.implausible = false AND t.status = 'FINISHED' AND client_id = 2 AND (COALESCE(adm.fullname, t.model) IN ('DEFAULT_DEVICE')) AND nt.group_name IN ('2G (GSM)') ORDER BY time DESC LIMIT 1 OFFSET 2";
String DEFAULT_TEST_HISTORY_FINAL_QUERY_CLIENT_SYNCED = "SELECT DISTINCT t.uuid, t.open_test_uuid, time, timezone, speed_upload, speed_download, ping_median, lte_rsrp, signal_strength, dual_sim, sim_count, network_type, nt.group_name network_type_group_name, l.loop_uuid loop_uuid, COALESCE(adm.fullname, t.model) model FROM test t LEFT JOIN device_map adm ON adm.codename=t.model LEFT JOIN network_type nt ON t.network_type=nt.uid LEFT JOIN test_loopmode l ON (l.test_uuid = t.uuid) WHERE t.deleted = false AND t.implausible = false AND t.status = 'FINISHED' AND (t.client_id IN (SELECT 2 UNION SELECT uid FROM client WHERE sync_group_id = 5 )) AND (COALESCE(adm.fullname, t.model) IN ('DEFAULT_DEVICE')) AND nt.group_name IN ('2G (GSM)') ORDER BY time DESC LIMIT 1 OFFSET 2";
Integer DEFAULT_CLIENT_SYNC_GROUP_ID = 5;
MeasurementType DEFAULT_MEASUREMENT_TYPE_FLAG = MeasurementType.REGULAR;
String DEFAULT_SYNC_CODE = "DEFAULT_SYNC_CODE";
Expand Down

0 comments on commit 244c72c

Please sign in to comment.