Author: manik.surtani(a)jboss.com
Date: 2008-06-27 10:23:54 -0400 (Fri, 27 Jun 2008)
New Revision: 6097
Added:
core/trunk/src/test/java/org/jboss/cache/api/optimistic/DeletedChildResurrectionOptimisticTest.java
Modified:
core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java
Log:
Better organisation of tests
Modified: core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java 2008-06-27
14:19:48 UTC (rev 6096)
+++
core/trunk/src/test/java/org/jboss/cache/api/DeletedChildResurrectionTest.java 2008-06-27
14:23:54 UTC (rev 6097)
@@ -6,6 +6,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.AfterMethod;
@@ -33,12 +34,15 @@
private static final String VALUE = "value";
private static final String K2 = "k2";
private static final String V2 = "v2";
+ protected NodeLockingScheme nodeLockingScheme = NodeLockingScheme.PESSIMISTIC;
@BeforeMethod(alwaysRun = true)
public void setUp()
{
cache = new DefaultCacheFactory<Object,
Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL,
true), false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
+ cache.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
+ cache.start();
}
@AfterMethod(alwaysRun = true)
@@ -47,59 +51,8 @@
TestingUtil.killCaches(cache);
}
- /**
- * Tests whether the deleted child re-appears if the parent node is re-added
- * via a simple node.addChild(parentFqn) call. Pessimistic locking case.
- *
- * @throws Exception
- */
- public void testDeletedChildResurrectionPessimistic1() throws Exception
+ public void testDeletedChildResurrection1() throws Exception
{
- deletedChildResurrectionTest1(Configuration.NodeLockingScheme.PESSIMISTIC);
- }
-
- /**
- * Tests whether the deleted child re-appears if the parent node is re-added
- * via a simple node.addChild(parentFqn) call. Optimistic locking case.
- *
- * @throws Exception
- */
- public void testDeletedChildResurrectionOptimistic1() throws Exception
- {
- deletedChildResurrectionTest1(Configuration.NodeLockingScheme.OPTIMISTIC);
- }
-
- /**
- * Tests whether the deleted child re-appears if the parent node is re-added
- * via a node.addChild(differentChildofParentFqn) call. Pessimistic locking case.
- *
- * @throws Exception
- */
- public void testDeletedChildResurrectionPessimistic2() throws Exception
- {
- deletedChildResurrectionTest2(Configuration.NodeLockingScheme.PESSIMISTIC);
- }
-
- /**
- * Tests whether the deleted child re-appears if the parent node is re-added
- * via a node.addChild(differentChildofParentFqn) call. Optimistic locking case.
- *
- * @throws Exception
- */
- public void testDeletedChildResurrectionOptimistic2() throws Exception
- {
- deletedChildResurrectionTest2(Configuration.NodeLockingScheme.OPTIMISTIC);
- }
-
- /**
- * Tests whether, in a single tx, deleting a parent node with an pre-existing
- * child and then inserting a different child under the parent Fqn results
- * in the pre-existing child remaining in the cache after tx commit.
- */
- private void deletedChildResurrectionTest1(Configuration.NodeLockingScheme
lockingScheme) throws Exception
- {
- cache.getConfiguration().setNodeLockingScheme(lockingScheme);
- cache.start();
CacheSPI spi = (CacheSPI) cache;
Node<Object, Object> root = cache.getRoot();
@@ -123,10 +76,8 @@
* child and then inserting a different child under the parent Fqn results
* in the pre-existing child remaining in the cache after tx commit.
*/
- private void deletedChildResurrectionTest2(Configuration.NodeLockingScheme
lockingScheme) throws Exception
+ public void testDeletedChildResurrection2() throws Exception
{
- cache.getConfiguration().setNodeLockingScheme(lockingScheme);
- cache.start();
Node<Object, Object> root = cache.getRoot();
TransactionManager txManager =
cache.getConfiguration().getRuntimeConfig().getTransactionManager();
Added:
core/trunk/src/test/java/org/jboss/cache/api/optimistic/DeletedChildResurrectionOptimisticTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/api/optimistic/DeletedChildResurrectionOptimisticTest.java
(rev 0)
+++
core/trunk/src/test/java/org/jboss/cache/api/optimistic/DeletedChildResurrectionOptimisticTest.java 2008-06-27
14:23:54 UTC (rev 6097)
@@ -0,0 +1,14 @@
+package org.jboss.cache.api.optimistic;
+
+import org.jboss.cache.api.DeletedChildResurrectionTest;
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "optimistic"})
+public class DeletedChildResurrectionOptimisticTest extends DeletedChildResurrectionTest
+{
+ public DeletedChildResurrectionOptimisticTest()
+ {
+ nodeLockingScheme = NodeLockingScheme.OPTIMISTIC;
+ }
+}
Show replies by date