This repository has been archived by the owner on Jul 7, 2023. It is now read-only.
forked from iipc/openwayback
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request iipc#12 from ukwa/master
Check WARC/GZ via file extension
- Loading branch information
Showing
3 changed files
with
3,201 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/test/java/org/archive/io/warc/WARCReaderFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.archive.io.warc; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
|
||
import org.archive.format.warc.WARCConstants; | ||
import org.archive.format.warc.WARCConstants.WARCRecordType; | ||
import org.archive.io.ArchiveReader; | ||
import org.archive.io.ArchiveRecord; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class WARCReaderFactoryTest extends TestCase { | ||
|
||
// Test files: | ||
String[] files = new String[] { | ||
"src/test/resources/org/archive/format/gzip/IAH-urls-wget.warc.gz", | ||
"src/test/resources/org/archive/format/warc/IAH-urls-wget.warc" | ||
}; | ||
|
||
public void testGetStringInputstreamBoolean() throws IOException { | ||
// Check the test files can be opened: | ||
for( String file : files ) { | ||
FileInputStream is = new FileInputStream(file); | ||
ArchiveReader ar = WARCReaderFactory.get(file, is, true); | ||
ArchiveRecord r = ar.get(); | ||
String type = (String) r.getHeader().getHeaderValue(WARCConstants.HEADER_KEY_TYPE); | ||
// Check the first record comes out as a 'warcinfo' record. | ||
assertEquals(WARCRecordType.warcinfo.name(), type); | ||
} | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.