input
stringlengths
10
828
output
stringlengths
5
107
public void set datagram router manager lcap datagram router datagram router man datagram router manager datagram router man manager map put lockss daemon datagram router manager datagram router manager
set the datagram router manager
static public void assert equals string message map expected map actual if expected null actual null return if expected null expected equals actual return fail not equals message expected actual
asserts that two maps are equal contain the same mappings
public void set router manager lcap router router man router manager router man manager map put lockss daemon router manager router manager
set the router manager
public void set crawl manager crawl manager crawl man crawl manager crawl man manager map put lockss daemon crawl manager crawl manager
set the crawl manager
static public void assert positive int value assert positive null value
asserts that an int is positive
public void set repository manager repository manager repository man repository manager repository man manager map put lockss daemon repository manager repository manager
set the repository manager
public void set errors element elm err elm elm
set errors in oai response format
public void set node list element elm
set a node list in a particular format
public void set node manager manager node manager manager node man man node manager manager node man man manager map put lockss daemon node manager manager node man man
set the node manager manager
public void set watchdog service watchdog service wdog service this wdog service wdog service manager map put lockss daemon watchdog service wdog service
set the watchdog service
protected void set bufsize int n bufsize n
call before set up
public void set mail service mail service mail man mail service mail man manager map put lockss daemon mail service mail service
set the mail service
static public void assert negative int value assert negative null value
asserts that an int is negative
public void set alert manager alert manager alert man alert manager alert man manager map put lockss daemon alert manager alert manager
set the alert manager
public void set account manager account manager account man account manager account man manager map put lockss daemon account manager account manager
set the account manager
public mock cached url add url string url return add url url false true
same as above but with exists defaulting to false should cache to true
public mock cached url add url string url string content mock cached url cu add url url true true cu set content content return cu
set up a cached url with content
public void set random manager random manager random man random manager random man manager map put lockss daemon random manager random manager
set the random manager
public void set keystore manager lockss key store manager keystore man keystore manager keystore man manager map put lockss daemon keystore manager keystore manager
set the keystore manager
static public void assert compare is greater than comparable c1 comparable c2 assert compare is greater than null c1 c2
asserts that c1
public void set hash service hash service hash serv hash service hash serv manager map put lockss daemon hash service hash service
set the hash service
public void set sched service sched service sched serv sched service sched serv manager map put lockss daemon sched service sched service
set the sched service
public void set identity manager identity manager id man identity manager id man manager map put lockss daemon identity manager identity manager
set the identity manager
static public void assert compare is equal to comparable c1 comparable c2 assert compare is equal to null c1 c2
asserts that c1
public void set metadata manager metadata manager metadata man metadata manager metadata man manager map put lockss daemon metadata manager metadata manager
set the metadata manager
public void set plugin manager plugin manager plugin man plugin manager plugin man manager map put lockss daemon plugin manager plugin manager
set the plugin manager
public void set poll manager poll manager poll man poll manager poll man manager map put lockss daemon poll manager poll manager
set the poll manager
public void set proxy manager proxy manager proxy mgr proxy manager proxy mgr manager map put lockss daemon proxy manager proxy manager
set the proxy manager
public void set servlet manager servlet manager servlet mgr servlet manager servlet mgr manager map put lockss daemon servlet manager servlet manager
set the servlet manager
public void set true zip manager true zip manager tz mgr tzip manager tz mgr manager map put lockss daemon truezip manager tzip manager
set the true zip manager
static public void assert isomorphic collection expected collection actual assert isomorphic null expected actual
asserts that two collections are isomorphic
public void set system metrics system metrics sys metrics system metrics sys metrics manager map put lockss daemon system metrics sys metrics
set the system metrics
public void set remote api remote api sys metrics remote api sys metrics manager map put lockss daemon remote api sys metrics
set the remote api
public lockss au manager new au manager string key archival unit au manager desc desc find au manager desc key if desc null throw new lockss app exception no au manager desc for key log debug2 loading manager desc get key for au try lockss au manager mgr init au manager desc au set au manager desc au mgr return mgr catch exception e log error error starting au manager e throw new lockss app exception can t load au manager e to string
create an au manager instance mimicking what lockss daemon does
static public void assert isomorphic object expected collection actual assert isomorphic null expected actual
asserts that the array is isomorphic with the collection
public activity regulator get activity regulator archival unit au try return super get activity regulator au catch illegal argument exception e return activity regulator new au manager lockss daemon activity regulator au
return activity regulator for au
static public void assert isomorphic collection expected object actual assert isomorphic null expected actual
asserts that the collection is isomorphic with the array
public lockss repository get lockss repository archival unit au try return super get lockss repository au catch illegal argument exception e return lockss repository new au manager lockss daemon lockss repository au
return lockss repository for au
public history repository get history repository archival unit au try return super get history repository au catch illegal argument exception e return history repository new au manager lockss daemon history repository au
return history repository for au
static public void assert isomorphic iterator expected iterator actual assert isomorphic null expected actual
asserts that the collections behind the iterator are isomorphic
public void set activity regulator activity regulator act reg archival unit au set au manager activity regulator au act reg
set the activity regulator for a given au
public void set lockss repository lockss repository repo archival unit au set au manager lockss repository au repo
set the lockss repository for a given au
private void time it throws exception string buffer sb new string buffer if label null sb append label sb append sb append msg if is read io msg null sb append sb append io msg if b buffer null b buffer has array sb append sb append reporter new tree timing reporter sb to string time reporter new computation public void execute throws exception do tree walk root file
time previously setup test
public void set node manager node manager node man archival unit au set au manager node manager au node man
set the node manager for a given au
static public void assert isomorphic object expected iterator actual assert isomorphic null expected actual
asserts that the array is isomorphic with the collection behind the
public void set history repository history repository hist repo archival unit au set au manager history repository au hist repo
set the history repository for a given au
private void do hash byte b array long size for int pos 0 pos size pos integer max value int n if size pos integer max value n int size pos else n integer max value for int ix 0 ix hashes ix hashers ix update b array pos n
hash the byte array n times
public void set icp manager icp manager icp manager this icp manager icp manager manager map put lockss daemon icp manager icp manager
p forcibly sets the icp manager to a new value
private void do hash byte buffer buf long size buf rewind if buf has array do hash buf array size else int len b array length for int pos 0 pos size pos len int n if size pos len n int size pos else n len buf get b array 0 n for int ix 0 ix hashes ix hashers ix update b array 0 n
hash the byte buffer n times using its backing araay if possible else
public void close mds close
flags this as a closed socket
public void set daemon inited boolean val daemon inited val
set daemon inited
public void receive datagram packet p throws ioexception mds receive p
receive a packet that has been added to the receive queue with
public void add to receive queue datagram packet packet mds add to receive queue packet
add a packet to the receive queue to be processed by
public void regenerate is null is closed false
signals that the input stream should reset
public void test plugins throws exception string args system get property plugin name prop if string util is null string args return list string failed new array list string for string plugin name list string string util break at args try system err println testing plugin plugin name reset and test plugin name catch exception e log error plugin plugin name failed e failed add plugin name if failed is empty fail string util number of units failed size plugin failed failed
this test expects to find a semicolon separated list in the system
public void run try socket new datagram socket port inet address get by name host int length socket get receive buffer size while num packets got num packets to get packet new datagram packet new byte length length ready to receive give socket receive packet num packets got synchronized packets packets add packet got packet give socket close catch ioexception ioe ioe print stack trace
tells the object to connect and get num packets packets
public boolean did return did
return true iff action was taken
public void set thread dump thread dump true
get a thread dump before triggering the event
public void test valid au tdb au au null try au new tdb au test au test plugin catch illegal argument exception ex fail unexpected xception creating tdb au ex assert not null au assert equals test au au get name
test creating valid tdb au
public void test null title name tdb publisher publisher null try publisher new tdb publisher null fail tdb publisher did not throw illegal argument exception for null argument catch illegal argument exception ex assert null publisher
test creating tdb publisher with null name
protected void doit log debug interrupting thread interrupt
interrupt the thread
public void test is down throws tdb exception tdb au au1 new tdb au test au plugin a assert false au1 is down same as title1 tdb au au2 new tdb au test au plugin a au2 set param pub down true assert true au2 is down
test equals method
public void test get title throws tdb exception tdb title title new tdb title test title 0000 0000 tdb au au new tdb au test au plugin a title add tdb au au collection tdb au aus title get tdb aus assert equals 1 aus size assert true aus contains au get title tdb title get title au get tdb title assert same title get title
test add au method
public interrupter interrupt me in long ms interrupter i new interrupter ms thread current thread i start return i
interrupt current thread in a while
public void test get publisher throws tdb exception tdb publisher publisher new tdb publisher test publisher collection tdb title titles publisher get tdb titles assert empty titles add title tdb title title new tdb title test title 0000 0000 publisher add tdb title title add au tdb au au new tdb au test au plugin a title add tdb au au ensure same as publisher for au s title tdb publisher get publisher au get tdb publisher assert equals publisher get publisher
test get publisher method
public interrupter interrupt me in long ms boolean thread dump interrupter i new interrupter ms thread current thread if thread dump i set thread dump i start return i
interrupt current thread in a while first printing a thread dump
public void test valid title tdb title title null try title new tdb title test title 0000 0000 catch illegal argument exception ex assert not null title assert equals test title title get name
test creating valid tdb title
public sock abort abort in long in ms socket sock sock abort sa new sock abort in ms sock if boolean get boolean org lockss test thread dump sa set thread dump sa start return sa
close the socket after a timeout
public void test null title name and id tdb title title null try title new tdb title null 0000 0000 fail tdb title did not throw illegal argument exception for null title argument catch illegal argument exception ex assert null title try title new tdb title title null fail tdb title did not throw illegal argument exception for null id argument catch illegal argument exception ex assert null title
test creating tdb publisher with null name and or id
public void test get publisher throws tdb exception tdb publisher publisher new tdb publisher test publisher collection tdb title titles publisher get tdb titles assert empty titles add title tdb title title new tdb title test title 1 0000 0000 publisher add tdb title title titles publisher get tdb titles assert equals 1 titles size assert true titles contains title get publisher tdb publisher get publisher title get tdb publisher assert same publisher get publisher
test add title method
public void test get id throws tdb exception tdb publisher publisher new tdb publisher test publisher add title with id tdb title title1 new tdb title journal title 1 1234 5678 publisher add tdb title title1 ensure specified id is being returned assert equals 1234 5678 title1 get id
test the get id and equals functions
public sock abort abort in long in ms server socket sock sock abort sa new sock abort in ms sock if boolean get boolean org lockss test thread dump sa set thread dump sa start return sa
close the socket after a timeout
public void test seal tdb throws tdb exception tdb tdb new tdb assert false tdb is sealed tdb seal assert true tdb is sealed create an au tdb publisher p1 new tdb publisher p1 tdb title t1p1 new tdb title t1p1 0000 0001 p1 add tdb title t1p1 tdb au a1t1p1 new tdb au a1t1p1 a1t1p1 t1p1 add tdb au a1t1p1 try adding au to sealed tdb try tdb add tdb au a1t1p1 fail tdb did not throw tdb exception adding au to sealed tdb catch tdb exception ex assert true tdb is empty
test sealing a tdb title
public void set error if timer throws boolean flg error if timer throws flg
if flg is true exceptions thrown from timer queue callbacks will
public void test valid publisher tdb publisher publisher null try publisher new tdb publisher test publisher catch illegal argument exception ex assert equals test publisher publisher get name
test creating valid tdb publisher
public void test null publisher name tdb publisher publisher null try publisher new tdb publisher null fail tdb publisher did not throw illegal argument exception for null constructor argument catch illegal argument exception ex assert null publisher
test creating tdb publisher with null name
public void start service
start the compute service
public boolean schedule task schedulable task task throw new unsupported operation exception
attempt to add a task to the schedule
public boolean is task schedulable schedulable task task throw new unsupported operation exception
return true iff the task could be scheduled but doesnt actually
public background task schedule hint background task task throw new unsupported operation exception
find the earliest possible time a background task could be scheduled
public boolean is idle throw new unsupported operation exception
return true if the sched service has nothing to do
public void test cant read config file cf string re throws ioexception assert false cf is loaded try configuration config cf get configuration fail shouldn t have created config config catch ioexception e if re null assert matches re re cf get load error message
test that reading the config file causes the appropriate error
public void test load text throws ioexception configuration config test load text1 false assert equals foo config get prop 1 assert equals bar config get prop 2 assert equals baz config get prop 3
load a props file
public void test valid load tdb text throws ioexception configuration config test load tdb text1 false assert equals value config get org lockss prop tdb tdb config get tdb assert not null tdb assert equals 1 tdb get tdb au count
load valid tdb property file with a single entry
public void test invalid load tdb text throws ioexception configuration config test load tdb text2 false assert equals value config get org lockss prop tdb tdb config get tdb assert null tdb
load invalid tdb property file with a single entry
public void test load xml throws ioexception configuration config test load xml1 true assert equals foo config get prop 7 assert equals bar config get prop 8 assert equals baz config get prop 9
load an xml file
public void test ill xml throws ioexception test ill content bad config true saxparse exception
try to load a bogus xml file
public void test valid load tdb xml throws ioexception configuration config test load tdb xml1 true assert equals value config get org lockss prop tdb tdb config get tdb assert not null tdb assert equals 1 tdb get tdb au count
load valid tdb xml file with a single entry
public void test invalid load tdb xml throws ioexception configuration config test load tdb xml2 true assert equals value config get org lockss prop tdb tdb config get tdb assert null tdb
load invalid tdb xml file with a single entry
public void test message digest implementations are cloneable throws exception message digest md5 message digest get instance md5 message digest sha1 message digest get instance sha1 message digest sha message digest get instance sha message digest test digs md5 sha1 sha byte inits null null null capture blocks event handler block handler new capture blocks event handler mock archival unit mau setup content tree mock cached url set cus mock cached url set mau get au cached url set should not throw illegal argument exception cached url set hasher hasher new block hasher cus test digs inits block handler
ensure that message digests implementations used on the test platform
public boolean compute steps int n throws memory bound function exception step limit n if step limit 0 logger info mock memory bound function vote valid valid agreeing agreeing finished true return finished
do n steps of the underlying hash or effort proof generation
protected void set up throws exception super set up log logger get logger test memory bound function if false rand new random 100 else rand new random system current time millis if basis t null basis t new byte 16 1024 1024 rand next bytes basis t log info basis t length bytes of t created if basis a0 null basis a0 new byte 1024 rand next bytes basis a0 log info basis a0 length bytes of a0 created
set up test case by creating the basis arrays if necessary
public void tear down throws exception super tear down
tear down method for test case
public void test bad factory boolean got exception false try memory bound function factory tmp new memory bound function factory bogus null null catch no such algorithm exception ex got exception true catch exception ex fail bogus threw ex to string if got exception fail bogus didn t throw no such algorithm exception
test factory by attempting to create one for a bogus implementation
public void test bad factory boolean got exception false try memory bound function vote factory tmp new memory bound function vote factory bogus catch no such algorithm exception ex got exception true catch exception ex fail bogus threw ex to string if got exception fail bogus didn t throw no such algorithm exception
test factory by trying to create a bogus one
public void test long proof byte nonce new byte 4 rand next bytes nonce for int i 0 i factory length i try int bad new int 12 memory bound function mbf factory i make verifier nonce 7 256 2 bad 9 fail names i didn t throw exception on too long proof catch memory bound function exception ex no action intended catch exception ex fail names i threw ex to string
test that an exception is thrown if the proof is too long
public void test empty proof byte nonce new byte 4 rand next bytes nonce for int i 0 i factory length i try int bad new int 0 memory bound function mbf factory i make verifier nonce 7 256 2 bad 9 empty proofs are ok for mbf2 if names i equals mbf2 fail names i didn t throw exception on empty proof catch memory bound function exception ex if names i equals mbf2 fail names i threw ex to string catch exception ex fail names i threw ex to string
test that an exception is thrown for an empty proof unless the
public void test good proof and nonce throws ioexception for int i 0 i names length i one pair i 63 2048 2 true true
test one generate verify pair with a good proof and nonce
public void test agreeing vote for int j 0 j mbfvfactory length j for int i 0 i mbffactory length i agreeing vote i j
test an agreeing vote for each combination of mbf vote and mbf
public void test bad proof good nonce throws ioexception for int i 0 i names length i one pair i 511 128 2 true false
test one generate verify pair with a bad proof and good nonce