Author: jason.greene(a)jboss.com
Date: 2007-10-26 14:30:20 -0400 (Fri, 26 Oct 2007)
New Revision: 4698
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/NoZeroArgConstructorTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedListTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedMapTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedObjectTest.java
Log:
Fix tests
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/NoZeroArgConstructorTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/NoZeroArgConstructorTest.java 2007-10-26
15:03:50 UTC (rev 4697)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/NoZeroArgConstructorTest.java 2007-10-26
18:30:20 UTC (rev 4698)
@@ -6,8 +6,8 @@
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.annotation.Replicable;
import org.testng.AssertJUnit;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
@@ -21,7 +21,7 @@
Log log = LogFactory.getLog(NoZeroArgConstructorTest.class);
PojoCache cache, cache1;
- @BeforeTest(alwaysRun = true)
+ @BeforeClass(alwaysRun = true)
protected void setUp() throws Exception
{
log.info("setUp() ....");
@@ -32,7 +32,7 @@
cache1.start();
}
- @AfterTest(alwaysRun = true)
+ @AfterClass(alwaysRun = true)
protected void tearDown() throws Exception
{
cache.stop();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java 2007-10-26
15:03:50 UTC (rev 4697)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java 2007-10-26
18:30:20 UTC (rev 4698)
@@ -66,6 +66,7 @@
protected void tearDown() throws Exception
{
cache.stop();
+ listener.clear();
}
private <T extends Event> T takeNotification(Class<T> clazz)
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java 2007-10-26
15:03:50 UTC (rev 4697)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java 2007-10-26
18:30:20 UTC (rev 4698)
@@ -48,8 +48,8 @@
@Test(groups = {"functional"})
public class MapTest
{
- private PojoCache cache;
- private Listener listener = new Listener();
+ protected PojoCache cache;
+ protected Listener listener = new Listener();
@BeforeMethod(alwaysRun = true)
@@ -67,6 +67,7 @@
protected void tearDown() throws Exception
{
cache.stop();
+ listener.clear();
}
private <T extends Event> T takeNotification(Class<T> clazz)
@@ -119,7 +120,7 @@
// Map Attach
attach = takeNotification(AttachedEvent.class);
- assertSame(map, attach.getSource());
+ assertEquals(map, attach.getSource());
}
@@ -160,7 +161,7 @@
// Map Attach
attach = takeNotification(AttachedEvent.class);
- assertSame(map, attach.getSource());
+ assertEquals(map, attach.getSource());
// Map remove
modify = takeNotification(MapModifiedEvent.class);
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java 2007-10-26
15:03:50 UTC (rev 4697)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java 2007-10-26
18:30:20 UTC (rev 4698)
@@ -9,6 +9,7 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertSame;
+import static org.testng.AssertJUnit.assertTrue;
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
@@ -30,10 +31,10 @@
* @author Jason T. Greene
*/
@Test(groups = {"functional"})
-public class ObjectTest
+public class ObjectTest
{
- private PojoCache cache;
- private Listener listener;
+ protected PojoCache cache;
+ protected Listener listener;
@BeforeMethod(alwaysRun = true)
@@ -107,13 +108,14 @@
// Person Attach
AttachedEvent attach = takeNotification(AttachedEvent.class);
- assertEquals(test, attach.getSource());
+ Object attached = attach.getSource();
+ assertEquals(test, attached);
cache.detach("/a");
// Person Detach
DetachedEvent detach = takeNotification(DetachedEvent.class);
- assertEquals(test, detach.getSource());
+ assertSame(attached, detach.getSource());
}
public void testFieldNotification() throws Exception
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedListTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedListTest.java 2007-10-26
15:03:50 UTC (rev 4697)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedListTest.java 2007-10-26
18:30:20 UTC (rev 4698)
@@ -61,6 +61,7 @@
{
cache.stop();
listenerCache.stop();
+ listener.clear();
}
protected void verifyNotification(Event notification)
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedMapTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedMapTest.java 2007-10-26
15:03:50 UTC (rev 4697)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedMapTest.java 2007-10-26
18:30:20 UTC (rev 4698)
@@ -42,7 +42,7 @@
* @author Jason T. Greene
*/
@Test(groups = {"functional"})
-public class ReplicatedMapTest extends ListTest
+public class ReplicatedMapTest extends MapTest
{
private PojoCache listenerCache;
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedObjectTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedObjectTest.java 2007-10-26
15:03:50 UTC (rev 4697)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedObjectTest.java 2007-10-26
18:30:20 UTC (rev 4698)
@@ -42,7 +42,7 @@
* @author Jason T. Greene
*/
@Test(groups = {"functional"})
-public class ReplicatedObjectTest extends ListTest
+public class ReplicatedObjectTest extends ObjectTest
{
private PojoCache listenerCache;
@@ -53,6 +53,7 @@
cache.start();
listenerCache =
PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
false);
listenerCache.start();
+ listener = new Listener();
listenerCache.addListener(listener);
}
@AfterMethod(alwaysRun = true)