[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/aop/loader ...
Manik Surtani
msurtani at jboss.com
Wed Sep 6 11:30:56 EDT 2006
User: msurtani
Date: 06/09/06 11:30:56
Modified: tests/functional/org/jboss/cache/aop/loader
CacheLoaderTestsBase.java ObjectGraphTestsBase.java
Log:
Removed TreeCache dependency on ServiceMBeanSupport
Revision Changes Path
1.11 +33 -19 JBossCache/tests/functional/org/jboss/cache/aop/loader/CacheLoaderTestsBase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheLoaderTestsBase.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/aop/loader/CacheLoaderTestsBase.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- CacheLoaderTestsBase.java 20 Jul 2006 08:05:17 -0000 1.10
+++ CacheLoaderTestsBase.java 6 Sep 2006 15:30:56 -0000 1.11
@@ -3,9 +3,9 @@
import junit.framework.Test;
import junit.framework.TestSuite;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.aop.PojoCache;
import org.jboss.cache.aop.test.Person;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.loader.CacheLoader;
import javax.transaction.Transaction;
@@ -14,15 +14,17 @@
* Commons tests for all CacheLoaders. Aop version.
*
* @author bwang
- * @version $Id: CacheLoaderTestsBase.java,v 1.10 2006/07/20 08:05:17 msurtani Exp $
+ * @version $Id: CacheLoaderTestsBase.java,v 1.11 2006/09/06 15:30:56 msurtani Exp $
*/
-abstract public class CacheLoaderTestsBase extends AbstractCacheLoaderTestBase {
+abstract public class CacheLoaderTestsBase extends AbstractCacheLoaderTestBase
+{
PojoCache cache;
CacheLoader loader = null;
Transaction tx = null;
static final Fqn FQN = new Fqn("key");
- protected void setUp() throws Exception {
+ protected void setUp() throws Exception
+ {
super.setUp();
cache = new PojoCache();
Configuration c = new Configuration();
@@ -30,33 +32,40 @@
c.setCacheMode("local");
configureCache();
c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
- cache.createService();
- cache.startService();
+ cache.create();
+ cache.start();
loader = cache.getCacheLoader();
}
abstract protected void configureCache() throws Exception;
- protected void tearDown() throws Exception {
+ protected void tearDown() throws Exception
+ {
super.tearDown();
- if (tx != null) {
- try {
+ if (tx != null)
+ {
+ try
+ {
tx.commit();
- } catch (Throwable e) {
+ }
+ catch (Throwable e)
+ {
e.printStackTrace();
}
}
cache.remove("/");
loader.remove(Fqn.fromString("/"));
- cache.stopService();
- cache.destroyService();
+ cache.stop();
+ cache.destroy();
}
- protected void addDelay() {
+ protected void addDelay()
+ {
; // returns immediately in this case. Subclasses may override where a delay is needed.
}
- public void testEviction() throws Exception {
+ public void testEviction() throws Exception
+ {
cache.putObject("/first/second/third", "val1"); // stored in cache loader
cache.evict(Fqn.fromString("/first/second/third")); // removes node, because there are no children
addDelay();
@@ -71,7 +80,8 @@
}
- public void testPojoEviction() throws Exception {
+ public void testPojoEviction() throws Exception
+ {
Person test = new Person();
test.setName("Ben");
test.setAge(10);
@@ -90,7 +100,8 @@
assertTrue(cache.exists("/first"));
}
- public void testPojoRemove() throws Exception {
+ public void testPojoRemove() throws Exception
+ {
Person test = new Person();
test.setName("Ben");
test.setAge(10);
@@ -108,7 +119,8 @@
* This test illustrates the problem in JBCACHE-477. That is transactional remove under
* cacheloader using pessimistic locking.
*/
- public void testTxCollectionRemove() throws Exception {
+ public void testTxCollectionRemove() throws Exception
+ {
/*
Person joe = new Person();
joe.setName("Joe");
@@ -167,11 +179,13 @@
}
- public static Test suite() {
+ public static Test suite()
+ {
return new TestSuite(CacheLoaderTestsBase.class);
}
- public static void main(String[] args) {
+ public static void main(String[] args)
+ {
junit.textui.TestRunner.run(suite());
}
1.6 +31 -21 JBossCache/tests/functional/org/jboss/cache/aop/loader/ObjectGraphTestsBase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ObjectGraphTestsBase.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/aop/loader/ObjectGraphTestsBase.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- ObjectGraphTestsBase.java 20 Jul 2006 08:05:17 -0000 1.5
+++ ObjectGraphTestsBase.java 6 Sep 2006 15:30:56 -0000 1.6
@@ -5,11 +5,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.aop.PojoCache;
import org.jboss.cache.aop.test.Address;
import org.jboss.cache.aop.test.Person;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.loader.CacheLoader;
import javax.transaction.Transaction;
@@ -17,16 +17,18 @@
* Commons tests for all CacheLoaders. Aop version.
*
* @author bwang
- * @version $Id: ObjectGraphTestsBase.java,v 1.5 2006/07/20 08:05:17 msurtani Exp $
+ * @version $Id: ObjectGraphTestsBase.java,v 1.6 2006/09/06 15:30:56 msurtani Exp $
*/
-abstract public class ObjectGraphTestsBase extends AbstractCacheLoaderTestBase {
- Log log=LogFactory.getLog(ObjectGraphTestsBase.class);
+abstract public class ObjectGraphTestsBase extends AbstractCacheLoaderTestBase
+{
+ Log log = LogFactory.getLog(ObjectGraphTestsBase.class);
PojoCache cache;
CacheLoader loader = null;
Transaction tx = null;
static final Fqn FQN = new Fqn("key");
- protected void setUp() throws Exception {
+ protected void setUp() throws Exception
+ {
super.setUp();
cache = new PojoCache();
Configuration c = new Configuration();
@@ -34,29 +36,35 @@
c.setCacheMode("local");
configureCache();
c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
- cache.createService();
- cache.startService();
+ cache.create();
+ cache.start();
loader = cache.getCacheLoader();
}
abstract protected void configureCache() throws Exception;
- protected void tearDown() throws Exception {
+ protected void tearDown() throws Exception
+ {
super.tearDown();
- if (tx != null) {
- try {
+ if (tx != null)
+ {
+ try
+ {
tx.commit();
- } catch (Throwable e) {
+ }
+ catch (Throwable e)
+ {
e.printStackTrace();
}
}
cache.remove("/");
loader.remove(Fqn.fromString("/"));
- cache.stopService();
- cache.destroyService();
+ cache.stop();
+ cache.destroy();
}
- protected void addDelay() {
+ protected void addDelay()
+ {
; // returns immediately in this case. Subclasses may override where a delay is needed.
}
@@ -88,8 +96,8 @@
ben.setAddress(addr);
log.info("testMultipleReference(): verify");
- Address add1 = (Address) ((Person)cache.getObject("/person/joe")).getAddress();
- Address add2 = (Address) ((Person)cache.getObject("/person/ben")).getAddress();
+ Address add1 = (Address) ((Person) cache.getObject("/person/joe")).getAddress();
+ Address add2 = (Address) ((Person) cache.getObject("/person/ben")).getAddress();
assertEquals(add1.getCity(), add2.getCity());
addr.setCity("Santa Clara");
assertEquals(add1.getCity(), add2.getCity());
@@ -98,19 +106,21 @@
cache.evict(Fqn.fromString("/person/ben"));
log.info("testMultipleReference(): after eviction");
- add1 = (Address) ((Person)cache.getObject("/person/joe")).getAddress();
- add2 = (Address) ((Person)cache.getObject("/person/ben")).getAddress();
+ add1 = (Address) ((Person) cache.getObject("/person/joe")).getAddress();
+ add2 = (Address) ((Person) cache.getObject("/person/ben")).getAddress();
assertEquals(add1.getCity(), add2.getCity());
add1.setCity("Santa Clara");
// Still not working now. Will need to support it. JCACHE-223
// assertEquals(add1.getCity(), add2.getCity());
}
- public static Test suite() {
+ public static Test suite()
+ {
return new TestSuite(ObjectGraphTestsBase.class);
}
- public static void main(String[] args) {
+ public static void main(String[] args)
+ {
junit.textui.TestRunner.run(suite());
}
More information about the jboss-cvs-commits
mailing list