Package de.hybris.platform.test
Class AbstractCacheUnitThreadTest
java.lang.Object
de.hybris.platform.testframework.HybrisJUnit4Test
de.hybris.platform.test.AbstractCacheUnitThreadTest
- All Implemented Interfaces:
JaloSessionHolder
Test
AbstractCacheUnit and Cache behavior, especially in multi-threaded mode.-
Field Summary
Fields inherited from class de.hybris.platform.testframework.HybrisJUnit4Test
jaloSession -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTests whetherAbstractCacheUnit.compute()is really working exclusively whenCache.isForceExclusiveComputation()is switched on.voidTests whetherCache.getOrAddUnit(AbstractCacheUnit)is ensuring that only one unit per key is being added even if multiple threads are trying that at the same time.voidTests multiple threads accessingAbstractCacheUnitand implicitelyCache, without testing for correctness! Instead it compares the memory before access, after filling up and after clearing the cache.Methods inherited from class de.hybris.platform.testframework.HybrisJUnit4Test
establishJaloSession, finish, getOrCreateCurrency, getOrCreateLanguage, init, intenseChecksActivated, takeJaloSession
-
Constructor Details
-
AbstractCacheUnitThreadTest
public AbstractCacheUnitThreadTest()
-
-
Method Details
-
testMultiThreadedAccessAndMemory
Tests multiple threads accessingAbstractCacheUnitand implicitelyCache, without testing for correctness! Instead it compares the memory before access, after filling up and after clearing the cache. The test will fail if after clear the memory gain is higher than a allowed gain (atm 50 bytes per thread, which is 5000 bytes for 100 threads).- Throws:
InterruptedException
-
testExclusiveUnitAddToCache
Tests whetherCache.getOrAddUnit(AbstractCacheUnit)is ensuring that only one unit per key is being added even if multiple threads are trying that at the same time. To enforce potential errors the test runs several turns of all threads trying to add a unit with the same key per turn.- Throws:
InterruptedException
-
testExclusiveComputation
Tests whetherAbstractCacheUnit.compute()is really working exclusively whenCache.isForceExclusiveComputation()is switched on. To test this we let many threads try to access the cache using one unit per thread having the same key.- Throws:
InterruptedException
-