[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/api ...
Manik Surtani
manik at jboss.org
Fri Jun 29 07:41:06 EDT 2007
User: msurtani
Date: 07/06/29 07:41:06
Modified: tests/functional/org/jboss/cache/api CacheAPITest.java
Log:
fixed ut
Revision Changes Path
1.18 +16 -22 JBossCache/tests/functional/org/jboss/cache/api/CacheAPITest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheAPITest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/api/CacheAPITest.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- CacheAPITest.java 28 Jun 2007 16:53:39 -0000 1.17
+++ CacheAPITest.java 29 Jun 2007 11:41:06 -0000 1.18
@@ -29,6 +29,7 @@
{
private Cache<String, String> cache;
protected boolean optimistic;
+ final List<String> events = new ArrayList<String>();
protected void setUp() throws Exception
{
@@ -37,6 +38,7 @@
cache = cf.createCache("META-INF/local-tx-service.xml", false);
cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
+ events.clear();
}
protected void tearDown()
@@ -78,21 +80,7 @@
{
assertEquals(0, cache.getCacheListeners().size());
-
- final List<String> events = new ArrayList<String>();
-
- Object dummy = new Object();
-
- @CacheListener
- class Listener
- {
-
- @NodeCreated
- public void nodeCreated(Event e)
- {
- if (e.isPre()) events.add("Created");
- }
- }
+ Object dummy = new Listener();
cache.addCacheListener(dummy);
@@ -126,14 +114,9 @@
// expected
}
- @CacheListener
- class TestListener
- {
- }
-
try
{
- cache.addCacheListener(Fqn.ROOT, new TestListener());
+ cache.addCacheListener(Fqn.ROOT, new Listener());
fail("Fqn-based cache listener operation should throw an exception");
}
catch (Exception e)
@@ -143,7 +126,7 @@
try
{
- cache.removeCacheListener(Fqn.ROOT, new TestListener());
+ cache.removeCacheListener(Fqn.ROOT, new Listener());
fail("Fqn-based cache listener operation should throw an exception");
}
catch (Exception e)
@@ -353,4 +336,15 @@
assertTrue(cache.getRoot().getData().isEmpty());
assertTrue(cache.getRoot().getChildren().isEmpty());
}
+
+ @CacheListener
+ public class Listener
+ {
+
+ @NodeCreated
+ public void nodeCreated(Event e)
+ {
+ if (e.isPre()) events.add("Created");
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list