[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/options ...
Manik Surtani
msurtani at jboss.com
Thu Sep 7 11:42:16 EDT 2006
User: msurtani
Date: 06/09/07 11:42:16
Modified: tests/functional/org/jboss/cache/options
CacheModeLocalSimpleTest.java
ExplicitVersionsTest.java FailSilentlyTest.java
Log:
Updated options API usage
Revision Changes Path
1.5 +2 -1 JBossCache/tests/functional/org/jboss/cache/options/CacheModeLocalSimpleTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheModeLocalSimpleTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/options/CacheModeLocalSimpleTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- CacheModeLocalSimpleTest.java 6 Sep 2006 15:31:00 -0000 1.4
+++ CacheModeLocalSimpleTest.java 7 Sep 2006 15:42:16 -0000 1.5
@@ -64,7 +64,8 @@
mgr.begin();
cache1.put(Fqn.fromString("/replicate"), "k", "v");
- cache1.put(Fqn.fromString("/not-replicate"), "k", "v", cacheModeLocal);
+ cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ cache1.put(Fqn.fromString("/not-replicate"), "k", "v");
mgr.commit();
1.6 +10 -10 JBossCache/tests/functional/org/jboss/cache/options/ExplicitVersionsTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ExplicitVersionsTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/options/ExplicitVersionsTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- ExplicitVersionsTest.java 6 Sep 2006 15:31:00 -0000 1.5
+++ ExplicitVersionsTest.java 7 Sep 2006 15:42:16 -0000 1.6
@@ -53,8 +53,8 @@
public void testSimplePut() throws Exception
{
DataVersion version = new TestVersion("99");
- option.setDataVersion(version);
- cache.put(fqn, key, "value", option);
+ cache.getInvocationContext().getOptionOverrides().setDataVersion(version);
+ cache.put(fqn, key, "value");
//now retrieve the data from the cache.
Assert.assertEquals("value", cache.get(fqn, key));
@@ -70,14 +70,14 @@
public void testFailingPut() throws Exception
{
DataVersion version = new TestVersion("99");
- option.setDataVersion(version);
- cache.put(fqn, key, "value", option);
+ cache.getInvocationContext().getOptionOverrides().setDataVersion(version);
+ cache.put(fqn, key, "value");
version = new TestVersion("25");
- option.setDataVersion(version);
+ cache.getInvocationContext().getOptionOverrides().setDataVersion(version);
TransactionManager mgr = cache.getTransactionManager();
mgr.begin();
- cache.put(fqn, key, "value2", option);
+ cache.put(fqn, key, "value2");
try
{
mgr.commit();
@@ -93,12 +93,12 @@
public void testIncompatibleVersionTypes() throws Exception
{
DataVersion version = new TestVersion("99");
- option.setDataVersion(version);
- cache.put(fqn, key, "value", option);
+ cache.getInvocationContext().getOptionOverrides().setDataVersion(version);
+ cache.put(fqn, key, "value");
TransactionManager mgr = cache.getTransactionManager();
mgr.begin();
- option.setDataVersion(new DefaultDataVersion(777));
- cache.put(fqn, key, "value2", option);
+ cache.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion(777));
+ cache.put(fqn, key, "value2");
try
{
// this call will use implicit versioning and will hence fail.
1.5 +27 -11 JBossCache/tests/functional/org/jboss/cache/options/FailSilentlyTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FailSilentlyTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/options/FailSilentlyTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- FailSilentlyTest.java 6 Sep 2006 15:31:00 -0000 1.4
+++ FailSilentlyTest.java 7 Sep 2006 15:42:16 -0000 1.5
@@ -10,7 +10,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.TreeCache;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.Option;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
@@ -29,7 +28,6 @@
private Transaction tx;
private Fqn fqn = Fqn.fromString("/a");
private String key = "key";
- private Option failSilently;
protected void setUp() throws Exception
{
@@ -42,8 +40,19 @@
cache.start();
manager = cache.getTransactionManager();
- failSilently = new Option();
- failSilently.setFailSilently(true);
+ // kill any ongoing tx's.
+ if (manager.getTransaction() != null)
+ {
+ try
+ {
+ manager.rollback();
+ }
+ catch (Exception e)
+ {
+ // do nothing
+ }
+ }
+
}
protected void tearDown()
@@ -62,7 +71,8 @@
manager.begin();
cache.put(fqn, key, "value");
tx = manager.suspend();
- cache.put(fqn, key, "value2", failSilently);
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.put(fqn, key, "value2");
}
catch (Exception e)
{
@@ -87,7 +97,8 @@
manager.begin();
cache.put(fqn, data);
tx = manager.suspend();
- cache.put(fqn, data, failSilently);
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.put(fqn, data);
}
catch (Exception e)
{
@@ -113,7 +124,8 @@
// get a read lock
cache.get(fqn, key);
tx = manager.suspend();
- cache.remove(fqn, failSilently);
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.remove(fqn);
}
catch (Exception e)
{
@@ -138,7 +150,8 @@
// get a read lock
cache.get(fqn, key);
tx = manager.suspend();
- cache.remove(fqn, key, failSilently);
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.remove(fqn, key);
}
catch (Exception e)
{
@@ -163,7 +176,8 @@
// get a WL
cache.put(fqn, key, "value2");
tx = manager.suspend();
- cache.get(fqn, failSilently);
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.get(fqn);
}
catch (Exception e)
{
@@ -188,7 +202,8 @@
// get a WL
cache.put(fqn, key, "value2");
tx = manager.suspend();
- cache.get(fqn, key, failSilently);
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.get(fqn, key);
}
catch (Exception e)
{
@@ -213,7 +228,8 @@
// get a WL
cache.put(fqn, key, "value2");
tx = manager.suspend();
- cache.getChildrenNames(fqn, failSilently);
+ cache.getInvocationContext().getOptionOverrides().setFailSilently(true);
+ cache.getChildrenNames(fqn);
}
catch (Exception e)
{
More information about the jboss-cvs-commits
mailing list