
|
If you were logged in you would be able to see more operations.
|
|
|
OSCache
Created: 29/Sep/04 04:20 PM
Updated: 19/Apr/05 02:36 PM
|
|
| Component/s: |
Listeners
|
| Affects Version/s: |
2.1
|
| Fix Version/s: |
2.1.1
|
|
|
Environment:
|
Lastest CVS version September 27, 2004
|
|
|
The following JUnit test run successfully, without ever receiving an exception from the cache engine which is not normal. The persisted object are the Exception which is persisted.
public void TestNotSerializableObject() throws Exception
{
java.util.Properties properties = new java.util.Properties();
final String CACHE_DIRECTORY_PATH = "\\temp\\unique\\";
properties.setProperty("cache.path", CACHE_DIRECTORY_PATH);
properties.setProperty("cache.persistence.class", "com.opensymphony.oscache.plugins.diskpersistence.DiskPersistenceListener");
properties.setProperty("cache.persistence.overflow.only", "true");
properties.setProperty("cache.algorithm", "cache.algorithm=com.opensymphony.oscache.base.algorithm.LRUCache");
properties.setProperty("cache.capacity", "2");
properties.setProperty("cache.unlimited.disk", "true");
GeneralCacheAdministrator cache = new GeneralCacheAdministrator(properties);
cache.putInCache("1", new UnSerializable());
cache.putInCache("2", new UnSerializable());
assertTrue(isDirectoryEmpty(CACHE_DIRECTORY_PATH));
cache.putInCache("3", new UnSerializable());
cache.putInCache("4", new UnSerializable());
assertTrue(!isDirectoryEmpty(CACHE_DIRECTORY_PATH));
cache.flushAll();
}
public static class UnSerializable
{
int asdfasdfasdf = 234;
};
cache directory have those files after successfully running this JUnit test:
1.cache
2.cache
having for content the serialization of the exception, look something like:
...
java.io.NotSerializableException
...
|
|
Description
|
The following JUnit test run successfully, without ever receiving an exception from the cache engine which is not normal. The persisted object are the Exception which is persisted.
public void TestNotSerializableObject() throws Exception
{
java.util.Properties properties = new java.util.Properties();
final String CACHE_DIRECTORY_PATH = "\\temp\\unique\\";
properties.setProperty("cache.path", CACHE_DIRECTORY_PATH);
properties.setProperty("cache.persistence.class", "com.opensymphony.oscache.plugins.diskpersistence.DiskPersistenceListener");
properties.setProperty("cache.persistence.overflow.only", "true");
properties.setProperty("cache.algorithm", "cache.algorithm=com.opensymphony.oscache.base.algorithm.LRUCache");
properties.setProperty("cache.capacity", "2");
properties.setProperty("cache.unlimited.disk", "true");
GeneralCacheAdministrator cache = new GeneralCacheAdministrator(properties);
cache.putInCache("1", new UnSerializable());
cache.putInCache("2", new UnSerializable());
assertTrue(isDirectoryEmpty(CACHE_DIRECTORY_PATH));
cache.putInCache("3", new UnSerializable());
cache.putInCache("4", new UnSerializable());
assertTrue(!isDirectoryEmpty(CACHE_DIRECTORY_PATH));
cache.flushAll();
}
public static class UnSerializable
{
int asdfasdfasdf = 234;
};
cache directory have those files after successfully running this JUnit test:
1.cache
2.cache
having for content the serialization of the exception, look something like:
...
java.io.NotSerializableException
... |
Show » |
|