Commit Graph
58 Commits
Author SHA1 Message Date
Noah Levitt 99acaa9bfa Fix tests revealed to be failing
* UriUtils.java
    isLikelyFalsePositive() - do not flag urls starting with ../ as likely false positives
* UriUtilsTest.java
    remove test url that is now rejected
2012-06-06 09:00:13 -07:00
Noah Levitt 342ea33be5 Move test classes into test area of source tree
* LongToIntConsistentHashTest.java, UriUtilsTest.java
2012-06-05 18:03:33 -07:00
Noah Levitt 3dce1e909d Change scope of most/all default-scope i.e. package-scoped class members to protected, to make heritrix more friendly to third-party extensions. (I don't think there was ever an intent to limit the scope of any of these to package-only.) 2012-06-05 17:55:41 -07:00
Kenji Nagahashi 27d621f21a renamed PublicSuffixes2 to PublicSuffixes.
deleted debug println.
2012-04-18 10:14:51 -07:00
Kenji Nagahashi a0d52e6c17 PublicSuffixes2Test still had tests for PublicSuffix. fixed. 2012-04-18 10:14:51 -07:00
Kenji Nagahashi b2d62a81ff trial rewrite of PublicSuffixes for small memory footprint (no significant performance gain) 2012-04-18 10:14:50 -07:00
nlevitt 1390024902 * BdbModuleTest.java
testDoCheckpoint() - call BdbModule.destroy() in addition to stop() to close resources
2011-09-29 21:37:34 +00:00
nlevitt f20b3eee30 Fix HER-1935 Many calls to File.mkdirs() and other file/dir methods don't check the return value. Also fix bug where pointless empty directories were created in scratch dir.
* BasicProfileTest.java, SelfTestBase.java, CrawlControllerTest.java, PrecedenceLoader.java, MigrateH1to3Tool.java, CrawlerLoggerModule.java, StatisticsTracker.java, CheckpointUtils.java, BdbUriUniqFilter.java, ARCWriterProcessorTest.java, WARCWriterProcessorTest.java, PersistProcessor.java, WriterPoolProcessor.java, PrefixFinderTest.java, StoredQueueTest.java, FileUtilsTest.java, ObjectIdentityBdbManualCacheTest.java, ObjectIdentityBdbCacheTest.java, ObjectPlusFilesOutputStream.java, TestUtils.java, TmpDirTestCase.java, Engine.java
    Replace calls to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir). In these cases the calls were either already in a spot where the possible IOException would be handled appropriately, or the line was trivially moved into such a block.
* ActionDirectory.java, Engine.java
    replace calls to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir), and throw IllegalStateException on failure
* BdbModule.java
    setup() - replace call to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir) and add "throws IOException" - conveniently the place where this method is called was already in a try block that catches IOException
* Checkpoint.java
    generateFrom() - replace call to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir) and add "throws IOException"
* CheckpointService.java
    move call to Checkpoint.generateFrom() inside existing try block since it now can throw IOException
* Recorder.java
    ensure(File) - replace call to File.mkdirs() with FileUtils.ensureWriteableDirectory(dir), and throw IllegalStateException on failure
    new Recorder(File,String,int,int) - call ensure() on the correct object, the containing directory; and remove redundant call to ensure()
2011-09-12 20:12:10 +00:00
gojomo 71ca9262df extra output to determine reason for slow test runs 2011-06-08 23:49:53 +00:00
gojomo 4ea85ac817 * commons/pom.xml
bump test heap back to -Xmx1g
* BloomFilterTest
    restore 495MB-filter test
