[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/passivation ...
Manik Surtani
msurtani at jboss.com
Fri Dec 15 12:49:19 EST 2006
User: msurtani
Date: 06/12/15 12:49:19
Modified: tests/functional/org/jboss/cache/passivation
PassivationTestsBase.java
Log:
refactored
Revision Changes Path
1.21 +179 -265 JBossCache/tests/functional/org/jboss/cache/passivation/PassivationTestsBase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PassivationTestsBase.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/PassivationTestsBase.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- PassivationTestsBase.java 23 Nov 2006 19:43:05 -0000 1.20
+++ PassivationTestsBase.java 15 Dec 2006 17:49:19 -0000 1.21
@@ -18,8 +18,8 @@
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.DummyTransactionManager;
import org.jboss.cache.xml.XmlHelper;
-import org.jboss.util.stream.MarshalledValueOutputStream;
import org.jboss.util.stream.MarshalledValueInputStream;
+import org.jboss.util.stream.MarshalledValueOutputStream;
import org.w3c.dom.Element;
import javax.transaction.NotSupportedException;
@@ -38,7 +38,7 @@
* Base tests for passivation using any of the cache loaders
*
* @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
- * @version $Id: PassivationTestsBase.java,v 1.20 2006/11/23 19:43:05 genman Exp $
+ * @version $Id: PassivationTestsBase.java,v 1.21 2006/12/15 17:49:19 msurtani Exp $
*/
abstract public class PassivationTestsBase extends TestCase
{
@@ -333,7 +333,7 @@
}
- public void testGetChildrenWithEvictionPassivation() throws CacheException
+ public void testGetChildrenWithEvictionPassivation() throws Exception
{
cache.put("/a/b/c/1", null);
cache.put("/a/b/c/2", null);
@@ -352,30 +352,19 @@
assertTrue(children.contains("1"));
assertTrue(children.contains("2"));
assertTrue(children.contains("3"));
- try
- {
+
assertTrue(loader.exists(Fqn.fromString("/a/b/c")));
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
+
cache.get("/a/b/c/1", "test"); // load child
cache.get("/a/b/c/2", "test"); // load child
cache.get("/a/b/c/3", "test"); // load child
cache.get("/a/b/c", "test"); // load attributes
- try
- {
+
assertFalse(loader.exists(Fqn.fromString("/a/b/c/1")));
assertFalse(loader.exists(Fqn.fromString("/a/b/c/2")));
assertFalse(loader.exists(Fqn.fromString("/a/b/c/3")));
assertFalse(loader.exists(Fqn.fromString("/a/b/c")));
}
- catch (Exception e)
- {
- fail(e.toString());
- }
- }
public void testGetChildren2()
{
@@ -454,9 +443,7 @@
}
- public void testGetChildren6Passivation()
- {
- try
+ public void testGetChildren6Passivation() throws Exception
{
cache.put("/a/1", null); // put node in memory
cache.put("/a/2", null); // put node in memory
@@ -484,15 +471,8 @@
cache.get("/a", "test"); // activate node
assertFalse(loader.exists(Fqn.fromString("/a")));
}
- catch (Exception e)
- {
- fail(e.toString());
- }
- }
- public void testGetChildren7Passivation()
- {
- try
+ public void testGetChildren7Passivation() throws Exception
{
cache.put("/a/1", null);
cache.put("/a/2", null);
@@ -521,15 +501,8 @@
assertFalse(loader.exists(Fqn.fromString("/a/3")));
assertTrue(loader.exists(Fqn.fromString("/a")));
}
- catch (Exception e)
- {
- fail(e.toString());
- }
- }
- public void testGetChildren8Passivation()
- {
- try
+ public void testGetChildren8Passivation() throws Exception
{
cache.put("/a/1", null);
cache.put("/a/2", null);
@@ -553,15 +526,8 @@
assertEquals("3 children weren't loaded", 3, children.size());
assertTrue(loader.exists(Fqn.fromString("/a"))); //loaded children but didn't initalizae them
}
- catch (Exception e)
- {
- fail(e.toString());
- }
- }
- public void testGetChildren9Passivation()
- {
- try
+ public void testGetChildren9Passivation() throws Exception
{
cache.put("/a/1", null);
cache.put("/a/2", null);
@@ -608,16 +574,9 @@
assertNull(cache.get("/a", "test")); // load attributes and has no children by now, activation
assertFalse(loader.exists(Fqn.fromString("/a")));
}
- catch (Exception e)
- {
- fail(e.toString());
- }
- }
- public void testGetChildren10Passivation()
- {
- try
+ public void testGetChildren10Passivation() throws Exception
{
cache.put("/a/1", null);
cache.put("/a/2", null);
@@ -646,11 +605,6 @@
assertNull(cache.get("/a", "test")); // activate node
assertFalse(loader.exists(Fqn.fromString("/a")));
}
- catch (Exception e)
- {
- fail(e.toString());
- }
- }
public void testRemoveData() throws Exception
{
@@ -683,14 +637,7 @@
addDelay();
keys = cache.getKeys(key); // activate node
- try
- {
assertFalse(loader.exists(key));
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
assertEquals(0, keys.size());
}
@@ -739,7 +686,7 @@
assertNull(retval);
}
- public void testRemoveKey3Passivation() throws CacheException
+ public void testRemoveKey3Passivation() throws Exception
{
final String NODE = "/test";
final String KEY = "key";
@@ -750,37 +697,16 @@
cache.evict(Fqn.fromString(NODE)); // passivate node
addDelay();
- try
- {
assertTrue(loader.exists(Fqn.fromString(NODE)));
assertEquals(new Integer(10), loader.get(Fqn.fromString(NODE)).get(KEY));
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
retval = cache.remove(NODE, KEY); // activate node
assertEquals(new Integer(10), retval);
- try
- {
assertFalse(loader.exists(Fqn.fromString(NODE)));
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
cache.evict(Fqn.fromString(NODE)); // passiave node
addDelay();
retval = cache.remove(NODE, KEY); // activate node
- try
- {
assertFalse(loader.exists(Fqn.fromString(NODE)));
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
assertNull(retval);
}
@@ -838,25 +764,11 @@
cache.put("/first/second/third", "key1", "val1"); // stored in cache loader
cache.evict(Fqn.fromString("/first/second/third")); // passivate node, note: it has no children
addDelay();
- try
- {
assertTrue(loader.exists(Fqn.fromString("/first/second/third")));
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
assertTrue(cache.exists("/first/second"));
assertTrue(cache.exists("/first"));
String val = (String) cache.get("/first/second/third", "key1"); // activate node
- try
- {
assertFalse(loader.exists(Fqn.fromString("/first/second/third")));
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
assertEquals("val1", val);
assertTrue(cache.exists("/first/second/third"));
assertTrue(cache.exists("/first/second"));
@@ -886,7 +798,7 @@
assertTrue(children.contains("1"));
assertTrue(children.contains("2"));
assertTrue(children.contains("3"));
- assertEquals(4, cache.getNumberOfLocksHeld());
+ assertEquals(5, cache.getNumberOfLocksHeld());
tx.commit();
}
@@ -1660,7 +1572,7 @@
os.close();
assertTrue(baos.size() > 0);
- byte [] savedState = baos.toByteArray();
+ byte[] savedState = baos.toByteArray();
/* Restore state. */
ByteArrayInputStream bais = new ByteArrayInputStream(savedState);
@@ -1680,7 +1592,9 @@
*/
private static class Complex implements Serializable
{
- /** The serialVersionUID */
+ /**
+ * The serialVersionUID
+ */
private static final long serialVersionUID = 8950692199236424832L;
Complex nested;
More information about the jboss-cvs-commits
mailing list