You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Benedikt Ritter <br...@apache.org> on 2014/04/03 13:11:13 UTC

Re: svn commit: r1584225 - in /commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils: struct/LRUMapConcurrentTest.java struct/LRUMapConcurrentUnitTest.java struct/SortedPrefArrayUnitTest.java threadpool/ThreadPoolUnitTest.java

Hi sebb,


2014-04-03 2:16 GMT+02:00 <se...@apache.org>:

> Author: sebb
> Date: Thu Apr  3 00:16:40 2014
> New Revision: 1584225
>
> URL: http://svn.apache.org/r1584225
> Log:
> Tidy up
>
> Modified:
>
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentTest.java
>
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
>
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java
>
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java
>
> Modified:
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentTest.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentTest.java?rev=1584225&r1=1584224&r2=1584225&view=diff
>
> ==============================================================================
> ---
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentTest.java
> (original)
> +++
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentTest.java
> Thu Apr  3 00:16:40 2014
> @@ -44,16 +44,6 @@ public class LRUMapConcurrentTest
>      }
>
>      /**
> -     * Description of the Method
> -     * @param args Description of the Parameter
> -     */
> -    public static void main( String args[] )
> -    {
> -        String[] testCaseName = { LRUMapConcurrentTest.class.getName() };
> -        junit.textui.TestRunner.main( testCaseName );
> -    }
> -
> -    /**
>       * A unit test suite for JUnit
>       * @return The test suite
>       */
> @@ -163,9 +153,9 @@ public class LRUMapConcurrentTest
>          Iterator<?> it = map.entrySet().iterator();
>          while ( it.hasNext() )
>          {
> -            System.out.println( it.next() );
> +            assertNotNull( it.next() );
>          }
> -        System.out.println( map.getStatistics() );
> +//        System.out.println( map.getStatistics() );
>
>          // get the max out backwards
>          for ( int i = total - 1; i >= 0; i-- )
> @@ -174,7 +164,7 @@ public class LRUMapConcurrentTest
>              assertNotNull( "[" + i + ":key] should not be null", res );
>          }
>
> -        System.out.println( map.getStatistics() );
> +//        System.out.println( map.getStatistics() );
>
>          //since we got them backwards the total should be at the end.
>          // add one confirm that total is gone.
> @@ -213,7 +203,7 @@ public class LRUMapConcurrentTest
>              assertNotNull( "[" + i + ":key] should not be null", res );
>          }
>
> -        System.out.println( map.getStatistics() );
> +//        System.out.println( map.getStatistics() );
>
>      }
>
>
> Modified:
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java?rev=1584225&r1=1584224&r2=1584225&view=diff
>
> ==============================================================================
> ---
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
> (original)
> +++
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
> Thu Apr  3 00:16:40 2014
> @@ -161,9 +161,9 @@ public class LRUMapConcurrentUnitTest
>          Iterator<?> it = map.entrySet().iterator();
>          while ( it.hasNext() )
>          {
> -            System.out.println( it.next() ); // TODO replace noise with
> an assertion
> +            assertNotNull( it.next() );
>          }
> -        System.out.println( map.getStatistics() ); // TODO replace noise
> with an assertion
> +//        System.out.println( map.getStatistics() );
>

I don't understand this changes. Do you still intend to replace this with
an assertion? Then why has the TODO been droped? Or is it obsolete? Then
why keep the commented out line at all?


