Java Doc for JCacheTest.java in  » Cache » ehcache » net » sf » ehcache » jcache » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Cache » ehcache » net.sf.ehcache.jcache 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


net.sf.ehcache.AbstractCacheTest
   net.sf.ehcache.jcache.JCacheTest

JCacheTest
public class JCacheTest extends AbstractCacheTest (Code)
Tests for a Cache
author:
   Greg Luck
version:
   $Id:JCacheTest.java 318 2007-01-25 01:48:35Z gregluck $




Method Summary
protected  JCachegetTest1Cache()
    
protected  voidsetUp()
    
protected  voidtearDown()
    
public  voidtestAPIObjectCompatibility()
    
public  voidtestAPISerializableCompatibility()
    
public  voidtestCacheExceptionHandler()
    
public  voidtestCacheStatistics()
     Test cache statistics, including get.
public  voidtestClear()
    
public  voidtestContainsKey()
    
public  voidtestContainsValue()
    
public  voidtestEhcacheConstructor()
     Create a JCache from an inactive Ehcache and try adding to CacheManager.
public  voidtestElementStatistics()
    
public  voidtestEvict()
    
public  voidtestExpiryBasedOnTimeToIdle()
     Test expiry based on time to idle.
public  voidtestExpiryBasedOnTimeToLive()
    
public  voidtestExpiryBasedOnTimeToLiveTTL()
    
public  voidtestExpiryBasedOnTimeToLiveUsingPeek()
     Test expiry based on time to live.
public  voidtestExpiryBasedOnTimeToLiveWhenNoIdle()
    
public  voidtestGet()
     Test the get method.
public  voidtestGetAll()
    
public  voidtestGetKeysAfterExpiry()
    
public  voidtestGetKeysPerformance()
     Checks the expense of checking for duplicates JSR107 has only one keyset command.
public  voidtestGetSizeAfterExpiry()
     Expire elements and verify size is correct.
public  voidtestGetValues()
     Test the get values method.
public  voidtestIsEmpty()
    
public  voidtestKeySet()
    
public  voidtestLoad()
    
public  voidtestLoadAll()
    
public  voidtestLoadWithDynamicLoaderInjection()
     Tests that the setLoader method allows the loader to be changed.
public  voidtestLoaderName()
     Test the loader name method.
public  voidtestNoIdleOrExpiryBasedOnTimeToLiveForEternal()
    
public  voidtestNoOverflowToDisk()
    
public  voidtestNonSerializableElement()
     Tests using elements with null values.
public  voidtestNullCacheEntry()
    
public  voidtestNullTreatment()
    
public  voidtestProportionMemoryAndDiskPerformance()
     Performance tests for a range of Memory Store - Disk Store combinations.

This demonstrates that a memory only store is approximately an order of magnitude faster than a disk only store.

It also shows that double the performance of a Disk Only store can be obtained with a maximum memory size of only 1.

public  voidtestPutAll()
    
public  voidtestReadWriteThreads()
     Multi-thread read-write test with lots of threads Just use MemoryStore to put max stress on cache Values that work:

The get here will often load data, so it does not give raw cache performance.

public  voidtestSizeMultipleCallsWithPutAndRemove()
    
public  voidtestSizeWithPutAndRemove()
     Test size with put and remove.
public  voidtestSizes()
     Tests cache, memory store and disk store sizes from config jsr107 does not breakdowns of store sizes.
public  voidtestSpoolThreadHandlesThreadKiller()
     Tests what happens when an Element throws an Error on serialization.
public  voidtestToString()
     Tests that the toString() method works.



Method Detail
getTest1Cache
protected JCache getTest1Cache() throws CacheException(Code)
Gets the sample cache 1



setUp
protected void setUp() throws Exception(Code)
setup test



tearDown
protected void tearDown() throws Exception(Code)
teardown limits to what we can do here under jsr107



testAPIObjectCompatibility
public void testAPIObjectCompatibility() throws CacheException(Code)
Does the Object API work? jsr107 is an object API



testAPISerializableCompatibility
public void testAPISerializableCompatibility() throws CacheException(Code)
Does the Serializable API work?



testCacheExceptionHandler
public void testCacheExceptionHandler()(Code)
Test exception handling from JCache



testCacheStatistics
public void testCacheStatistics() throws Exception(Code)
Test cache statistics, including get. Reconcile CacheEntry stats with cache stats and make sure they agree



testClear
public void testClear()(Code)
Tests clear()



testContainsKey
public void testContainsKey() throws Exception(Code)
Test containsKey



testContainsValue
public void testContainsValue() throws Exception(Code)
Test containsValue



testEhcacheConstructor
public void testEhcacheConstructor() throws Exception(Code)
Create a JCache from an inactive Ehcache and try adding to CacheManager.

Check that getting JCache, Ehcache and Cache all make sense.




testElementStatistics
public void testElementStatistics() throws Exception(Code)
Test element statistics, including get and getQuiet eternal="false" timeToIdleSeconds="5" timeToLiveSeconds="10" overflowToDisk="true"

jsr107 has no put quiet




testEvict
public void testEvict() throws Exception(Code)
Test isEmpty



testExpiryBasedOnTimeToIdle
public void testExpiryBasedOnTimeToIdle() throws Exception(Code)
Test expiry based on time to idle.



testExpiryBasedOnTimeToLive
public void testExpiryBasedOnTimeToLive() throws Exception(Code)
Test expiry based on time to live



testExpiryBasedOnTimeToLiveTTL
public void testExpiryBasedOnTimeToLiveTTL() throws Exception(Code)
Test expiry based on time to live where the TTL is set in the put



