From 66ca3a4d0b847b9053219a798ee6dcd7641f53b6 Mon Sep 17 00:00:00 2001 From: Simon Entholzer Date: Tue, 1 Oct 2024 21:52:33 +0200 Subject: [PATCH] add field to check if server is testserver --- .../cit/ase/artemistelemetry/domain/Telemetry.java | 11 +++++++++++ .../artemistelemetry/service/dto/TelemetryDTO.java | 5 +++-- src/main/resources/db/changelog/20241001210000.xml | 10 ++++++++++ .../resources/db/changelog/db.changelog-master.xml | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/db/changelog/20241001210000.xml diff --git a/src/main/java/de/tum/cit/ase/artemistelemetry/domain/Telemetry.java b/src/main/java/de/tum/cit/ase/artemistelemetry/domain/Telemetry.java index dc45a4e..8cf6805 100644 --- a/src/main/java/de/tum/cit/ase/artemistelemetry/domain/Telemetry.java +++ b/src/main/java/de/tum/cit/ase/artemistelemetry/domain/Telemetry.java @@ -34,6 +34,9 @@ public class Telemetry extends DomainObject { @Column(name = "is_production_instance") private boolean isProductionInstance; + @Column(name = "is_test_server") + private boolean isTestServer; + @Column(name = "datasource") private String dataSource; @@ -130,4 +133,12 @@ public int getBuildAgentCount() { public void setBuildAgentCount(int buildAgentCount) { this.buildAgentCount = buildAgentCount; } + + public boolean isTestServer() { + return isTestServer; + } + + public void setTestServer(boolean testServer) { + isTestServer = testServer; + } } diff --git a/src/main/java/de/tum/cit/ase/artemistelemetry/service/dto/TelemetryDTO.java b/src/main/java/de/tum/cit/ase/artemistelemetry/service/dto/TelemetryDTO.java index 3cabb17..1739876 100644 --- a/src/main/java/de/tum/cit/ase/artemistelemetry/service/dto/TelemetryDTO.java +++ b/src/main/java/de/tum/cit/ase/artemistelemetry/service/dto/TelemetryDTO.java @@ -8,12 +8,12 @@ @JsonInclude(JsonInclude.Include.NON_EMPTY) public record TelemetryDTO(Long id, String version, String serverUrl, String operator, String adminName, List profiles, String contact, ZonedDateTime timestamp, - boolean isProductionInstance, String dataSource, int numberOfNodes, int buildAgentCount) { + boolean isProductionInstance, boolean isTestServer, String dataSource, int numberOfNodes, int buildAgentCount) { public static TelemetryDTO from(Telemetry telemetry) { List profilesList = List.of(telemetry.getProfiles().split(",")); return new TelemetryDTO(telemetry.getId(), telemetry.getVersion(), telemetry.getServerUrl(), telemetry.getOperatorName(), telemetry.getAdminName(), profilesList, telemetry.getContact(), telemetry.getTimestamp(), - telemetry.isProductionInstance(), telemetry.getDataSource(), telemetry.getNumberOfNodes(), telemetry.getBuildAgentCount()); + telemetry.isProductionInstance(), telemetry.isTestServer(), telemetry.getDataSource(), telemetry.getNumberOfNodes(), telemetry.getBuildAgentCount()); } public static Telemetry to(TelemetryDTO telemetryDTO) { @@ -31,6 +31,7 @@ public static Telemetry to(TelemetryDTO telemetryDTO) { telemetry.setDataSource(telemetryDTO.dataSource()); telemetry.setNumberOfNodes(telemetryDTO.numberOfNodes()); telemetry.setBuildAgentCount(telemetryDTO.buildAgentCount()); + telemetry.setTestServer(telemetryDTO.isTestServer()); return telemetry; } } diff --git a/src/main/resources/db/changelog/20241001210000.xml b/src/main/resources/db/changelog/20241001210000.xml new file mode 100644 index 0000000..da5b826 --- /dev/null +++ b/src/main/resources/db/changelog/20241001210000.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/db/changelog/db.changelog-master.xml b/src/main/resources/db/changelog/db.changelog-master.xml index a58dc44..1c3ee73 100644 --- a/src/main/resources/db/changelog/db.changelog-master.xml +++ b/src/main/resources/db/changelog/db.changelog-master.xml @@ -8,4 +8,5 @@ + \ No newline at end of file