org.alfresco.repo.cache
Class CacheTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.alfresco.repo.cache.CacheTest
All Implemented Interfaces:
junit.framework.Test

public class CacheTest
extends junit.framework.TestCase

See Also:
EhCacheAdapter

Constructor Summary
CacheTest()
           
 
Method Summary
static void main(java.lang.String[] args)
           
 long runPerformanceTestOnCache(org.alfresco.repo.cache.SimpleCache cache, int objectCount)
          Preloads the cache, then performs a simultaneous addition of N new values and removal of the N preloaded values.
 void setUp()
           
 void tearDown()
           
 void testConcurrentAddAgainstAdd()
           Add to the transaction cache Add to the backing cache Commit
 void testConcurrentAddAgainstAddSame()
           Add to the transaction cache Add to the backing cache Commit
 void testConcurrentAddAgainstClear()
           Add to the transaction cache Clear the backing cache Commit
 void testConcurrentRemoveAgainstClear()
           Add to the backing cache Remove from the transactional cache Clear the backing cache Commit
 void testConcurrentRemoveAgainstRemove()
           Add to the backing cache Remove from the transactional cache Remove from the backing cache Commit
 void testConcurrentRemoveAgainstUpdate_NoPreExisting()
           Remove from the backing cache Remove from the transactional cache Add to the backing cache Commit
 void testConcurrentRemoveAgainstUpdate_PreExisting()
           Add to the backing cache Remove from the transactional cache Add to the backing cache Commit
 void testConcurrentUpdateAgainstClear()
           Add to the backing cache Update the transactional cache Clear the backing cache Commit
 void testConcurrentUpdateAgainstRemove()
           Add to the backing cache Update the transactional cache Remove from the backing cache Commit
 void testConcurrentUpdateAgainstUpdate()
           Add to the backing cache Update the transactional cache Update the backing cache Commit
 void testConcurrentUpdateAgainstUpdateNull()
           Add to the backing cache Update the transactional cache Update the backing cache with a null value Commit
 void testConcurrentUpdateNullAgainstUpdate()
           Add to the backing cache Update the transactional cache with a null value Update the backing cache Commit
 void testEhcacheAdaptors()
           
 void testInitializationPerformance()
          Time how long it takes to create and complete a whole lot of transactions
 void testMaxSizeOverrun()
          Add 50K objects into the transactional cache and checks that the first object added has been discarded.
 void testNullValue()
          Starts off with a null in the backing cache and adds a value to the transactional cache.
 void testObjectCache()
           
 void testPerformance()
          Tests a straight Ehcache adapter against a transactional cache both in and out of a transaction.
 void testRollbackCleanup()
           
 void testSetUp()
           
 void testTransactionalCacheNoTxn()
           
 void testTransactionalCacheWithSingleTxn()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CacheTest

public CacheTest()
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

public void tearDown()
Overrides:
tearDown in class junit.framework.TestCase

testSetUp

public void testSetUp()
               throws java.lang.Exception
Throws:
java.lang.Exception

testObjectCache

public void testObjectCache()
                     throws java.lang.Exception
Throws:
java.lang.Exception

testEhcacheAdaptors

public void testEhcacheAdaptors()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testTransactionalCacheNoTxn

public void testTransactionalCacheNoTxn()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

testRollbackCleanup

public void testRollbackCleanup()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testTransactionalCacheWithSingleTxn

public void testTransactionalCacheWithSingleTxn()
                                         throws java.lang.Throwable
Throws:
java.lang.Throwable

runPerformanceTestOnCache

public long runPerformanceTestOnCache(org.alfresco.repo.cache.SimpleCache cache,
                                      int objectCount)
Preloads the cache, then performs a simultaneous addition of N new values and removal of the N preloaded values.

Parameters:
cache -
objectCount -
Returns:
Returns the time it took in nanoseconds.

testPerformance

public void testPerformance()
                     throws java.lang.Exception
Tests a straight Ehcache adapter against a transactional cache both in and out of a transaction. This is done repeatedly, pushing the count up.

Throws:
java.lang.Exception

testInitializationPerformance

public void testInitializationPerformance()
                                   throws java.lang.Exception
Time how long it takes to create and complete a whole lot of transactions

Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
See Also:
CacheTest.testPerformance()

testNullValue

public void testNullValue()
                   throws java.lang.Exception
Starts off with a null in the backing cache and adds a value to the transactional cache. There should be no problem with this.

Throws:
java.lang.Exception

testMaxSizeOverrun

public void testMaxSizeOverrun()
                        throws java.lang.Exception
Add 50K objects into the transactional cache and checks that the first object added has been discarded.

Throws:
java.lang.Exception

testConcurrentAddAgainstAdd

public void testConcurrentAddAgainstAdd()
                                 throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentAddAgainstAddSame

public void testConcurrentAddAgainstAddSame()
                                     throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentAddAgainstClear

public void testConcurrentAddAgainstClear()
                                   throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentUpdateAgainstUpdate

public void testConcurrentUpdateAgainstUpdate()
                                       throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentUpdateAgainstUpdateNull

public void testConcurrentUpdateAgainstUpdateNull()
                                           throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentUpdateNullAgainstUpdate

public void testConcurrentUpdateNullAgainstUpdate()
                                           throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentUpdateAgainstRemove

public void testConcurrentUpdateAgainstRemove()
                                       throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentUpdateAgainstClear

public void testConcurrentUpdateAgainstClear()
                                      throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentRemoveAgainstUpdate_NoPreExisting

public void testConcurrentRemoveAgainstUpdate_NoPreExisting()
                                                     throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentRemoveAgainstUpdate_PreExisting

public void testConcurrentRemoveAgainstUpdate_PreExisting()
                                                   throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentRemoveAgainstRemove

public void testConcurrentRemoveAgainstRemove()
                                       throws java.lang.Throwable

Throws:
java.lang.Throwable

testConcurrentRemoveAgainstClear

public void testConcurrentRemoveAgainstClear()
                                      throws java.lang.Throwable

Throws:
java.lang.Throwable


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.