[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/optimistic ...
Manik Surtani
manik at jboss.org
Tue May 29 09:51:27 EDT 2007
User: msurtani
Date: 07/05/29 09:51:27
Modified: tests/functional/org/jboss/cache/optimistic
AbstractOptimisticTestCase.java
OptimisticWithPassivationTest.java
Log:
optimised tests to use DummyInMemoryCacheLoader as a stub
Revision Changes Path
1.48 +6 -26 JBossCache/tests/functional/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractOptimisticTestCase.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- AbstractOptimisticTestCase.java 7 Mar 2007 18:00:51 -0000 1.47
+++ AbstractOptimisticTestCase.java 29 May 2007 13:51:27 -0000 1.48
@@ -19,6 +19,8 @@
import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
import org.jboss.cache.interceptors.OptimisticReplicationInterceptor;
import org.jboss.cache.interceptors.TxInterceptor;
+import org.jboss.cache.loader.DummyInMemoryCacheLoader;
+import org.jboss.cache.loader.DummySharedInMemoryCacheLoader;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
@@ -33,7 +35,6 @@
import javax.transaction.TransactionManager;
import java.io.DataInputStream;
import java.io.DataOutputStream;
-import java.io.File;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
@@ -46,31 +47,10 @@
*/
public abstract class AbstractOptimisticTestCase extends TestCase
{
- private int instanceNumber;
-
// some test data shared among all the test cases
protected Fqn fqn = Fqn.fromString("/blah");
protected String key = "myKey", value = "myValue";
- protected String getTempDir()
- {
- return getTempDir("tempdir");
- }
-
- private String getTempDir(String name)
- {
- String tempDir = System.getProperty("java.io.tmpdir", "/tmp");
- tempDir = tempDir + File.separator + name;
- System.out.println("tmpdir property: " + System.getProperty("java.io.tmpdir"));
- System.out.println("Attempting to create dir [" + tempDir + "]");
- File tempDirFile = new File(tempDir);
- if (!tempDirFile.exists())
- {
- tempDirFile.mkdirs();
- }
- return tempDir;
- }
-
public AbstractOptimisticTestCase(String name)
{
super(name);
@@ -118,14 +98,14 @@
return createCacheWithLoader(false);
}
- protected CacheLoaderConfig getCacheLoaderConfig(boolean shared, String filename, boolean passivation) throws Exception
+ protected CacheLoaderConfig getCacheLoaderConfig(boolean shared, boolean passivation) throws Exception
{
String xml = " <config>\n" +
" <passivation>" + passivation + "</passivation>\n" +
" <preload></preload>\n" +
" <shared>" + shared + "</shared>\n" +
" <cacheloader>\n" +
- " <class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
+ " <class>" + (shared ? DummySharedInMemoryCacheLoader.class.getName() : DummyInMemoryCacheLoader.class.getName()) + "</class>\n" +
" <properties>\n" +
" </properties>\n" +
" <async>false</async>\n" +
@@ -142,7 +122,7 @@
CacheImpl cache = createCacheUnstarted();
Configuration c = cache.getConfiguration();
cache.setConfiguration(c);
- c.setCacheLoaderConfig(getCacheLoaderConfig(true, getTempDir(), passivationEnabled));
+ c.setCacheLoaderConfig(getCacheLoaderConfig(true, passivationEnabled));
cache.create();
cache.start();
return cache;
@@ -277,7 +257,7 @@
c.setSyncRollbackPhase(true);
c.setNodeLockingScheme("OPTIMISTIC");
c.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- c.setCacheLoaderConfig(getCacheLoaderConfig(shared, shared ? getTempDir(name + "-shared") : getTempDir(name + instanceNumber++), false));
+ c.setCacheLoaderConfig(getCacheLoaderConfig(shared, false));
cache.create();
cache.start();
1.15 +3 -5 JBossCache/tests/functional/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticWithPassivationTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/optimistic/OptimisticWithPassivationTest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- OptimisticWithPassivationTest.java 30 Dec 2006 17:49:52 -0000 1.14
+++ OptimisticWithPassivationTest.java 29 May 2007 13:51:27 -0000 1.15
@@ -28,7 +28,7 @@
super(s);
}
- protected CacheLoaderConfig getCacheLoaderConfig(String loc) throws Exception
+ protected CacheLoaderConfig getCacheLoaderConfig() throws Exception
{
String xml = " <config>\n" +
" \n" +
@@ -36,9 +36,7 @@
" <preload></preload>\n" +
"\n" +
" <cacheloader>\n" +
- " <class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
- " <properties>\n" +
- " </properties>\n" +
+ " <class>org.jboss.cache.loader.DummyInMemoryCacheLoader</class>\n" +
" <async>false</async>\n" +
" <fetchPersistentState>false</fetchPersistentState>\n" +
" <ignoreModifications>false</ignoreModifications>\n" +
@@ -52,7 +50,7 @@
private CacheImpl createLocalCache() throws Exception
{
CacheImpl cache = createCacheUnstarted(false);
- cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(getTempDir()));
+ cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig());
cache.create();
cache.start();
More information about the jboss-cvs-commits
mailing list