input
stringlengths
10
828
output
stringlengths
5
107
private int find resource xaresource xa res a linear search may seem slow but please note that the number of xa resources registered with a transaction are usually low note this searches backwards intentionally it ensures that if this resource was enlisted multiple times then the last one will be returned all others sh...
return index of xaresource or code 1 code if not found
public void check notification id timer notification p notification integer p notification id if p notification null fail notification is null if p notification get notification id equals p notification id fail wrong notification id received p notification get notification id expected p notification id
checks if the given notification id is the same as the
private long calc time long offset return system current time millis offset
calculate the time using an offset from the current time
public void test invoke qualified unqualified invoke property 1 my domain property 1
test invoke qualified unqualifed
private void update role role role array list old role value roles put role get role name role try check service proxy service proxy update role map relation id role old role value service proxy send role update notification relation id role old role value catch exception e throw new runtime exception e to string
update the role
public void test integer throws exception value exp one query value 10 value exp two query value 20 value exp div query value 2 value exp minus query value 10 value exp mult query value 200 value exp plus query value 30 equals test one two operation test one two div minus mult plus comparison test one two between test ...
test a int
public void test default notification filter support nfs new notification filter support assert equals false nfs is notification enabled n1 assert equals false nfs is notification enabled n2 assert equals false nfs is notification enabled n3 assert equals false nfs is notification enabled n4 assert equals false nfs is ...
by default all types are disabled
public void test string constructor object instance instance null try instance new object instance test type test class name catch exception e fail e to string did it work assert equals test type test instance get object name to string assert equals class name instance get class name
test string constructor
public void test object name constructor object instance instance null object name object name null try object name new object name type test instance new object instance object name class name catch exception e fail e to string did it work assert equals object name instance get object name assert equals class name ins...
test object name constructor
public void test enable type notification filter support nfs new notification filter support nfs enable type type1plus assert equals false nfs is notification enabled n1 assert equals false nfs is notification enabled n2 assert equals true nfs is notification enabled n3 assert equals false nfs is notification enabled n...
enable a single type all others should be disabled
public void test invoke unqualified unqualified invoke property 1 property 1
test invoke unqualified unqualified
public void test disable all types notification filter support nfs new notification filter support nfs enable type type1 nfs enable type type2 nfs disable all types assert equals false nfs is notification enabled n1 assert equals false nfs is notification enabled n2 assert equals false nfs is notification enabled n3 as...
enable some types then disable everyting
public void test disable type notification filter support nfs new notification filter support nfs enable type type1 nfs enable type type2 nfs disable type type1 assert equals false nfs is notification enabled n1 assert equals false nfs is notification enabled n2 assert equals false nfs is notification enabled n3 assert...
enable some types the disable one of them
public void test prefix notification filter support nfs new notification filter support nfs enable type type1 assert equals true nfs is notification enabled n1 assert equals true nfs is notification enabled n2 assert equals true nfs is notification enabled n3 assert equals false nfs is notification enabled n4 assert eq...
enable a prefix that matched multiple types
public void test add nlunqualified name listener register qualified add nlname listener my domain property 1 property 1
add notification listenter
public void test long throws exception value exp one query value 10l value exp two query value 20l value exp div query value 2l value exp minus query value 10l value exp mult query value 200l value exp plus query value 30l equals test one two operation test one two div minus mult plus comparison test one two between te...
test a long
public void test add nlqualified name listener register unqualified add nlname listener property 1 my domain property 1
add notification listenter
public void test add nlunqualified name listener register unqualified add nlname listener property 1 property 1
add notification listenter
public void test add nlunqualified qualified register unqualified qualified add nlname name property 1 my domain property 2 property 1 my domain property 2
add notification listenter
public void test add nlunqualified qualified register qualified qualified add nlname name property 1 my domain property 2 my domain property 1 my domain property 2
add notification listenter
public void test add nlqualified qualified register unqualified qualified add nlname name my domain property 1 my domain property 2 property 1 my domain property 2
add notification listenter
public void test add nlqualified unqualified register qualified unqualified add nlname name my domain property 1 property 2 my domain property 1 property 2
add notification listenter
private void do before completion unlock try for int i 0 i sync count i try if trace log trace calling sync i sync i end of if sync i before completion catch throwable t if trace log trace failed before completion t status status status marked rollback save the cause off so the user can inspect it cause t break finally...
call synchronization code before completion code
public void test and true both throws exception new query test new mbean new mbean new number test 0 domain1 type instance1 new mbean 0 query and query eq query value 10 query value 10 query eq query value hello query value hello test
test and is true both
public void test add nlqualified unqualified register qualified qualified add nlname name my domain property 1 property 2 my domain property 1 my domain property 2
add notification listenter
public void test add nlqualified qualified register qualified unqualified add nlname name my domain property 1 my domain property 2 my domain property 1 property 2
add notification listenter
public void test and false first throws exception new query test new mbean 0 new mbean new mbean new number test 0 domain1 type instance1 query and query eq query value 10 query value 20 query eq query value hello query value hello test
test and is false first parameter
private void do after completion assert status indicates too late to add new synchronizations unlock try for int i 0 i sync count i try sync i after completion status catch throwable t if trace log trace failed after completion t finally lock
call synchronization code after completion code
public void test and false second throws exception new query test new mbean 0 new mbean new mbean new number test 0 domain1 type instance1 query and query eq query value 10 query value 10 query eq query value hello query value goodbye test
test and is false second parameter
private void add nlname listener string register string test mbean server server null object name register name null object name test name null try server mbean server factory create mbean server my domain register name new object name register test name new object name test server register mbean new broadcaster regist...
add notification listenter
public void test and false both throws exception new query test new mbean 0 new mbean new mbean new number test 0 domain1 type instance1 query and query eq query value 10 query value 20 query eq query value hello query value goodbye test
test and is false both parameters
public void test or true both throws exception new query test new mbean new mbean new number test 0 domain1 type instance1 new mbean 0 query or query eq query value 10 query value 10 query eq query value hello query value hello test
test or is true both
public void test or false first throws exception new query test new mbean new mbean new number test 0 domain1 type instance1 new mbean 0 query or query eq query value 10 query value 20 query eq query value hello query value hello test
test or is false first parameter
public void test or false second throws exception new query test new mbean 0 new mbean new mbean new number test 0 domain1 type instance1 query and query eq query value 10 query value 10 query eq query value hello query value goodbye test
test or is false second parameter
public void test or false both throws exception new query test new mbean 0 new mbean new mbean new number test 0 domain1 type instance1 query or query eq query value 10 query value 20 query eq query value hello query value goodbye test
test or is false both parameters
public void test class attribute throws exception new query test new mbean new mbean new number test 0 domain1 type instance1 new mbean new mbean new trivial domain1 type instance2 query eq query classattr query value number test class get name test
test class attribute
private xid create xid branch long branch id last branch id return xid factory new branch xid branch id
create an xid representing a new branch of this transaction
public void test instantiate with default constructor throws exception mbean server server mbean server factory new mbean server object o server instantiate test compliance server support test assert true o instanceof test compliance server support test
tests instantiate string class name
private boolean is one resource if resource count 1 return true first xaresource surely has 1 it s the first for int i 1 i resource count i if resource same rm i 1 this one is not the same rm as previous ones there must be at least 2 return false all rms are the same one one phase commit is ok return true
check if we can do one phase optimization
public void test instantiate with default constructor and application exception throws exception try mbean server server mbean server factory new mbean server object o server instantiate test compliance server support constructor test shouldn t get here fail instantiate should have thrown an mbean exception catch mbean...
tests instantiate string class name with constructor that throws a checked application exception
public void test instantiate with default constructor and runtime exception throws exception try mbean server server mbean server factory new mbean server object o server instantiate test compliance server support constructor test2 shouldn t get here fail instantiate should have thrown a runtime mbean exception catch r...
tests instantiate string class name with constructor that throws an unchecked application exception
public void test instantiate with default constructor and error throws exception try mbean server server mbean server factory new mbean server object o server instantiate test compliance server support constructor test3 shouldn t get here fail instantiate should have thrown a runtime error exception catch runtime error...
tests instantiate string class name with constructor that throws an error
public void test descriptor support default constructor try descriptor d1 new descriptor support catch assertion failed error e throw e catch throwable t fail unexpected error t to string
tests the tt descriptor support tt default constructor
public void test descriptor support copy constructor try descriptor support d1 new descriptor support d1 set field foo bar d1 set field wombat new integer 666 descriptor support d2 new descriptor support d1 assert true d2 get field value foo equals bar assert true d2 get field value wombat equals new integer 666 descri...
tests the tt descriptor support tt copy constructor
public void test match question beginning throws exception new query test new mbean new mbean new string test hello domain1 type instance1 new mbean new string test hello domain1 type instance2 new mbean new string test ello domain1 type instance3 new mbean new mbean new string test ello domain2 type instance1 new mbea...
test match question beginning
public void test different for int i 0 i types length 1 i for int j i 1 j types length j if types i equals types j fail relation notifications types not unique
make sure all the constants are different
public void test instantiate with default constructor and unknown class throws exception try mbean server server mbean server factory new mbean server object o server instantiate foo bar should not get here fail instantiate should have thrown a reflection exception catch reflection exception e this is expected assert t...
tests instantiate string class name with unfound class
public void test different for int i 0 i statii length 1 i for int j i 1 j statii length j if statii i statii j fail role status constants are not unique
make sure all the constants are different
public void test role status role status test new role status for int i 0 i statii length i if test is role status statii i false fail statii desc is not a role status
make sure all the constants are accepted
public void test instantiate with missing default constructor throws exception try mbean server server mbean server factory new mbean server object o server instantiate test compliance server support constructor test6 should not get here fail instantiate should have thrown a reflection exception catch reflection except...
tests instantiate string class name with class that doesnt have a default constructor
public void test basic constructor set up roles array list roles new array list roles add role1 roles add role2 role list full new role list roles assert equals 2 full size assert equals role1 full get 0 assert equals role2 full get 1 iterator iterator full iterator assert equals role1 iterator next assert equals role2...
basic constructor test
public void test basic constructor ordering set up roles array list roles new array list roles add role2 roles add role1 role list full new role list roles assert equals 2 full size assert equals role2 full get 0 assert equals role1 full get 1 iterator iterator full iterator assert equals role2 iterator next assert equ...
basic constructor test ordering
public void test basic constructor set up role unresolveds array list role unresolveds new array list role unresolveds add role unresolved1 role unresolveds add role unresolved2 role unresolved list full new role unresolved list role unresolveds assert equals 2 full size assert equals role unresolved1 full get 0 assert...
basic constructor test
public void test instantiate with inaccessible no args constructor throws exception try mbean server server mbean server factory new mbean server object o server instantiate test compliance server support constructor test7 should not get here fail instantiate should have thrown a reflection exception catch reflection e...
tests instantiate string class name with protected no access no args constructor
public void test basic constructor duplicates set up roles check duplicates allowed array list roles new array list roles add role1 roles add role1 role list full new role list roles assert equals 2 full size assert equals role1 full get 0 assert equals role1 full get 1 iterator iterator full iterator assert equals rol...
basic constructor test allows duplicates
public void test basic constructor ordering set up role unresolveds array list role unresolveds new array list role unresolveds add role unresolved2 role unresolveds add role unresolved1 role unresolved list full new role unresolved list role unresolveds assert equals 2 full size assert equals role unresolved2 full get...
basic constructor test ordering
public void test basic constructor duplicates set up role unresolveds check duplicates allowed array list role unresolveds new array list role unresolveds add role unresolved1 role unresolveds add role unresolved1 role unresolved list full new role unresolved list role unresolveds assert equals 2 full size assert equal...
basic constructor test allows duplicates
public void test instantiate with null class name throws exception try mbean server server mbean server factory new mbean server object o server instantiate null should not reach here fail incorrect exception behavior catch runtime operations exception e expected check that it wraps iae assert true e get target excepti...
tests instantiate string class name with null class name
public void test delegate constructor mbean server server create mbean server object name service create relation service test type service null create roles b null relation support support null try support new relation support id service server relation type b roles b catch exception e fail e to string assert equals i...
test the delegate constructor
public void test creation removal errors2 relation notification rn null object name object name null try object name new object name a a catch exception e fail e to string array list unregs new array list boolean caught false try rn new relation notification null new relation service true 21 23 message relation id rela...
test creation removal error handling
public void test instantiate with empty class name throws exception try mbean server server mbean server factory new mbean server object o server instantiate should not reach here fail incorrect exception classloading behavior catch reflection exception e expected check that it wraps cnfe assert true e get target excep...
tests instantiate string class name with empty class name string
public void test escaping asterisk throws exception new query test new mbean new mbean new string test hello domain1 type instance1 new mbean new mbean new string test helloz domain2 type instance1 query match query attr string query value hello test
test match escaping asterisk
public void test get referenced mbeans not registered mbean server server create mbean server object name service create relation service test type service null create relation type c service create roles c server map result null try relation support support new relation support id service server relation type c roles ...
test get referenced mbeans when not registered in service
public void test get referenced mbeans when registered mbean server server create mbean server object name service create relation service test type service server create relation type c service create roles c server map result null try relation support support new relation support id service server relation type c rol...
test get referenced mbeans when registered in service
public void test escaping open bracket throws exception new query test new mbean new mbean new string test hello ab domain1 type instance1 new mbean new mbean new string test helloa domain2 type instance1 new mbean new string test hello a domain2 type instance2 query match query attr string query value hello ab test
test match escaping open bracket
public void test instantiate with null class name2 throws exception try mbean server server mbean server factory new mbean server object o server instantiate null null should not reach here fail incorrect exception behavior catch runtime operations exception e expected check that it wraps iae assert true e get target e...
tests instantiate string class name object name loader with null class name
public void test constructor try mbean feature info info new mbean feature info name this is a description assert true info get name equals name assert true info get description equals this is a description catch assertion failed error e throw e catch throwable t t print stack trace fail unexpected error t to string
tests tt mbean operation info string descr method m tt constructor
public void test get role cardinality unregistered mbean server server create mbean server object name service create relation service test type service null create roles c null integer result null relation support support null try support new relation support id service server relation type c roles c result support ge...
test get role cardinality when not registered
public void test minus in character set throws exception try new query test new mbean new mbean new string test hello domain1 type instance1 new mbean new mbean new string test hello ab domain2 type instance1 query match query attr string query value hello ab test catch assertion failed error e fail fails in ri expecte...
test match minus in character set
public void test constructor throws exception relation service rs null rs new relation service true assert equals true rs get purge flag rs new relation service false assert equals false rs get purge flag
test the constructor
public void test constructor with method try class c this get class method m c get method test constructor with method new class 0 mbean operation info info new mbean operation info this is a description m assert true info get description equals this is a description assert true info get name equals m get name assert t...
tests tt mbean operation info string descr method m tt constructor
public void test instantiate with empty class name2 throws exception try mbean server server mbean server factory new mbean server object o server instantiate null should not reach here fail incorrect exception classloading behavior catch reflection exception e expected check that it wraps cnfe assert true e get target...
tests instantiate string class name object name loader with empty class name string
public void test relation service flag mbean server server create mbean server object name service create relation service test type service null create roles b null relation support support null try support new relation support id service server relation type b roles b catch exception e fail e to string assert equals ...
test relation service flag
public void test instantiate with null class name3 throws exception try mbean server server mbean server factory new mbean server object o server instantiate null null null should not reach here fail incorrect exception behavior catch runtime operations exception e expected check that it wraps iae assert true e get tar...
tests instantiate string class name object args string sign with null
public void test retrieve all roles un registered mbean server server create mbean server object name service create relation service test type service null create roles b null role list result null try relation support support new relation support id service server relation type b roles b result support retrieve all r...
test retrieve all roles when unregistered
public void test instantiate with empty class name3 throws exception try mbean server server mbean server factory new mbean server object o server instantiate null null should not reach here fail incorrect exception classloading behavior catch reflection exception e expected check that it wraps cnfe assert true e get t...
tests instantiate string class name object args string sign with
public void test instantiate with null class name4 throws exception try mbean server server mbean server factory new mbean server object o server instantiate null null null null should not reach here fail incorrect exception behavior catch runtime operations exception e expected check that it wraps iae assert true e ge...
tests instantiate string class name object name loader object args string sign
public void test instantiate with empty class name4 throws exception try mbean server server mbean server factory new mbean server object o server instantiate null null null should not reach here fail incorrect exception classloading behavior catch reflection exception e expected check that it wraps cnfe assert true e ...
tests instantiate string class name object name loader object args string sign
public void test instantiate with default loader repository throws exception note the urls used here are relative to the location of the build xml mbean server server mbean server factory new mbean server mlet mlet new mlet mlet cl to dlr mlet add url file output etc test compliance server test jar server register mbea...
tests instantiate string class name classloading behaviour
public void set phone numbers string numbers this numbers numbers
describe code set phone numbers code method here
public string print info return user get name n address get address n phone get phone numbers 0 n phone get phone numbers 1 n phone get phone numbers 2 n
describe code print info code method here
public void test register null object name boolean caught false try mbean server server mbean server factory new mbean server server register mbean new test null catch runtime operations exception e if e get target exception instanceof illegal argument exception caught true else fail wrong wrapped exception e get targe...
tests registering with null object name
public void add phone number string number for int i 0 i numbers length i if numbers i null numbers i number break
describe code add phone number code method here
public void remove phone number int index if index 0 index numbers length return numbers index null
describe code remove phone number code method here
public void test register pattern object name boolean caught false try mbean server server mbean server factory new mbean server server register mbean new test new object name domai type test catch runtime operations exception e if e get target exception instanceof illegal argument exception caught true else fail wrong...
tests registering with a pattern object name
private void stop timer timer remove all notifications timer stop
stop the timer does a small wait to avoid problems with the ri
private integer add notification long offset long period long occurs return timer add notification timer type message user data time offset offset period occurs
add a notification
public void test create relation throws exception mbean server server mbean server factory create mbean server try object name service create relation service test type service server create relation type b service create roles b server relation support support null listener listener new listener relation notification ...
test create relation
public void test register jmimplementation object name boolean caught false try mbean server server mbean server factory new mbean server server register mbean new test new object name jmimplementation type test catch runtime operations exception e if e get target exception instanceof illegal argument exception caught ...
tests registering into jmimplementation
public dynamic mbean get mbean return invoker
retrieve the invoker for the mbean
public string get resource class name return resource class name
retrieve the class name for the mbean
public object get resource instance return resource
retrieve the mbean
public void test register jmimplementation default domain object name boolean caught false try mbean server server mbean server factory new mbean server jmimplementation server register mbean new test new object name type test catch runtime operations exception e if e get target exception instanceof illegal argument ex...
tests registering into jmimplementation using default domain
public class loader get class loader return cl
retrieve the context class loader with which to invoke the mbean
public object get value string key if value map null return value map get key return null
retrieve a value from the map
public void test register mbean on exception from pre register throws exception mbean server server mbean server factory new mbean server object name name new object name test foo bar try server register mbean new test2 name should not reach here fail test2 registered despite of throwing an exception from the pre regis...
tests register for an mbean that throws unchecked exception from pre register
protected boolean domain matches string src string pat if src equals no point doing more that we have to return true return domain matches src to char array 0 pat to char array 0
compare the src and pat strings where and chars are significant
public void test register mbean on exception from pre register2 throws exception mbean server server mbean server factory new mbean server object name name new object name test foo bar try server register mbean new test3 name should not reach here fail test3 registered despite of throwin an exception from the pre regis...
tests register for an mbean that throws checked exception from pre register
public void test register mbean on exception from pre register3 throws exception mbean server server mbean server factory new mbean server object name name new object name test foo bar try server register mbean new test4 name should not reach here fail test4 registered despite of throwing an exception from the pre regi...
tests register for an mbean that throws an mbean registration exception from
protected object name qualify name object name name if name null throw new runtime operations exception new illegal argument exception null object name try if name get domain length 0 return new object name default domain name get canonical key property list string else return name catch malformed object name exception...
qualify an object name with the default domain p