@Test public void rememberLastSuccessfulDownloadLocation() { for (int i = 0; i < MAX_ATTEMPTS; i++) { ConfigurationDownloader downloader = getDownloader(LOCATION_URL_SUCCESS); List<String> locationUrls = getMixedLocationUrls(); downloader.download(getSource(locationUrls)); resetParser(downloader); downloader.download(getSource(locationUrls)); verifyLastSuccessfulLocationUsedSecondTime(downloader); } }
DownloadResult download(ConfigurationSource source, String... contentIdentifiers) { DownloadResult result = new DownloadResult(); for (ConfigurationLocation location : getLocations(source)) { try { Configuration config = download(location, contentIdentifiers); rememberLastSuccessfulLocation(location); return result.success(config); } catch (Exception e) { result.addFailure(location, e); } } return result.failure(); }
ConfigurationDownloader { DownloadResult download(ConfigurationSource source, String... contentIdentifiers) { DownloadResult result = new DownloadResult(); for (ConfigurationLocation location : getLocations(source)) { try { Configuration config = download(location, contentIdentifiers); rememberLastSuccessfulLocation(location); return result.success(config); } catch (Exception e) { result.addFailure(location, e); } } return result.failure(); } }
ConfigurationDownloader { DownloadResult download(ConfigurationSource source, String... contentIdentifiers) { DownloadResult result = new DownloadResult(); for (ConfigurationLocation location : getLocations(source)) { try { Configuration config = download(location, contentIdentifiers); rememberLastSuccessfulLocation(location); return result.success(config); } catch (Exception e) { result.addFailure(location, e); } } return result.failure(); } ConfigurationDownloader(FileNameProvider fileNameProvider, int version,
            String... instanceIdentifiers); }
ConfigurationDownloader { DownloadResult download(ConfigurationSource source, String... contentIdentifiers) { DownloadResult result = new DownloadResult(); for (ConfigurationLocation location : getLocations(source)) { try { Configuration config = download(location, contentIdentifiers); rememberLastSuccessfulLocation(location); return result.success(config); } catch (Exception e) { result.addFailure(location, e); } } return result.failure(); } ConfigurationDownloader(FileNameProvider fileNameProvider, int version,
            String... instanceIdentifiers); static URL getDownloadURL(ConfigurationLocation location,
            ConfigurationFile file); static URLConnection getDownloadURLConnection(URL url); }
ConfigurationDownloader { DownloadResult download(ConfigurationSource source, String... contentIdentifiers) { DownloadResult result = new DownloadResult(); for (ConfigurationLocation location : getLocations(source)) { try { Configuration config = download(location, contentIdentifiers); rememberLastSuccessfulLocation(location); return result.success(config); } catch (Exception e) { result.addFailure(location, e); } } return result.failure(); } ConfigurationDownloader(FileNameProvider fileNameProvider, int version,
            String... instanceIdentifiers); static URL getDownloadURL(ConfigurationLocation location,
            ConfigurationFile file); static URLConnection getDownloadURLConnection(URL url); static final int READ_TIMEOUT; }