input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
public void test disagreeing vote for int j 0 j mbfvfactory length j for int i 0 i mbffactory length i disagreeing vote i j
|
test a disagreeing vote for each combination of mbf vote and mbf
|
public void test good proof bad nonce throws ioexception for int i 0 i names length i one pair i 511 128 2 false true
|
test one generate verify pair with a good proof and a bad nonce
|
public void test bad proof bad nonce throws ioexception for int i 0 i names length i one pair i 511 128 2 false false
|
test one generate verify pair with a bad proof and a bad nonce
|
public void test invalid nonce for int j 0 j mbfvfactory length j for int i 0 i mbffactory length i invalid nonce i j
|
test verifying a vote with a nonce different from the one
|
public article iterator factory get article iterator factory return article iterator factory
|
returns the article iterator factory for the mime type if any
|
public string get default article mime type return default article mime type
|
returns the default mime type of articles in this au
|
public void test accessors assert equals oai crawler get type string assert equals crawler type oai crawler get type assert true crawler is whole au
|
testing the simple accessor methods
|
public void test get permission map default throws malformed urlexception set cached urls cus get cached urls assert same elements list util list cached urls permission map p map crawler get permission map assert null p map
|
dont generate a permission map by default
|
public void set times to throw int times to throw this times to throw times to throw
|
set the number of times fetch from cache and or fetch from publisher
|
public void test set watch dog lockss watchdog wdog new mock lockss watchdog testable base crawler crawler new testable base crawler mau spec aus crawler set watchdog wdog assert same wdog crawler wdog
|
subclasses rely on set watchdog wdog assigning this value to the instance
|
protected ext map bean make sample ext map bean throws exception return new ext map bean make sample typed entry map m map
|
p builds a sample
|
protected void set urls to follow list urls urls to follow new list ordered set urls to follow add all urls
|
set urls to follow set the urls set that will return when calling
|
public void test load resource in jar throws exception attempt to load the file as a resource input stream is loader get resource as stream test txt assert not null is reader in new input stream reader is string writer out new string writer stream util copy in out string file contents out to string assert equals foo bar baz quux file contents
|
not much of a test honestly simply verify that the classloader
|
public void test load class not in jar throws exception class c loader load class java lang string assert not null c object o c new instance assert true o instanceof java lang string
|
test to be sure that the classloader will delegate up the
|
public conn abort abort in long in ms lockss url connection conn conn abort sa new conn abort in ms conn if boolean get boolean org lockss test thread dump sa set thread dump sa start return sa
|
abort the connection after a timeout
|
public void test get publisher from article url sub tree article iterator spec spec new sub tree article iterator spec set root http www title3 org sub tree article iterator it new sub tree article iterator sau3 spec while it has next article files af it next if af null string art url af get full text url if art url null string publisher name sql stored procedures get publisher from article url art url assert equals publisher 10 0135 12345678 publisher name return fail no publisher name
|
test getting the publisher from an article url
|
public void test get publisher from au id string au id sau3 get au id string plugin id plugin manager plugin id from au id au id string au key plugin manager au key from au id au id string publisher name sql stored procedures get publisher from au id plugin id au key assert equals publisher 10 0135 12345678 publisher name publisher name sql stored procedures get publisher from au id assert null publisher name
|
test getting the publisher from an au id
|
public void test get title from article url sub tree article iterator spec spec new sub tree article iterator spec set root http www title3 org sub tree article iterator it new sub tree article iterator sau3 spec while it has next article files af it next if af null string art url af get full text url if art url null string title name sql stored procedures get title from article url art url assert equals journal 10 0135 12345678 title name return fail no publisher name
|
test getting the journal title from an article url
|
public void test get volume title from article url sub tree article iterator spec spec new sub tree article iterator spec set root http www title3 org sub tree article iterator it new sub tree article iterator sau3 spec while it has next article files af it next if af null string art url af get full text url if art url null string title name sql stored procedures get volume title from article url art url assert equals title 10 0135 12345678 title name return fail no publisher name
|
test getting the volume title from an article url
|
public void test get title from au id string au id sau3 get au id string plugin id plugin manager plugin id from au id au id string au key plugin manager au key from au id au id string publisher name sql stored procedures get title from au id plugin id au key assert equals journal 10 0135 12345678 publisher name publisher name sql stored procedures get title from au id assert null publisher name
|
test getting the journal title from an au id
|
public void test get volume title from au id string au id sau3 get au id string plugin id plugin manager plugin id from au id au id string au key plugin manager au key from au id au id string volume title sql stored procedures get volume title from au id plugin id au key assert equals title 10 0135 12345678 volume title volume title sql stored procedures get volume title from au id assert null volume title
|
test getting the volume title from an au id
|
public void test get ingest date from article url sub tree article iterator spec spec new sub tree article iterator spec set root http www title3 org sub tree article iterator it new sub tree article iterator sau3 spec while it has next article files af it next if af null string art url af get full text url if art url null string ingest year sql stored procedures get ingest year from article url art url if ingest year null assert equals new date get year ingest year return fail no ingest year
|
test getting the ingest date from an article url
|
public void test get ingest year from article url sub tree article iterator spec spec new sub tree article iterator spec set root http www title3 org sub tree article iterator it new sub tree article iterator sau3 spec while it has next article files af it next if af null string art url af get full text url if art url null string au year sql stored procedures get ingest year from article url art url if au year null assert equals new date get year au year return fail no au year
|
test getting the au date from an article url
|
private putter put in long ms priority queue queue object obj putter p new putter ms queue obj p start return p
|
put something onto a queue in a while
|
public void test below threshold throws ioexception deferred temp file output stream dfos new my deferred temp file output stream test bytes length 42 dfos write test bytes 0 test bytes length dfos close assert true dfos is in memory assert equals test bytes dfos get data ensure this is harmless dfos delete temp file
|
tests the case where the amount of data falls below the threshold and
|
public void test above threshold throws ioexception deferred temp file output stream dfos new my deferred temp file output stream test bytes length 5 dfos write test bytes 0 test bytes length dfos close file test file dfos get file assert false dfos is in memory assert null dfos get data verify result file test file assert matches re deferred temp file test file get name
|
tests the case where the amount of data exceeds the threshold and is
|
public void test threshold reached throws ioexception deferred temp file output stream dfos new my deferred temp file output stream test bytes length 2 int chunk size test bytes length 3 try dfos write test bytes 0 chunk size dfos write test bytes chunk size chunk size dfos write test bytes chunk size 2 test bytes length chunk size 2 dfos close catch ioexception e fail unexpected ioexception assert false dfos is in memory assert null dfos get data file test file dfos get file verify result file test file
|
tests the case where there are multiple writes beyond the threshold to
|
private void verify result file file test file throws ioexception assert true test file exists file input stream fis new file input stream test file assert true fis available test bytes length byte result bytes new byte test bytes length assert true fis read result bytes test bytes length assert equals test bytes result bytes assert true fis read result bytes 1 try fis close catch ioexception e ignore an exception on close
|
verifies that the specified file contains the same data as the original
|
public void test tampered jar throws exception mock cached url tampered cu new mock cached url http foo com tampered jar tampered jar true jar validator validator new jar validator m pub keystore get temp dir file f null try f validator get blessed jar tampered cu catch jar validator jar validation exception ignore expected assert null f
|
ensure that a tampered jar will not load
|
public void test no manifest jar throws exception mock cached url no manifest cu new mock cached url http foo com nomanifest jar no manifest jar true jar validator validator new jar validator m pub keystore get temp dir file f null try f validator get blessed jar no manifest cu catch jar validator jar validation exception ignore expected assert null f
|
ensure that a jar with no manifest will not load
|
private putter put in long ms fifo queue queue object obj putter p new putter ms queue obj p start return p
|
put something onto a queue in a while
|
private giver give in long ms binary semaphore sem giver g new giver ms sem g start return g
|
give the smeaphore in a while
|
private expirer expire in long ms deadline timer expirer e new expirer ms timer e start return e
|
expire the timer in a while
|
private void parse xml properties throws exception string file configtest xml url url get class get resource file assert not null file missing url input stream istr url util open input stream url to string property tree props new property tree m xml property loader load properties props istr m props props
|
parse the xml test configuration and set m props
|
public void test unknown xml tag throws exception property tree props new property tree string buffer sb new string buffer sb append lockss config n sb append some unknown tag name foo value bar n sb append lockss config n input stream istr new reader input stream new string reader sb to string try m xml property loader load properties props istr fail should have thrown catch throwable t
|
test known bad xml
|
public void test get throws exception assert equals foo m props get a
|
test basic non nested property getting from the static config
|
public void test nested get throws exception assert equals foo m props get b c
|
test a nested property
|
public void test value tag throws exception assert equals bar m props get d
|
test value tag not in a list
|
public void test output format throws exception object serializer serializers get object serializers ext map bean for int serializer 0 serializer serializers length serializer object serializer deserializer null switch cxserializer serializers serializer get compatibility mode case cxserializer castor mode deserializer new castor serializer externalizable map mapping file name ext map bean class break case cxserializer xstream mode case cxserializer xstream overwrite mode deserializer new xstream serializer break default shouldn t happen fail unexpected compatibility mode serializer perform round trip serializers serializer deserializer
|
p checks that the serializer writes output in a format that is
|
public void test read castor input throws exception object serializer deserializers get object serializers ext map bean for int deserializer 0 deserializer deserializers length deserializer castor serializer serializer new castor serializer externalizable map mapping file name ext map bean class perform round trip serializer deserializers deserializer
|
p checks that the deserializer can read input in castor
|
public void test read xstream input throws exception object serializer deserializers get object serializers ext map bean for int deserializer 0 deserializer deserializers length deserializer xstream serializer serializer new xstream serializer perform round trip serializer deserializers deserializer
|
p checks that the deserializer can read input in xstream
|
public void test null value throws exception assert null m props get this prop does not exist
|
test a non existent property
|
public void test get list throws exception string s m props get property org lockss d assert not null s vector string v string util break at s 1 true true collections sort v assert equals 1 string v get 0 assert equals 2 string v get 1 assert equals 3 string v get 2 assert equals 4 string v get 3 assert equals 5 string v get 4
|
test getting a list out of the config
|
public boolean is unlimited return interval 0
|
return true iff the rate limiter imposes no limit
|
public void set rate string new rate this rate new rate
|
change the rate
|
public void set rate string new rate string dfault this rate new rate
|
change the rate
|
public void test null hostname throws exception set versions null null null null parse xml properties assert null m props get org lockss test s assert null m props get org lockss test t assert null m props get org lockss nulltest a assert equals bar m props get org lockss nulltest b
|
if any of the internal system values daemon version platform
|
private void set default versions mock xml property loader m xml property loader set versions 1 2 8 open bsd cd 135 testhost beta
|
set default values for testing conditionals
|
public void test empty file returns no links throws exception
|
this is an error for dublin core supress this test
|
public void test one url throws exception try if is skip network tests return set urls set util set http www foo com blah jpg assert equals urls extract urls construct valid rdf urls catch throwable ex fail ex
|
test that a single links is found
|
public void test multiple urls throws exception if is skip network tests return set urls set util set http www foo com blah jpg http www foo com blatch jpg http www foo com burble jpg assert equals urls extract urls construct valid rdf urls
|
test that multiple links are found
|
public void test no urls throws exception if is skip network tests return assert empty extract urls construct valid rdf collections empty set
|
ensure that a dublin core rdf file with no links will not
|
public void test no identifiers means no links throws exception if is skip network tests return set urls set util set http www foo com blah jpg http www foo com blatch jpg http www foo com burble jpg assert empty extract urls construct rdfwithout identifiers urls
|
the parser looks for dc identifier dc identifier tags in the
|
protected string get db root directory return temp dir path
|
get the db root directory for testing
|
protected void notify start reindexing au archival unit au log debug start reindexing au au
|
notify listeners that an au is being reindexed
|
protected void notify finish reindexing au archival unit au reindexing status status log debug finished reindexing au status au if status reindexing status rescheduled synchronized aus reindexed aus reindexed add au get au id aus reindexed notify all
|
notify listeners that an au is finshed being reindexed
|
private int wait for reindexing int au count long max wait time long start time system current time millis synchronized aus reindexed while system current time millis start time max wait time aus reindexed size au count try aus reindexed wait max wait time catch interrupted exception ex return aus reindexed size
|
waits a specified period for a specified number of aus to finish
|
public void test post unnarshal resolve throws exception xstream serializer serializer new xstream serializer for int ix 0 ix config param descr default descr array length ix file file file create temp file testfile xml file delete on exit serializer serialize file config param descr default descr array ix assert same config param descr default descr array ix serializer deserialize file
|
p tests that
|
protected void notify deleted au string au id int article count synchronized articles deleted articles deleted 0 article count articles deleted notify all
|
notify listeners that an au has been deleted
|
protected void notify start reindexing au archival unit au log info start reindexing au au
|
notify listeners that an au is being reindexed
|
protected void notify finish reindexing au archival unit au reindexing status status log info finished reindexing au status au if status reindexing status rescheduled synchronized aus reindexed aus reindexed add au get au id aus reindexed notify all
|
notify listeners that an au is finshed being reindexed
|
private int wait for deleted int au count long max wait time long start time system current time millis synchronized articles deleted while system current time millis start time max wait time articles deleted 0 au count try articles deleted wait max wait time catch interrupted exception ex return articles deleted 0
|
waits a specified period for a specified number of aus to finish
|
public void test get checkers has proper checkers list checkers new clockss permission get checkers assert equals expected three permission checkers 3 checkers size assert true first checker wasn t a string permission checker checkers get 0 instanceof string permission checker assert true second checker wasn t a creative commons permission checker checkers get 1 instanceof creative commons permission checker assert true third checker wasn t a creative commons v3 permission checker checkers get 2 instanceof creative commons v3 permission checker
|
to catch changes to the permission checker list
|
public void test get no au peer set dated peer id set dpis1 dated peer id set dpis2 dpis1 repository get no au peer set assert not null dpis1 dpis2 repository get no au peer set assert not null dpis2 assert same dpis1 dpis2
|
make sure that we have one and only one dated peer id set
|
public list get local au config descrs return list util list pd non def base url pd root pd depth pd branch pd num files pd bin file size pd bin random seed pd maxfile name pd file types pd odd branch content pd bad file loc pd bad file num
|
return the set of configuration properties required to configure
|
public void set fill out filenames fully boolean fill out fill out filenames fill out
|
determine whether or not to expand all file names to maximum length
|
public void set odd branches have content boolean have content odd branches have content have content
|
sets whether or not all the odd branches should have content
|
public boolean odd branches have content return odd branches have content
|
whether or not all the odd branches have content
|
public void set abnormal file string branch str int file num abnormal branch str branch str abnormal file num file num is abnormal file true
|
sets the parameters to create an abnormal file
|
public boolean is content tree file tree root new file content root return tree root exists tree root is directory
|
tests whether the root of the generated tree exists
|
public void delete content tree logger debug deleting content root file util del tree new file content root
|
deletes the generated content tree
|
public void test make permission checkers setup au def map put string definable archival unit key au permission checker factory org lockss plugin definable test definable archival unit my permission checker factory permission checker permission checker cau make permission checker assert true permission checker instanceof mock permission checker
|
verify that the permission checker returned by make permission checker
|
public string get url from loc string file loc string file num string tokenizer tok new string tokenizer file loc string path while tok has more tokens int loc integer parse int tok next token path get directory name loc path get file name integer parse int file num get file types return path
|
converts a specification to a url
|
public void set root dir string root dir file root root dir
|
set the directory where simulated content is generated
|
public string get root dir return file root
|
returns the directory where simulated content is generated
|
public void generate content tree if scgen null scgen get content generator if scgen null log error scgen null in generate content tree return if scgen is content tree sim root scgen generate content tree
|
generate content tree generates the simulated content
|
public boolean has content tree return scgen null scgen is content tree
|
return true if the simulated content has been generated
|
public void reset content tree clears and restores content tree to starting state if scgen null scgen get content generator if scgen is content tree scgen delete content tree sim root scgen generate content tree
|
reset content tree deletes and regenerates the simulated content
|
public void delete content tree if scgen null scgen get content generator scgen delete content tree
|
delete content tree deletes the simulated content
|
public string map url to content file name string url string base str string util replace string url base url no slash simulated content generator root name return file util sys dep path base str
|
map url to content file name
|
public string map content file name to url string filename string base str string util replace string filename sim root base url no slash return file util sys indep path base str
|
map a content file location to its url
|
public void test load loadable plugin prefer loadable throws exception test load loadable plugin true
|
load a loadable plugin preferring the loadable version
|
public rate limiter find fetch rate limiter return rate limiter unlimited
|
no longer effective
|
public void test load loadable plugin prefer lib jar throws exception test load loadable plugin false
|
load a loadable plugin preferring the library jar version
|
public object get param value string param key return m map get param key
|
get param value
|
public void test single char read over buffer throws ioexception string config org lockss filter buffer capacity 5 configuration util set current config from string config 5 chars between the start and end tags string content this is test content string expected content this content assert filter string expected content content new html tag filter tag pair
|
to catch an old error case involving single char reads when the string
|
public void message logged build event event string flg system getenv show sun api warnings if flg null flg length 0 if skip lines 0 skip lines return if pat matcher event get message matches if matches skip this and the nect two lines the code and the caret skip lines 2 return super message logged event
|
logs a message for a target if it is of an appropriate
|
public void set parameters parameter parameters super set parameters parameters if parameters null for int i 0 i parameters length i string paramname parameters i get name if class key equals ignore case paramname set class parameters i get value else set error invalid parameter paramname
|
when using this as a custom selector this method will be called
|
public void verify settings if class name null set error the class attribute is required if class to test null try class to test class for name class name catch class not found exception e set error class not found class name
|
checks to make sure all settings are kosher
|
private class class from filename string filename int dot filename last index of string noext dot 0 filename filename substring 0 dot string name noext replace file separator char class c null try c class for name name catch class not found exception e set error class not found for file filename return c
|
transoform a filename into a class name and attempt to load the class
|
private void put metadata in article metadata am for int i 0 i article tags size i am put metadata fields i article values i system out println article values i
|
stores the gathered metadata field values in the article metadata
|
protected void add eissn string line article metadata ret string issn flag issn b int issn begin string util index of ignore case line issn flag if issn begin 0 log debug line no issn flag return issn begin issn flag length string issn line substring issn begin issn begin 9 if issn length 9 log debug line too short return ret put metadata field field eissn issn
|
extract the issn from a line of html source code
|
protected string extract string str int dot str index of if dot 0 return str if str length dot 1 character is digit str char at dot 1 int dot2 str index of dot 1 return dot2 0 str str substring 0 dot2 return str substring 0 dot
|
p extracts a volume issue page or figure component from
|
protected void add issn string line article metadata ret string issn flag issn int issn begin string util index of ignore case line issn flag if issn begin 0 log debug line no issn flag return issn begin issn flag length string issn line substring issn begin issn begin 9 if issn length 9 log debug line too short return ret put metadata field field issn issn
|
extract the issn from a line of html source code
|
public void test crawl window none throws exception properties props new properties props put base archival unit param use crawl window false configuration util set current config from props props definable archival unit au make au new url http shadow1 stanford edu 42 crawl window window au get crawl spec get crawl window assert null window
|
real tests in test highwire archival unit
|
public plugin get plugin for string plugin id plugin plugin null string plugin key plugin manager plugin key from name plugin id if plugin mgr ensure plugin loaded plugin key plugin plugin mgr get plugin plugin key return plugin
|
return the plugin for this instance for the specified plugin manager
|
public void print tdb au diffs print stream ps tdb au tdb au1 tdb au tdb au2 ps print tdb au diffs tdb au1 tdb au2
|
print the parameter differences between two aus
|
static public void usage string message system err println message usage
|
show usage message
|
static public void usage system err println usage tdbdiff show all show fields exclude fields field1 field n config file1 file n config file1 file n
|
show usage message
|
public string get value field f string values try return field positions contains key f values field positions get f null string s values kbart field positions get f return empty string if the string is empty or null return string util is null string s s catch exception e return
|
get the value of the field from the array using the mapping
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.