1515import org .haiku .haikudepotserver .job .model .JobService ;
1616import org .haiku .haikudepotserver .job .model .JobSnapshot ;
1717import org .haiku .haikudepotserver .reference .model .ReferenceDumpExportJobSpecification ;
18- import org .haiku .haikudepotserver .support .DateTimeHelper ;
18+ import org .haiku .haikudepotserver .support .RuntimeInformationService ;
1919import org .junit .Assert ;
2020import org .junit .Test ;
2121import org .springframework .test .context .ContextConfiguration ;
2222
2323import javax .annotation .Resource ;
24- import javax .sql .DataSource ;
2524import java .io .InputStream ;
26- import java .sql .Connection ;
27- import java .sql .PreparedStatement ;
28- import java .sql .ResultSet ;
29- import java .sql .SQLException ;
30- import java .util .Date ;
3125import java .util .Optional ;
3226import java .util .stream .IntStream ;
3327import java .util .zip .GZIPInputStream ;
@@ -42,7 +36,7 @@ public class ReferenceDumpExportJobRunnerIT extends AbstractIntegrationTest {
4236 private ObjectMapper objectMapper ;
4337
4438 @ Resource
45- private DataSource dataSource ;
39+ private RuntimeInformationService runtimeInformationService ;
4640
4741 /**
4842 * <p>Uses the sample data and checks that the output from the report matches a captured, sensible-looking
@@ -52,10 +46,9 @@ public class ReferenceDumpExportJobRunnerIT extends AbstractIntegrationTest {
5246 @ Test
5347 public void testRun () throws Exception {
5448
55- long now = DateTimeHelper .secondAccuracyDate (new Date ()).getTime ();
5649 ReferenceDumpExportJobSpecification specification = new ReferenceDumpExportJobSpecification ();
5750 specification .setNaturalLanguageCode (NaturalLanguage .CODE_GERMAN );
58- java .util .Date latestModifyTimestamp = getLatestReferenceDataDate ( );
51+ java .util .Date latestModifyTimestamp = new java . util . Date ( runtimeInformationService . getBuildTimestamp (). toEpochMilli () );
5952
6053 // ------------------------------------
6154 String guid = jobService .submit (
@@ -99,28 +92,12 @@ public void testRun() throws Exception {
9992 // the request was in German so the results should be in German too.
10093 JsonNode pkgCategoriesArrayNode = rootNode .get ("pkgCategories" );
10194 assertItemWithCodeAndName (pkgCategoriesArrayNode , "graphics" , "Grafik" );
102- }
103-
104- }
105-
106- private java .util .Date getLatestReferenceDataDate () throws SQLException {
10795
108- String query = "WITH mt AS (SELECT modify_timestamp FROM haikudepot.country\n "
109- + "UNION SELECT modify_timestamp FROM haikudepot.natural_language\n "
110- + "UNION SELECT modify_timestamp FROM haikudepot.pkg_category)\n "
111- + "SELECT MAX(mt.modify_timestamp) FROM mt" ;
112-
113- try (
114- Connection connection = dataSource .getConnection ();
115- PreparedStatement statement = connection .prepareStatement (query );
116- ResultSet resultSet = statement .executeQuery ()
117- ) {
118- while (resultSet .next ()) {
119- return DateTimeHelper .secondAccuracyDate (resultSet .getTimestamp (1 ));
120- }
121-
122- throw new AssertionError ("unable to get the latest reference data date" );
96+ // check a user rating stability
97+ JsonNode userRatingStabilitiesArrayNode = rootNode .get ("userRatingStabilities" );
98+ assertItemWithCodeAndName (userRatingStabilitiesArrayNode , "unstablebutusable" , "Nicht stabil, aber benutzbar" );
12399 }
100+
124101 }
125102
126103 private void assertItemWithCodeAndName (JsonNode array , String code , String name ) {
0 commit comments