Author: manik.surtani(a)jboss.com
Date: 2009-02-03 04:56:12 -0500 (Tue, 03 Feb 2009)
New Revision: 7629
Modified:
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
Log:
Added rollback test
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2009-02-03
02:16:01 UTC (rev 7628)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2009-02-03
09:56:12 UTC (rev 7629)
@@ -1687,27 +1687,19 @@
{
loader.remove(Fqn.fromString("/"));
- int num = 0;
- try
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- MarshalledValueOutputStream os = new MarshalledValueOutputStream(baos);
- loader.loadEntireState(os);
- num = baos.size();
- }
- catch (UnsupportedOperationException ex)
- {
- return;
- }
+ cache.put(FQN, "K", "V");
+ assert loader.get(FQN).get("K").equals("V");
+ assert cache.get(FQN, "K").equals("V");
- Object txnKey = new Object();
- List<Modification> mods = createUpdates();
- loader.prepare(txnKey, mods, false);
- loader.rollback(txnKey);
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- MarshalledValueOutputStream os = new MarshalledValueOutputStream(baos);
- loader.loadEntireState(os);
- assertEquals(num, baos.size());
+ // now modify K in a tx
+ cache.getTransactionManager().begin();
+ cache.put(FQN, "K", "V2");
+ assert loader.get(FQN).get("K").equals("V");
+ assert cache.get(FQN, "K").equals("V2");
+ cache.getTransactionManager().rollback();
+
+ assert loader.get(FQN).get("K").equals("V");
+ assert cache.get(FQN, "K").equals("V");
}
/**