Skip to content

Commit

Permalink
hotfix: CreateConnectionRequest startTime
Browse files Browse the repository at this point in the history
  • Loading branch information
EddeCCC committed Nov 8, 2024
1 parent fd3ed25 commit 045d3d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public record CreateConnectionRequest(
@NotNull(message = "Gepard Version missing.") String gepardVersion,
@NotNull(message = "OpenTelemetry Version missing.") String otelVersion,
@NotNull(message = "VM-ID is missing.") String vmId,
@NotNull(message = "Start-Time missing.") Long startTime,
@NotNull(message = "Start-Time missing.") Instant startTime,
@NotNull(message = "Java Version missing.") String javaVersion,
Map<String, String> attributes) {

Expand All @@ -27,7 +27,7 @@ public static Connection toConnection(CreateConnectionRequest createConnectionRe
createConnectionRequest.vmId,
createConnectionRequest.gepardVersion,
createConnectionRequest.otelVersion,
Instant.ofEpochMilli(createConnectionRequest.startTime),
createConnectionRequest.startTime,
createConnectionRequest.javaVersion,
createConnectionRequest.attributes != null
? createConnectionRequest.attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void connect_whenEverythingIsValid_shouldReturnOk() throws Exception {
"0.0.1",
"1.26.8",
"67887@localhost",
Instant.now().toEpochMilli(),
Instant.now(),
"22",
Map.of());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void testGetConnections() {
"0.0.1",
"1.26.8",
"67887@localhost",
Instant.now().toEpochMilli(),
Instant.now(),
"22",
Map.of());
connectionService.handleConnectRequest(id, createConnectionRequest);
Expand All @@ -86,15 +86,15 @@ void testGetConnection() {
"0.0.1",
"1.26.8",
"67887@localhost",
Instant.now().toEpochMilli(),
Instant.now(),
"22",
Map.of());
Connection connection = connectionService.handleConnectRequest(id, createConnectionRequest);

ConnectionDto connectionDto = connectionService.getConnection(id);

assertEquals(
Instant.ofEpochMilli(createConnectionRequest.startTime()), connectionDto.startTime());
createConnectionRequest.startTime(), connectionDto.startTime());
assertEquals(createConnectionRequest.javaVersion(), connectionDto.javaVersion());
assertEquals(createConnectionRequest.otelVersion(), connectionDto.otelVersion());
assertEquals(createConnectionRequest.gepardVersion(), connectionDto.gepardVersion());
Expand All @@ -115,14 +115,14 @@ void testHandleConnectRequest() {
"0.0.1",
"1.26.8",
"67887@localhost",
Instant.now().toEpochMilli(),
Instant.now(),
"22",
Map.of());

Connection response = connectionService.handleConnectRequest(id, createConnectionRequest);

assertEquals(
createConnectionRequest.startTime(), response.getAgent().getStartTime().toEpochMilli());
createConnectionRequest.startTime(), response.getAgent().getStartTime());
assertEquals(createConnectionRequest.javaVersion(), response.getAgent().getJavaVersion());
assertEquals(createConnectionRequest.otelVersion(), response.getAgent().getOtelVersion());
assertEquals(createConnectionRequest.gepardVersion(), response.getAgent().getGepardVersion());
Expand Down

0 comments on commit 045d3d6

Please sign in to comment.