>
>          // get the max out backwards
>          for ( int i = total - 1; i >= 0; i-- )
> @@ -172,7 +172,7 @@ public class LRUMapConcurrentUnitTest
>              assertNotNull( "[" + i + ":key] should not be null", res );
>          }
>
> -        System.out.println( map.getStatistics() ); // TODO replace noise
> with an assertion
> +//        System.out.println( map.getStatistics() );
>
>          //since we got them backwards the total should be at the end.
>          // add one confirm that total is gone.
>
> Modified:
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java?rev=1584225&r1=1584224&r2=1584225&view=diff
>
> ==============================================================================
> ---
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java
> (original)
> +++
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java
> Thu Apr  3 00:16:40 2014
> @@ -394,7 +394,7 @@ public class SortedPrefArrayUnitTest
>
>          // DO WORK
>          Comparable<String> taken = array.takeNearestLargerOrEqual( "04" );
> -        System.out.println( "testTakeLargerThanGreatest" +
> array.dumpArray() );
> +//        System.out.println( "testTakeLargerThanGreatest" +
> array.dumpArray() );
>
>          assertNull( "We should have nothing since the largest element was
> smaller than what we asked for. "
>              + " Instead we got " + taken, taken );
>
> Modified:
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java?rev=1584225&r1=1584224&r2=1584225&view=diff
>
> ==============================================================================
> ---
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java
> (original)
> +++
> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java
> Thu Apr  3 00:16:40 2014
> @@ -59,12 +59,13 @@ public class ThreadPoolUnitTest
>              pool.execute( new Runnable()
>              {
>
> +                @Override
>                  public void run()
>                  {
>                      try
>                      {
>                          //System.out.println( cnt );
> -                        System.out.println( "count = " + cnt + " before
> sleep current size = " + myPool.getPoolSize() );
> +//                        System.out.println( "count = " + cnt + " before
> sleep current size = " + myPool.getPoolSize() );
>                          Thread.sleep( 200 / cnt );
>                          //System.out.println( "count = " + cnt + " after
> sleep current size = " + myPool.getPool().getPoolSize() );
>                      }
>
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Re: svn commit: r1584225 - in /commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils: struct/LRUMapConcurrentTest.java struct/LRUMapConcurrentUnitTest.java struct/SortedPrefArrayUnitTest.java threadpool/ThreadPoolUnitTest.java

Posted by sebb <se...@gmail.com>.
On 3 April 2014 12:11, Benedikt Ritter <br...@apache.org> wrote:
> Hi sebb,
>
>
> 2014-04-03 2:16 GMT+02:00 <se...@apache.org>:
>
>> Author: sebb
>> Date: Thu Apr  3 00:16:40 2014
>> New Revision: 1584225
>>
>> URL: http://svn.apache.org/r1584225
>> Log:
>> Tidy up
>>
>> Modified:
>>
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentTest.java
>>
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
>>
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java
>>
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java
>>
>> Modified:
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentTest.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentTest.java?rev=1584225&r1=1584224&r2=1584225&view=diff
>>
>> ==============================================================================
>> ---
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentTest.java
>> (original)
>> +++
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentTest.java
>> Thu Apr  3 00:16:40 2014
>> @@ -44,16 +44,6 @@ public class LRUMapConcurrentTest
>>      }
>>
>>      /**
>> -     * Description of the Method
>> -     * @param args Description of the Parameter
>> -     */
>> -    public static void main( String args[] )
>> -    {
>> -        String[] testCaseName = { LRUMapConcurrentTest.class.getName() };
>> -        junit.textui.TestRunner.main( testCaseName );
>> -    }
>> -
>> -    /**
>>       * A unit test suite for JUnit
>>       * @return The test suite
>>       */
>> @@ -163,9 +153,9 @@ public class LRUMapConcurrentTest
>>          Iterator<?> it = map.entrySet().iterator();
>>          while ( it.hasNext() )
>>          {
>> -            System.out.println( it.next() );
>> +            assertNotNull( it.next() );
>>          }
>> -        System.out.println( map.getStatistics() );
>> +//        System.out.println( map.getStatistics() );
>>
>>          // get the max out backwards
>>          for ( int i = total - 1; i >= 0; i-- )
>> @@ -174,7 +164,7 @@ public class LRUMapConcurrentTest
>>              assertNotNull( "[" + i + ":key] should not be null", res );
>>          }
>>
>> -        System.out.println( map.getStatistics() );
>> +//        System.out.println( map.getStatistics() );
>>
>>          //since we got them backwards the total should be at the end.
>>          // add one confirm that total is gone.
>> @@ -213,7 +203,7 @@ public class LRUMapConcurrentTest
>>              assertNotNull( "[" + i + ":key] should not be null", res );
>>          }
>>
>> -        System.out.println( map.getStatistics() );
>> +//        System.out.println( map.getStatistics() );
>>
>>      }
>>
>>
>> Modified:
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java?rev=1584225&r1=1584224&r2=1584225&view=diff
>>
>> ==============================================================================
>> ---
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
>> (original)
>> +++
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/LRUMapConcurrentUnitTest.java
>> Thu Apr  3 00:16:40 2014
>> @@ -161,9 +161,9 @@ public class LRUMapConcurrentUnitTest
>>          Iterator<?> it = map.entrySet().iterator();
>>          while ( it.hasNext() )
>>          {
>> -            System.out.println( it.next() ); // TODO replace noise with
>> an assertion
>> +            assertNotNull( it.next() );
>>          }
>> -        System.out.println( map.getStatistics() ); // TODO replace noise
>> with an assertion
>> +//        System.out.println( map.getStatistics() );
>>
>
> I don't understand this changes. Do you still intend to replace this with
> an assertion? Then why has the TODO been droped? Or is it obsolete? Then
> why keep the commented out line at all?