2011-05-31 22:28:39 +00:00
gojomo e791c23751 * BloomFilterTest
temporarily disable 495MB test until build box has more RAM
2011-05-28 01:10:33 +00:00
nlevitt b064d43db5 Fix HER-1792 backslashes in urls can in some cases really mean backslashes
(specifically, when they're in the query string)
* UURIFactory.java
    fixup() - replace \ with / up to the first ? in the url, instead of
    anywhere in the url
    and update comments
* UURIFactoryTest.java
    backslash test
2011-04-19 02:11:20 +00:00
gojomo 3a53da1073 adapted tests for other changes 2011-04-06 20:52:06 +00:00
gojomo 1395854f9a [HER-1865] JDK6u23 breaks GzippedInputStream & W/ARCReaders with different GZIP handling
* OpenJDK7GZIPInputStream.java, OpenJDK7InflatedInputStream.java
    backport the working GZIP implementation from OpenJDK7, with minimal 
    renames/imports/private-to-protected changes to enable member-at-a-time reading
* GZIPMembersInputStream
    base on OpenJDK7 implementation to avoid pre- & post-6u23 codepaths, and 6u23/24 readHeader bug
    override readTrailer to set member-end; update comment to reflect end-uncertainty without EOF-per-member-mode
* GZIPMembersInputStreamTest, ARCWriterTest
    test tweaks
2011-03-30 02:42:26 +00:00
gojomo fe5363feb0 * GzipMembersInputStreamTest
test with 6 small members
2011-02-24 22:13:46 +00:00
gojomo bb07080e02 [HER-1865] JDK6u23 breaks GzippedInputStream & W/ARCReaders with different GZIP handling
* ArchiveReaderFactoryTest
    test cases for generic reader-get methods -- one of which had obsolete STREAM_ALL=-1 problem
2011-02-23 01:09:05 +00:00
gojomo a6f3b7db25 * ARCWriterTest
test inspired by Erik Hetzner's HER-1865 test code
2011-02-19 00:35:09 +00:00
gojomo 885a25c90c Robustify based on JUnit issues on Windows
* ArchiveReader
    improve warning message
* WriterPoolMember
    attempt pre-delete of target filename, warn on failure, for better odds on some filesystems
* ARCWriterTest, WARCWriterTest
    ensure timely close of readers/writers in case filenames are reused
    restore originally-intended unique target names
2011-02-17 01:21:48 +00:00
gojomo 9b78770027 [HER-1865] JDK6u23 breaks GzippedInputStream & W/ARCReaders with different GZIP handling
* GZIPMembersInputStream
    new workaround class that offers choice of pre/post JDK6u23 behavior and new accessors for finding member boundary offsets
* GZIPMembersInputStreamTest
    test for above
* ArchiveUtils, ARCWriter
    move static compress utilities to ArchiveUtils
* ArchiveReader, (W)ARCReaderFactory, (W)ARCWriterTest
    adapt to use GZIPMembersInputStream
* GzippedInputStream(Test)
    deleted
2011-02-16 01:12:25 +00:00
gojomo 0b577c1245 [HER-1860] H3: Remove dependence on GC/finalization/PhantomReference magic in used ObjectIdentityCache implementation
* IdentityCacheable
    new interface required of objects stored in ObjectIdentityCaches
* IdentityCacheableWrapper
    wrapper for storing arbitrary objects in ObjectIdentityCaches
* ObjectIdentityCache
    keys now always Strings
    values now always IdentityCacheables
    new dirtyKey() method to ensure a key is persisted
* ObjectIdentityBdbCache, ObjectIdentityMemCache
    update for new ObjectIdentityCache shape; still using legacy GC magic
* ObjectIdentityBdbManualCache
    alternate implementation relying on dirtying to ensure persistence
    use Guava library MapMaker for soft memMap; capped dirtyMap
* BdbModule
    use ObjectIdentityBdbManualCache by default
    up expectedConcurrency default to 64
* BdbModuleTest, ObjectIdentityBdbCacheTest, ObjectIdentityBdbManualCacheTest
    update, add tests
* Frontier
    FrontierGroup as IdentityCacheable
* AbstractFrontier, WorkQueueFrontier, BdbFrontier
    touchup queue/group accessors
    make queue instances dirty whenever mutated 
* WorkQueue, CrawlHost, CrawlServer
    IdentityCacheable support; appropriate makeDirty()s
* ServerCache, DefaultServerCache
    update for new ObjectIdentityCache shape
2011-01-20 23:28:38 +00:00
gojomo cd398d4c46 W/ARCWriter-related refactoring
* Arc2Warc, Warc2Arc
    adapt to new constructors, settings-object
* MiserOutputStream
    stream to monitor position, optionally suppress flushes
* WriterPoolMember
    use MiserOutputStream rather than special file-access to find compressed offsets
    use shared settings object rather than copying multiple values
* WriterPoolSettings
    add settings for frequentFlushes and writeBufferSize for IO optimization
* ARCReader, ARCWriter, ARCWriterPool
    adapt to new constructors, settings-object
* WriterPoolSettingsData
    impl of WriterPoolSettings for testing and adhoc use
* WARCWriter
    adapt to new constructors, settings-object
    remove checkSize rollover to new file (done elsewhere)
    remove extraneous id-generator code/static-method
* WARCWriterPool
    adapt to new constructors, settings-object
* WARCWriterPoolSettings, WARCWriterPoolSettingsData
    add recordIDGenerator setting, impl class for testing/adhoc use
* WARCWriterTest
    adapt to new constructors, settings-object
* Generator, GeneratorFactory
    removed in favor of RecordIDGenerator interface
* RecordIDGenerator 
    common interface for classes that can provide WARC record IDs
* UUIDGenerator, UUIDGeneratorTest
    adapt to derive from RecordIDGenerator
    avoid throwing exceptions
* ARCWriterPoolTest, ARCWriterTest
    adapt to new constructors, settings-object
* WARCWriterProcessor
    do checkSize file-rollover here, so related records don't span WARCs
    calculate processor's totalBytesWritten via position offset changes (as before stats-additions)
    delegate record-ID generation
* WriterPoolProcessor
    add frequentFlushes and writeBufferSize from new WARCWriterPoolSettings interface
2011-01-14 23:26:31 +00:00
gojomo 0627a67dce Minimize transient garbage volume by optimized serialization based on the 'Kryo' library
* AutoKryo
    extension of Kryo to allow classes to control their own registration, trigger registration of associated classes, and deserialize classes without no-arg constructors
* KryoBinding
    binding for use with BDB that uses AutoKryo serialization for a 2X-4X reduction in byte[] size
* UURI
    improved serialization via Externalizable and Kryo's CustomSerialization methods
* BdbModule
    discard deprecated CachedBDBMap option
    (getObjectCache) extend with both declaredClass and valueClass (for when map values are specializations of the declared type, as with frontier.allQueues)
    adjust type declarations
* ObjectIdentityBdbCache
    use KryoBinding rather than SerialBinding
* CachedBdbMapTest
    discarded
* BdbFrontier, BdbServerCache, StatisticsTracker
    adjust type declarations, objectCache creation
* BdbMultipleWorkQueues
    use KryoBinding rather than (Recycling)SerialBinding
* BdbWorkQueue, CrawlServer, CrawlHost, CrawlURI
    add autoregister support
* LinkContext
    public for kryo registration
2010-11-05 23:23:58 +00:00
gojomo 966646871c [HER-1727] (W)ARC filename uniqueness guarantees: adminport option, process_id option(?), JVM-global-repeat-suppression
* ArchiveUtilsTest.java
    tests for new HER-1727 guaranteed-no-repeat-timestamp functionality
2010-09-20 13:51:13 +00:00
gojomo bc698c09fc [HER-1480] URIs logged (as -6 or -7) that should never be scheduled
* LaxURI.java
    increase tolerance with regard to path-segments
* UURIFactory.java
    allow digits in scheme regex
    discard old supported-schemes code
* UURIFactoryTest.java
    tests for roundtrip serialization of problematic hostlike-scheme and bars-in-path
* CrawlerLoggerModule.java
    discard special-casing of URI scheme errors
* SchemeNotInSetDecideRule.java
    rule to apply to URIs of unknown schemes; by default REJECTs those not usually handled by Heritrix
* **/profile-crawler-beans.cxml
    add REJECT SchemeNotInSetDecideRule
2010-09-03 00:24:13 +00:00
gojomo 8d1083922d [HER-1814] remove dependency on apache commons-pool/GenericObjectPool
* .classpath, pom.xml, org/apache/commons/pool/impl/*
    remove references to and patched classes based on commons-pool
* WriterPool.java
    move instance creation/round-robin-pool/dispose into this class
    close (rather then recycle) extra writers when crawl slows (via tracking time of last need/rollover)
* WriterPoolMember.java
    add isOversize() for external check of ready-to-rollover file
    avoid rollover before every record (so that set of related WARC records aren't split between files)
* ARCWriterPool.java, WARCWriterPool.java
    remove BasePoolableObjectFactory reference, implement class-appropriate makeWriter()
* ARCWriterPoolTest.java
    adjust for new never-timeout behavior
* ARCWriterPoolProcessor.java WARCWriterPoolProcessor.java
    adjust constructor calls
* WriterPoolProcessor.java
    replace poolMaxWaitMs (which caused eventual complete timeout from waiting for writer) with maxWaitForIdleMs, a much smaller value which only controls how long a thread waits for an reusable writer before considering creating a new one. (If creation isn't allowed, threads will now wait indefinitely for a writer to become available.)
2010-08-25 23:25:26 +00:00
gojomo b388479d32 [HER-1727] (W)ARC filename uniqueness guarantees: adminport option, process_id option(?), JVM-global-repeat-suppression
* Heritrix.java
    make heritrix.hostname, heritrix.pid, heritrix.port available as global properties
* PropertyUtils.java, PropertyUtilsTest.java
    utility methods to interpolate string values from one or several supplied Properties instances
* ArchiveUtils.java
    utility methods to give timestamps guaranteed larger/different than any previously-issued timestamp

* WriterPoolSettings.java, WriterPool.java, ARCWriterPool.java, WARCWriterPool.java, ARCWriterPoolTest.java
    improve field names, change 'suffix' to more general 'template'
* WriterPoolMember.java
    replace 'suffix' with 'template' which is interpolated when specific name is needed
    set default template to pattern extremely unlikely to generate duplicate filenames
    change default prefix to 'WEB'
    centralize creation of new basenames into generateNewBasename() method, which internalizes timetamp/serialNo minting and interpolation
* WriterPoolProcessor.java, ARCWriterProcessor.java, WARCWriterProcessor.java
    serve as own WriterPoolSettings instance
    replace 'suffix' with 'template' 
    
* ARCWriter.java
    accept (but truncate) 17-digit timestamps at creation
* DefaultWriterPoolSettings.java, TimestampSerialNo.java
    delete as superfluous
2010-08-20 00:21:43 +00:00
gojomo 4c1a4f2e12 remove unneeded import 2010-06-15 21:34:57 +00:00
gojomo 3c8e72a20e * BloomFilterTest.java
disable by renaming ('xest') those tests taking >15mins each
2010-06-15 21:33:34 +00:00
gojomo 6be649b286 [HER-1783] BloomFilter64bit bit-length bug prevents full bitfield from being used; premature saturation
* BloomFilter64bit.java
    include the split-to-subarrays (for larger bitfields) and round-up-to-power-of-2 (for performance) options previously in largely-redundant classes
    fit a number of problems with int/long overflow and bitwise ops
    add methods for reporting/testing
* BloomFilter.java
    add methods for reporting/testing
* BloomFilterTest.java, BloomFilter64bitTest.java
    more extensive tests, including two lengthy tests of default/oversized blooms usually disabled by renaming
* BloomFilter32bit.java, BloomFilter32bitSplit.java, BloomFilter32bp2.java, BloomFilter32bp2Split.java
    deleted as buggy or redundant
* BenchmarkBlooms.java
    move to test source dir
* BloomUriUniqFilter.java
    change to accept filter instance (rather than parameters) for added configuration flexibility
    fix comments
* BloomUriUniqFilterTest.java
    supply filter not paramters
2010-06-15 21:30:34 +00:00
gojomo f9a3c2344c * BloomFilterTest.java
explicit deferenced bloom instance to avoid OOME
2010-06-08 03:38:56 +00:00
gojomo e9a11e56c6 HER-1783 BloomFilter64bit bit-length bug prevents full bitfield from being used; premature saturation
* BloomFilter64bit.java
    fix long arithmetic calculating bit-length m in constructor
    slight optimization of add()
* BloomFilterTest.java
    abstract superclass for bloom impl class tests
* BloomFilter64bitTest.java
    sanity check that set bits, after a handful of adds into default-sized filter, occupy top and bottom 20% of range (which would have caught this bug earlier)
2010-06-08 02:39:35 +00:00
gojomo 72fb1c55bd Move TLD list to resource file for easier drop-in updating
* ArchiveUtils.java
    read TLDs from tlds-alpha-by-domain.txt
* ArchiveUtilsTest.java
    verify TLDs read
* tlds-alpha-by-domain.txt
    from http://data.iana.org/TLD/tlds-alpha-by-domain.txt
2010-04-22 01:05:23 +00:00
gojomo 9e12e4abe5 test/deprecation cleanup
* CachedBdbMap.java
   @deprecated
* BdbModule.java
   note (unused) 'CBM' option is deprecated
* ObjectIdentityBdbCache.java
   tighten logging to FINE
* ObjectIdentityBdbCacheTest.java
   fix test that was only trying to log, rather than fail, problems
2010-04-13 02:15:53 +00:00
gojomo 1698412130 HER-1450 Reading at EOF using read(byte[]) causes position pointer to decrement.
* ARCWriterTest.java
    one more test to ensure the problem with read(void) was exercised/fixed
2010-04-09 21:25:26 +00:00
szznax cc6fb841d9 part of fix for [HER-1450] Reading at EOF using read(byte[]) causes position pointer to decrement.
* ArchiveRecord.java
    do not decrement position after EOR, port from H1
* ARCWriterTest.java
    added testArchiveRecordEORConsistent(), testArchiveRecordMarkSupport()
        port from H1
2010-04-09 18:25:16 +00:00
gojomo ed2061560e Improve Maven build robustness
* UURIFactoryTest.java
    specify stirng literal with escape-encoding, rather than as raw UTF-8
* **/pom.xml
    include 'project.build.sourceEncoding' property to suppress platform-encoding warnings
    (unfortunately, neither this nor similar 'maven.compile.encoding' property actually casues maven build to interpret Java source as UTF-8)
2009-12-02 01:34:40 +00:00
gojomo eb9bf5a8e2 BDBJE updates, refactoring
* commons/pom.xml, .classpath
    update to BDB-JE 4.0.71
* BdbModule.java
    (getStoredQueue) added
    (getStoredMap) made more general
    (openDatabase) all databases now 'managed'
* TempStoredSortedMap.java -> DisposableStoredSortedMap.java
    renamed
* StatisticsTracker.java, **Report.java
    use new name
* StoredQueue.java, StoredQueueTest.java
    move to org.archive.bdb package
* BdbMultipleWorkQueues.java, PrefixFinderTest.java
    update for BDB-JE 4 changes
* BdbFrontier.java
    use getStoredQueue 
    drop unneeded custom serialization support
* WorkQueueFrontier.java
    drop unneeded custom serialization support
2009-11-23 04:41:32 +00:00
gojomo daab317c94 [HER-1546] Springify(5): Update checkpointing to work smoothly with spring-configured crawls
processor-related bean checkpoint support:
* Checkpoint.java
    move to commons for proper dependency graph
* (others) 
    recognize above
2009-11-20 01:10:32 +00:00
gojomo 8591002573 [HER-1546] Springify(5): Update checkpointing to work smoothly with spring-configured crawls
* BdbModule.java
    implement Checkpointable; save/restore consistent sets of jdb log files
* BdbModuleTest.java
    testDoCheckpoint
2009-11-20 00:45:07 +00:00
gojomo e42e2ed7f6 Cleanup/consolidation/expansion of *Utils classes
* IoUtils.java
    remove class that confusingly-overlaps with commons IOUtils; move remaining methods to ArchiveUtils or archive's FileUtils
* ArchiveUtils.java, FileUtils.java
    receive relocated methods; eliminated deprecated or unused methods
* JSONUtils.java
    new class to collect common JSON actions
* Iteratorable.java
    wrap Iterator as Iterable for foreach usage
* (many)
    update to use alternate utils methods
2009-11-19 22:39:53 +00:00
gojomo 0497efbb32 [HER-1561] update license to Apache License 2.0
* (many)
    update license boilerplate
* (few)
    delete no-longer used classes
2009-11-10 21:03:27 +00:00
gojomo c05044d51b Eliminate double-database close log messages
* BdbModule.java
   split openDatabase() to openManagedDatabase() (auto-closed) and plain openDatabase() (caller-closes)
   set TempStoredSortedMap to use unmanaged openDatabase
* (others)
   use openManagedDatabase()
2009-10-04 05:06:14 +00:00
gojomo 1951930842 Improve test robustness in face of unpredictable GC
* ObjectIdentityBdbCache.java
   (pageOutStaleEntries) package-protection for unit-test visibility
* ObjectIdentityBdbCacheTest.java
   explicit pageOutStaleEntries, better assert-fail message
2009-09-29 20:20:14 +00:00
gojomo 5a0fe30366 Quiet JUnite test issues
* BdbModuleTest.java, CachedBdbMapTest.java
    use putIfAbsent() in preference to put() (which logs warning)
* BdbModule.java
    register big-cache DBs in implementation-specific methods, so always auto-closed on env close
2009-09-29 19:22:23 +00:00
gojomo 7521375128 [HER-1677] threads stuck in CachedBdbMap.get/_getMem
alternate simplified implementation of our object-cache need
* ObjectIdentityCache.java
    new interface, far less than (Concurrent)Map, for big seems-like-in-memory object-cache
* Supplier.java
    trivial interface for deferred-provision of new instance
* CachedBdbMap.java
    implement ObjectIdentityCache, mainly via getOrUse()
* ObjectIdentityMemCache.java
    trivial ConcurrentHashMap-based all-in-memory ObjectIdentityCache implementation
* ObjectIdentityBdbCache.java
    BDB-backed ObjectIdentityCache implementation, carved from CachedBdbMap
* BdbModule.java
    refactor utility methods to offer CachedBdbMap or ObjectIdentityBdbCache instances, via source toggle
* EnhancedEnvironment.java
    convenience test-environment method
* (others)
    update to use ObjectIdentityCache/ObjectIdentityMemCache in place of ConcurrentMap/ConcurrentHashMap
2009-09-25 21:18:14 +00:00
gojomo e7ab73dd5d [HER-1677] threads stuck in CachedBdbMap.get/_getMem
alternate simplified implementation of our object-cache need
* ObjectIdentityCache.java
    new interface, far less than (Concurrent)Map, for big seems-like-in-memory object-cache
* Supplier.java
    trivial interface for deferred-provision of new instance
* CachedBdbMap.java
    implement ObjectIdentityCache, mainly via getOrUse()
* ObjectIdentityMemCache.java
    trivial ConcurrentHashMap-based all-in-memory ObjectIdentityCache implementation
* ObjectIdentityBdbCache.java
    BDB-backed ObjectIdentityCache implementation, carved from CachedBdbMap
* BdbModule.java
    refactor utility methods to offer CachedBdbMap or ObjectIdentityBdbCache instances, via source toggle
* EnhancedEnvironment.java
    convenience test-environment method
* (others)
    update to use ObjectIdentityCache/ObjectIdentityMemCache in place of ConcurrentMap/ConcurrentHashMap
2009-09-25 21:16:53 +00:00
gojomo 8d09ee38ae CachedBdbMap cleanup 2009-08-11 02:07:22 +00:00
gojomo 0ebac2f115 * CachedBdbMapTest.java
more timing/heap voodoo for test robustness
2009-08-06 20:11:04 +00:00
gojomo 272ae19961 Cleanup
* CachedBdbMap.java
    remove debug output
* TestUtils.java
    add info logging
* CachedBdbMapTest.java
    make more robust against prior heap usage, different platforms
2009-08-04 06:55:31 +00:00
gojomo c196a1de77 [HER-1658] CachedBdbMaps not expunging as expected (especially StatisticsTracker.processedSeedsRecords)
* CachedBdbMap.java
    do expunge on put(), replace()
    add low-memory-sensitive 'canary' to force expunge even if otherwise untriggered
* CachedBdbMapTest.java
    add test of idle expunge in low-memory conditions
* CrawlURI.java
    (getURI) direct access to String URI (don't reuse toString() functionally)
* SeedRecord.java
    support for updating record with later/repeat report
* StatisticsTracker.java
    remove put()s for processedSeedRecords, hostsLastFinished
* BdbFrontier.java
    (getQueueFor) remove put, do in concurrent-compliant manner
2009-08-04 00:06:22 +00:00