input
stringlengths
10
828
output
stringlengths
5
107
public void test get length from buffer throws exception test get something from buffer test get length from buffer new get something tester public void do assert icp message actual byte buffer in assert equals actual get length icp util get length from buffer in
p tests the
public icp message make miss no fetch throws icp exception throw unsupported
p throws an
public void test get opcode from buffer throws exception test get something from buffer test get opcode from buffer new get something tester public void do assert icp message actual byte buffer in assert equals actual get opcode icp util get opcode from buffer in
p tests the
public icp message make miss no fetch short src rtt response throws icp exception throw unsupported
p throws an
public void test get option data from buffer throws exception test get something from buffer test get option data from buffer new get something tester public void do assert icp message actual byte buffer in assert equals actual get option data icp util get option data from buffer in
p tests the
public void test get options from buffer throws exception test get something from buffer test get options from buffer new get something tester public void do assert icp message actual byte buffer in assert equals actual get options icp util get options from buffer in
p tests the
public datagram packet to datagram packet ipaddr recipient int port throw unsupported
p throws an
public void test get payload object length from buffer throws exception test get something from buffer test get payload object length from buffer new get something tester public void do assert icp message actual byte buffer in if actual get opcode icp message icp op hit obj assert equals actual get payload object length icp util get payload object length from buffer in actual get payload url else skip
p tests the
public void test get payload url from buffer throws exception test get something from buffer test get payload url from buffer new get something tester public void do assert icp message actual byte buffer in assert equals actual get payload url icp util get payload url from buffer in actual is query
p tests the
public void test get requester from buffer throws exception test get something from buffer test get requester from buffer new get something tester public void do assert icp message actual byte buffer in if actual is query assert equals actual get requester get address icp util get requester from buffer in get address else skip
p tests the
public void test get request number from buffer throws exception test get something from buffer test get request number from buffer new get something tester public void do assert icp message actual byte buffer in assert equals actual get request number icp util get request number from buffer in
p tests the
public void test get sender from buffer throws exception test get something from buffer test get sender from buffer new get something tester public void do assert icp message actual byte buffer in assert equals actual get sender icp util get sender from buffer in
p tests the
public void test get version from buffer throws exception test get something from buffer test get version from buffer new get something tester public void do assert icp message actual byte buffer in assert equals actual get version icp util get version from buffer in
p tests the
public void test valid opcodes careful not to run into an infinite overflow loop for byte op byte min value op byte max value op doesn t work and for byte op byte min value op byte max value op requires an extra test for byte max value byte op byte min value do assert equals 1 op op 4 query hit miss err 10 op op 11 secho decho 21 op op 23 miss nofetch denied hit obj icp util is valid opcode op op while op byte min value
p tests the
public inet address get inet address return internal inet addr
returns a dummy local ip address of the form 127
public inet address get local address return internal inet addr
returns a dummy local ip address of the form 127
public socket address get remote socket address if is connected return null return new internal socket address get port
returns server endpoint information as
synchronized public boolean take while state try this wait catch interrupted exception e if state break else return false state false return true
wait until the semaphore is full
synchronized public boolean take long timeout long exp ms system current time millis timeout while state long now ms system current time millis if now ms exp ms break try this wait exp ms now ms catch interrupted exception e break if state state false return true else return false
wait until the semaphore is full or the timeout elapses
private putter put in long ms simple queue fifo queue object obj putter p new putter ms queue obj p start return p
put something onto a queue in a while
public void handle message logger log int msg level string message string buffer sb new string buffer sb append logger name of msg level sb append sb append message string str sb to string messages add str
adds the message and severity to a vector so they can be retrieved
public string get poll key return m poll key
return the unique key for the poll for this tally
public boolean is my poll return m is my poll
returns true if the poll belongs to this identity
public cached url set get cached url set return m cus
the cached url set for this poll
public archival unit get archival unit return m au
the archival unit for this poll
public string to string string buffer sb new string buffer sb append string input stream sb append the string sb append return sb to string
returns the string the stream represents
public int get type return m polltype
returns poll type constant one of poll
public void set start time long start time m start time start time
set the poll start time
public boolean is my poll return m is mine
returns true if the poll belongs to this identity
public void set is my poll boolean is mine m is mine is mine
set to true if we started this poll false otherwise
public void set poll spec poll spec pollspec m pollspec pollspec
set the poll spec used to define the poll
public cached url set get cached url set return m pollspec get cached url set
return the cached url set
public iterator get correct entries return m voted entries null collection util empty iterator m voted entries iterator
return an interator for the set of entries tallied during the vote
public void set version int version m version version
set the poll protocol version
public iterator get local entries return m local entries null collection util empty iterator m local entries iterator
return an interator for the set of entries we have locally
public void set message lcap message msg m msg msg
set the message which triggered this poll
public int get err return m error
get the error state for this poll
public void set deadline deadline deadline m deadline deadline
set the deadline by which the poll must complete
public string get err string string err string null return err string
get the error as a string
public int get tally result return m result
get the current value of the poll tally status
public void set vote tally poll tally tally m tally tally
set the vote tally for this poll
public void init plugin lockss daemon daemon super init plugin daemon init ctr
called after plugin is loaded to give the plugin time to perform any
public void stop plugin stop ctr
called when the application is stopping to allow the plugin to perform
public byte get updated byte if input list size 0 return 1 byte ret byte input list remove 0 return ret byte value
method to retrieve bytes fed in by code update code
public int get updated bytes byte output int length math min input list size output length for int i 0 i length i output i get updated byte return length
method to retrieve bytes fed in by code update code
public int get num remaining bytes return input list size
return the number of bytes we have left
public object clone mock message digest ret val new mock message digest ret val input list vector input list clone return ret val
block hasher requires cloneable message digests
public list get supported titles return list util list mock supported title
return the list of names of the archival units and volranges supported by
public list get local au config descrs return au config descrs
return the set of configuration properties required to configure
public boolean is skip network tests return boolean get boolean org lockss test skip network tests
return true if should skip tests that rely on a working network
public file get temp dir throws ioexception file res get temp dir locksstest to aid in finding the cause of temp dirs that don t get deleted setting dorg lockss test id temp dirs true will record the name of the test creating the dir in dir locksstestcase this may cause tests to fail expecting empty dir if is keep temp files boolean get boolean org lockss test id temp dirs file test util write file new file res test id file name string util short name this get class return res
create and return the name of a temp dir
public watchdog service get watchdog service if wdog service null wdog service watchdog service new manager lockss daemon watchdog service manager map put lockss daemon watchdog service wdog service return wdog service
return the watchdog service instance
public mail service get mail service if mail service null mail service new null mail service manager map put lockss daemon mail service mail service return mail service
return the mail manager instance
public file get temp dir string prefix throws ioexception file tmpdir file util create temp dir prefix null if tmpdir null if tmp dirs null tmp dirs new linked list tmp dirs add tmpdir return tmpdir
create and return the name of a temp dir
public resource manager get resource manager if resource manager null resource manager resource manager new manager resource manager manager map put resource manager resource manager return resource manager
return the resource manager instance
public alert manager get alert manager if alert manager null alert manager new null alert manager manager map put lockss daemon alert manager alert manager return alert manager
return the alert manager instance
public mock lockss daemon get mock lockss daemon return mock daemon
return the mock lockss daemon instance for this testcase
public account manager get account manager if account manager null account manager account manager new manager account manager manager map put lockss daemon account manager account manager return account manager
return the account manager instance
protected article metadata extract from string content try list article metadata lst extractor extract get target cu add version content return lst get 0 catch exception e fail extract threw e return null impossible
extract metadata from the string and return it
protected article metadata extract from resource string resname string content try content resource content resname catch ioexception e throw new runtime exception couldn t read file e return extract from content
extract metadata from the named resource e
public random manager get random manager if random manager null random manager random manager new manager random manager manager map put lockss daemon random manager random manager return random manager
return the random manager instance
public string to string string buffer sb new string buffer sb append gzipped input stream sb append return sb to string
returns the string the stream represents
protected void set up throws exception timer queue set singleton new error recording timer queue java io tmpdir system get property java io tmpdir config manager make config manager logger reset logs mock daemon new mock lockss daemon super set up disable thread watchdog
create a fresh config manager mock lockss daemon
public lockss key store manager get keystore manager if keystore manager null keystore manager lockss key store manager new manager keystore manager manager map put lockss daemon keystore manager keystore manager return keystore manager
return the keystore manager instance
public void close this is closed true
flags this as a closed socket
public hash service get hash service if hash service null hash service hash service new manager lockss daemon hash service manager map put lockss daemon hash service hash service return hash service
return the hash service instance
public sched service get sched service if sched service null sched service sched service new manager lockss daemon sched service manager map put lockss daemon sched service sched service return sched service
return the sched service instance
public system metrics get system metrics if system metrics null system metrics system metrics new manager lockss daemon system metrics manager map put lockss daemon system metrics system metrics return system metrics
return the system metrics instance
public void add to receive queue datagram packet packet receive queue put packet
add a packet to the receive queue to be processed by
public poll manager get poll manager if poll manager null poll manager poll manager new manager lockss daemon poll manager manager map put lockss daemon poll manager poll manager return poll manager
return the poll manager instance
public psm manager get psm manager if psm manager null psm manager psm manager new manager lockss daemon psm manager manager map put lockss daemon psm manager psm manager return psm manager
return the psm manager instance
public lcap datagram comm get datagram comm manager if comm manager null comm manager lcap datagram comm new manager lockss daemon datagram comm manager manager map put lockss daemon datagram comm manager comm manager return comm manager
return the datagram communication manager instance
public void assert substance url string url archival unit au substance checker checker new substance checker au assert true not a substance url url checker is substance url url
assert that the url matches a substance pattern
public void assert non substance string url archival unit au substance checker checker new substance checker au assert true not a non substance url url checker is non substance url url
assert that the url does not match a substance pattern
public lcap stream comm get stream comm manager if scomm manager null scomm manager lcap stream comm new manager lockss daemon stream comm manager manager map put lockss daemon stream comm manager scomm manager return scomm manager
return the stream communication manager instance
public void assert not substance url string url archival unit au substance checker checker new substance checker au assert false is a substance url url checker is substance url url
assert that the url matches a non substance pattern
public void assert not non substance string url archival unit au substance checker checker new substance checker au assert false is a non substance url url checker is non substance url url
assert that the url does not match a non substance pattern
public lcap datagram router get datagram router manager if datagram router manager null datagram router manager lcap datagram router new manager lockss daemon datagram router manager manager map put lockss daemon datagram router manager datagram router manager return datagram router manager
return the datagram router manager instance
public lcap router get router manager if router manager null router manager lcap router new manager lockss daemon router manager manager map put lockss daemon router manager router manager return router manager
return the router manager instance
public proxy manager get proxy manager if proxy manager null proxy manager proxy manager new manager lockss daemon proxy manager manager map put lockss daemon proxy manager proxy manager return proxy manager
return the proxy manager instance
public servlet manager get servlet manager if servlet manager null servlet manager servlet manager new manager lockss daemon servlet manager manager map put lockss daemon servlet manager servlet manager return servlet manager
return the servlet manager instance
public true zip manager get true zip manager if tzip manager null tzip manager true zip manager new manager lockss daemon truezip manager manager map put lockss daemon truezip manager tzip manager return tzip manager
return the true zip manager instance
public crawl manager get crawl manager if crawl manager null crawl manager crawl manager new manager lockss daemon crawl manager manager map put lockss daemon crawl manager crawl manager return crawl manager
return the crawl manager instance
public node manager manager get node manager manager if node manager manager null node manager manager node manager manager new manager lockss daemon node manager manager manager map put lockss daemon node manager manager node manager manager return node manager manager
return the node manager status instance
public void set permission map source permission map source pm source this permission map source pm source
set permission map
protected void assert success rate double rate int max repetitions if success max failures 0 success rate rate success max repetitions max repetitions success max failures max repetitions int rate max repetitions
causes the current test case to be repeated if it fails ultimately
public repository manager get repository manager if repository manager null repository manager repository manager new manager lockss daemon repository manager manager map put lockss daemon repository manager repository manager return repository manager
return the repository manager instance
private giver give in long ms simple binary semaphore sem giver g new giver ms sem g start return g
give the smeaphore in a while
public plugin manager get plugin manager if plugin manager null plugin manager plugin manager new manager lockss daemon plugin manager manager map put lockss daemon plugin manager plugin manager return plugin manager
return the plugin manager instance
public void run bare throws throwable int rpt 0 int failures 0 success rate set up try while true try log the name of the test case test foo method log debug testcase get name super run bare catch throwable e if failures success max failures rpt throw e if rpt success max repetitions break if double rpt failures double rpt success rate break finally if success max failures 0 failures 0 system err println get name failed failures of rpt tries failures success max failures not achieving a success rate success rate success rate tear down
runs the bare test sequence repeating if necessary to achieve the
public metadata manager get metadata manager if metadata manager null metadata manager metadata manager new manager lockss daemon metadata manager manager map put lockss daemon metadata manager metadata manager return metadata manager
return the metadata manager instance
public identity manager get identity manager if identity manager null identity manager identity manager new manager lockss daemon identity manager manager map put lockss daemon identity manager identity manager return identity manager
return the identity manager
protected void success rate set up success max failures 0
called once before set up before a set of repetitions of a test
protected void success rate tear down
called once after tear down after a set of repetitions of a test
public remote api get remote api if remote api null remote api remote api new manager lockss daemon remote api manager map put lockss daemon remote api remote api return remote api
return the remote api instance
static public void assert equals not same object expected object actual assert equals not same null expected actual
asserts that two objects are equal but not the same object
public clockss params get clockss params if clockss params null clockss params clockss params new manager lockss daemon clockss params manager map put lockss daemon clockss params clockss params return clockss params
return the clockss params instance
public void set datagram comm manager lcap datagram comm comm man comm manager comm man manager map put lockss daemon datagram comm manager comm manager
set the datagram comm manager
static public void assert equals map expected map actual assert equals null expected actual
asserts that two maps are equal contain the same mappings
public void set stream comm manager lcap stream comm scomm man scomm manager scomm man manager map put lockss daemon stream comm manager scomm manager
set the stream comm manager