I originally added the TODO to all the noisy lines.
On review, I decided that some did not make sense as assertions.
I was considering dropping the line altogether but thought it might be
useful as potential debug, so left it to save typing later.

The main purpose of the changes was to reduce the output noise, which
I have done somewhat.

>
>>
>>          // get the max out backwards
>>          for ( int i = total - 1; i >= 0; i-- )
>> @@ -172,7 +172,7 @@ public class LRUMapConcurrentUnitTest
>>              assertNotNull( "[" + i + ":key] should not be null", res );
>>          }
>>
>> -        System.out.println( map.getStatistics() ); // TODO replace noise
>> with an assertion
>> +//        System.out.println( map.getStatistics() );
>>
>>          //since we got them backwards the total should be at the end.
>>          // add one confirm that total is gone.
>>
>> Modified:
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java?rev=1584225&r1=1584224&r2=1584225&view=diff
>>
>> ==============================================================================
>> ---
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java
>> (original)
>> +++
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/struct/SortedPrefArrayUnitTest.java
>> Thu Apr  3 00:16:40 2014
>> @@ -394,7 +394,7 @@ public class SortedPrefArrayUnitTest
>>
>>          // DO WORK
>>          Comparable<String> taken = array.takeNearestLargerOrEqual( "04" );
>> -        System.out.println( "testTakeLargerThanGreatest" +
>> array.dumpArray() );
>> +//        System.out.println( "testTakeLargerThanGreatest" +
>> array.dumpArray() );
>>
>>          assertNull( "We should have nothing since the largest element was
>> smaller than what we asked for. "
>>              + " Instead we got " + taken, taken );
>>
>> Modified:
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java?rev=1584225&r1=1584224&r2=1584225&view=diff
>>
>> ==============================================================================
>> ---
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java
>> (original)
>> +++
>> commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/utils/threadpool/ThreadPoolUnitTest.java
>> Thu Apr  3 00:16:40 2014
>> @@ -59,12 +59,13 @@ public class ThreadPoolUnitTest
>>              pool.execute( new Runnable()
>>              {
>>
>> +                @Override
>>                  public void run()
>>                  {
>>                      try
>>                      {
>>                          //System.out.println( cnt );
>> -                        System.out.println( "count = " + cnt + " before
>> sleep current size = " + myPool.getPoolSize() );
>> +//                        System.out.println( "count = " + cnt + " before
>> sleep current size = " + myPool.getPoolSize() );
>>                          Thread.sleep( 200 / cnt );
>>                          //System.out.println( "count = " + cnt + " after
>> sleep current size = " + myPool.getPool().getPoolSize() );
>>                      }
>>
>>
>>
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org