@@ -0,0 +1,2044 @@
+package org.hisrc.tenet.zugradar.tests;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.net.URL;%0Aimport java.text.MessageFormat;%0Aimport java.time.LocalDate;%0Aimport java.time.LocalTime;%0Aimport java.time.format.DateTimeFormatter;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport javax.json.Json;%0Aimport javax.json.JsonArray;%0A%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0A%0Apublic class ZugnumbersTest %7B%0A%0A%09@Ignore%0A%09@Test%0A%09public void writesZugnumbers() throws IOException %7B%0A%09%09request(LocalDate.of(2016, 1, 1));%0A%09%7D%0A%0A%09public static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern(%22yyyyMMdd%22);%0A%09public static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern(%22HH:mm:ss%22);%0A%09public static final String URL_PATTERN = %22http://www.apps-bahn.de/bin/livemap/query-livemap.exe/dny?L=vs_livefahrplan&performLocating=1&performFixedLocating=1&look_requesttime=%7B1%7D&livemapRequest=yes&ts=%7B0%7D%22;%0A%0A%09public void request(LocalDate localDate) throws IOException %7B%0A%09%09final Map%3CString, String%3E trainIds = new HashMap%3C%3E();%0A%0A%09%09System.out.println(%22Start.%22);%0A%09%09for (int hour = 0; hour %3C 24; hour++) %7B%0A%09%09%09for (int minute = 0; minute %3C 60; minute += 3) %7B%0A%09%09%09%09final String url = MessageFormat.format(URL_PATTERN, DATE_FORMATTER.format(localDate),%0A%09%09%09%09%09%09TIME_FORMATTER.format(LocalTime.of(hour, minute, 0)));%0A%09%09%09%09try (InputStream is = new URL(url).openStream()) %7B%0A%09%09%09%09%09JsonArray results = Json.createReader(is).readArray();%0A%09%09%09%09%09JsonArray trainsArray = results.getJsonArray(0);%0A%09%09%09%09%09for (int index = 0; index %3C trainsArray.size() - 1; index++) %7B%0A%09%09%09%09%09%09final JsonArray trainArray = trainsArray.getJsonArray(index);%0A%09%09%09%09%09%09final String trainNumber = trainArray.getString(0);%0A%09%09%09%09%09%09final String trainId = trainArray.getString(3);%0A%09%09%09%09%09%09final String departure = trainArray.getString(16, null);%0A%09%09%09%09%09%09if (trainIds.putIfAbsent(trainNumber, trainId) == null) %7B%0A%09%09%09%09%09%09%09System.out.println(MessageFormat.format(%22%7B0%7D,%7B1%7D%22, trainNumber, trainId));%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09System.out.println(trainIds.size());%0A%09%7D%0A%7D%0A

Test for HAFAS Zugnummern.