Author: adriancole
Date: 2009-03-02 05:18:44 -0500 (Mon, 02 Mar 2009)
New Revision: 7817
Modified:
core/branches/flat/src/test/java/org/horizon/loader/BaseCacheStoreTest.java
core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreIntegrationTest.java
Log:
reverted redundant test case definition
Modified: core/branches/flat/src/test/java/org/horizon/loader/BaseCacheStoreTest.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/loader/BaseCacheStoreTest.java 2009-03-02
09:46:47 UTC (rev 7816)
+++ core/branches/flat/src/test/java/org/horizon/loader/BaseCacheStoreTest.java 2009-03-02
10:18:44 UTC (rev 7817)
@@ -131,38 +131,10 @@
mods.add(new Remove("k1"));
Transaction tx = EasyMock.createNiceMock(Transaction.class);
cs.prepare(mods, tx, false);
- cs.commit(tx);
- assert cs.load("k2").getValue().equals("v2");
assert !cs.containsKey("k1");
-
- cs.clear();
-
- mods = new ArrayList<Modification>();
- mods.add(new Store(new StoredEntry("k1", "v1", -1, -1)));
- mods.add(new Store(new StoredEntry("k2", "v2", -1, -1)));
- mods.add(new Clear());
- mods.add(new Store(new StoredEntry("k3", "v3", -1, -1)));
-
- cs.prepare(mods, tx, false);
- cs.commit(tx);
-
- assert !cs.containsKey("k1");
assert !cs.containsKey("k2");
- assert cs.containsKey("k3");
- }
- public void testTwoPhaseCommitReadCommitted() throws CacheLoaderException {
- List<Modification> mods = new ArrayList<Modification>();
- mods.add(new Store(new StoredEntry("k1", "v1", -1, -1)));
- mods.add(new Store(new StoredEntry("k2", "v2", -1, -1)));
- mods.add(new Remove("k1"));
- Transaction tx = EasyMock.createNiceMock(Transaction.class);
- cs.prepare(mods, tx, false);
-
- assert !cs.containsKey("k1");
- assert !cs.containsKey("k2");
-
cs.commit(tx);
assert cs.load("k2").getValue().equals("v2");
@@ -189,6 +161,7 @@
assert cs.containsKey("k3");
}
+
public void testRollback() throws CacheLoaderException {
cs.store(new StoredEntry("old", "old", -1, -1));
@@ -200,49 +173,17 @@
mods.add(new Remove("old"));
Transaction tx = EasyMock.createNiceMock(Transaction.class);
cs.prepare(mods, tx, false);
- cs.rollback(tx);
assert !cs.containsKey("k1");
assert !cs.containsKey("k2");
assert cs.containsKey("old");
- mods = new ArrayList<Modification>();
- mods.add(new Store(new StoredEntry("k1", "v1", -1, -1)));
- mods.add(new Store(new StoredEntry("k2", "v2", -1, -1)));
- mods.add(new Clear());
- mods.add(new Store(new StoredEntry("k3", "v3", -1, -1)));
-
- cs.prepare(mods, tx, false);
cs.rollback(tx);
assert !cs.containsKey("k1");
assert !cs.containsKey("k2");
- assert !cs.containsKey("k3");
assert cs.containsKey("old");
- }
- public void testRollbackReadCommitted() throws CacheLoaderException {
-
- cs.store(new StoredEntry("old", "old", -1, -1));
-
- List<Modification> mods = new ArrayList<Modification>();
- mods.add(new Store(new StoredEntry("k1", "v1", -1, -1)));
- mods.add(new Store(new StoredEntry("k2", "v2", -1, -1)));
- mods.add(new Remove("k1"));
- mods.add(new Remove("old"));
- Transaction tx = EasyMock.createNiceMock(Transaction.class);
- cs.prepare(mods, tx, false);
-
- assert !cs.containsKey("k1");
- assert !cs.containsKey("k2");
- assert cs.containsKey("old");
-
- cs.rollback(tx);
-
- assert !cs.containsKey("k1");
- assert !cs.containsKey("k2");
- assert cs.containsKey("old");
-
mods = new ArrayList<Modification>();
mods.add(new Store(new StoredEntry("k1", "v1", -1, -1)));
mods.add(new Store(new StoredEntry("k2", "v2", -1, -1)));
Modified:
core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreIntegrationTest.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreIntegrationTest.java 2009-03-02
09:46:47 UTC (rev 7816)
+++
core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreIntegrationTest.java 2009-03-02
10:18:44 UTC (rev 7817)
@@ -1,11 +1,21 @@
package org.horizon.loader.bdbje;
+import org.easymock.EasyMock;
import org.horizon.loader.BaseCacheStoreTest;
import org.horizon.loader.CacheLoaderException;
import org.horizon.loader.CacheStore;
+import org.horizon.loader.StoredEntry;
+import org.horizon.loader.modifications.Clear;
+import org.horizon.loader.modifications.Modification;
+import org.horizon.loader.modifications.Remove;
+import org.horizon.loader.modifications.Store;
import org.horizon.test.TestingUtil;
import org.testng.annotations.Test;
+import javax.transaction.Transaction;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author Adrian Cole
* @version $Id: $
@@ -27,14 +37,72 @@
return cs;
}
+ /**
+ * this is the same as the superclass, except that it doesn't attempt
read-committed
+ */
@Override
- public void testTwoPhaseCommitReadCommitted() throws CacheLoaderException {
- // this depends on READ_COMMTTED, which is not supported on sleepycat
+ public void testTwoPhaseCommit() throws CacheLoaderException {
+ List<Modification> mods = new ArrayList<Modification>();
+ mods.add(new Store(new StoredEntry("k1", "v1", -1, -1)));
+ mods.add(new Store(new StoredEntry("k2", "v2", -1, -1)));
+ mods.add(new Remove("k1"));
+ Transaction tx = EasyMock.createNiceMock(Transaction.class);
+ cs.prepare(mods, tx, false);
+ cs.commit(tx);
+
+ assert cs.load("k2").getValue().equals("v2");
+ assert !cs.containsKey("k1");
+
+ cs.clear();
+
+ mods = new ArrayList<Modification>();
+ mods.add(new Store(new StoredEntry("k1", "v1", -1, -1)));
+ mods.add(new Store(new StoredEntry("k2", "v2", -1, -1)));
+ mods.add(new Clear());
+ mods.add(new Store(new StoredEntry("k3", "v3", -1, -1)));
+
+ cs.prepare(mods, tx, false);
+ cs.commit(tx);
+
+ assert !cs.containsKey("k1");
+ assert !cs.containsKey("k2");
+ assert cs.containsKey("k3");
}
+ /**
+ * this is the same as the superclass, except that it doesn't attempt
read-committed
+ */
@Override
- public void testRollbackReadCommitted() throws CacheLoaderException {
- // this depends on READ_COMMTTED, which is not supported on sleepycat
+ public void testRollback() throws CacheLoaderException {
+
+ cs.store(new StoredEntry("old", "old", -1, -1));
+
+ List<Modification> mods = new ArrayList<Modification>();
+ mods.add(new Store(new StoredEntry("k1", "v1", -1, -1)));
+ mods.add(new Store(new StoredEntry("k2", "v2", -1, -1)));
+ mods.add(new Remove("k1"));
+ mods.add(new Remove("old"));
+ Transaction tx = EasyMock.createNiceMock(Transaction.class);
+ cs.prepare(mods, tx, false);
+ cs.rollback(tx);
+
+ assert !cs.containsKey("k1");
+ assert !cs.containsKey("k2");
+ assert cs.containsKey("old");
+
+ mods = new ArrayList<Modification>();
+ mods.add(new Store(new StoredEntry("k1", "v1", -1, -1)));
+ mods.add(new Store(new StoredEntry("k2", "v2", -1, -1)));
+ mods.add(new Clear());
+ mods.add(new Store(new StoredEntry("k3", "v3", -1, -1)));
+
+ cs.prepare(mods, tx, false);
+ cs.rollback(tx);
+
+ assert !cs.containsKey("k1");
+ assert !cs.containsKey("k2");
+ assert !cs.containsKey("k3");
+ assert cs.containsKey("old");
}
}