input
stringlengths
10
828
output
stringlengths
5
107
public void test invalid destination queue receive throws exception get log debug starting invalid destination queue receive test connect queue session session queue connection create queue session false session auto acknowledge temporary queue queue session create temporary queue queue receiver receiver session create receiver queue queue delete boolean caught false try receiver receive no wait catch invalid destination exception expected caught true disconnect assert true expected an invalid destination exception caught get log debug invalid destination queue receive passed
test invalid destination trying to receive a message
public void test asynch queue receive back throws exception get log debug starting asynch queue receive roll back test run asynch queue receive roll back delivery mode non persistent false run asynch queue receive 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 receive roll back passed
a unit test for junit
public void test unacked topic throws exception get log debug starting unacked topic test run unacked topic delivery mode non persistent run unacked topic delivery mode persistent get log debug unacked topic passed
a unit test for junit
public void test invalid destination queue browse throws exception get log debug starting invalid destination queue browse test connect queue session session queue connection create queue session false session auto acknowledge temporary queue queue session create temporary queue queue browser browser session create browser queue queue delete boolean caught false try browser get enumeration catch invalid destination exception expected caught true disconnect assert true expected an invalid destination exception caught get log debug invalid destination queue browse passed
test invalid destination trying to browse a message
public void test topic send roll back throws exception get log debug starting asynch topic send roll back test run topic send roll back delivery mode non persistent false run topic send roll back delivery mode persistent false run topic send roll back delivery mode non persistent true run topic send roll back delivery mode persistent true get log debug asynch topic send roll back passed
a unit test for junit
public void test unacked durable topic throws exception get log debug starting unacked durable topic test run unacked durable topic delivery mode non persistent run unacked durable topic delivery mode persistent get log debug unacked durable topic passed
a unit test for junit
public void test server found
this testcase does not use the elba server so override
public void test asynch topic receive roll back throws exception get log debug starting asynch topic receive roll back test run asynch topic receive roll back delivery mode non persistent false run asynch topic receive roll back delivery mode persistent false run asynch topic receive roll back delivery mode non persistent true run asynch topic receive roll back delivery mode persistent true get log debug asynch topic receive roll back passed
a unit test for junit
public void test invalid destination topic publish throws exception get log debug starting invaid destination topic publish test connect topic session session topic connection create topic session false session auto acknowledge temporary topic topic session create temporary topic topic publisher publisher session create publisher topic topic delete text message message session create text message hello boolean caught false try publisher publish message catch invalid destination exception expected caught true disconnect assert true expected an invalid destination exception caught get log debug invald destination topic publish passed
test invalid destination trying to send a message
public void test dummy last throws exception topic session session topic durable connection create topic session false session auto acknowledge topic topic topic context lookup test durable topic session unsubscribe test queue connection close topic connection close topic durable connection close
a unit test for junit
public void test asynch queue performance throws exception get log debug starting asynch queue performance test run asynch queue performance trans none delivery mode non persistent run asynch queue performance trans none delivery mode persistent run asynch queue performance trans individual delivery mode non persistent run asynch queue performance trans individual delivery mode persistent run asynch queue performance trans total delivery mode non persistent run asynch queue performance trans total delivery mode persistent get log debug asynch queue performance passed
a unit test for junit
public void test asynch durable topic receive roll back throws exception get log debug starting asynch durable topic receive roll back test run asynch durable topic receive roll back delivery mode non persistent false run asynch durable topic receive roll back delivery mode persistent false run asynch durable topic receive roll back delivery mode non persistent true run asynch durable topic receive roll back delivery mode persistent true get log debug asynch durable topic receive roll back passed
a unit test for junit
protected void set up throws exception if context null context get initial context queue connection factory queue factory queue connection factory context lookup queue factory queue connection queue factory create queue connection topic connection factory topic factory topic connection factory context lookup topic factory topic connection topic factory create topic connection topic durable connection topic factory create topic connection john needle get log debug connection to elbamq established
the junit setup method
public void test asynch topic performance throws exception get log debug starting asynch topic performance test run asynch topic performance trans none delivery mode non persistent run asynch topic performance trans none delivery mode persistent run asynch topic performance trans individual delivery mode non persistent run asynch topic performance trans individual delivery mode persistent run asynch topic performance trans total delivery mode non persistent run asynch topic performance trans total delivery mode persistent get log debug asynch topic performance passed
a unit test for junit
public void test queue subscriber throws exception run queue subscriber part one run queue subscriber part two
test queue without taking the server down
protected void set up throws exception if context null context get initial context queue connection factory queue factory queue connection factory context lookup queue factory queue connection queue factory create queue connection topic factory topic connection factory context lookup topic factory topic connection topic factory create topic connection get log debug connection to elbamq established
the junit setup method
public void test synch queue performance throws exception get log debug starting synch queue performance test run synch queue performance trans none delivery mode non persistent run synch queue performance trans none delivery mode persistent run synch queue performance trans individual delivery mode non persistent run synch queue performance trans individual delivery mode persistent run synch queue performance trans total delivery mode non persistent run synch queue performance trans total delivery mode persistent get log debug synch queue performance passed
a unit test for junit
protected void set up throws exception reconfigure acording to props queue factory system get property elbatest queuefactory queue factory topic factory system get property elbatest topicfactory topic factory test queue system get property elbatest queue test queue test topic system get property elbatest topic test topic if context null context get initial context queue factory queue connection factory context lookup queue factory topic factory topic connection factory context lookup topic factory get log debug connection to elbamq established
the junit setup method
public void run bad client throws exception topic worker sub1 new topic worker connector trans none null sub1 set durable john needle sub2 thread t1 new thread sub1 t1 start try thread sleep 2000 catch interrupted exception e take it down abruptly t1 stop sub1 close assert assert null error in connecting durable sub sub1 get exception
test connecting as a durable subscriber and diconecction without taking
public void test synch topic performance throws exception get log debug starting synch topic performance test run synch topic performance trans none delivery mode non persistent run synch topic performance trans none delivery mode persistent run synch topic performance trans individual delivery mode non persistent run synch topic performance trans individual delivery mode persistent run synch topic performance trans total delivery mode non persistent run synch topic performance trans total delivery mode persistent get log debug synch topic performance passed
a unit test for junit
public void run auz valid topic publisher throws exception topic worker pub1 null try int range message creator c1 new int range message creator user nr 0 pub1 new topic worker publisher trans none c1 1 pub1 set user john needle pub1 connect pub1 publish catch exception ex assert fail could not publish to valid destination finally try pub1 close catch exception ex
tests to check autorization
protected void set up throws exception if context null context get initial context queue connection factory queue factory queue connection factory context lookup queue factory queue connection queue factory create queue connection topic connection factory topic factory topic connection factory context lookup topic factory topic connection topic factory create topic connection get log debug connection to elbamq established
the junit setup method
public void test external service jar throws exception deploy the external jar containg the schedulable deploy scheduler jar deploy the ear sar deploy scheduler ear try object name scheduler new object name test service test scheduler assert true test service test scheduler is registered get server is registered scheduler finally undeploy scheduler ear undeploy scheduler jar
test the deployment of a ear containing a sar which creates an
public void perform date time long remaining log info schedulable examples is called at time remaining repetitions remaining name name data data
just log the call
public void subscribe throws jmsexception subscribe false
subsribes collects checking any set filters
public collection get accounts return accounts
field get set pair for field accounts
public void set up try tear down catch exception e ignore end of try catch try statement s get connection create statement s execute create table ccbmpcustomer id integer not null primary key name varchar 64 s execute create table ccbmpaccount id integer not null primary key balance integer not null customerid integer s close catch exception e throw new ejbexception e end of try catch
describe code set up code method here
public void add account account local account try account set customer id id accounts add account catch exception e throw new ejbexception problem in add account e
describe code add account local code method here
public void tear down try statement s get connection create statement s execute drop table ccbmpcustomer s execute drop table ccbmpaccount s close catch exception e throw new ejbexception e end of try catch
describe code tear down code method here
public boolean equals object other return other get class this get class
this code equals code method tests whether the cached connection manager deals
public void remove account account local account try accounts remove account account remove catch exception e throw new ejbexception problem in remove account e
describe code remove account code method here
public void set balance final int balance this balance balance
set the value of balance
public integer get customer id return customer id
field get set pair for field customer id
public void transfer account from account to int amount try category get instance teller bean class get name info invocation invocations from withdraw amount to deposit amount catch exception e throw new ejbexception could not transfer amount from from to to e
describe code transfer code method here
public void subscribe boolean failsafe throws jmsexception if consumer null throw new jmsexception no message consumer created if failsafe connection set exception listener this consumer set message listener this
subsribes collects checking any set filters
public account create account integer id try account home home account home new initial context lookup account account acct home create id 0 null return acct catch exception e throw new ejbexception could not create account e
describe code create account code method here
public void set customer id final integer customer id this customer id customer id
set the value of customer id
public int get account balance integer id try account local home home account local home new initial context lookup account local account local a home find by primary key id return a get balance catch exception e category get instance get class get name info get account balance failed e throw new ejbexception could not get account for id id e
describe code get account balance code method here
public void deposit int amount set balance get balance amount
describe code deposit code method here
public void withdraw int amount set balance get balance amount
describe code withdraw code method here
public void test jdbcstatement tests connection throws exception jdbcstatement tests connection session home home jdbcstatement tests connection session home get initial context lookup jdbcstatement tests connection session jdbcstatement tests connection session s home create s test connection obtainable
this test will probably fail with a class cast exception if run
public void test auto commit in returned connection throws exception s test auto commit in returned connection
the code test auto commit in returned connection code method tests that
public void test auto commit throws exception s test auto commit
the code test auto commit code method tests that autocommit is really on
public integer get integer property return integer property
get the integer property value
public void set integer property integer integer property this integer property integer property
set the integer property value
public integer get default integer property return default integer property
get the default integer property value
public void set default integer property integer default integer property this default integer property default integer property
set the default integer property value
public boolean get boolean property return boolean property
get the boolean property value
public void set boolean property boolean boolean property this boolean property boolean property
set the boolean property value
public long get long property return long property
get the long property value
public double get double property return double property
get the double property value
public url get url property return url property
get the url property value
public boolean test user tx jndi try test connection factory tcf test connection factory new initial context lookup java elba test cf test connection tc test connection tcf get connection user transaction ut user transaction new initial context lookup user transaction ut begin boolean result tc is in tx log info jndi test in tx result ut commit tc close return result catch exception e throw new ejbexception e get message end of try catch
describe code test user tx jndi code method here
public boolean test user tx session ctx try test connection factory tcf test connection factory new initial context lookup java elba test cf test connection tc test connection tcf get connection user transaction ut ctx get user transaction ut begin boolean result tc is in tx log info ctx test in tx result ut commit tc close return result catch exception e throw new ejbexception e get message end of try catch
describe code test user tx session ctx code method here
public void set url property url url property this url property url property
set the url property value
public integer ejb create integer id reentrant other throws create exception remote exception this id id return id
creates a new code ejb create code instance
public void ejb post create integer id reentrant other throws create exception remote exception this id id reentrant me reentrant ctx get ejbobject connection c null try try data source ds data source new initial context lookup java default ds c ds get connection if other null other do something me finally c close catch exception e throw new create exception could not get data source or connection e get message
creates a new code ejb post create code instance
public void do something reentrant first throws remote exception if first null first do something null
describe code do something code method here
public void test connection factory serialization try data source ds data source new initial context lookup java default ds connection c ds get connection c close marshalled object mo new marshalled object ds ds data source mo get c ds get connection c close catch exception e log info exception e throw new ejbexception exception e end of try catch
describe code test connection factory serialization code method here
public void test xaexception to transaction rolledback exception try xaexception session home xh xaexception session home new initial context lookup test xaexception session home xaexception session x xh create try x test xaexception to transaction rolledback exception catch transaction rolledback exception tre system out println test worked return end of try catch catch exception e log info unexpected exception e throw new ejbexception unexpected exception e end of try catch throw new ejbexception no exception
describe code test xaexception code method here
public void test xaexception to transaction rolledback local exception try xaexception session local home xh xaexception session local home new initial context lookup test xaexception session local home xaexception session local x xh create try x test xaexception to transaction rolledback exception catch transaction rolledback local exception tre log info test worked return end of try catch catch exception e log info unexpected exception e throw new ejbexception unexpected exception e end of try catch throw new ejbexception no exception
describe code test xaexception code method here
public void test rmerrin one pcto transaction rolledback exception try xaexception session home xh xaexception session home new initial context lookup test xaexception session home xaexception session x xh create try x test rmerrin one pcto transaction rolledback exception catch transaction rolledback exception tre system out println test worked return end of try catch catch exception e log info unexpected exception e throw new ejbexception unexpected exception e end of try catch throw new ejbexception no exception
describe code test xaexception code method here
public void test xaexception to transaction rolledbac localk exception try xaexception session local home xh xaexception session local home new initial context lookup test xaexception session local home xaexception session local x xh create try x test rmerrin one pcto transaction rolledback exception catch transaction rolledback local exception tre log info test worked return end of try catch catch exception e log info unexpected exception e throw new ejbexception unexpected exception e end of try catch throw new ejbexception no exception
describe code test xaexception code method here
public void on exception jmsexception ex log error ex in connection ex try connection set exception listener null close catch jmsexception c try reconnect loops until success or shut down try boolean try it true while try it stop requested log info trying reconnect try thread sleep 10000 catch interrupted exception ie try connect subscribe true try it false log info reconnect ok return catch jmsexception e log error error in reconnect e catch exception je log error strange error in failsafe handling je je
on exception handling is only for subscriber
public void create table try drop table catch exception e ignore end of try catch try statement s get conn create statement try s execute create table testcachedconn id numeric 18 0 not null primary key val varchar 255 finally s close end of try catch catch sqlexception e log error sql exception in create table e end of try catch
describe code create table code method here
public void test xaexception to transaction rolledback exception try initial context ctx new initial context connection factory cf1 connection factory ctx lookup java elba test cf connection factory cf2 connection factory ctx lookup java elba test cf2 connection c1 cf1 get connection try test connection c2 test connection cf2 get connection try c2 set fail in prepare true xaexception xa rbrollback finally c2 close end of try catch finally c1 close end of try catch catch exception e e print stack trace throw new ejbexception unexpected exception e end of try catch
describe code test xaexception code method here
public void test rmerrin one pcto transaction rolledback exception try initial context ctx new initial context connection factory cf1 connection factory ctx lookup java elba test cf test connection c1 test connection cf1 get connection try c1 set fail in commit true xaexception xaer rmerr finally c1 close end of try catch catch exception e e print stack trace throw new ejbexception unexpected exception e end of try catch
describe code test xaexception code method here
public void drop table try statement s get conn create statement try s execute drop table testcachedconn finally s close end of try catch catch sqlexception e log error sql exception in drop e end of try catch
describe code drop table code method here
public string fetch long id try prepared statement p get conn prepare statement select val from testcachedconn where id result set rs null try p set long 1 id rs p execute query if rs next return rs get string 1 end of if return null finally rs close p close end of try catch catch sqlexception e log error sql exception in fetch e return null end of try catch
describe code fetch code method here
public void test auto commit in returned connection try data source ds data source new initial context lookup java single connection ds connection c ds get connection if c get auto commit false throw new ejbexception initial autocommit state false end of if c set auto commit false c commit c close c ds get connection if c get auto commit false throw new ejbexception returned and reaccessed autocommit state false end of if c close catch ejbexception e throw e end of try catch catch exception e throw new ejbexception untested problem in test e end of catch
describe code test auto commit in returned connection code method here
public void set up throws exception log debug elba test services set up log info elbatest beancount system get property elbatest beancount log info elbatest iterationcount system get property elbatest iterationcount log info elbatest threadcount system get property elbatest threadcount log info elbatest nodeploy system get property elbatest nodeploy
the junit setup method
public void tear down throws exception server null log debug elba test services tear down
the teardown method for junit
protected string get deploy url final string filename throws malformed urlexception first see if it is already a complete url try return new url filename to string catch malformed urlexception mue ok lets see if we can figure out what it might be string deploy dir system get property elbatest deploy dir if deploy dir null deploy dir lib string url deploy dir filename try to canonicalize the strings a bit if new file url exists return new file url to url to string else return new url url to string
returns the deployment directory to use
public void test connect throws exception log debug test connect management jsr77 mejb get management ejb string l domain jsr77 mejb get default domain log debug test connect domain l domain jsr77 mejb remove
test that the jsr77 mejb is available
public void test auto commit off in user tx2 try create table user transaction ut user transaction new initial context lookup user transaction ut begin insert and check auto commit ut rollback catch ejbexception e throw e end of try catch catch exception e throw new ejbexception untested problem in test e end of catch finally check row and drop table end of try catch
describe code test auto commit off in user tx2 code method here
public void create table try data source ds data source new initial context lookup java default ds connection c1 ds get connection connection uc1 wrapped connection c1 get underlying connection if c1 get auto commit false throw new ejbexception initial autocommit state false end of if statement s1 c1 create statement try s1 execute create table autocommittest id integer finally s1 close c1 close end of try catch catch ejbexception e throw e end of try catch catch exception e throw new ejbexception untested problem in test e end of catch
describe code create table code method here
public void insert and check auto commit try data source ds data source new initial context lookup java default ds connection c1 ds get connection connection uc1 wrapped connection c1 get underlying connection statement s1 c1 create statement try s1 execute insert into autocommittest values 1 if uc1 get auto commit throw new ejbexception underlying autocommit is true in user tx end of if finally s1 close c1 close end of try catch catch ejbexception e throw e end of try catch catch exception e throw new ejbexception untested problem in test e end of catch
describe code insert and check auto commit code method here
public void deploy string name throws exception if boolean get boolean elbatest nodeploy true log debug skipping deployment of name return string deploy url get deploy url name log debug deploying name url deploy url invoke get deployer name deploy new object deploy url new string java lang string set deployed deploy url
deploy a package with the main deployer
public void undeploy string name throws exception if boolean get boolean elbatest nodeploy true return string deploy name get deploy url name invoke get deployer name undeploy new object deploy name new string java lang string set un deployed deploy name
undeploy a package with the main deployer
public void test jndiresource throws exception get log debug test jndiresource management jsr77 mejb get management ejb string domain name jsr77 mejb get default domain object name query name new object name domain name j2 eemanaged object type jndiresource j2 ee type set names jsr77 mejb query names query name null if names is empty fail could not find jsr 77 jndiresource jndiresource j2 ee type iterator iter names iterator while iter has next get log debug jndiresource iter next jsr77 mejb remove
test the jsr 77 jndiresource availability
public void test java mail resource throws exception get log debug test java mail resource management jsr77 mejb get management ejb string domain name jsr77 mejb get default domain object name query name new object name domain name j2 eemanaged object type java mail resource j2 ee type set names jsr77 mejb query names query name null if names is empty fail could not find jsr 77 java mail resource java mail resource j2 ee type iterator iter names iterator while iter has next get log debug java mail resource iter next jsr77 mejb remove
test java mail resource availability
protected void init throws exception if initial context null initial context new initial context if server null string adaptor name system get property elbatest server name if adaptor name null adaptor name jmx rmi rmiadaptor server rmiadaptor initial context lookup adaptor name
lookup the rmiadaptor interface from jndi
public void test jcaresource throws exception get log debug test jcaresource management jsr77 mejb get management ejb string domain name jsr77 mejb get default domain object name query name new object name domain name j2 eemanaged object type jcaresource j2 ee type set names jsr77 mejb query names query name null if names is empty fail could not find jsr 77 jcaresource jcaresource j2 ee type iterator iter names iterator while iter has next get log debug jcaresource iter next jsr77 mejb remove
test jcaresource availability
public void test jtaresource throws exception get log debug test jtaresource management jsr77 mejb get management ejb string domain name jsr77 mejb get default domain object name query name new object name domain name j2 eemanaged object type jtaresource j2 ee type set names jsr77 mejb query names query name null if names is empty fail could not find jsr 77 jtaresource jtaresource j2 ee type iterator iter names iterator while iter has next get log debug jtaresource iter next jsr77 mejb remove
test jtaresource availability
public void test jmsresource throws exception get log debug test jmsresource management jsr77 mejb get management ejb string domain name jsr77 mejb get default domain object name query name new object name domain name j2 eemanaged object type jmsresource j2 ee type set names jsr77 mejb query names query name null if names is empty fail could not find jsr 77 jmsresource jmsresource j2 ee type iterator iter names iterator while iter has next get log debug jmsresource iter next jsr77 mejb remove
test jmsresource availability
private void check discarded if was discarded log debug log debug attempt to invoke method on an instance that should have been discarded log debug throw new runtime exception invokation on discarded instance
check if we are called when we should have been discarded
protected context get environment try context ic new initial context return context ic lookup java comp env catch naming exception ex was discarded true throw new ejbexception ex
get a reference to the environment of this enterprise bean
public void test apiservlet throws exception url url new url base url elbatest apiservlet access url url
access the http localhost elba test apiservlet
protected data source get data source try return data source get environment lookup jdbc entityexc catch naming exception ex was discarded true throw new ejbexception ex
return the data source of this enterprise bean
public void test ejbon startup servlet throws exception url url new url base url elbatest ejbon startup servlet access url url
access the http localhost elba test ejbon startup servlet
public void test encservlet throws exception url url new url base url elbatest encservlet access url url
access the http localhost elba test encservlet
public void test ejbservlet throws exception url url new url base url elbatest ejbservlet access url url
access the http localhost elba test ejbservlet
public void test entity servlet throws exception url url new url base url elbatest entity servlet access url url
access the http localhost elba test entity servlet
public void test stateful session servlet throws exception url url new url base url elbatest stateful session servlet access url url need a mechanism to force passivation access url url
access the http localhost elba test stateful session servlet
public void test user transaction servlet throws exception url url new url base url elbatest user transaction servlet access url url
access the http localhost elba test user transaction servlet
public void test speed servlet throws exception url url new url base url elbatest speed servlet access url url
access the http localhost elba test speed servlet
public void test snoop jsp throws exception url url new url base url elbatest snoop jsp access url url
access the http localhost elba test snoop
public void test snoop jspby pattern throws exception url url new url base url elbatest test snoop snp access url url
access the http localhost elba test snoop
public void test snoop jspby mapping throws exception url url new url base url elbatest test jsp mapping access url url
access the http localhost elba test test jsp mapping
public void test jspclasspath throws exception url url new url base url elbatest classpath jsp access url url
access the http localhost elba test classpath