diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 00987110..917deb60 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,11 +1,11 @@ [versions] -spring = "5.3.21" -springBoot = "2.7.1" +spring = "5.3.22" +springBoot = "2.7.2" thymeleaf = "3.0.15.RELEASE" thymeleafExtrasTime = "3.0.4.RELEASE" logback = "1.2.11" -jsonSchemaValidator = "1.0.71" -gson = "2.9.0" +jsonSchemaValidator = "1.0.72" +gson = "2.9.1" slf4j = "1.7.36" h2 = "2.1.214" jdbi3 = "3.30.0" @@ -14,10 +14,10 @@ lombok = "1.18.24" findbugs = "3.0.2" junit4 = "4.13.2" -jupiter = "5.8.2" -jupiterPlatform = "1.8.2" +jupiter = "5.9.0" +jupiterPlatform = "1.9.0" mockitoCore = "4.6.1" -cucumber = "7.4.1" +cucumber = "7.6.0" testNg = "7.6.1" lombokPlugin = "6.5.0.3" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index c824031d..3e5115a0 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -88,21 +88,6 @@ - - - - - - - - - - - - - - - @@ -208,12 +193,12 @@ - - - + + + - - + + @@ -226,9 +211,9 @@ - - - + + + @@ -427,12 +412,12 @@ - - - + + + - - + + @@ -541,25 +526,25 @@ - - - + + + - - + + - - - + + + - - - + + + - - + + @@ -570,41 +555,41 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + @@ -612,70 +597,65 @@ - - - - - - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -1199,11 +1179,24 @@ + + + + + + + + + + + + + @@ -1485,6 +1478,11 @@ + + + + + @@ -1493,6 +1491,14 @@ + + + + + + + + @@ -1501,6 +1507,14 @@ + + + + + + + + @@ -1509,6 +1523,14 @@ + + + + + + + + @@ -1517,6 +1539,14 @@ + + + + + + + + @@ -1525,6 +1555,14 @@ + + + + + + + + @@ -1533,36 +1571,44 @@ - - - + + + + + + + + + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -1570,6 +1616,11 @@ + + + + + @@ -1715,12 +1766,12 @@ - - - + + + - - + + @@ -1909,116 +1960,116 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + diff --git a/mission-report/flight-evaluation-report/src/main/java/com/github/nagyesta/abortmission/reporting/controller/ConversionController.java b/mission-report/flight-evaluation-report/src/main/java/com/github/nagyesta/abortmission/reporting/controller/ConversionController.java index ffe04507..1bec7ceb 100644 --- a/mission-report/flight-evaluation-report/src/main/java/com/github/nagyesta/abortmission/reporting/controller/ConversionController.java +++ b/mission-report/flight-evaluation-report/src/main/java/com/github/nagyesta/abortmission/reporting/controller/ConversionController.java @@ -104,7 +104,12 @@ private LaunchJson readValidJson() throws RenderException { .forEach(log::error); throw new IllegalArgumentException("validation failed."); } - return objectMapper.treeToValue(rootNode, LaunchJson.class); + final LaunchJson launchJson = objectMapper.treeToValue(rootNode, LaunchJson.class); + if (launchJson.getClasses().isEmpty()) { + log.error("No measurements found in telemetry JSON. Please double-check your reporting configuration!"); + throw new IllegalArgumentException("Telemetry has no measurements."); + } + return launchJson; } catch (final Exception e) { log.error(e.getMessage(), e); throw new RenderException(); diff --git a/mission-report/flight-evaluation-report/src/test/java/com/github/nagyesta/abortmission/reporting/controller/ConversionControllerIntegrationTest.java b/mission-report/flight-evaluation-report/src/test/java/com/github/nagyesta/abortmission/reporting/controller/ConversionControllerIntegrationTest.java index fdfdb7b5..b20744dc 100644 --- a/mission-report/flight-evaluation-report/src/test/java/com/github/nagyesta/abortmission/reporting/controller/ConversionControllerIntegrationTest.java +++ b/mission-report/flight-evaluation-report/src/test/java/com/github/nagyesta/abortmission/reporting/controller/ConversionControllerIntegrationTest.java @@ -79,6 +79,26 @@ void testConvertShouldConvertAndRenderDataWhenCalledWithValidJson(final String j assertIterableEquals(expectedLines, actualLines); } + @Test + void testConvertShouldThrowExceptionWhenCalledWithEmptyJson() throws Exception { + //given + final File inputFile = new File(this.getClass().getResource("/abort-mission-report-empty.json").getFile()); + final ConversionProperties properties = ConversionProperties.builder() + .input(inputFile) + .output(File.createTempFile("abort-mission-test", ".html")) + .relaxed(false) + .build(); + + properties.getOutput().deleteOnExit(); + + final ConversionController underTest = new ConversionController(properties, objectMapper, launchConverter, templateEngine); + + //when + assertThrows(RuntimeException.class, underTest::convert); + + //then + exception + } + @Test void testConvertShouldThrowExceptionWhenCalledWithInvalidJson() throws Exception { //given diff --git a/mission-report/flight-evaluation-report/src/test/resources/abort-mission-report-empty.json b/mission-report/flight-evaluation-report/src/test/resources/abort-mission-report-empty.json new file mode 100644 index 00000000..68dd11f6 --- /dev/null +++ b/mission-report/flight-evaluation-report/src/test/resources/abort-mission-report-empty.json @@ -0,0 +1,121 @@ +{ + "classes": {}, + "countdownStats": { + "minStart": { + "date": { + "year": 2020, + "month": 11, + "day": 30 + }, + "time": { + "hour": 22, + "minute": 54, + "second": 43, + "nano": 429000000 + } + }, + "maxEnd": { + "date": { + "year": 2020, + "month": 11, + "day": 30 + }, + "time": { + "hour": 22, + "minute": 54, + "second": 44, + "nano": 746000000 + } + }, + "worstResult": "FAILURE", + "count": 3, + "sumDuration": 947, + "minDuration": 2, + "maxDuration": 938, + "avgDuration": 315.7, + "resultCount": { + "FAILURE": 1, + "SUCCESS": 2 + } + }, + "missionStats": { + "minStart": { + "date": { + "year": 2020, + "month": 11, + "day": 30 + }, + "time": { + "hour": 22, + "minute": 54, + "second": 43, + "nano": 436000000 + } + }, + "maxEnd": { + "date": { + "year": 2020, + "month": 11, + "day": 30 + }, + "time": { + "hour": 22, + "minute": 54, + "second": 45, + "nano": 5000000 + } + }, + "worstResult": "FAILURE", + "count": 16, + "sumDuration": 11, + "minDuration": 0, + "maxDuration": 6, + "avgDuration": 0.7, + "resultCount": { + "FAILURE": 2, + "SUPPRESSED": 1, + "ABORT": 8, + "SUCCESS": 5 + } + }, + "stats": { + "minStart": { + "date": { + "year": 2020, + "month": 11, + "day": 30 + }, + "time": { + "hour": 22, + "minute": 54, + "second": 43, + "nano": 429000000 + } + }, + "maxEnd": { + "date": { + "year": 2020, + "month": 11, + "day": 30 + }, + "time": { + "hour": 22, + "minute": 54, + "second": 45, + "nano": 5000000 + } + }, + "worstResult": "FAILURE", + "count": 19, + "sumDuration": 958, + "minDuration": 0, + "maxDuration": 938, + "avgDuration": 50.4, + "resultCount": { + "FAILURE": 3, + "SUPPRESSED": 1, + "ABORT": 8, + "SUCCESS": 7 + } + } +}