input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
public void test invalid default key manager instantiation try ensure that local security environment settings do not cause the test to fail security set property keystore type jks key manager factory get instance catch illegal state exception ise fail default jks keystore should be supported
|
test the instantiation of the default key manager in this test jks
|
public void test invalid key store key manager instantiation try fake the keystore type in order to trigger an invalid keystore type security set property keystore type xyz key manager factory get instance fail invalid key manager type should be rejected catch illegal argument exception ise this is what we expected to happen
|
test the failed instantiation of a non existent key manager
|
public void test supported types assert equals supported type not recognised true supported key manager is supported jks assert equals unsupported type not recognised false supported key manager is supported xyz
|
test the recognition of un supported types
|
private string get signed url string url throws key materials exception return signer util sign url url key mgr get private key url signer constants key password to char array
|
convenience method for those tests that require something to be signed
|
private void test invocation int status string msg string args try assert equals msg status signer process args catch exception e fail msg
|
convenience method to test success or failure of execution of command line arguments
|
public void test change validity period try cache signature cache get instance short validity period long validity period signature cache get validity period assert equals validity period incorrect short validity period validity period now change the validity period cache signature cache get instance short validity period 1 long new validity period signature cache get validity period assert equals validity period incorrect short validity period 1 new validity period catch exception e fail unable to alter the validity period e get message
|
test changing the validity period of an existing cache
|
public void test help invocation test invocation url signer status success help should have been invocable without errors help invocation
|
test the invocation with the help option
|
public void test instantiation try new httputil catch exception e fail unable to instantiate utility type
|
rudimentary test of instantiation of a utility type
|
public void test empty cache assert equals when created the cache should be empty 0 cache size
|
test the initial state of a newly instantiated signature cache
|
public void test version invocation test invocation url signer status success version should have been invocable without errors version invocation
|
test the invocation with the help option
|
public void test url encoding assert equals url encoding does not correspond to sample text encoded text httputil url encode text
|
verify that a sample text produces the expected result when url encoded
|
public void test remove signature parameters from signed url try string signed url sign url url signer constants url without parameters assert equals signed url with signature parameters removed should be the original url url signer constants url without parameters httputil remove signature components signed url catch exception e fail unable to create signed url e get message
|
test that the removal of signature paramters restores the original url
|
public void test invalid keystore file location try key mgr load url signer constants keystore file that does not exist url signer constants keystore alias url signer constants keystore password to char array fail invalid keystore file location should have been detected catch exception e this is what we expect to happen
|
test loading a keystore from a non existent location
|
public void test remove signature parameters from signed parameterized url try string signed url sign url url signer constants url with parameters assert equals signed url with signature parameters removed should be the original url url signer constants url with parameters httputil remove signature components signed url catch exception e fail unable to create signed url e get message
|
test that the removal of signature paramters restores the original url
|
public void test standard invocation test invocation url signer status success standard invocation should have been invocable without errors standard invocation
|
test standard invocation using a key pair generated by url signer
|
private string sign url string url throws key materials exception key manager key mgr key manager factory get instance key mgr load url signer constants keystore file url signer constants keystore alias url signer constants keystore password to char array private key key key mgr get private key url signer constants key password to char array return signer util sign url url key
|
convenience method to perform the signing required of specific tests
|
public void test rsakeystore file location try key mgr load url signer constants rsa keystore file url signer constants keystore alias url signer constants keystore password to char array fail unsupported keystore file location should have been detected catch exception e this is what we expect to happen
|
test loading of unsupported rsa keystores
|
public void test add cache valid try cache add get signed url url signer constants url without parameters assert equals cache should contain valid signature 1 cache size catch exception e fail unable to add signed url to cache e get message
|
add a newly signed url to the cache
|
public void test extract nonce parameter assert equals extracted nonce is incorrect url signer constants encoded nonce httputil get nonce sample parameter extraction url
|
test the extraction of the nonce signature paramter from a signed url
|
public void test invalid keystore credentials try int l url signer constants keystore password length key mgr load url signer constants keystore file url signer constants keystore alias url signer constants keystore password substring 0 l 1 to char array fail invalid keystore credentials should have been detected catch exception e this is what we expect to happen
|
test loading a keystore using invalid credentials
|
public void test extract timestamp parameter assert equals extracted timestamp is incorrect url signer constants encoded timestamp httputil get timestamp sample parameter extraction url
|
test the extraction of the nonce signature paramter from a signed url
|
public void test extract malformed timestamp parameter try httputil get timestamp malformed parameter url fail unable to detect malformed timestamp parameter catch illegal state exception ise this is what we expected to happen
|
test the extraction of a timestamp parameter that has been malformed i
|
public void test load corrupt keystore try key mgr load url signer constants corrupt keystore file url signer constants keystore alias url signer constants keystore password to char array fail unable to detect a corrupt keystore catch key materials exception kse this is what we expect to happen
|
test the loading of a keystore file that has been corrupted
|
public void test extract signature parameter assert equals extracted nonce is incorrect dummy signature httputil url encode new string httputil get signature sample parameter extraction url
|
test the extraction of the nonce signature paramter from a signed url
|
public void test corrupt keystore invocation test invocation url signer status failure missing url should have been detected standard invocation with corrupt keystore
|
test standard invocation using a corrupted keystore file
|
public void test type assert equals anticipated a different key manager type key manager type key mgr get type
|
confirm that the type of this key manager is jks
|
public void test add cache invalid try cache add expired signed url fail signature is expired and should not have been added to the cache catch expired signature exception ese this is what we expected catch exception e fail unable to perform test e get message assert equals cache should be empty 0 cache size
|
test adding a signed url that has already expired
|
public void test instantiation try new nonce util catch exception e fail unable to instantiate utility type
|
rudimentary test of instantiation of a utility type
|
public void test try new timestamp util catch exception e fail unable to instantiate utility type
|
a rudimentary test of instantiation
|
public void test missing url argument invocation test invocation url signer status failure missing url should have been detected missing url invocation
|
test invocation when the url argument is missing
|
public void test nonce size assert equals unexpected nonce size nonce size nonce util get nonce size
|
simple test to confirm the expected size of the only supported nonce size
|
public void test replay attack try string signed url get signed url url signer constants url without parameters cache add signed url cache add signed url fail signature has been replayed and should not have been added to the cache catch replay attack exception rae this is what we expected catch exception e fail unable to perform test e get message assert equals cache should be empty 1 cache size
|
add a newly signed url to the cache
|
public void test too many url arguments invocation test invocation url signer status failure missing url should have been detected too many urls invocation
|
test invocation when there are too many url arguments
|
public void test is not expired signature cache is expired new gregorian calendar time zone get time zone timestamp util default time zone
|
permits the cache to assess the aging policy enforcement
|
public void test is expired calendar c calendar get instance c set 2010 0 1 signature cache is expired c
|
permits the cache to assess the aging policy enforcement
|
public void test unsupported option invocation test invocation url signer status failure unsupported option should have been detected unsupported option invocation
|
test the attempt to invoke url signer with an unsupported option
|
public void test missing key store option invocation test invocation url signer status failure missing keystore option should have been detected missing keystore option invocation
|
test invocation with missing keystore option
|
public void test clean throws exception string signed url1 get signed url url signer constants url without parameters cache add signed url1 assert equals cache should contain the signed url entry 1 cache size signature cache clean assert equals cache should still contain the signed url entry 1 cache size
|
tests a routine clean of the expired timestamps in the cache
|
public void test missing key store value invocation test invocation url signer status failure missing keystore value should have been detected missing keystore value invocation
|
test invocation with missing keystore option
|
public void test clean expired signatures throws exception create a cache with a very short aging policy i e long enough to add a single signed url cache signature cache get instance short validity period string signed url1 get signed url url signer constants url without parameters cache add signed url1 assert equals cache should contain the signed url entry 1 cache size now go to sleep long enough for the signed url to expire thread sleep short validity period signature cache clean assert equals cache should no longer contain the signed url entry 0 cache size
|
test the removal of an existing but since expired entry from the cache
|
public void test missing key store password option invocation test invocation url signer status failure missing keystore password option should have been detected missing keystore password option invocation
|
test invocation with missing keystore password option
|
public void test missing key store password value invocation test invocation url signer status failure missing keystore password value should have been detected missing keystore password value invocation
|
test invocation with missing keystore password value
|
public void test missing key materials password option invocation test invocation url signer status failure missing keystore option should have been detected missing key materials password option invocation
|
test invocation with missing key materials password option
|
public void test missing key materials password value invocation test invocation url signer status failure missing keystore value should have been detected missing key materials password value invocation
|
test invocation with missing key materials password value
|
public boolean available return source available
|
whether functions except for open close available get meta data are
|
public boolean has next throws exception return next instance null
|
whether has more transaction
|
public void first throws exception source first if source has next next instance source next else next instance null
|
move to first transaction
|
public boolean has next throws exception return source has next
|
whether has more record
|
public void first throws exception source first
|
move to first record
|
protected void init tokenizer stream tokenizer tokenizer tokenizer reset syntax tokenizer whitespace chars 0 tokenizer word chars 1 u00 ff tokenizer whitespace chars tokenizer comment char tokenizer quote char tokenizer quote char tokenizer ordinary char tokenizer ordinary char tokenizer eol is significant true tokenizer parse numbers tokenizer slash slash comments true tokenizer slash star comments true
|
initializes the stream tokenizer used for reading the arff file
|
public double get y object x return 0
|
of no use
|
public kernel get default kernel return new default kernel
|
used by constructor
|
public int get pattern count return svm length
|
total pattern count
|
public double get y object x double probs get probability array x double max double max value int arg 1 for int i 0 i svm length i double v probs i if v max max v arg i return arg
|
predict the pattern of x
|
public matrix pseudoinverse max rank decomposition mrd new max rank decomposition this matrix b mrd get b matrix t b b transpose matrix bb t b times b matrix c mrd get c matrix t c c transpose matrix cc c times t c matrix bl bb inverse times t b matrix cr t c times cc inverse return cr times bl
|
matrix pseudoinverse added by shellkk
|
protected double get density int i double x double v new double dim for int k 0 k dim k v k x k ob mean i get k 0 matrix v new matrix v dim matrix vt v transpose double e vt times ob inv sigma i times v get 0 0 double f 1 0d for int k 0 k dim k f factor double d f math sqrt ob det inv sigma i math exp 0 5 e return d
|
density of x by state i
|
protected double compute square svrange double max double max value for int i 0 i alpha length i if alpha i 0 0 d for int j 0 j alpha length j if i j alpha j 0 0 d double eta kernel cache null kernel cache product i i kernel cache product j j 2 0d kernel cache product i j kernel product samples i x samples i x kernel product samples j x samples j x 2 0d kernel product samples i x samples j x if eta max max eta return max
|
maximum distance between support vectors
|
public double get interspace return square norm 0 math sqrt 1 0 d square norm double max value
|
distance of supports over superspace
|
public double get yvalue object x return get y x
|
get the value predicted by svm
|
public cross density kernel get default kernel return new strip density kernel
|
used by constructor
|
public jcomponent get main panel if event type main panel changed return jcomponent get source return null
|
convenience method for getting the jcomponent related to a main panel changed event
|
public int get detuning string tuning if tuning equals tuning types tuning in tune unison return 0 get a random integer based on the possible detunings int possibilities get max deviation get granularity int value settings random next int possibilities if value 0 value 1 int detuning value get granularity if tuning equals tuning types tuning flat put it in a negative direction detuning 1 return detuning
|
randomly generates a detuning in the direction passed in
|
private void tell answer if curr chord null answered correctly notify listeners new generator event generator event general message resources get string already finished msg return string answers resources get string answer msg replace all 1 resources get string chord replace all 2 curr chord if curr chord null answers resources get string no item played msg replace all 1 resources get string chord else add to total answers 1 answered correctly true notify listeners new generator event generator event general message answers
|
tells what the current chord is
|
public void end playing if playing incorrect answer swap back the previous note set note set prev note set curr chord prev chord playing incorrect answer false else run query
|
calls run query to walk the user through the querying process
|
public void set selected scales list sel scales loop through the intervals and create a list of indices to set int sel indices new int sel scales size for int x 0 x sel indices length x sel indices x scales get scale index sel scales get x to string scale list set selected indices sel indices
|
tells the list box to set these scales as selected
|
public void end playing if playing incorrect answer playing incorrect answer false note set prev note set curr scale prev scale else run query
|
calls run query to walk the user through the querying process
|
public void set selected intervals list sel intervals loop through the intervals and create a list of indices to set int sel indices new int sel intervals size for int x 0 x sel indices length x sel indices x intervals get interval value sel intervals get x to string interval list set selected indices sel indices
|
tells the list box to set these intervals as selected
|
public void set selected chords list sel chords loop through the intervals and create a list of indices to set int sel indices new int sel chords size for int x 0 x sel indices length x sel indices x chords get chord index sel chords get x to string chord list set selected indices sel indices
|
tells the list box to set these chords as selected
|
public midi event get as midi event short message msg new short message try msg set message short message program change channel patch number 0 catch invalid midi data exception e1 e1 print stack trace return new midi event msg offset
|
convenience method to get this as a midievent to add to a sequence
|
public boolean add note note new note if notes contains new note notes add new note if channels contains new integer new note get channel need to add this to the list of used channels channels add new note get channel return true return false
|
attempts to add a note to the note set
|
protected void switch generator string generator if generators null for int x 0 x settings test types length x if settings test types x to lower case equals curr generator generators set selected index x break if generator to lower case equals curr generator return curr generator generator to lower case
|
switches the generator to the new generator type passed
|
public int number of notes return notes size
|
tells how many notes are currently in the note set
|
public note get note int index return note notes get index
|
returns the requested note in this note set
|
public void load misc settings root note new jcombo box new vector string midi notes note list root note set selected item midi notes get note name settings get root note root note add action listener new action listener public void action performed action event e play note arpeggio direction new jcombo box settings get all directions arpeggio direction set selected item settings get direction
|
loads up the arpeggiation settings and the root note settings
|
public void load velocity velocity new jslider jslider horizontal 0 127 settings get velocity velocity set major tick spacing 8 velocity set snap to ticks true velocity set paint ticks true hashtable integer jlabel label table new hashtable integer jlabel label table put 0 new jlabel 0 label table put 127 new jlabel 100 velocity set label table label table velocity set paint labels true velocity add change listener new change listener public void state changed change event e play note
|
sets up and loads the velocity information
|
private void tell answer if curr tuning null answered correctly notify listeners new generator event generator event general message resources get string already finished msg return string answers resources get string answer msg replace all 1 resources get string second note replace all 2 curr tuning if curr tuning null answers resources get string no item played msg replace all 1 resources get string tuning else add to total answers 1 answered correctly true notify listeners new generator event generator event general message answers
|
tells what the current tuning is
|
public void load generators string generator settings get generator type generator generator substring 0 1 to upper case generator substring 1 generators new jtabbed pane loop through the available types and add a tab for each for int x 0 x settings test types length x try generator gen obj generator factory get generator settings test types classnames x generators add resources get string settings test types classnames x to lower case gen obj get settings panel catch generator exception e logger log e generators set selected index generators index of tab resources get string generator to lower case
|
loads up the data related to the types of trainers generators available
|
public void end playing if playing incorrect answer swap back the previous notes raw notes prev raw notes playing incorrect answer false else run query
|
calls run query to walk the user through the querying process
|
public void end playing run query
|
calls run query to walk the user through the querying process
|
protected void reset counter settings get current generator action performed new action event this 0 settings clear counter
|
the reset counter button was pressed
|
protected void show settings settings dialog show dialog
|
the settings button was pressed
|
public void play note set settings get current generator play current note set
|
the play again button was pushed
|
private void toggle buttons enabled boolean new state new int btn set enabled new state tell int btn set enabled new state exist int btn set enabled new state
|
toggles the buttons on the top panel to enabled or disabled
|
public void remove repository system out println deleteing repo repository get repository id remove the repository from cache synchronized sesame db face cache soft reference sesame dbface ref sesame db face cache get repository get repository id if ref null sesame db face cache remove repository get repository id remove the repository physically sesame server get local service remove repository repository get repository id
|
removes current repository physically and from cache
|
public graph perform graph query string query object args system out println string format query args try return repository perform graph query query language serql string format query args catch exception e e print stack trace return null
|
performs a serql query and returns a graph containing its result
|
public statement iterator get graph statements string query object args try graph graph perform graph query query args return graph null null graph get statements catch exception e e print stack trace return null
|
performs a serql query and returns a statement iterator for the obtained graph
|
public boolean add graph graph graph try repository add graph graph return true catch exception e e print stack trace return false
|
adds to the repository given graph
|
public boolean add graph string query object args try repository add graph perform graph query query args return true catch exception e e print stack trace return false
|
adds to the repository graph created by executing the given query
|
public boolean add data string data string base uri rdfformat format boolean verify data admin listener listener try repository add data data base uri format verify data listener return true catch exception e e print stack trace return false
|
adds data to the repository
|
public void add statement resource resource uri uri value value graph add new statement impl resource uri value
|
adds to the repository a statement created from input parameters
|
public string get say if removed return removed true removed true
|
used in the los list xml
|
private string get valid url string url if url contains http system out println nie ma http if url contains http system out println ma http url url replace http http return url
|
makes valid url from the given attribute
|
public string get string string key return this inner map get key null this inner map get key to string null
|
returns the string value of the request parameter of given key
|
public string get value s string key return this inner map get key null this inner map get key get value s null
|
returns the string value of the request parameter of given key
|
public file item get value fi string key return this inner map get key null this inner map get key get value fi null
|
returns the file value of the request parameter of given key
|
public void clear inner map clear
|
this method has been overridden
|
public void add value string value assert this type fvt unknown this type fvt string this type fvt array of strings if this type fvt unknown this type fvt string this s value null this set value value else if this type fvt string string as new string 2 as 0 this s value as 1 value this set value as else list string ls new array list string arrays as list this as value ls add value string as ls to array new string 0 this set value as
|
adds a feature to the value attribute of the field value wrapper object
|
private void url of data for gaining rdf throws ioexception malformed urlexception source source new source url iterator iter source find all elements link iterator while iter has next element e element iter next if application rdf xml equals e get attribute value type sioc equals e get attribute value title url of data for gaining rdf new url e get attribute value href return logger error getting url of rdf data for the post url failed throw new malformed urlexception
|
scrapes the blog post page with given url in order to find
|
private string get title segment content return content extract text
|
returns the title of the post
|
private string get url segment content iterator iter content find all elements a iterator if iter has next element a element iter next if util is string set a get attribute value href return a get attribute value href return null
|
returns the url of the post
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.