Skip to content

Commit

Permalink
Merge pull request #6 from ls1intum/add-more-fields
Browse files Browse the repository at this point in the history
Add field to check if server is a testserver
  • Loading branch information
SimonEntholzer authored Oct 8, 2024
2 parents e045310 + 66ca3a4 commit 5704f42
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record TelemetryDTO(Long id, String version, String serverUrl, String operator, String adminName, List<String> 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<String> 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) {
Expand All @@ -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;
}
}
10 changes: 10 additions & 0 deletions src/main/resources/db/changelog/20241001210000.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet id="20241001210000_1" author="entholzer">
<addColumn tableName="telemetry">
<column name="is_test_server" type="boolean" defaultValue="false"/>
</addColumn>
</changeSet>
</databaseChangeLog>
1 change: 1 addition & 0 deletions src/main/resources/db/changelog/db.changelog-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<!-- Reference changesets here -->
<include file="classpath:db/changelog/initial-schema.xml"/>
<include file="classpath:db/changelog/20240929130000.xml"/>
<include file="classpath:db/changelog/20241001210000.xml"/>
</databaseChangeLog>

0 comments on commit 5704f42

Please sign in to comment.