public void test_singleResourceLocking_waitsFor_defaultConcurrency20() throws Exception {
  final Properties properties=new Properties();
  final int nthreads=20;
  final int ntasks=1000;
  properties.setProperty(TestOptions.CORE_POOL_SIZE,"" + nthreads);
  properties.setProperty(TestOptions.NTASKS,"" + ntasks);
  properties.setProperty(TestOptions.NRESOURCES,"100");
  properties.setProperty(TestOptions.MIN_LOCKS,"1");
  properties.setProperty(TestOptions.MAX_LOCKS,"1");
  properties.setProperty(TestOptions.PREDECLARE_LOCKS,"false");
  properties.setProperty(TestOptions.SORT_LOCK_REQUESTS,"false");
  final Result result=doComparisonTest(properties);
  assertEquals("ndeadlock",0,Integer.parseInt(result.get("ndeadlock")));
  assertEquals("nsuccess",ntasks,Integer.parseInt(result.get("nsuccess")));
  assertEquals("maxrunning",nthreads,Integer.parseInt(result.get("maxrunning")));
}

public void test_singleResourceLocking_waitsFor_defaultConcurrency20 ( ) throws Exception { final Properties properties = new Properties ( ) ; final int nthreads = 20 ; final int ntasks = 1000 ; properties . setProperty ( TestOptions . CORE_POOL_SIZE , "" + nthreads ) ; properties . setProperty ( TestOptions . NTASKS , "" + ntasks ) ; properties . setProperty ( TestOptions . NRESOURCES , "100" ) ; properties . setProperty ( TestOptions . MIN_LOCKS , "1" ) ; properties . setProperty ( TestOptions . MAX_LOCKS , "1" ) ; properties . setProperty ( TestOptions . PREDECLARE_LOCKS , "false" ) ; properties . setProperty ( TestOptions . SORT_LOCK_REQUESTS , "false" ) ; final Result result = doComparisonTest ( properties ) ; assertEquals ( "ndeadlock" , 0 , Integer . parseInt ( result . get ( "ndeadlock" ) ) ) ; assertEquals ( "nsuccess" , ntasks , Integer . parseInt ( result . get ( "nsuccess" ) ) ) ; assertEquals ( "maxrunning" , nthreads , Integer . parseInt ( result . get ( "maxrunning" ) ) ) ; }
test where each operation locks only a single resource using a thread pool with 20 core threads . since there is no timeout , all tasks should run to completion . the maximum observed concurrency should be equal to the size of the thread pool .