testExpiryBasedOnTimeToLiveUsingPeek
public void testExpiryBasedOnTimeToLiveUsingPeek() throws Exception(Code)
Test expiry based on time to live. This test uses peek, which behaves the same as get



testExpiryBasedOnTimeToLiveWhenNoIdle
public void testExpiryBasedOnTimeToLiveWhenNoIdle() throws Exception(Code)
Test expiry based on time to live



testGet
public void testGet() throws Exception(Code)
Test the get method.



testGetAll
public void testGetAll() throws InterruptedException, ExecutionException, CacheException(Code)
Tests the getAll Public API method



testGetKeysAfterExpiry
public void testGetKeysAfterExpiry() throws Exception(Code)
Test getKeys after expiry

Makes sure that if an element is expired, its key should also be expired




testGetKeysPerformance
public void testGetKeysPerformance() throws Exception(Code)
Checks the expense of checking for duplicates JSR107 has only one keyset command. It returns a Set rather than a list, so duplicates are automatically handled.

31ms for 2000 keys, half in memory and half on disk




testGetSizeAfterExpiry
public void testGetSizeAfterExpiry() throws Exception(Code)
Expire elements and verify size is correct.



testGetValues
public void testGetValues() throws Exception(Code)
Test the get values method.



testIsEmpty
public void testIsEmpty() throws Exception(Code)
Test isEmpty



testKeySet
public void testKeySet()(Code)
Test the keyset method



testLoad
public void testLoad() throws InterruptedException, ExecutionException, CacheException(Code)
Tests the public API load method with a single item



testLoadAll
public void testLoadAll() throws InterruptedException, ExecutionException, CacheException(Code)
Tests the loadAll Public API method



testLoadWithDynamicLoaderInjection
public void testLoadWithDynamicLoaderInjection() throws InterruptedException, ExecutionException, CacheException(Code)
Tests that the setLoader method allows the loader to be changed. The load is async so timing is important.



testLoaderName
public void testLoaderName() throws Exception(Code)
Test the loader name method.



testNoIdleOrExpiryBasedOnTimeToLiveForEternal
public void testNoIdleOrExpiryBasedOnTimeToLiveForEternal() throws Exception(Code)
Test expiry based on time to live



testNoOverflowToDisk
public void testNoOverflowToDisk() throws Exception(Code)
Test overflow to disk = false



testNonSerializableElement
public void testNonSerializableElement() throws Exception(Code)
Tests using elements with null values. They should work as normal.
throws:
  Exception -



testNullCacheEntry
public void testNullCacheEntry()(Code)
Check getting a cache entry where it does not exist



testNullTreatment
public void testNullTreatment() throws Exception(Code)
Tests putting nulls throws correct exception
throws:
  Exception -



testProportionMemoryAndDiskPerformance
public void testProportionMemoryAndDiskPerformance() throws Exception(Code)
Performance tests for a range of Memory Store - Disk Store combinations.

This demonstrates that a memory only store is approximately an order of magnitude faster than a disk only store.

It also shows that double the performance of a Disk Only store can be obtained with a maximum memory size of only 1. Accordingly a Cache created without a maximum memory size of less than 1 will issue a warning.

Threading changes were made in v1.41 of DiskStore. The before and after numbers are shown.




testPutAll
public void testPutAll()(Code)
Tests putAll



testReadWriteThreads
public void testReadWriteThreads() throws Exception(Code)
Multi-thread read-write test with lots of threads Just use MemoryStore to put max stress on cache Values that work:

The get here will often load data, so it does not give raw cache performance. See the similar test in CacheTest for that.




testSizeMultipleCallsWithPutAndRemove
public void testSizeMultipleCallsWithPutAndRemove() throws Exception(Code)
Test size after multiple calls, with put and remove



testSizeWithPutAndRemove
public void testSizeWithPutAndRemove() throws Exception(Code)
Test size with put and remove.

It checks that size makes sense, and also that getKeys.size() matches getSize()




testSizes
public void testSizes() throws Exception(Code)
Tests cache, memory store and disk store sizes from config jsr107 does not breakdowns of store sizes.



testSpoolThreadHandlesThreadKiller
public void testSpoolThreadHandlesThreadKiller() throws Exception(Code)
Tests what happens when an Element throws an Error on serialization. This mimics what a nasty error like OutOfMemoryError could do.

Before a change to the SpoolAndExpiryThread to handle this situation this test failed and generated the following log message. Jun 28, 2006 7:17:16 PM net.sf.ehcache.store.DiskStore put SEVERE: testThreadKillerCache: Elements cannot be written to disk store because the spool thread has died.
throws:
  Exception -




testToString
public void testToString() throws CacheException(Code)
Tests that the toString() method works.



Fields inherited from net.sf.ehcache.AbstractCacheTest
final public static String SRC_CONFIG_DIR(Code)(Java Doc)
final public static String TEST_CLASSES_DIR(Code)(Java Doc)
final public static String TEST_CONFIG_DIR(Code)(Java Doc)
protected CacheManager manager(Code)(Java Doc)
final protected String sampleCache1(Code)(Java Doc)
final protected String sampleCache2(Code)(Java Doc)

Methods inherited from net.sf.ehcache.AbstractCacheTest
public MBeanServer createMBeanServer()(Code)(Java Doc)
protected void deleteFile(String name) throws IOException(Code)(Java Doc)
public static void forceVMGrowth()(Code)(Java Doc)
protected long measureMemoryUse() throws InterruptedException(Code)(Java Doc)
protected void runThreads(List executables) throws Exception(Code)(Java Doc)
protected void setUp() throws Exception(Code)(Java Doc)
protected void tearDown() throws Exception(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.