|
|
|
@ -26,6 +26,8 @@ import static org.junit.Assert.assertTrue;
|
|
|
|
|
*/
|
|
|
|
|
public class HttpClientDownloaderTest {
|
|
|
|
|
|
|
|
|
|
public static final String PAGE_ALWAYS_NOT_EXISTS = "http://localhost:13421/404";
|
|
|
|
|
|
|
|
|
|
@Ignore
|
|
|
|
|
@Test
|
|
|
|
|
public void testCookie() {
|
|
|
|
@ -52,7 +54,7 @@ public class HttpClientDownloaderTest {
|
|
|
|
|
public void testCycleTriedTimes() {
|
|
|
|
|
HttpClientDownloader httpClientDownloader = new HttpClientDownloader();
|
|
|
|
|
Task task = Site.me().setDomain("localhost").setCycleRetryTimes(5).toTask();
|
|
|
|
|
Request request = new Request("http://localhost/404");
|
|
|
|
|
Request request = new Request(PAGE_ALWAYS_NOT_EXISTS);
|
|
|
|
|
Page page = httpClientDownloader.download(request, task);
|
|
|
|
|
assertThat(page.getTargetRequests().size() > 0);
|
|
|
|
|
assertThat((Integer) page.getTargetRequests().get(0).getExtra(Request.CYCLE_TRIED_TIMES)).isEqualTo(1);
|
|
|
|
|