Package org.archive.io.warc

Examples of org.archive.io.warc.TestWARCRecordInfo


     * uncompressed, but chunked-encoded HTTP response
     * @throws Exception
     */
    public void testPlainChunkedHttpRecord() throws Exception {
        String payload = "hogehogehogehogehoge";
        WARCRecordInfo recinfo = new TestWARCRecordInfo(
                TestWARCRecordInfo.buildHttpResponseBlock("200 OK",
                        "text/plain", payload.getBytes("UTF-8"), true));
        TestWARCReader ar = new TestWARCReader(recinfo);
        WARCRecord rec = ar.get(0);
        WarcResource res = new WarcResource(rec, ar);
View Full Code Here


     * @throws Exception
     */
    public void testCompressedHttpRecord() throws Exception {
        String payload = "hogehogehogehogehoge";
        String ctype = "text/plain";
        WARCRecordInfo recinfo = new TestWARCRecordInfo(
                TestWARCRecordInfo.buildCompressedHttpResponseBlock(ctype,
                        payload.getBytes()));
        TestWARCReader ar = new TestWARCReader(recinfo);
        WARCRecord rec = ar.get(0);
        WarcResource res = new WarcResource(rec, ar);
View Full Code Here

     * @throws Exception
     */
    public void testCompressedChunkedHttpRecord() throws Exception {
        String payload = "hogehogehogehogehoge";
        String ctype = "text/plain";
        WARCRecordInfo recinfo = new TestWARCRecordInfo(
                TestWARCRecordInfo.buildCompressedHttpResponseBlock(ctype,
                        payload.getBytes(), true));
        TestWARCReader ar = new TestWARCReader(recinfo);
        WARCRecord rec = ar.get(0);
        WarcResource res = new WarcResource(rec, ar);
View Full Code Here

                71, 73, 70, 56, 57, 97, 1, 0, 1, 0, -128, 0, 0, -64, -64, -64,
                0, 0, 0, 33, -7, 4, 1, 0, 0, 0, 0, 44, 0, 0, 0, 0,
                1, 0, 1, 0, 0, 2, 2, 68, 1, 0, 59, 13, 10, 13, 10
        };
        final String ct = "image/gif";
        WARCRecordInfo recinfo = new TestWARCRecordInfo(block);
        recinfo.setType(WARCRecordType.metadata);
        recinfo.setMimetype(ct);
        TestWARCReader ar = new TestWARCReader(recinfo);
        WARCRecord rec = ar.get(0);
        WarcResource res = new WarcResource(rec, ar);
        // must not fail
        res.parseHeaders();
View Full Code Here

     * @throws Exception
     */
    public void testResourceRecord() throws Exception {
        final String ct = "text/plain";
        final byte[] block = "blahblahblah\n".getBytes();
        WARCRecordInfo recinfo = new TestWARCRecordInfo(block);
        recinfo.setType(WARCRecordType.resource);
        recinfo.setUrl("ftp://ftp.example.com/afile.txt");
        recinfo.setMimetype(ct);
        ArchiveReader ar = new TestWARCReader(recinfo);
        WARCRecord rec = (WARCRecord)ar.get(0);
        WarcResource res = new WarcResource(rec, ar);
        res.parseHeaders();
               
View Full Code Here

     * uncompressed, but chunked-encoded HTTP response.
     * @throws Exception
     */
    public void testPlainChunkedHttpRecord() throws Exception {
        String payload = "hogehogehogehogehoge";
        WARCRecordInfo recinfo = new TestWARCRecordInfo(
                TestWARCRecordInfo.buildHttpResponseBlock("200 OK",
                        "text/plain", payload.getBytes("UTF-8"), true));
        recinfo.setMimetype("text/plain");
        TestARCReader ar = new TestARCReader(recinfo);
        ARCRecord rec = ar.get(0);
        ArcResource res = new ArcResource(rec, ar);
        res.parseHeaders();
       
View Full Code Here

     * @throws Exception
     */
    public void testCompressedHttpRecord() throws Exception {
        String payload = "hogehogehogehogehoge";
        String ctype = "text/plain";
        WARCRecordInfo recinfo = new TestWARCRecordInfo(
                TestWARCRecordInfo.buildCompressedHttpResponseBlock(ctype,
                        payload.getBytes()));
        recinfo.setMimetype(ctype);
        TestARCReader ar = new TestARCReader(recinfo);
        ARCRecord rec = ar.get(0);
        ArcResource res = new ArcResource(rec, ar);
        res.parseHeaders();
       
View Full Code Here

     * @throws Exception
     */
    public void testCompressedChunkedHttpRecord() throws Exception {
        String payload = "hogehogehogehogehoge";
        String ctype = "text/plain";
        WARCRecordInfo recinfo = new TestWARCRecordInfo(
                TestWARCRecordInfo.buildCompressedHttpResponseBlock(ctype,
                        payload.getBytes(), true));
        recinfo.setMimetype(ctype);
        TestARCReader ar = new TestARCReader(recinfo);
        ARCRecord rec = ar.get(0);
        ArcResource res = new ArcResource(rec, ar);
        res.parseHeaders();
       
View Full Code Here

            cut.setUriConverter(uc);
        }
    }
   
    public static Resource createTestHtmlResource(String uri, String timestamp, byte[] payloadBytes) throws IOException {
        TestWARCRecordInfo recinfo = TestWARCRecordInfo.createCompressedHttpResponse("text/html", payloadBytes);
        recinfo.setCreate14DigitDateFromDT14(timestamp);
        if (uri != null) recinfo.setUrl(uri);
        TestWARCReader ar = new TestWARCReader(recinfo);
        WARCRecord rec = ar.get(0);
        WarcResource resource = new WarcResource(rec, ar);
        resource.parseHeaders();
        return resource;
View Full Code Here

    public static Resource createTestHtmlResource(String timestamp, byte[] payloadBytes) throws IOException {
        // by passing null to uri, default "http://test.example.com/" will be used.
        return createTestHtmlResource(null, timestamp, payloadBytes);
    }
    public static Resource createTestRevisitResource(String timestamp, int len, boolean withHeader) throws IOException {
        TestWARCRecordInfo recinfo = TestWARCRecordInfo.createRevisitHttpResponse("text/html", len, withHeader);
        recinfo.setCreate14DigitDateFromDT14(timestamp);
        TestWARCReader ar = new TestWARCReader(recinfo);
        WARCRecord rec = ar.get(0);
        WarcResource resource = new WarcResource(rec, ar);
        resource.parseHeaders();
        return resource;
View Full Code Here

TOP

Related Classes of org.archive.io.warc.TestWARCRecordInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.