input
stringlengths
10
828
output
stringlengths
5
107
public void noop
basic test that has no arguments or return values to test the
public void ping string arg
basic test that has argument serialization
public perf result run probe tests int iteration count string buffer results new string buffer h1 run probe tests iteration count h1 pre n int test count 0 int failure count 0 perf result result new perf result try test count test probe timings iteration count results catch exception e failure count format exception e test timings results result error e results append n results append n total tests test count results append n total failures failure count results append n pre result report results to string return result
run the unit tests using probe and return a report as a string
public string echo string arg return arg
basic test that has both argument serialization and return
protected void set up throws exception super set up url istring impl get class get resource org elba test jrmp ejb astring class if istring impl null get log debug found istring impl at istring impl file impl file new file istring impl get file get log debug removed impl file delete deploy jrmp dl jar
remove any local istring implementation so that we test rmi class loading
public void test custom access throws exception initial context jndi context new initial context get log debug lookup stateless session object obj jndi context lookup stateless session stateless session home home stateless session home obj get log debug found stateless session home stateless session bean home create get log debug created stateless session test that the entity bean sees username as its principal string echo bean echo jrmp comp get log debug bean echo jrmp comp echo bean remove
a unit test for junit
protected void tear down throws exception undeploy jrmp dl jar super tear down
the teardown method for junit
public void test access throws exception initial context jndi context new initial context get log debug lookup stateful session object obj jndi context lookup stateful session stateless session home home stateless session home obj get log debug found stateful session home stateless session bean home create get log debug created stateful session test that the entity bean sees username as its principal string echo bean echo jrmp get log debug bean echo jrmp echo bean remove
a unit test for junit
public server socket create server socket int port throws ioexception server socket active socket new compression server socket port return active socket
create a server socket on the specified port port 0 indicates
public socket create socket string host int port throws ioexception socket s new compression socket host port return s
create a client socket connected to the specified host and port
private void login throws exception login jduke theduke to char array
login as user scott using the conf
public void test echo args throws exception log debug test echo args login srp test username password object obj get initial context lookup srp stateless session obj portable remote object narrow obj stateless session home class stateless session home home stateless session home obj log debug found stateless session home stateless session bean home create log debug created spec stateless session log debug bean echo hello bean echo hello bean remove logout
test that the echo method is secured by the srpcache login module
public void test srplogin throws exception log debug test srplogin login srp test username password null logout
test a login against the srp service using the srplogin module
public void test srplogin http throws exception log debug test srplogin http login srp test http username password null logout
test a login against the srp service using the srplogin module
public void test srplogin with external a throws exception log debug test srplogin with external a byte abytes abcdefgh get bytes login srp test ex username password abytes logout
test a login against the srp service using the srplogin module and
public void test srplogin with multiple sessions throws exception log debug test srplogin with multiple sessions session 1 app callback handler handler new app callback handler username password null log debug creating login context srp test multi 1 login context lc1 new login context srp test multi handler lc1 login log debug created login context subject lc1 get subject session 1 log debug creating login context srp test multi 2 login context lc2 new login context srp test multi handler lc2 login log debug created login context subject lc2 get subject lc1 logout lc2 logout
test a login against the srp service using the srplogin module with
public void test jsse throws exception log debug test jsse server socket factory factory sslserver socket factory get default sslserver socket ssl socket sslserver socket factory create server socket 0 int port ssl socket get local port string cipher suites ssl socket get enabled cipher suites for int i 0 i cipher suites length i get log debug cipher suite i cipher suites i ssl socket close
test the jsse installation
public void xxtest https url throws exception log debug test https url setup the ssl listening port string https url init server log debug setup ssl socket url https url have the service in elba use the https url object name name new object name elba security tests service https client string method read url object args https url string sig java lang string string reply string invoke name method args sig log debug reply for url https url is reply
test a login against the srp service using the srplogin module
public void test stateful create caller throws exception log debug test stateful create caller login initial context jndi context new initial context object obj jndi context lookup spec stateful session obj portable remote object narrow obj stateful session home class stateful session home home stateful session home obj log debug found stateful session home the create should be allowed to call get caller principal stateful session bean home create test stateful create caller need to invoke a method to ensure an ejb create call bean echo test stateful create caller log debug bean echo ok logout
test the use of get caller principal from within the ejb create
public boolean verify string host1 string host2 log debug verify host1 host1 host2 host2 return true
we dont care if the server cert host matches the https url host
public string read url string url string throws ioexception try string reply internal read url url string log debug read url reply return reply catch throwable e log error failed to read url e throw new ioexception failed to read url ex e get message
read the contents of the given url and return it
public void test principal propagation throws exception log debug test principal propagation logout login object obj get initial context lookup spec unsecure stateless session2 obj portable remote object narrow obj stateless session home class stateless session home home stateless session home obj log debug found unsecure stateless session home stateless session bean home create log debug created spec unsecure stateless session2 log debug bean forward hello bean forward hello bean remove
test that the calling principal is propagated across bean calls
public string echo string arg log debug echo arg arg this call should fail if the bean is not secured principal p session context get caller principal log debug echo caller principal p string echo null try initial context ctx new initial context entity home home entity home ctx lookup java comp env ejb entity entity bean home find by primary key arg echo bean echo arg catch exception e log debug failed e e fill in stack trace throw new ejbexception e return echo
this method creates an instance of the entity bean bound under
public void noop log debug noop calling excluded stateless session my ejb stateless session session context get ejbobject try my ejb excluded catch remote exception e throw new ejbexception failed to access excluded e detail
this method gets this beans remote interface and invokes the
public void test method access throws exception log debug test method access login object obj get initial context lookup spec stateless session obj portable remote object narrow obj stateless session home class stateless session home home stateless session home obj log debug found stateless session home stateless session bean home create log debug created spec stateless session log debug bean echo hello bean echo hello try this should not be allowed bean noop fail was able to call stateless session noop catch remote exception e log debug stateless session noop failed as expected bean remove
test that the echo method is accessible by an echo
public void test method access2 throws exception log debug test method access2 login initial context jndi context new initial context object obj jndi context lookup spec stateless session test obj portable remote object narrow obj stateless session home class stateless session home home stateless session home obj log debug found stateless session home stateless session bean home create log debug created spec stateless session test log debug bean echo hello bean echo hello bean remove
test that the permissions assigned to the stateless session bean
public void test unchecked throws exception log debug test unchecked login as scott to create the bean login object obj get initial context lookup spec stateless session obj portable remote object narrow obj stateless session home class stateless session home home stateless session home obj log debug found spec stateless session home stateless session bean home create log debug created spec stateless session logout and login back in as stark to test access to the unchecked method logout login stark javaman to char array bean unchecked log debug called bean unchecked logout
test that a user with a role that has not been assigned any
public void test excluded throws exception log debug test excluded login object obj get initial context lookup spec stateless session2 obj portable remote object narrow obj stateless session home class stateless session home home stateless session home obj log debug found spec stateless session2 home stateless session bean home create log debug created spec stateless session2 try bean excluded fail was able to call bean excluded catch exception e log debug bean excluded failed as expected this is what we expect logout
test that user scott who has the echo role is not able to
protected void run new proxy string ejbname throws exception failures 0 system out println system out println new proxy ejbname stateless session home home stateless session home ctx lookup ejbname thread threads new thread num threads for int i 0 i num threads i threads i new thread new new proxy home long start system current time millis for int i 0 i num threads i threads i start for int i 0 i num threads i threads i join system out println time system current time millis start system out println failures failures
creates proxy at every invocation
public void test simple throws exception print header get log debug verify simple send of message publisher simple 1 assert assert equals 1 get jms message print ok
a unit test for junit
protected void init final context context throws exception topic connection factory factory topic connection factory context lookup topic factory connection factory create topic connection session topic connection connection create topic session false session auto acknowledge topic topic topic context lookup topic consumer topic session session create subscriber topic
description of the method
public void test server found throws exception if deployment exception null throw deployment exception assert true server was not found get server null
this just checks the server is there
public void test simple fail throws exception print header get log debug verify simple failed transaction publisher simple fail 2 assert assert equals 1 get jms message print ok
a unit test for junit
protected void init final context context throws exception queue connection factory factory queue connection factory context lookup queue factory connection factory create queue connection session queue connection connection create queue session false session auto acknowledge queue queue queue context lookup queue consumer queue session session create receiver queue
description of the method
protected void run old proxy string ejbname throws exception failures 0 system out println system out println old proxy ejbname stateless session home home stateless session home ctx lookup ejbname stateless session proxy home create thread threads new thread num threads for int i 0 i num threads i threads i new thread new old proxy proxy long start system current time millis for int i 0 i num threads i threads i start for int i 0 i num threads i threads i join system out println time system current time millis start system out println failures failures
creates bean proxy before timing and shares it between threads
public void test bean ok throws exception print header get log debug verify bean ok publisher bean ok 3 assert assert equals 3 get jms message print ok
a unit test for junit
protected void set up throws exception create a receiver context context get initial context try queue rec home home queue rec home context lookup bean jndi rec home create init context finally context close start up the session connection start
the junit setup method
public void test bean error throws exception print header get log debug verify bean eroor failed transaction try publisher bean error 4 catch exception ignore assert assert equals 1 get jms message print ok
a unit test for junit
protected void init final context context throws exception queue connection factory factory queue connection factory context lookup queue factory connection factory create queue connection session queue connection connection create queue session false session auto acknowledge queue queue queue context lookup queue sender queue session session create sender queue
description of the method
protected void tear down throws exception if sender null sender close if session null session close if connection null connection close
the teardown method for junit
protected void set up throws exception create a publisher context context get initial context try publisher home home publisher home context lookup bean jndi publisher home create init context finally context close start up the session connection start flush the destination flush
the junit setup method
public void test sync rec throws exception send a message to queue text message message session create text message message set text string value of message nr message set int property publisher jms message nr message nr sender send message get log debug sent message with nr message nr let bean fetch it sync int res rec get message assert assert equals message nr res get log debug test sync rec ok
test sync receive of message with jms ra
protected initial context get initial context throws exception return delegate get initial context
gets the initial context attribute of the elba test case object
protected int get jms message throws exception return get jms message default timeout
check if we got a message
protected rmiadaptor get server throws exception return delegate get server
gets the server attribute of the elba test case object
protected int get jms message long timeout throws exception message msg consumer receive timeout if msg null get log debug recived message msg int nr msg get int property publisher jms message nr get log debug nr nr return nr else get log debug no message recived return 1
check if we got a message
protected category get log return delegate get log
gets the log attribute of the elba test case object
protected void tear down throws exception if consumer null consumer close if connection null connection close
the teardown method for junit
public void simple int message nr send message message nr
send a message with a message nr in property message nr
public void simple fail int message nr send message message nr roll it back no message should be sent if transactins work log debug debug setting rollback only ctx set rollback only log debug debug rollback set ctx get rollback only
try send a message with a message nr in property message nr
protected object name get deployer name throws malformed object name exception return delegate get deployer name
gets the deployer name attribute of the elba test case object
protected void print header get log debug n testing method get name for bean bean jndi
description of the method
protected void print ok get log debug test ok n
description of the method
protected string get deploy url final string filename throws malformed urlexception return delegate get deploy url filename
returns the deployment directory to use
protected void flush throws exception get log debug flushing destination int nr 0 do try nr get jms message flush timeout catch exception ignore while nr 1 get log debug flushed
flush the destiniation so we know that it contains no messages which might
protected string get resource url final string resource throws malformed urlexception class loader loader thread current thread get context class loader url res url loader get resource resource return res url null res url to string null
get a url string to a resource in the testsuite output resources dir
protected boolean is deployed string name return delegate is deployed name
gets the deployed attribute of the elba test case object
public void simple int message nr log info sending message send message message nr log info sent
send a message with a message nr in property message nr
public void simple fail int message nr log info sending message send message message nr log info sent roll it back no message should be sent if transactins work log info setting rollback only ctx set rollback only log info rollback set ctx get rollback only
try send a message with a message nr in property message nr
private void login throws exception login username password
login as user scott using the conf
protected void deploy string name throws exception delegate deploy name
deploy a package with the main deployer
protected void undeploy string name throws exception delegate undeploy name
undeploy a package with the main deployer
public void test inter jar call throws exception deploy the cts2 jar deploy cts2 jar session bean simple call true session bean simple call2 true undeploy cts2 jar deploy cts2 jar session bean simple call true session bean simple call2 true undeploy cts2 jar
a test of two ejb deployments cts
private boolean test begin rollback try if ut get status status status no transaction throw new runtime exception no tx should be active ut begin if ut get status status status active throw new runtime exception new tx not active ut rollback if ut get status status status no transaction throw new runtime exception no tx should be active catch exception ex log debug failed ex return false return true
simple begin rollback test
public void test call by value in same jar throws exception session bean call by value in same jar
a test of two ejb deployments cts
private boolean test begin commit try if ut get status status status no transaction throw new runtime exception no tx should be active ut begin if ut get status status status active throw new runtime exception new tx not active ut commit if ut get status status status no transaction throw new runtime exception no tx should be active catch exception ex log debug failed ex return false return true
simple begin commit test
private boolean test begin setrollbackonly rollback try if ut get status status status no transaction throw new runtime exception no tx should be active ut begin if ut get status status status active throw new runtime exception new tx not active ut set rollback only if ut get status status status marked rollback throw new runtime exception tx not marked for rollback ut rollback if ut get status status status no transaction throw new runtime exception no tx should be active catch exception ex log debug failed ex return false return true
simple begin set rollback only rollback test
public void ejb post create account pk pk string persons name log debug ejb post create account pk string called send msg container mbox ejb post create msg
method ejb post create
public void xxtest in vmsession handle passivation throws exception context ctx new initial context get log debug test in vmsession handle passivation stateful session home session home stateful session home ctx lookup ejbcts facade stateful session bean stateful session session bean session home create test in vmsession handle passivation get log debug creating stateful session handle session bean create stateful session handle test in vmsession handle passivation2 session bean use stateful session handle
create a stateful session bean and then create a handle to a stateful
public void call by value in same jar throws remote exception call the second deployment instance caller session callee null try cached home lookup home ejbcts callee session home callee cached home create catch naming exception e throw new server exception failed to lookup callee home e catch create exception e throw new server exception failed to create callee e catch throwable e log error unexpected error e throw new server exception unexpected error e get message reference test test new reference test callee validate value marshalling test
lookup the cts
public void set up throws exception initial context jndi new initial context exception tester home exception tester home jndi lookup exception exception tester exception tester local home exception tester local home jndi lookup exception exception tester local
looks up all of the home interfaces and creates the initial data
public void ejb store log debug ejb store account number called thread current thread dump stack send msg container mbox ejb store msg try connection con ds get connection try prepared statement ps ps con prepare statement update table name set name where account number try ps set string 1 persons name ps set string 2 account number ps execute update finally ps close finally con close catch sqlexception e log debug failed e throw new ejbexception e log debug ejb store account number returning
method ejb store
public void ejb activate log debug ejb activate called send msg container mbox ejb activate msg
method ejb activate
public void set up throws exception initial context jndi new initial context exception tester home entity exception tester home jndi lookup exception entity exception tester exception tester local home entity exception tester local home jndi lookup exception entity exception tester local
looks up all of the home interfaces and creates the initial data
public void ejb passivate log debug ejb passivate called send msg container mbox ejb passivate msg drop message sender if ms null try ms close catch jmsexception e log debug failed e otherwise ignore ms null
method ejb passivate
protected elba test services create test services return new elba test services get class get name
factory for testservices delegate
public void set entity context entity context ctx log debug set entity context ctx get primary key called send msg container mbox set entity context msg this ctx ctx lookup the datasource try context context new initial context ds data source context lookup java comp env datasource catch naming exception nex log debug failed nex throw new ejbexception datasource not found nex get message
method set entity context
public hashtable get config return config
for the client to ask for success
public void unset entity context log debug unset entity context called send msg container mbox unset entity context msg ctx null ds null
method unset entity context
public void test queue throws exception print header queue session session get queue session queue queue queue get initial context lookup dest queue sender sender session create sender queue get log debug test queue dest sending 10 messages 1 10 for int i 1 i 11 i text message message session create text message message set text queue message dest nr i sender send queue message sender close
test sending messages to topic test topic
public void test ejb link named throws exception object obj get initial context lookup naming session b obj portable remote object narrow obj test ejb link home class test ejb link home home test ejb link home obj get log debug found naming session b test ejb link bean home create get log debug created the bean assert equals works bean test ejb link caller java comp env ejb session a get log debug test succeeded bean remove
test an ejblink
public void test ejb link relative throws exception object obj get initial context lookup naming session b obj portable remote object narrow obj test ejb link home class test ejb link home home test ejb link home obj get log debug found naming session b test ejb link bean home create get log debug created the bean assert equals works bean test ejb link caller java comp env ejb relative session a get log debug test succeeded bean remove
test an ejblink with a relative path
public void test ejb link local named throws exception object obj get initial context lookup naming session b obj portable remote object narrow obj test ejb link home class test ejb link home home test ejb link home obj get log debug found naming session b test ejb link bean home create get log debug created the bean assert equals works bean test ejb link caller local java comp env ejb local session a get log debug test succeeded bean remove
test an ejblink using a local ejb ref
public void test ejb link local relative throws exception object obj get initial context lookup naming session b obj portable remote object narrow obj test ejb link home class test ejb link home home test ejb link home obj get log debug found naming session b test ejb link bean home create get log debug created the bean assert equals works bean test ejb link caller local java comp env ejb local relative session a get log debug test succeeded bean remove
test an ejblink using a local ejb ref with a relative path
public void test enc throws exception object obj get initial context lookup encbean obj portable remote object narrow obj test enchome class test enchome home test enchome obj get log debug found test enchome ejbobject bean home create get log debug created encbean bean remove
a unit test for junit
public void test enc2 throws exception object obj get initial context lookup encbean0 obj portable remote object narrow obj test enchome2 class test enchome2 home test enchome2 obj get log debug found test enchome2 ejbobject bean home create get log debug created encbean0 bean remove
a unit test for junit
private void send msg string msg if ms null ms new msg sender ms send msg msg
send a jms message
public void test external contexts throws exception if context names null get log debug no external context names exist return for int n 0 n context names length n object name name context names n string jndi name name get key property jndi name if jndi name null get log debug skipping name as it has no jndi name property continue context ctx context get initial context lookup jndi name get log debug listing for ctx list ctx
a unit test for junit
public void test create subcontext throws exception get log debug test create subcontext initial context ctx get initial context ctx create subcontext foo try ctx create subcontext foo fail second create subcontext foo did not fail catch name already bound exception e get log debug second create subcontext foo failed as expected ctx create subcontext foo bar ctx unbind foo bar ctx unbind foo
tests that the second time you create a subcontext you get an exception
public void test lookup throws exception get log debug test lookup initial context ctx get initial context object obj ctx lookup get log debug lookup obj
lookup a name to test basic connectivity and lookup of a known name
public void on message message message try if transacted trans individual session commit i catch jmsexception e get log error unable to commit e synchronized this this notify if i iteration count long end time system current time millis long p time end time start time log debug received all messages in double p time 1000 seconds synchronized this this notify
description of the method
public void test temporary queue delete throws exception get log debug starting temporary queue delete test connect queue session session queue connection create queue session false session auto acknowledge temporary queue queue session create temporary queue queue delete disconnect get log debug temporary queue delete passed
test that temporary queues can be deleted
public void test unacked queue throws exception get log debug starting unacked queue test run unacked queue delivery mode non persistent run unacked queue delivery mode persistent get log debug unacked queue passed
a unit test for junit
public void test temporary topic delete throws exception get log debug starting temporary topic delete test connect topic session session topic connection create topic session false session auto acknowledge temporary topic topic session create temporary topic topic delete disconnect get log debug temporary topic delete passed
test that temporary topics can be deleted
public void run login no cred throws exception topic worker pub1 null try drain topic pub1 new topic worker publisher trans none null 0 pub1 connect catch exception ex assert fail could lot login without any cred finally try pub1 close catch exception ex
tests that check authentication
public void run try queue session session queue connection create queue session transacted trans none session auto acknowledge queue queue queue context lookup test queue queue receiver receiver session create receiver queue long start time system current time millis for int i 0 i iteration count i receiver receive get log debug received i if transacted trans individual session commit if transacted trans total session commit long end time system current time millis session close long p time end time start time log debug received all messages in double p time 1000 seconds catch exception e log error error e
main processing method for the elba mqperf stress test case object
public void test unacked multiple session throws exception get log debug starting unacked multiple session test run unacked multiple session delivery mode non persistent run unacked multiple session delivery mode persistent get log debug unacked multiple session passed
a unit test for junit
public void test invalid destination queue send throws exception get log debug starting invaid destination queue send test connect queue session session queue connection create queue session false session auto acknowledge temporary queue queue session create temporary queue queue sender sender session create sender queue queue delete text message message session create text message hello boolean caught false try sender send message catch invalid destination exception expected caught true disconnect assert true expected an invalid destination exception caught get log debug invald destination queue send passed
test invalid destination trying to send a message
public void test unacked multiple connection throws exception get log debug starting unacked multiple connection test run unacked multiple connection delivery mode non persistent run unacked multiple connection delivery mode persistent get log debug unacked multiple connection passed
a unit test for junit
public void test queue send roll back throws exception get log debug starting asynch queue send roll back test run queue send roll back delivery mode non persistent false run queue send roll back delivery mode persistent false run queue send roll back delivery mode non persistent true run queue send roll back delivery mode persistent true get log debug asynch queue send roll back passed
a unit test for junit