@Test public void testUrlExistsAndNeverDownloaded() { String url = "http: Entry entry = createEntry(url, 10); when(robotsRepository.findByHost(anyString())).thenReturn(entry); when(redisUrlRepository.exists(anyString())).thenReturn(true); consumerService.receiveUrl(url); verify(downloaderService, never()).download(anyString(), anyString()); }
public void receiveUrl(String url) { if (!UrlUtils.isValid(url)) { log.error("Url {} is not valid", url); return; } log.info("Received url {}, prepared to fetch robots.txt file for it", url); try { URI uri = new URI(url); String baseHost = DomainUtils.base(uri); log.debug("Validated url to base host: {}", baseHost); checkHost(baseHost); } catch (URISyntaxException e) { log.error("Can't create URI using url {}", url, e); } }
IncomingUrlService { public void receiveUrl(String url) { if (!UrlUtils.isValid(url)) { log.error("Url {} is not valid", url); return; } log.info("Received url {}, prepared to fetch robots.txt file for it", url); try { URI uri = new URI(url); String baseHost = DomainUtils.base(uri); log.debug("Validated url to base host: {}", baseHost); checkHost(baseHost); } catch (URISyntaxException e) { log.error("Can't create URI using url {}", url, e); } } }
IncomingUrlService { public void receiveUrl(String url) { if (!UrlUtils.isValid(url)) { log.error("Url {} is not valid", url); return; } log.info("Received url {}, prepared to fetch robots.txt file for it", url); try { URI uri = new URI(url); String baseHost = DomainUtils.base(uri); log.debug("Validated url to base host: {}", baseHost); checkHost(baseHost); } catch (URISyntaxException e) { log.error("Can't create URI using url {}", url, e); } }  }
IncomingUrlService { public void receiveUrl(String url) { if (!UrlUtils.isValid(url)) { log.error("Url {} is not valid", url); return; } log.info("Received url {}, prepared to fetch robots.txt file for it", url); try { URI uri = new URI(url); String baseHost = DomainUtils.base(uri); log.debug("Validated url to base host: {}", baseHost); checkHost(baseHost); } catch (URISyntaxException e) { log.error("Can't create URI using url {}", url, e); } }  void receiveUrl(String url); }
IncomingUrlService { public void receiveUrl(String url) { if (!UrlUtils.isValid(url)) { log.error("Url {} is not valid", url); return; } log.info("Received url {}, prepared to fetch robots.txt file for it", url); try { URI uri = new URI(url); String baseHost = DomainUtils.base(uri); log.debug("Validated url to base host: {}", baseHost); checkHost(baseHost); } catch (URISyntaxException e) { log.error("Can't create URI using url {}", url, e); } }  void receiveUrl(String url);  }