Search in sources :

Example 31 with CrawlingAccessException

use of org.codelibs.fess.crawler.exception.CrawlingAccessException in project fess-crawler by codelibs.

the class HcHttpClientTest method test_doHead_accessTimeoutTarget.

public void test_doHead_accessTimeoutTarget() {
    HcHttpClient client = new HcHttpClient() {

        @Override
        protected ResponseData processHttpMethod(final String url, final HttpUriRequest httpRequest) {
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                throw new CrawlingAccessException(e);
            }
            return null;
        }
    };
    client.setAccessTimeout(1);
    try {
        client.doHead("http://localhost/");
        fail();
    } catch (CrawlingAccessException e) {
        assertTrue(e.getCause() instanceof InterruptedException);
    }
}
Also used : HttpUriRequest(org.apache.http.client.methods.HttpUriRequest) CrawlingAccessException(org.codelibs.fess.crawler.exception.CrawlingAccessException)

Example 32 with CrawlingAccessException

use of org.codelibs.fess.crawler.exception.CrawlingAccessException in project fess-crawler by codelibs.

the class HcHttpClientTest method test_doGet_accessTimeoutTarget.

public void test_doGet_accessTimeoutTarget() {
    HcHttpClient client = new HcHttpClient() {

        @Override
        protected ResponseData processHttpMethod(final String url, final HttpUriRequest httpRequest) {
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                throw new CrawlingAccessException(e);
            }
            return null;
        }
    };
    client.setAccessTimeout(1);
    try {
        client.doGet("http://localhost/");
        fail();
    } catch (CrawlingAccessException e) {
        assertTrue(e.getCause() instanceof InterruptedException);
    }
}
Also used : HttpUriRequest(org.apache.http.client.methods.HttpUriRequest) CrawlingAccessException(org.codelibs.fess.crawler.exception.CrawlingAccessException)

Example 33 with CrawlingAccessException

use of org.codelibs.fess.crawler.exception.CrawlingAccessException in project fess-crawler by codelibs.

the class SitemapsHelperTest method test_parseXmlSitemaps_invalid4.

public void test_parseXmlSitemaps_invalid4() {
    final byte[] bytes = "<sitemap".getBytes();
    final InputStream in = new ByteArrayInputStream(bytes);
    try {
        sitemapsHelper.parse(in);
        fail();
    } catch (final CrawlingAccessException e) {
    // NOP
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) CrawlingAccessException(org.codelibs.fess.crawler.exception.CrawlingAccessException) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream)

Example 34 with CrawlingAccessException

use of org.codelibs.fess.crawler.exception.CrawlingAccessException in project fess-crawler by codelibs.

the class SitemapsHelperTest method test_parseXmlSitemaps_invalid2.

public void test_parseXmlSitemaps_invalid2() {
    final byte[] bytes = "test".getBytes();
    final InputStream in = new ByteArrayInputStream(bytes);
    try {
        sitemapsHelper.parse(in);
        fail();
    } catch (final CrawlingAccessException e) {
    // NOP
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) CrawlingAccessException(org.codelibs.fess.crawler.exception.CrawlingAccessException) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream)

Example 35 with CrawlingAccessException

use of org.codelibs.fess.crawler.exception.CrawlingAccessException in project fess-crawler by codelibs.

the class SitemapsHelperTest method test_parseXmlSitemaps_invalid3.

public void test_parseXmlSitemaps_invalid3() {
    final byte[] bytes = "<urlset".getBytes();
    final InputStream in = new ByteArrayInputStream(bytes);
    try {
        sitemapsHelper.parse(in);
        fail();
    } catch (final CrawlingAccessException e) {
    // NOP
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) CrawlingAccessException(org.codelibs.fess.crawler.exception.CrawlingAccessException) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream)

Aggregations

CrawlingAccessException (org.codelibs.fess.crawler.exception.CrawlingAccessException)36 CrawlerSystemException (org.codelibs.fess.crawler.exception.CrawlerSystemException)14 InputStream (java.io.InputStream)13 Map (java.util.Map)9 IOException (java.io.IOException)8 ResponseData (org.codelibs.fess.crawler.entity.ResponseData)8 BufferedInputStream (java.io.BufferedInputStream)7 HashMap (java.util.HashMap)7 HashSet (java.util.HashSet)7 ResultData (org.codelibs.fess.crawler.entity.ResultData)7 ChildUrlsException (org.codelibs.fess.crawler.exception.ChildUrlsException)7 MalformedURLException (java.net.MalformedURLException)6 AccessResultData (org.codelibs.fess.crawler.entity.AccessResultData)6 MaxLengthExceededException (org.codelibs.fess.crawler.exception.MaxLengthExceededException)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 File (java.io.File)5 LinkedHashMap (java.util.LinkedHashMap)5 FileInputStream (java.io.FileInputStream)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 Date (java.util.Date)4