You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by pa...@apache.org on 2002/02/04 20:54:40 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/portletcache TestTurbineCache.java

paulsp      02/02/04 11:54:40

  Modified:    src/java/org/apache/jetspeed/services/portletcache
                        TestTurbineCache.java
  Log:
  Apply a Jetspeed version of the turbine patch commited by Jeff Brekke.  Below the log
  message from Jeff's commit
  
     Updated test case to work on even slower or heavily loaded machines.  This was
     not an issue with what was being tested, rather how soon the test was looking
     for information.
  
  Revision  Changes    Path
  1.4       +13 -22    jakarta-jetspeed/src/java/org/apache/jetspeed/services/portletcache/TestTurbineCache.java
  
  Index: TestTurbineCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/portletcache/TestTurbineCache.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestTurbineCache.java	2 Feb 2002 05:25:01 -0000	1.3
  +++ TestTurbineCache.java	4 Feb 2002 19:54:40 -0000	1.4
  @@ -72,7 +72,7 @@
    * TestTurbineCache
    *
    * @author <a href="paulsp@apache.org">Paul Spencer</a>
  - * @version $Id: TestTurbineCache.java,v 1.3 2002/02/02 05:25:01 paulsp Exp $
  + * @version $Id: TestTurbineCache.java,v 1.4 2002/02/04 19:54:40 paulsp Exp $
    */
   public class TestTurbineCache extends ServletTestCase {
       
  @@ -313,36 +313,27 @@
        */    
       
       public void testObjectCount() throws Exception {
  -        String testString = new String( "This is a test");
  -        Object retrievedObject = null;
  -        CachedObject cacheObject = null;
   
           GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
           .getInstance()
           .getService( GlobalCacheService.SERVICE_NAME );
  +        assertNotNull("Could not retrive cache service.", globalCache);
           
  -        // Wait 2 Refresh to allow for remove object to be deleted
  -        Thread.sleep(TURBINE_CACHE_REFRESH * 2);
  -        assertEquals("Initial Object Count", 0, globalCache.getNumberOfObjects());
  -
  -        // Create and add Object that expires in 1 turbine Refresh + 1 millis 
  -        cacheObject = new CachedObject(testString, TURBINE_CACHE_REFRESH  + 1);
  +        // Create and add Object that expires in 1.5 turbine Refresh
  +        long expireTime = TURBINE_CACHE_REFRESH + TURBINE_CACHE_REFRESH/2;
  +        CachedObject cacheObject = new CachedObject("This is a test", expireTime);
           assertNotNull( "Failed to create a cachable object", cacheObject);
  -        long addTime = System.currentTimeMillis();
  +
           globalCache.addObject(cacheKey, cacheObject);
  -        
           assertEquals("After adding 1 Object", 1, globalCache.getNumberOfObjects());
           
  -        // Wait 1 Refresh
  -        Thread.sleep(TURBINE_CACHE_REFRESH + 1);
  -        assertEquals("After refresh", 1, globalCache.getNumberOfObjects());
  -
  -        // Wait 2 additional Refresh
  -        Thread.sleep((TURBINE_CACHE_REFRESH * 2) + 1);
  -        assertEquals("After refresh", 0, globalCache.getNumberOfObjects());
  -
  -        // Remove objects
  -        globalCache.removeObject(cacheKey);
  +        // Wait until we're passed 1 refresh, but not half way.
  +        Thread.sleep(TURBINE_CACHE_REFRESH + TURBINE_CACHE_REFRESH/3);
  +        assertEquals("After one refresh", 1, globalCache.getNumberOfObjects());
  +
  +        // Wait until we're passed 2 more refreshes
  +        Thread.sleep((TURBINE_CACHE_REFRESH * 2) + TURBINE_CACHE_REFRESH/3);
  +        assertEquals("After three refreshes", 0, globalCache.getNumberOfObjects());
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/portletcache TestTurbineCache.java

Posted by Paul Spencer <pa...@apache.org>.
Santiago,
JUnit 3.7 has depracated their assert().

Paul Spencer

Santiago Gala wrote:

> paulsp@apache.org wrote:
> 
>> paulsp      02/02/04 11:54:40
>>
>>  Modified:    src/java/org/apache/jetspeed/services/portletcache
>>                        TestTurbineCache.java
>>  Log:
>>  Apply a Jetspeed version of the turbine patch commited by Jeff 
>> Brekke.  Below the log
>>  message from Jeff's commit
>>  
>>     Updated test case to work on even slower or heavily loaded 
>> machines.  This was
>>     not an issue with what was being tested, rather how soon the test 
>> was looking
>>     for information.
>>  
>>
> (...)
> 
>> GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
>>           .getInstance()
>>           .getService( GlobalCacheService.SERVICE_NAME );
>>  +        assertNotNull("Could not retrive cache service.", globalCache);
>>
>>
> Just in case you don't know, I have received warnings "assert is a 
> reserved keyword" when compiling under jdk1.4beta.
> 
> I have not tested if it is the case for assertNotNull (I don't think 
> so), but seeing Paul's change reminded me I have seen this warning 
> compiling jetspeed (somewhere in DBProfiler code).
> 
> For everybody: please don't use the assert (future) keyword or we will 
> have to edit it to some other name. Looks like they are thinking into 
> having a standard for assertions in java.
> 
> (...)
> 
> 
> 
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/portletcache TestTurbineCache.java

Posted by Santiago Gala <sg...@hisitech.com>.
paulsp@apache.org wrote:

>paulsp      02/02/04 11:54:40
>
>  Modified:    src/java/org/apache/jetspeed/services/portletcache
>                        TestTurbineCache.java
>  Log:
>  Apply a Jetspeed version of the turbine patch commited by Jeff Brekke.  Below the log
>  message from Jeff's commit
>  
>     Updated test case to work on even slower or heavily loaded machines.  This was
>     not an issue with what was being tested, rather how soon the test was looking
>     for information.
>  
>
(...)

>GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
>           .getInstance()
>           .getService( GlobalCacheService.SERVICE_NAME );
>  +        assertNotNull("Could not retrive cache service.", globalCache);
> 
>
Just in case you don't know, I have received warnings "assert is a 
reserved keyword" when compiling under jdk1.4beta.

I have not tested if it is the case for assertNotNull (I don't think 
so), but seeing Paul's change reminded me I have seen this warning 
compiling jetspeed (somewhere in DBProfiler code).

For everybody: please don't use the assert (future) keyword or we will 
have to edit it to some other name. Looks like they are thinking into 
having a standard for assertions in java.

(...)



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>