Author: jason.greene(a)jboss.com
Date: 2007-09-11 21:05:23 -0400 (Tue, 11 Sep 2007)
New Revision: 4456
Removed:
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTxTest.java
Modified:
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/BuddyReplicationTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/CircularGraphTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTxTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/NewLocalTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTxTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/RecursiveRefTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedByteTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedCircularGraphTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedSerializableTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedTxTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/TestingUtil.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/annotation/ReplicatedAnnotationTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListImplTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapImplTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapNullTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedSetTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CollectionTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ObjectGraphTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncListTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncMapTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncSetTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/integrated/NetworkManagementTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/integrated/ReplicatedNetworkManagementTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/LegacyConfigurationTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/NotificationTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/ReplicatedTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/SelectedClassnameClassLoader.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/optimistic/AbstractOptimisticTestCase.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/CachedListTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/LocalTxTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/NewLocalTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/ReplicatedTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/InMemoryTxUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListTxUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalExceptionUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapTxUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/PojoCollectionRollbackTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ReplicatedTxTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetTxUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/ReplicatedTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransferAopTestBase.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/CacheObject.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NetworkDomain.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NetworkNode.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NodeManager.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/Person.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SerializedAddress.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SpecialAddress.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SpecialSerializedAddress.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/TestNode.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/Node.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/NodeImpl.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/ORSummaryRule.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/PropagationManagerImpl.java
Log:
Fix warnings
Fix remaining test failures
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -21,9 +21,9 @@
public static final String SERIALIZED = "__SERIALIZED__";
public static final String JBOSS_INTERNAL_STRING = "__JBossInternal__";
public static final String JBOSS_INTERNAL_ID_SEP_STRING = "_ID_";
- public static final Fqn JBOSS_INTERNAL = new Fqn(JBOSS_INTERNAL_STRING);
- public static final Fqn JBOSS_INTERNAL_ID_SEP = new
Fqn(JBOSS_INTERNAL_ID_SEP_STRING);
- public static final Fqn JBOSS_INTERNAL_MAP = new Fqn(InternalConstant.JBOSS_INTERNAL,
"__RefMap__");
+ public static final Fqn<String> JBOSS_INTERNAL = new
Fqn<String>(JBOSS_INTERNAL_STRING);
+ public static final Fqn<String> JBOSS_INTERNAL_ID_SEP = new
Fqn<String>(JBOSS_INTERNAL_ID_SEP_STRING);
+ public static final Fqn<String> JBOSS_INTERNAL_MAP = new
Fqn<String>(InternalConstant.JBOSS_INTERNAL, "__RefMap__");
public static final String JBOSS_INTERNAL_STATIC = "__jboss:static__";
public static final String POJOCACHE_KEY_PREFIX = "POJOCache.";
public static final String POJOCACHE_STATUS = POJOCACHE_KEY_PREFIX +
"Status";
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/BuddyReplicationTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/BuddyReplicationTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/BuddyReplicationTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -36,7 +36,6 @@
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.test.Person;
-import org.jboss.cache.pojo.test.Student;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -96,16 +95,6 @@
return p;
}
- private Student createStudent(String id, String name, int age, String grade)
- {
- Student p = new Student();
- p.setName(name);
- p.setAge(age);
- p.setYear(grade);
- cache.attach(id, p);
- return p;
- }
-
private Person getReplicatedPerson(String id) throws PojoCacheException
{
Person repl = (Person) cache1.find(id);
@@ -130,7 +119,7 @@
try
{
person.setAge(30);
- List med = person.getMedication();
+ List<String> med = person.getMedication();
assertNull("Medication should be null ", med);
person.setAge(61);
med = person.getMedication();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/CircularGraphTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/CircularGraphTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/CircularGraphTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -218,6 +218,7 @@
*
* @throws Exception
*/
+
public void testCircularReference7() throws Exception
{
log.info("testCircularReference7() ...");
@@ -232,7 +233,10 @@
cache_.attach("/list", list);
cache_.attach("/alias", list);
+ @SuppressWarnings("unchecked")
List<Link> list1 = (List<Link>) cache_.find("/list");
+
+ @SuppressWarnings("unchecked")
List<Link> list2 = (List<Link>) cache_.find("/alias");
assertEquals("parent", list1.get(0).getName());
@@ -270,15 +274,8 @@
pm_.addNode("root.kanto.tokyo", "hadanshita");
assertEquals("hadanshita",
pm_.findNode("root.kanto.tokyo.hadanshita").getNodeRDN());
- List list = pm_.findNode("root").getChildren();
+ List<?> list = pm_.findNode("root").getChildren();
assertEquals("Root should have children of ", 1, list.size());
pm_.printNodes();
}
-
- public void XtestObjectIdentity() throws Exception
- {
- }
-
-
-
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -41,7 +41,7 @@
Properties p_;
String oldFactory_ = null;
final String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
- static ArrayList nodeList_;
+ static ArrayList<String> nodeList_;
static final int depth_ = 2;
static final int children_ = 2;
static final int MAX_LOOP = 100;
@@ -212,7 +212,7 @@
* of the hierarchy and children is the number of children under each node.
* This strucutre is used to add, get, and remove for each node.
*/
- private ArrayList nodeGen(int depth, int children)
+ private ArrayList<String> nodeGen(int depth, int children)
{
ArrayList<String> strList = new ArrayList<String>();
ArrayList<String> oldList = new ArrayList<String>();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTest.java 2007-09-12 01:04:18 UTC
(rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTest.java 2007-09-12 01:05:23 UTC
(rev 4456)
@@ -117,7 +117,7 @@
public void testRemove() throws Exception
{
- Person joe = createPerson("/person/test3", "Joe", 32);
+ createPerson("/person/test3", "Joe", 32);
cache_.detach("/person/test3");
// assertNull("Underlying cache content " +
cache_.getCache().printDetails(),
// cache_.getCache().get("/person/test3"));
@@ -129,7 +129,7 @@
try
{
person.setAge(30);
- List med = person.getMedication();
+ List<String> med = person.getMedication();
assertNull("Medication should be null ", med);
person.setAge(60);
med = person.getMedication();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTxTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTxTest.java 2007-09-12 01:04:18 UTC
(rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/LocalTxTest.java 2007-09-12 01:05:23 UTC
(rev 4456)
@@ -20,7 +20,6 @@
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
-import javax.transaction.Transaction;
import javax.transaction.UserTransaction;
import org.apache.commons.logging.Log;
@@ -133,8 +132,6 @@
{
Thread t1 = new Thread("t1")
{
- Transaction tx;
-
public void run()
{
try
@@ -162,8 +159,6 @@
Thread t2 = new Thread("t2")
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
@@ -228,8 +223,6 @@
{
Thread t1 = new Thread("t1")
{
- Transaction tx;
-
public void run()
{
try
@@ -254,8 +247,6 @@
Thread t2 = new Thread("t2")
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
@@ -413,8 +404,8 @@
}
};
- Person p1 = createPerson("/p1/test6", "p6", 50);
- Person p2 = createPerson("/p2/test6", "p6", 50);
+ createPerson("/p1/test6", "p6", 50);
+ createPerson("/p2/test6", "p6", 50);
t1.start();
t2.start();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/NewLocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/NewLocalTest.java 2007-09-12 01:04:18
UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/NewLocalTest.java 2007-09-12 01:05:23
UTC (rev 4456)
@@ -28,7 +28,7 @@
*/
@Test(groups = {"functional"})
-public class NewLocalTest
+public class NewLocalTest
{
Log log_ = LogFactory.getLog(NewLocalTest.class);
PojoCache cache_;
@@ -52,6 +52,7 @@
// public void testDummy() {}
+ @Test(enabled = false)
public void XtestBadFqn() throws Exception
{
log_.info("testBadFqn() ....");
@@ -122,7 +123,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
list.add("English");
list.add("Taiwanese");
test.setLanguages(list);
@@ -145,7 +146,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashSet set = new HashSet();
+ HashSet<String> set = new HashSet<String>();
set.add("Golf");
set.add("Cooking");
test.setSkills(set);
@@ -169,7 +170,7 @@
test.setName("Ben");
test.setAge(10);
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("1", "Golf");
map.put("2", "Surfing");
test.setHobbies(map);
@@ -190,7 +191,7 @@
public void testFindObjects() throws Exception
{
log_.info("testFindObjects() ....");
- Map map = cache_.findAll("/");
+ Map<?, ?> map = cache_.findAll("/");
assertEquals("Objects size should be ", 0, map.size());
Person ben = new Person();
ben.setName("Ben");
@@ -213,9 +214,5 @@
map = cache_.findAll(null); // should everything.
assertEquals("Objects size should be ", 2, map.size());
}
-
-
-
-
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -177,7 +177,7 @@
addr.addResidents("Ben");
addr.addResidents("Joe");
// Test serialization first
- Fqn fqn = new Fqn("/plain");
+ Fqn<String> fqn = Fqn.fromString("/plain");
cache_.getCache().put(fqn, "test", addr);
cache_.getCache().remove(fqn, "test");
@@ -209,6 +209,7 @@
public static class PersonSerial implements Serializable
{
+ private static final long serialVersionUID = 1L;
public String name;
public int age;
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTxTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTxTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/NewReplicatedTxTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -20,7 +20,6 @@
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
-import javax.transaction.Transaction;
import javax.transaction.UserTransaction;
import org.apache.commons.logging.Log;
@@ -191,8 +190,6 @@
Thread t2 = new Thread()
{
- Transaction tx;
-
public void run()
{
try
@@ -239,8 +236,6 @@
{
Thread t1 = new Thread()
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
@@ -288,8 +283,6 @@
Thread t2 = new Thread()
{
- Transaction tx;
-
public void run()
{
try
@@ -346,8 +339,6 @@
Thread t1 = new Thread()
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
@@ -390,8 +381,6 @@
Thread t2 = new Thread()
{
- Transaction tx;
-
public void run()
{
List<String> lang = null;
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/RecursiveRefTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/RecursiveRefTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/RecursiveRefTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -3,7 +3,6 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -18,9 +17,6 @@
private PojoCache cache;
Log log = LogFactory.getLog(RecursiveRefTest.class);
- private Map cachedMap;
-
-
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
@@ -28,8 +24,7 @@
boolean toStart = false;
cache = PojoCacheFactory.createCache(CONFIG_FILENAME, toStart);
cache.start();
- cache.attach("/aop/test", new HashMap());
- cachedMap = (Map) cache.find("/aop/test");
+ cache.attach("/aop/test", new HashMap<Object, Object>());
}
@AfterMethod(alwaysRun = true)
@@ -37,21 +32,7 @@
{
}
- public void XtestDummy()
- {
-
- }
-//
-// This is a bogus test. A key must be serializable since it part of an FQN.
-// Also it shouldn't be mutable.
-//
-// public void testRecuriveMapKey()
-// {
-// IdObject id = new IdObject("1");
-// ValueObject value = new ValueObject(id, 3.0f);
-// cachedMap.put(id, value);
-// }
-
+ @SuppressWarnings("unchecked")
public void testRecursiveList() throws Exception
{
ArrayList list = new ArrayList();
@@ -62,6 +43,7 @@
System.out.println(list.toString());
}
+ @SuppressWarnings("unchecked")
public void testRecursiveSet() throws Exception
{
HashSet set = new HashSet();
@@ -72,6 +54,7 @@
System.out.println(set.toString());
}
+ @SuppressWarnings("unchecked")
public void testRecursiveMap() throws Exception
{
HashMap map = new HashMap();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedByteTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedByteTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedByteTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -70,7 +70,6 @@
Resource res = new Resource();
res.setName("mapping");
res.setConnection("wire");
- String s = "This is a test";
byte by = 1;
byte[] b = new byte[1];
b[0] = by;
@@ -88,12 +87,6 @@
b[0] = by;
res1.setByte(b);
assertEquals("Name ", res.getName(), res1.getName());
-
assertEquals("byte ", res.getByte()[0], res1.getByte()[0]);
-
}
-
-
-
-
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedCircularGraphTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedCircularGraphTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedCircularGraphTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -168,11 +168,13 @@
cache1.attach("/alias", list);
TestingUtil.sleepThread(100);
- List list1 = (List) cache2.find("/list");
- List list2 = (List) cache2.find("/alias");
+ @SuppressWarnings("unchecked")
+ List<Link> list1 = (List<Link>) cache2.find("/list");
+ @SuppressWarnings("unchecked")
+ List<Link> list2 = (List<Link>) cache2.find("/alias");
- assertEquals("parent", ((Link) list1.get(0)).getName());
- assertEquals("child", ((Link) list2.get(0)).getLink().getName());
+ assertEquals("parent", list1.get(0).getName());
+ assertEquals("child", list2.get(0).getLink().getName());
}
public void testCircularAndSharedReferences() throws Exception
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedSerializableTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedSerializableTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedSerializableTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -32,7 +32,7 @@
*/
@Test(groups = {"functional"})
-public class ReplicatedSerializableTest
+public class ReplicatedSerializableTest
{
Log log_ = LogFactory.getLog(ReplicatedSerializableTest.class);
PojoCache cache_;
@@ -84,6 +84,7 @@
*
* @throws Exception
*/
+ @Test(enabled = false)
public void XtestSeriazableSubObjectRelation() throws Exception
{
log_.info("testSerializableSubObjectRelation() ....");
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedTest.java 2007-09-12 01:04:18
UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedTest.java 2007-09-12 01:05:23
UTC (rev 4456)
@@ -27,8 +27,6 @@
Log log = LogFactory.getLog(ReplicatedTest.class);
PojoCache cache, cache1;
-
-
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
@@ -84,7 +82,7 @@
try
{
person.setAge(30);
- List med = person.getMedication();
+ List<String> med = person.getMedication();
assertNull("Medication should be null ", med);
person.setAge(61);
med = person.getMedication();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedTxTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedTxTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/ReplicatedTxTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -13,7 +13,6 @@
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
-import javax.transaction.Transaction;
import javax.transaction.UserTransaction;
import org.apache.commons.logging.Log;
@@ -21,7 +20,6 @@
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.test.Person;
-import org.jboss.cache.pojo.test.Student;
import org.jboss.cache.transaction.DummyTransactionManager;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -86,16 +84,6 @@
return p;
}
- private Student createStudent(String id, String name, int age, String grade)
- {
- Student p = new Student();
- p.setName(name);
- p.setAge(age);
- p.setYear(grade);
- cache.attach(id, p);
- return p;
- }
-
public void testSimple() throws Exception
{
log.info("testSimple() ....");
@@ -140,8 +128,6 @@
{
Thread t1 = new Thread()
{
- Transaction tx;
-
public void run()
{
try
@@ -166,8 +152,6 @@
Thread t2 = new Thread()
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/TestingUtil.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/TestingUtil.java 2007-09-12 01:04:18 UTC
(rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/TestingUtil.java 2007-09-12 01:05:23 UTC
(rev 4456)
@@ -8,6 +8,7 @@
package org.jboss.cache.pojo;
import org.jboss.cache.CacheImpl;
+import org.jgroups.Address;
import java.util.List;
@@ -46,7 +47,7 @@
{
long failTime = System.currentTimeMillis() + timeout;
- CacheImpl tcache = (CacheImpl) cache.getCache();
+ CacheImpl<Object, Object> tcache = (CacheImpl<Object, Object>)
cache.getCache();
while (System.currentTimeMillis() < failTime)
{
org.jboss.cache.pojo.TestingUtil.sleepThread(100);
@@ -74,7 +75,7 @@
for (int i = 0; i < memberCount; i++)
{
- CacheImpl cache = (CacheImpl) caches[i].getCache();
+ CacheImpl<Object, Object> cache = (CacheImpl<Object, Object>)
caches[i].getCache();
return org.jboss.cache.pojo.TestingUtil.isCacheViewComplete(cache,
memberCount);
}
@@ -87,9 +88,9 @@
* @param cache
* @param memberCount
*/
- public static boolean isCacheViewComplete(CacheImpl cache, int memberCount)
+ public static boolean isCacheViewComplete(CacheImpl<Object, Object> cache, int
memberCount)
{
- List members = cache.getMembers();
+ List<Address> members = cache.getMembers();
if (members == null || memberCount > members.size())
{
return false;
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/annotation/ReplicatedAnnotationTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/annotation/ReplicatedAnnotationTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/annotation/ReplicatedAnnotationTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -118,7 +118,8 @@
*
* @throws Exception
*/
- public void XtestSeriazableAnnotationWithRelationship() throws Exception
+ @Test(enabled = false)
+ public void testSeriazableAnnotationWithRelationship() throws Exception
{
log_.info("testSerializableAnnotationWithRelationship() ....");
Gadget ga = new Gadget();
@@ -146,6 +147,7 @@
*
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
public void testCollectionWithGenerics() throws Exception
{
log_.info("testCollectionWithGenerics() ....");
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListImplTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListImplTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListImplTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -28,8 +28,6 @@
Log log = LogFactory.getLog(CachedListImplTest.class);
PojoCache cache_, cache1_;
-
-
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
@@ -50,16 +48,17 @@
cache1_.stop();
}
+ @SuppressWarnings("unchecked")
public void testSimpleRepl()
{
- List list = new ArrayList();
+ List<String> list = new ArrayList<String>();
list.add("1");
list.add("2");
cache_.attach("list", list);
// proxy now
- list = (List) cache_.find("list");
+ list = (List<String>) cache_.find("list");
// test repl
try {
@@ -71,16 +70,13 @@
}
// JBCACHE-975
- list = (List) cache_.detach("list");
+ list = (List<String>) cache_.detach("list");
// test repl
cache_.getCache().put(Fqn.fromString("test"), "1", list);
- ArrayList l1 = (ArrayList) cache1_.getCache().get(Fqn.fromString("test"),
"1");
+ ArrayList<String> l1 = (ArrayList<String>)
cache1_.getCache().get(Fqn.fromString("test"), "1");
System.out.println(" list : " + l1);
}
-
-
-
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -27,17 +27,15 @@
*/
@Test(groups = {"functional"})
-public class CachedListTest
+public class CachedListTest
{
Log log = LogFactory.getLog(CachedListTest.class);
PojoCache cache_;
- List languages;
- List languages2;
+ List<String> languages;
+ List<String> languages2;
-
-
@BeforeMethod(alwaysRun = true)
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
log.info("setUp() ....");
String configFile = "META-INF/local-service.xml";
@@ -47,7 +45,7 @@
}
@AfterMethod(alwaysRun = true)
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
cache_.stop();
}
@@ -58,10 +56,10 @@
languages.add(1, "Taiwanese");
assertEquals("Languages size ", 4, languages.size());
- assertEquals("Language ", (Object) "Taiwanese", (Object)
languages.get(1));
+ assertEquals("Language ", (Object) "Taiwanese",
languages.get(1));
languages.remove(2);
assertEquals("Languages size ", 3, languages.size());
- assertEquals("Language ", (Object) "English", (Object)
languages.get(2));
+ assertEquals("Language ", (Object) "English",
languages.get(2));
languages.add("Mandarin");
assertEquals("Languages size ", 4, languages.size());
@@ -69,18 +67,19 @@
assertEquals("Languages size ", 3, languages.size());
}
+ @SuppressWarnings("unchecked")
protected void stage() throws Throwable
{
- languages = new ArrayList();
+ languages = new ArrayList<String>();
languages.add("English");
languages.add("French");
languages.add("English");
cache_.attach("/person/test6", languages);
- languages = (List) cache_.find("/person/test6");
+ languages = (List<String>) cache_.find("/person/test6");
int size = languages.size();
assertEquals("Size of list ", 3, size);
- languages2 = new ArrayList();
+ languages2 = new ArrayList<String>();
languages2.addAll(languages);
assertEquals("New ArrayList().addAll(CachedList)", languages,
languages2);
}
@@ -88,7 +87,7 @@
public void testAddAllAndClear() throws Throwable
{
stage();
- List list = new ArrayList();
+ List<String> list = new ArrayList<String>();
list.add("Taiwanese");
list.add("Madarin");
@@ -112,9 +111,10 @@
{
stage();
- List list = (List) cache_.find("/person/test6");
+ @SuppressWarnings("unchecked")
+ List<String> list = (List<String>)
cache_.find("/person/test6");
assertTrue("List should be the same ", list.equals(languages));
- list = new ArrayList();
+ list = new ArrayList<String>();
list.add("German");
list.add("test");
list.add("English");
@@ -126,7 +126,8 @@
{
stage();
- List list = (List) cache_.find("/person/test6");
+ @SuppressWarnings("unchecked")
+ List<String> list = (List<String>)
cache_.find("/person/test6");
assertTrue("List should be the same ", list.equals(languages));
assertEquals("List size ", 3, list.size());
list.set(0, "German");
@@ -137,14 +138,14 @@
public void testIterator() throws Throwable
{
- languages = new ArrayList();
- Iterator it0 = languages.iterator();
+ languages = new ArrayList<String>();
+ Iterator<String> it0 = languages.iterator();
assertFalse("Iterator should be empty ", it0.hasNext());
stage();
- Iterator it = languages.iterator();
- Iterator it2 = languages2.iterator();
+ Iterator<String> it = languages.iterator();
+ Iterator<String> it2 = languages2.iterator();
int counter = 0;
while (it.hasNext())
{
@@ -160,15 +161,15 @@
public void testListIterator() throws Throwable
{
- languages = new ArrayList();
- ListIterator it0 = languages.listIterator();
+ languages = new ArrayList<String>();
+ ListIterator<String> it0 = languages.listIterator();
assertFalse("Iterator should be empty ", it0.hasNext());
assertFalse("Iterator should be empty ", it0.hasPrevious());
stage();
- ListIterator li = languages.listIterator();
- ListIterator li2 = languages2.listIterator();
+ ListIterator<String> li = languages.listIterator();
+ ListIterator<String> li2 = languages2.listIterator();
assertFalse("LI has no previous element ", li.hasPrevious());
assertFalse("LI2 has no previous element ", li2.hasPrevious());
assertTrue("LI has next element ", li.hasNext());
@@ -265,8 +266,8 @@
li.nextIndex(), li2.nextIndex());
li2.set("German");
li.set("German");
- String s1 = (String) li.previous();
- String s2 = (String) li2.previous();
+ String s1 = li.previous();
+ String s2 = li2.previous();
assertEquals(s1, s2);
assertEquals(s2, "German");
}
@@ -280,8 +281,8 @@
assertEquals(li.next(), li2.next());
li2.add("Vulcan");
li.add("Vulcan");
- String s1 = (String) li.previous();
- String s2 = (String) li2.previous();
+ String s1 = li.previous();
+ String s2 = li2.previous();
assertEquals(s1, s2);
assertEquals(s2, "Vulcan");
}
@@ -292,19 +293,19 @@
}
-
+ @SuppressWarnings("unchecked")
public void testAttachAndDetach() throws Exception
{
- List list = new ArrayList();
+ List<String> list = new ArrayList<String>();
list.add("English");
list.add("French");
list.add("Taiwanese");
cache_.attach("/test", list); // attach
- list = (List) cache_.find("/test");
+ list = (List<String>) cache_.find("/test");
assertEquals("Size ", 3, list.size());
- list = (List) cache_.detach("/test");
+ list = (List<String>) cache_.detach("/test");
assertEquals("Size ", 3, list.size());
System.out.println("**** End of cache content **** ");
@@ -319,6 +320,7 @@
assertEquals("Size ", 2, list.size());
}
+ @SuppressWarnings("unchecked")
public void testPojoAttachAndDetach() throws Exception
{
Address add1 = new Address();
@@ -333,16 +335,16 @@
add3.setCity("Santa Clara");
add3.setZip(951131);
- List list = new ArrayList();
+ List<Address> list = new ArrayList<Address>();
list.add(add1);
list.add(add2);
list.add(add3);
cache_.attach("/test", list); // attach
- list = (List) cache_.find("/test");
+ list = (List<Address>) cache_.find("/test");
assertEquals("Size ", 3, list.size());
- list = (List) cache_.detach("/test");
+ list = (List<Address>) cache_.detach("/test");
assertEquals("Size ", 3, list.size());
System.out.println("**** End of cache content **** ");
@@ -357,25 +359,26 @@
assertEquals("Size ", 2, list.size());
}
+ @SuppressWarnings("unchecked")
public void testEqual1() throws Exception
{
- List list1 = new ArrayList();
+ List<String> list1 = new ArrayList<String>();
list1.add("ID1");
list1.add("ID2");
cache_.attach("test1", list1);
- list1 = (List)cache_.find("test1");
+ list1 = (List<String>)cache_.find("test1");
- List list2 = new ArrayList();
+ List<String> list2 = new ArrayList<String>();
list2.add("ID1");
list2.add("ID2");
cache_.attach("test2", list2);
- list2 = (List)cache_.find("test2");
+ list2 = (List<String>)cache_.find("test2");
- List list3 = new ArrayList();
+ List<String> list3 = new ArrayList<String>();
list3.add("ID2");
list3.add("ID1");
cache_.attach("test3", list3);
- list3 = (List)cache_.find("test3");
+ list3 = (List<String>)cache_.find("test3");
assertEquals("List should be equal: ", list1, list1);
assertTrue("List should be equal: ", list1.equals(list1));
@@ -383,23 +386,24 @@
assertFalse("List should not be equal: ", list1.equals(list3));
}
+ @SuppressWarnings("unchecked")
public void testEqual2() throws Exception
{
- List list1 = new ArrayList();
+ List<String> list1 = new ArrayList<String>();
cache_.attach("test1", list1);
- list1 = (List)cache_.find("test1");
+ list1 = (List<String>)cache_.find("test1");
list1.add("ID1");
list1.add("ID2");
- List list2 = new ArrayList();
+ List<String> list2 = new ArrayList<String>();
cache_.attach("test2", list2);
- list2 = (List)cache_.find("test2");
+ list2 = (List<String>)cache_.find("test2");
list2.add("ID1");
list2.add("ID2");
- List list3 = new ArrayList();
+ List<String> list3 = new ArrayList<String>();
cache_.attach("test3", list3);
- list3 = (List)cache_.find("test3");
+ list3 = (List<String>)cache_.find("test3");
list3.add("ID2");
list3.add("ID1");
@@ -408,8 +412,4 @@
assertTrue("List should be equal: ", list1.equals(list2));
assertFalse("List should not be equal: ", list1.equals(list3));
}
-
-
-
-}
-
+}
\ No newline at end of file
Deleted: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTxTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTxTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListTxTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -1,52 +0,0 @@
-package org.jboss.cache.pojo.collection;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-/**
- * List interface testing with transaction control.
- *
- * @author Scott Marlow
- */
-
-@Test(groups = {"functional"})
-public class CachedListTxTest
-{
- Log log = LogFactory.getLog(CachedListTxTest.class);
- PojoCache cache_;
-
-
-
- @BeforeMethod(alwaysRun = true)
- protected void setUp() throws Exception
- {
- log.info("setUp() ....");
- String configFile = "META-INF/cache-config.xml";
- boolean toStart = false;
- cache_ = PojoCacheFactory.createCache(configFile, toStart);
- cache_.start();
-
- }
-
- @AfterMethod(alwaysRun = true)
- protected void tearDown() throws Exception
- {
- cache_.stop();
- }
-
- public void testDummy()
- {
- // No op now.
- }
-
-
-
-}
-
-
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapImplTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapImplTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapImplTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -67,16 +67,17 @@
cache1_.stop();
}
+ @SuppressWarnings("unchecked")
public void testSimpleRepl()
{
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<String, String>();
map.put("1", "1");
map.put("2", "2");
cache_.attach("map", map);
// Can't use proxy here. JBCACHE-975.
- map = (Map) cache_.detach("map");
+ map = (Map<String, String>) cache_.detach("map");
// test repl
cache_.getCache().put(Fqn.fromString("test"), "1", map);
@@ -84,7 +85,4 @@
Map m1 = (Map) cache1_.getCache().get(Fqn.fromString("test"),
"1");
System.out.println(" map : " + m1);
}
-
-
-
-}
+}
\ No newline at end of file
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapNullTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapNullTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapNullTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -33,7 +33,7 @@
{
Log log = LogFactory.getLog(CachedMapNullTest.class);
PojoCache cache_;
- Map hobbies;
+ Map<String, String> hobbies;
@BeforeMethod(alwaysRun = true)
@@ -56,9 +56,10 @@
static final int NUMBER_OF_STAGED_HOBBIES = 5;
+ @SuppressWarnings("unchecked")
protected void stage() throws Exception
{
- hobbies = new HashMap();
+ hobbies = new HashMap<String, String>();
hobbies.put("1", "golf");
hobbies.put("2", "tennis");
hobbies.put("3", "polo");
@@ -66,7 +67,7 @@
hobbies.put("key is non-null but value is null", null);
cache_.attach("/person/test7", hobbies);
- hobbies = (Map) cache_.find("/person/test7");
+ hobbies = (Map<String, String>) cache_.find("/person/test7");
assertEquals("Map size", NUMBER_OF_STAGED_HOBBIES, hobbies.size());
if (!(hobbies instanceof ClassProxy || hobbies instanceof Map))
@@ -120,7 +121,7 @@
public void testPutAllEtc() throws Throwable
{
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<String, String>();
map.put("4", "pingpong");
map.put("5", "handball");
@@ -130,10 +131,10 @@
assertTrue("Key is ", hobbies.containsKey("4"));
- Set keys = hobbies.keySet();
+ Set<String> keys = hobbies.keySet();
assertEquals("Key size ", NUMBER_OF_STAGED_HOBBIES + 2, keys.size());
- Set entries = hobbies.entrySet();
+ Set<Map.Entry<String, String>> entries = hobbies.entrySet();
assertEquals("Entry size ", NUMBER_OF_STAGED_HOBBIES + 2,
entries.size());
}
@@ -141,9 +142,9 @@
public void testEntrySet() throws Throwable
{
System.out.println("Map " + hobbies.toString());
- for (Iterator i = hobbies.entrySet().iterator(); i.hasNext();)
+ for (Iterator<Map.Entry<String, String>> i =
hobbies.entrySet().iterator(); i.hasNext();)
{
- Map.Entry entry = (Map.Entry) i.next();
+ Map.Entry<String, String> entry = i.next();
System.out.println("Entry key and value " + entry.getKey() + "
" + entry.getValue());
}
}
@@ -152,18 +153,18 @@
{
System.out.println("Map " + hobbies.toString());
- Set correct = new HashSet();
+ Set<String> correct = new HashSet<String>();
correct.add("golf");
correct.add("tennis");
correct.add("polo");
correct.add("Non-null value but the key is null");
correct.add(null);
- Collection values = hobbies.values();
+ Collection<String> values = hobbies.values();
assertEquals("Correct number of elements in value collection",
correct.size(), values.size());
- Iterator iter = null;
+ Iterator<String> iter = null;
for (iter = correct.iterator(); iter.hasNext();)
assertTrue(values.contains(iter.next()));
@@ -201,7 +202,7 @@
public void testEquals() throws Throwable
{
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<String, String>();
map.put("1", "test");
map.put("4", "test");
map.put("2", "tennis");
@@ -218,18 +219,19 @@
assertTrue("Map should be the same ", hobbies.equals(hobbies));
}
+ @SuppressWarnings("unchecked")
public void testAttachAndDetach() throws Exception
{
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<String, String>();
map.put("1", "English");
map.put("2", "French");
map.put("3", "Taiwanese");
cache_.attach("/test", map); // attach
- map = (Map) cache_.find("/test");
+ map = (Map<String, String>) cache_.find("/test");
assertEquals("Size ", 3, map.size());
- map = (Map) cache_.detach("/test"); // detach
+ map = (Map<String, String>) cache_.detach("/test"); // detach
assertEquals("Size ", 3, map.size());
System.out.println("**** End of cache content **** ");
@@ -244,6 +246,7 @@
assertEquals("Size ", 2, map.size());
}
+ @SuppressWarnings("unchecked")
public void testPojoAttachAndDetach() throws Exception
{
Address add1 = new Address();
@@ -258,16 +261,16 @@
add1.setCity("Santa Clara");
add1.setZip(951131);
- Map map = new HashMap();
+ Map<String, Address> map = new HashMap<String, Address>();
map.put("1", add1);
map.put("2", add2);
map.put("3", add3);
cache_.attach("/test", map); // attach
- map = (Map) cache_.find("/test");
+ map = (Map<String, Address>) cache_.find("/test");
assertEquals("Size ", 3, map.size());
- map = (Map) cache_.detach("/test");
+ map = (Map<String, Address>) cache_.detach("/test");
assertEquals("Size ", 3, map.size());
System.out.println("**** End of cache content **** ");
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedMapTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -31,11 +31,11 @@
*/
@Test(groups = {"functional"})
-public class CachedMapTest
+public class CachedMapTest
{
Log log = LogFactory.getLog(CachedMapTest.class);
PojoCache cache_;
- Map hobbies;
+ Map<Object, Object> hobbies;
@BeforeMethod(alwaysRun = true)
@@ -56,16 +56,17 @@
cache_.stop();
}
+ @SuppressWarnings("unchecked")
protected void stage() throws Exception
{
- hobbies = new HashMap();
+ hobbies = new HashMap<Object, Object>();
hobbies.put("1", "golf");
hobbies.put("2", "tennis");
hobbies.put("3", "polo");
cache_.attach("/person/test7", hobbies);
- hobbies = (Map) cache_.find("/person/test7");
+ hobbies = (Map<Object, Object>) cache_.find("/person/test7");
assertEquals("Map size", 3, hobbies.size());
if (!(hobbies instanceof ClassProxy || hobbies instanceof Map))
@@ -112,7 +113,7 @@
public void testPutAllEtc() throws Throwable
{
- Map map = new HashMap();
+ Map<Object, Object> map = new HashMap<Object, Object>();
map.put("4", "pingpong");
map.put("5", "handball");
@@ -122,10 +123,10 @@
assertTrue("Key is ", hobbies.containsKey("4"));
- Set keys = hobbies.keySet();
+ Set<Object> keys = hobbies.keySet();
assertEquals("Key size ", 5, keys.size());
- Set entries = hobbies.entrySet();
+ Set<Map.Entry<Object, Object>> entries = hobbies.entrySet();
assertEquals("Entry size ", 5, entries.size());
}
@@ -143,9 +144,9 @@
public void testEntrySet() throws Throwable
{
System.out.println("Map " + hobbies.toString());
- for (Iterator i = hobbies.entrySet().iterator(); i.hasNext();)
+ for (Iterator<Map.Entry<Object, Object>> i =
hobbies.entrySet().iterator(); i.hasNext();)
{
- Map.Entry entry = (Map.Entry) i.next();
+ Map.Entry<Object, Object> entry = i.next();
System.out.println("Entry key and value " + entry.getKey() + "
" + entry.getValue());
}
}
@@ -154,22 +155,22 @@
{
System.out.println("Map " + hobbies.toString());
- Set correct = new HashSet();
+ Set<String> correct = new HashSet<String>();
correct.add("golf");
correct.add("tennis");
correct.add("polo");
- Collection values = hobbies.values();
+ Collection<Object> values = hobbies.values();
assertEquals("Correct number of elements in value collection",
correct.size(), values.size());
- Iterator iter = null;
- for (iter = correct.iterator(); iter.hasNext();)
- assertTrue(values.contains(iter.next()));
+ for (String s : correct)
+ assertTrue(values.contains(s));
- for (iter = values.iterator(); iter.hasNext();)
+ Iterator<Object> iter = values.iterator();
+ while (iter.hasNext())
{
- Object value = iter.next();
+ String value = (String) iter.next();
assertTrue(value + " expected", correct.remove(value));
}
assertTrue("No missing elements from iterator", correct.size() == 0);
@@ -201,57 +202,60 @@
public void testEquals1() throws Throwable
{
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<String, String>();
map.put("1", "test");
map.put("4", "test");
map.put("2", "tennis");
assertFalse("Map should not be the same ", map.equals(hobbies));
}
+ @SuppressWarnings("unchecked")
public void testEquals2() throws Throwable
{
- Map map1 = new HashMap();
+ Map<String, String> map1 = new HashMap<String, String>();
cache_.attach("map1", map1);
- map1 = (Map) cache_.find("map1");
+ map1 = (Map<String, String>) cache_.find("map1");
map1.put("1", "test");
- Map map2 = new HashMap();
+ Map<String, String> map2 = new HashMap<String, String>();
cache_.attach("map2", map2);
- map2 = (Map) cache_.find("map2");
+ map2 = (Map<String, String>) cache_.find("map2");
map2.put("1", "me");
assertFalse("Map should not be the same ", map1.equals(map2));
}
+ @SuppressWarnings("unchecked")
public void testEquals3() throws Throwable
{
- Map map1 = new HashMap();
+ Map<String, String> map1 = new HashMap<String, String>();
cache_.attach("map1", map1);
- map1 = (Map) cache_.find("map1");
+ map1 = (Map<String, String>) cache_.find("map1");
map1.put("1", "test");
map1.put("2", "test");
- Map map2 = new HashMap();
+ Map<String, String> map2 = new HashMap<String, String>();
cache_.attach("map2", map2);
- map2 = (Map) cache_.find("map2");
+ map2 = (Map<String, String>) cache_.find("map2");
map2.put("1", "me");
map2.put("2", "me");
assertFalse("Map should not be the same ", map1.equals(map2));
}
+ @SuppressWarnings("unchecked")
public void testAttachAndDetach() throws Exception
{
- Map map = new HashMap();
+ Map<Object, String> map = new HashMap<Object, String>();
map.put("1", "English");
map.put("2", "French");
map.put("3", "Taiwanese");
cache_.attach("/test", map); // attach
- map = (Map) cache_.find("/test");
+ map = (Map<Object, String>) cache_.find("/test");
assertEquals("Size ", 3, map.size());
- map = (Map) cache_.detach("/test"); // detach
+ map = (Map<Object, String>) cache_.detach("/test"); // detach
assertEquals("Size ", 3, map.size());
System.out.println("**** End of cache content **** ");
@@ -266,6 +270,7 @@
assertEquals("Size ", 2, map.size());
}
+ @SuppressWarnings("unchecked")
public void testPojoAttachAndDetach() throws Exception
{
Address add1 = new Address();
@@ -280,16 +285,16 @@
add3.setCity("Santa Clara");
add3.setZip(951131);
- Map map = new HashMap();
+ Map<String, Address> map = new HashMap<String, Address>();
map.put("1", add1);
map.put("2", add2);
map.put("3", add3);
cache_.attach("/test", map); // attach
- map = (Map) cache_.find("/test");
+ map = (Map<String, Address>) cache_.find("/test");
assertEquals("Size ", 3, map.size());
- map = (Map) cache_.detach("/test");
+ map = (Map<String, Address>) cache_.detach("/test");
assertEquals("Size ", 3, map.size());
System.out.println("**** End of cache content **** ");
@@ -312,12 +317,13 @@
add1.setStreet("404 Wyman Street");
add1.setZip(02451);
- Map map = new HashMap();
+ Map<SerializableKeyValue, Address> map = new HashMap<SerializableKeyValue,
Address>();
map.put(key, add1);
cache_.attach("/keytest", map);
- Map ref = (Map) cache_.find("/keytest");
+ @SuppressWarnings("unchecked")
+ Map<SerializableKeyValue, Address> ref = (Map<SerializableKeyValue,
Address>) cache_.find("/keytest");
- Iterator iter = ref.keySet().iterator();
+ Iterator<SerializableKeyValue> iter = ref.keySet().iterator();
assertTrue(iter.hasNext());
Object keyFromMap = iter.next();
assertEquals("original key is same as key in pojocache map, key class="
+
@@ -335,7 +341,7 @@
add1.setStreet("404 Wyman Street");
add1.setZip(02451);
- Map map = new HashMap();
+ Map<NotSerializableKeyValue, Address> map = new
HashMap<NotSerializableKeyValue, Address>();
map.put(key, add1);
try
{
@@ -351,7 +357,8 @@
}
map.clear();
cache_.attach("/keytest", map); // this should succeed
- Map ref = (Map) cache_.find("/keytest");
+ @SuppressWarnings("unchecked")
+ Map<NotSerializableKeyValue, Address> ref = (Map<NotSerializableKeyValue,
Address>) cache_.find("/keytest");
// try adding nonserializable key to pojocache based map
try
@@ -372,6 +379,7 @@
static class SerializableKeyValue implements Serializable
{
+ private static final long serialVersionUID = 1L;
Integer ivalue;
String svalue;
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedSetTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedSetTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedSetTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -6,6 +6,7 @@
import static org.testng.AssertJUnit.fail;
import java.io.PrintWriter;
+import java.io.Serializable;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
@@ -38,7 +39,7 @@
{
Log log = LogFactory.getLog(CachedSetTest.class);
PojoCache cache_;
- Set skills;
+ Set<String> skills;
@BeforeMethod(alwaysRun = true)
@@ -59,15 +60,16 @@
cache_.stop();
}
+ @SuppressWarnings("unchecked")
protected void stage() throws Exception
{
- skills = new HashSet();
+ skills = new HashSet<String>();
skills.add("Java");
skills.add("C++");
skills.add("Perl");
cache_.attach("/person/test7", skills);
- skills = (Set) cache_.find("/person/test7");
+ skills = (Set<String>) cache_.find("/person/test7");
int size = skills.size();
assertEquals("Size is ", 3, size);
}
@@ -112,6 +114,7 @@
private static class DumbObject implements java.io.Serializable
{
+ private static final long serialVersionUID = 1L;
int i;
DumbObject(int i) { this.i = i; }
public int hashCode()
@@ -124,9 +127,10 @@
}
}
+ @SuppressWarnings("unchecked")
public void testConflictingHash() throws Exception
{
- Set set = new HashSet();
+ Set<Serializable> set = new HashSet<Serializable>();
String nulls = null;
DumbObject o1 = new DumbObject(1);
DumbObject o2 = new DumbObject(2);
@@ -135,10 +139,10 @@
set.add(o2);
set.add(o3);
set.add(nulls);
- Set set2 = Collections.unmodifiableSet(new HashSet(set));
+ Set<Serializable> set2 = Collections.unmodifiableSet(new
HashSet<Serializable>(set));
cache_.attach("/test", set); // attach
- set = (Set) cache_.find("/test");
+ set = (Set<Serializable>) cache_.find("/test");
assertEquals("Same", set2, set);
assertEquals(true, set.remove(o2));
assertEquals(true, set.remove(nulls));
@@ -153,17 +157,17 @@
public void testAddAndRemoveAll() throws Throwable
{
- List list = new ArrayList();
+ List<String> list = new ArrayList<String>();
list.add("Tennis");
list.add("Polo");
list.add("Baseball");
- skills.addAll((Collection) list);
+ skills.addAll((Collection<String>) list);
int size = skills.size();
assertEquals("Size is ", 6, size);
assertTrue("Skill contains Polo ", skills.contains("Polo"));
- skills.removeAll((Collection) list);
+ skills.removeAll((Collection<String>) list);
size = skills.size();
assertEquals("Size is ", 3, size);
assertFalse("Skill does not contain Polo ",
skills.contains("Polo"));
@@ -180,7 +184,7 @@
public void testIterator()
{
- Iterator it = skills.iterator();
+ Iterator<String> it = skills.iterator();
int counter = 0;
while (it.hasNext())
{
@@ -192,7 +196,7 @@
assertEquals("iterator: Size should be ", 3, counter);
assertEquals("iterator: Skills should be empty ", 0, skills.size());
- List list = new ArrayList();
+ List<String> list = new ArrayList<String>();
list.add("Tennis");
list.add("Polo");
list.add("Baseball");
@@ -213,7 +217,7 @@
assertTrue("iterator: item not removed via iterator",
skills.contains("Lacrosse"));
// Check for proper relationship between hasNext and next
- list = new ArrayList();
+ list = new ArrayList<String>();
list.add("Tennis");
list.add("Polo");
list.add("Baseball");
@@ -253,11 +257,12 @@
}
+ @SuppressWarnings("unchecked")
public void testEquals() throws Throwable
{
- Set set = (Set) cache_.find("/person/test7");
+ Set<String> set = (Set<String>)
cache_.find("/person/test7");
assertTrue("iterator: List should be the same ", set.equals(skills));
- set = new HashSet();
+ set = new HashSet<String>();
set.add("German");
set.add("test");
set.add("English");
@@ -266,18 +271,19 @@
}
+ @SuppressWarnings("unchecked")
public void testAttachAndDetach() throws Exception
{
- Set set = new HashSet();
+ Set<String> set = new HashSet<String>();
set.add("English");
set.add("French");
set.add("Taiwanese");
cache_.attach("/test", set); // attach
- set = (Set) cache_.find("/test");
+ set = (Set<String>) cache_.find("/test");
assertEquals("Size ", 3, set.size());
- set = (Set) cache_.detach("/test");
+ set = (Set<String>) cache_.detach("/test");
assertEquals("Size ", 3, set.size());
System.out.println("**** End of cache content **** ");
@@ -292,6 +298,7 @@
assertEquals("Size ", 2, set.size());
}
+ @SuppressWarnings("unchecked")
public void testPojoAttachAndDetach() throws Exception
{
Address add1 = new Address();
@@ -306,16 +313,16 @@
add3.setCity("Santa Clara");
add3.setZip(951131);
- Set set = new HashSet();
+ Set<Address> set = new HashSet<Address>();
set.add(add1);
set.add(add2);
set.add(add3);
cache_.attach("/test", set); // attach
- set = (Set) cache_.find("/test");
+ set = (Set<Address>) cache_.find("/test");
assertEquals("Size ", 3, set.size());
- set = (Set) cache_.detach("/test");
+ set = (Set<Address>) cache_.detach("/test");
assertEquals("Size ", 3, set.size());
System.out.println("**** End of cache content **** ");
@@ -371,7 +378,7 @@
public void testRetainAll() throws Exception
{
- LinkedList list2 = new LinkedList();
+ LinkedList<String> list2 = new LinkedList<String>();
list2.add("Java");
assertTrue("testRetainAll", skills.retainAll(list2));
@@ -383,7 +390,7 @@
public void testContainsAll() throws Exception
{
- LinkedList list2 = new LinkedList();
+ LinkedList<String> list2 = new LinkedList<String>();
list2.add("Java");
list2.add("C++");
list2.add("Perl");
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CollectionTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CollectionTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CollectionTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -8,7 +8,6 @@
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
-import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,17 +51,18 @@
*
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
public void testLinkedList() throws Exception
{
- LinkedList list = new LinkedList();
- LinkedList list1;
+ LinkedList<String> list = new LinkedList<String>();
+ LinkedList<String> list1;
list.add("English");
try
{
cache_.attach("/aop/list", list);
- list = (LinkedList) cache_.find("/aop/list");
+ list = (LinkedList<String>) cache_.find("/aop/list");
list.add("French");
- list1 = (LinkedList) cache_.find("/aop/list");
+ list1 = (LinkedList<String>) cache_.find("/aop/list");
assertEquals("Size of list ", 2, list1.size());
}
catch (Exception e)
@@ -77,17 +77,18 @@
*
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
public void testLinkedMap() throws Exception
{
- LinkedHashMap map = new LinkedHashMap();
- LinkedHashMap map1;
+ LinkedHashMap<String, String> map = new LinkedHashMap<String,
String>();
+ LinkedHashMap<String, String> map1;
map.put("1", "English");
try
{
cache_.attach("/aop/map", map);
- map = (LinkedHashMap) cache_.find("/aop/map");
+ map = (LinkedHashMap<String, String>) cache_.find("/aop/map");
map.put("2", "French");
- map1 = (LinkedHashMap) cache_.find("/aop/map");
+ map1 = (LinkedHashMap<String, String>) cache_.find("/aop/map");
assertEquals("Size of map ", 2, map1.size());
}
catch (Exception e)
@@ -102,16 +103,16 @@
*
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
public void testLinkedSet() throws Exception
{
- LinkedHashSet set = new LinkedHashSet();
+ LinkedHashSet<String> set = new LinkedHashSet<String>();
LinkedHashSet set1;
set.add("English");
- Map map;
try
{
cache_.attach("/aop/set", set);
- set = (LinkedHashSet) cache_.find("/aop/set");
+ set = (LinkedHashSet<String>) cache_.find("/aop/set");
set.add("French");
set1 = (LinkedHashSet) cache_.find("/aop/set");
assertEquals("Size of set ", 2, set1.size());
@@ -123,18 +124,17 @@
}
}
-
-
// tests for each of the methods in Collection interface
+ @SuppressWarnings({ "unchecked", "unchecked" })
public void testSize() throws Exception
{
- LinkedList list = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
list.add("java");
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
assertEquals("size of collection", 1, list.size());
list.add("c");
list.add("lisp");
@@ -154,14 +154,15 @@
}
+ @SuppressWarnings("unchecked")
public void testIsEmpty() throws Exception
{
- LinkedList list = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
assertTrue("collection is empty", list.isEmpty());
list.add("c");
list.add("lisp");
@@ -178,14 +179,15 @@
}
}
+ @SuppressWarnings("unchecked")
public void testContains() throws Exception
{
- LinkedList list = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
list.add("java");
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
assertFalse("collection doesn't contains",
list.contains("lisp"));
list.add("c");
list.add("lisp");
@@ -204,10 +206,11 @@
}
+ @SuppressWarnings("unchecked")
public void testIterator() throws Exception
{
- LinkedList list = new LinkedList();
- LinkedList list2 = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
+ LinkedList<String> list2 = new LinkedList<String>();
list2.add("java");
list2.add("c");
list2.add("lisp");
@@ -216,7 +219,7 @@
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
list.addAll(list2);
for (Object o : list) assertTrue("Iteration test",
list2.contains(o));
}
@@ -227,10 +230,11 @@
}
}
+ @SuppressWarnings("unchecked")
public void testToArray() throws Exception
{
- LinkedList list = new LinkedList();
- LinkedList list2 = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
+ LinkedList<String> list2 = new LinkedList<String>();
list2.add("java");
list2.add("c");
list2.add("lisp");
@@ -240,7 +244,7 @@
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
Object[] values = list.toArray();
for (int looper = 0; looper < values.length; looper++)
@@ -270,13 +274,14 @@
}
}
+ @SuppressWarnings("unchecked")
public void testAdd() throws Exception
{
- LinkedList list = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
list.add("java");
assertTrue("add test", list.contains("java"));
assertFalse("add test", list.contains("c#"));
@@ -289,13 +294,14 @@
}
+ @SuppressWarnings("unchecked")
public void testRemove() throws Exception
{
- LinkedList list = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
list.add("java");
assertTrue(list.remove("java"));
assertFalse("remove test", list.contains("java"));
@@ -308,10 +314,11 @@
}
+ @SuppressWarnings("unchecked")
public void testAddAll() throws Exception
{
- LinkedList list = new LinkedList();
- LinkedList list2 = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
+ LinkedList<String> list2 = new LinkedList<String>();
list2.add("java");
list2.add("c");
list2.add("lisp");
@@ -321,7 +328,7 @@
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
assertTrue(list.addAll(list2));
Object[] values = list.toArray();
@@ -338,10 +345,11 @@
}
+ @SuppressWarnings("unchecked")
public void testClear() throws Exception
{
- LinkedList list = new LinkedList();
- LinkedList list2 = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
+ LinkedList<String> list2 = new LinkedList<String>();
list2.add("java");
list2.add("c");
list2.add("lisp");
@@ -351,7 +359,7 @@
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
assertTrue(list.addAll(list2));
assertTrue("testClear", list.size() > 0);
list.clear();
@@ -365,10 +373,11 @@
}
+ @SuppressWarnings("unchecked")
public void testRetainAll() throws Exception
{
- LinkedList list = new LinkedList();
- LinkedList list2 = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
+ LinkedList<String> list2 = new LinkedList<String>();
list2.add("java");
list2.add("c");
list2.add("lisp");
@@ -378,7 +387,7 @@
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
assertTrue(list.addAll(list2));
list2.remove("c");
list2.remove("lisp");
@@ -398,10 +407,11 @@
}
+ @SuppressWarnings({ "unchecked", "unchecked" })
public void testRemoveAll() throws Exception
{
- LinkedList list = new LinkedList();
- LinkedList list2 = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
+ LinkedList<String> list2 = new LinkedList<String>();
list2.add("java");
list2.add("c");
list2.add("lisp");
@@ -411,7 +421,7 @@
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
assertTrue(list.addAll(list2));
list2.remove("java");
assertTrue("testRemoveAll", list.removeAll(list2));
@@ -429,10 +439,11 @@
}
+ @SuppressWarnings("unchecked")
public void testContainsAll() throws Exception
{
- LinkedList list = new LinkedList();
- LinkedList list2 = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
+ LinkedList<String> list2 = new LinkedList<String>();
list2.add("java");
list2.add("c");
list2.add("lisp");
@@ -442,7 +453,7 @@
try
{
cache_.attach("/language/list", list);
- list = (LinkedList) cache_.find("/language/list");
+ list = (LinkedList<String>) cache_.find("/language/list");
assertTrue(list.addAll(list2));
list2.remove("java");
assertTrue("testContainsAll", list.containsAll(list2));
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ObjectGraphTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ObjectGraphTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ObjectGraphTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -28,6 +28,7 @@
*/
@Test(groups = {"functional"})
+@SuppressWarnings("unchecked")
public class ObjectGraphTest
{
Log log = LogFactory.getLog(ObjectGraphTest.class);
@@ -64,14 +65,14 @@
public void testListWithMultipleSharedObjccts() throws Exception
{
log.info("testListWithMultipleSharedObjects() ....");
- List list1 = new ArrayList();
+ List<Address> list1 = new ArrayList<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
list1.add(addr);
- List list2 = new ArrayList();
- List list3 = new ArrayList();
+ List<Address> list2 = new ArrayList<Address>();
+ List<Address> list3 = new ArrayList<Address>();
list2.add(addr);
list3.add(addr);
@@ -79,11 +80,11 @@
cache_.attach("/list2", list2);
cache_.attach("/list3", list3);
- list3 = (List) cache_.find("/list3");
+ list3 = (List<Address>) cache_.find("/list3");
assertTrue("List size should not be 0 ", (list3.size() != 0));
- assertEquals("Address ", addr.getZip(), ((Address)
list3.get(0)).getZip());
+ assertEquals("Address ", addr.getZip(), list3.get(0).getZip());
addr.setCity("Sunnyvale");
- assertEquals("Address ", addr.getCity(), ((Address)
list3.get(0)).getCity());
+ assertEquals("Address ", addr.getCity(), list3.get(0).getCity());
cache_.detach("/list1");
cache_.detach("/list2");
@@ -93,18 +94,18 @@
public void testRelationshipWithSharedList1() throws Exception
{
log.info("testRelationshipWithList() ....");
- List list1 = new ArrayList();
+ List<Address> list1 = new ArrayList<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
list1.add(addr);
cache_.attach("/list", list1);
- list1 = (List) cache_.find("/list");
+ list1 = (List<Address>) cache_.find("/list");
assertEquals("List size should be ", 1, list1.size());
cache_.attach("/alias", list1);
- list1 = (List) cache_.find("/list");
+ list1 = (List<Address>) cache_.find("/list");
assertEquals("List size should be ", 1, list1.size());
List list2 = (List) cache_.find("/alias");
// System.out.println(cache_.printDetails());
@@ -116,13 +117,13 @@
public void testRelationshipWithSharedList2() throws Exception
{
log.info("testRelationshipWithList2() ....");
- List list1 = new ArrayList();
+ List<Address> list1 = new ArrayList<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
list1.add(addr);
- List list2 = new ArrayList();
+ List<Address> list2 = new ArrayList<Address>();
list2.add(addr);
cache_.attach("/list1", list1);
@@ -136,7 +137,7 @@
public void testListWithAttachAndDetach() throws Exception
{
log.info("testListWithAttachAndDetach() ....");
- List list1 = new ArrayList();
+ List<Address> list1 = new ArrayList<Address>();
Address addr1 = new Address();
addr1.setCity("San Jose");
addr1.setZip(95123);
@@ -147,11 +148,11 @@
list1.add(addr2);
cache_.attach("/list", list1);
- list1 = (List) cache_.find("/list");
+ list1 = (List<Address>) cache_.find("/list");
assertEquals("List size should be ", 1, list1.size());
cache_.attach("/alias", list1);
- list1 = (List) cache_.find("/list");
+ list1 = (List<Address>) cache_.find("/list");
assertEquals("List size should be ", 1, list1.size());
List list2 = (List) cache_.find("/alias");
// System.out.println(cache_.printDetails());
@@ -163,7 +164,7 @@
public void testRelationshipWithSharedSet1() throws Exception
{
log.info("testRelationshipWithSet() ....");
- Set set1 = new HashSet();
+ Set<Address> set1 = new HashSet<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
@@ -172,10 +173,10 @@
// Pure set
cache_.attach("/set", set1);
// We specifically need to use Proxy otherwise it won't work with multiple
references
- set1 = (Set) cache_.find("/set");
+ set1 = (Set<Address>) cache_.find("/set");
cache_.attach("/alias", set1);
- set1 = (Set) cache_.find("/set");
+ set1 = (Set<Address>) cache_.find("/set");
Set set2 = (Set) cache_.find("/alias");
assertTrue("Set size should not be 0 ", (set2.size() != 0));
assertEquals("Both sets should be equal ", set1, set2);
@@ -187,13 +188,13 @@
public void testRelationshipWithSharedSet2() throws Exception
{
log.info("testRelationshipWithSet2() ....");
- Set set1 = new HashSet();
+ Set<Address> set1 = new HashSet<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
set1.add(addr);
- Set set2 = new HashSet();
+ Set<Address> set2 = new HashSet<Address>();
set2.add(addr);
cache_.attach("/set1", set1);
@@ -208,7 +209,7 @@
public void testRelationshipWithSharedMap1() throws Exception
{
log.info("testRelationshipWithMap() ....");
- Map map1 = new HashMap();
+ Map<String, Address> map1 = new HashMap<String, Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
@@ -217,7 +218,7 @@
cache_.attach("/map", map1);
cache_.attach("/alias", map1);
- map1 = (Map) cache_.find("/map");
+ map1 = (Map<String, Address>) cache_.find("/map");
Map map2 = (Map) cache_.find("/alias");
assertTrue("Map size should not be 0 ", (map2.size() != 0));
assertEquals("Both maps should be equal ", map1, map2);
@@ -229,21 +230,21 @@
public void testRelationshipWithSharedMap2() throws Exception
{
log.info("testRelationshipWithMap2() ....");
- Map map1 = new HashMap();
+ Map<String, Address> map1 = new HashMap<String, Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
map1.put("key1", addr);
- Map map2 = new HashMap();
+ Map<String, Address> map2 = new HashMap<String, Address>();
map2.put("key2", addr);
// Pure map
cache_.attach("/map", map1);
cache_.attach("/alias", map2);
- map1 = (Map) cache_.find("/map");
- map2 = (Map) cache_.find("/alias");
+ map1 = (Map<String, Address>) cache_.find("/map");
+ map2 = (Map<String, Address>) cache_.find("/alias");
assertTrue("Map size should not be 0 ", (map2.size() != 0));
Address add1 = (Address) ((Map.Entry)
map2.entrySet().iterator().next()).getValue();
assertNotNull("Address should not be null", add1);
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncListTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncListTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncListTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -77,10 +77,11 @@
*
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
public void testAttachDetach() throws Exception
{
log.info("testAttachDetach() ....");
- List list1 = new ArrayList();
+ List<Address> list1 = new ArrayList<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
@@ -96,20 +97,21 @@
// Pure list
cache1.attach("/list", list1);
- list1 = (List) cache1.find("/list");
+ list1 = (List<Address>) cache1.find("/list");
list1.add(addr2);
// The return value is the original reference.
- list1 = (List) cache1.detach("/list");
+ list1 = (List<Address>) cache1.detach("/list");
assertEquals("Detached list should still be", 2, list1.size());
list1.add(addr3);
cache1.attach("/list", list1);
List list2 = (List) cache2.find("/list");
assertTrue("List size should not be 0 ", (list2.size() != 0));
- assertEquals("Both list values should be equal ", ((Address)
list1.get(0)).getZip(),
+ assertEquals("Both list values should be equal ", list1.get(0).getZip(),
((Address) list2.get(0)).getZip());
}
+ @SuppressWarnings("unchecked")
public void testRemoteDetach() throws Exception
{
List<Object> list = new ArrayList<Object>();
@@ -144,10 +146,11 @@
*
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
public void testRelationshipWithSharedList1() throws Exception
{
log.info("testRelationshipWithList() ....");
- List list1 = new ArrayList();
+ List<Address> list1 = new ArrayList<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
@@ -156,7 +159,7 @@
// Pure list
cache1.attach("/list", list1);
// We specifically need to use Proxy otherwise it won't work with multiple
references
- list1 = (List) cache1.find("/list");
+ list1 = (List<Address>) cache1.find("/list");
cache1.attach("/alias", list1);
List list2 = (List) cache1.find("/alias");
@@ -164,7 +167,7 @@
assertNotNull("Address should not be null", add1);
assertEquals("Zip ", 95123, add1.getZip());
- list1 = (List) cache2.find("/list");
+ list1 = (List<Address>) cache2.find("/list");
list2 = (List) cache2.find("/alias");
assertTrue("List size should not be 0 ", (list2.size() != 0));
assertEquals("Both lists should be equal ", list1, list2);
@@ -180,19 +183,21 @@
{
log.info("testRelationshipWithList2() ....");
// 2 lists with shared objects
- List list1 = new ArrayList();
+ List<Address> list1 = new ArrayList<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
list1.add(addr);
- List list2 = new ArrayList();
+ List<Address> list2 = new ArrayList<Address>();
list2.add(addr);
cache1.attach("/list1", list1);
cache1.attach("/list2", list2);
- Address add2 = (Address) ((List) cache2.find("/list2")).get(0);
- Address add1 = (Address) ((List) cache2.find("/list1")).get(0);
+ @SuppressWarnings("unchecked")
+ Address add2 = ((List<Address>) cache2.find("/list2")).get(0);
+ @SuppressWarnings("unchecked")
+ Address add1 = ((List<Address>) cache2.find("/list1")).get(0);
assertEquals("Address should be the same", add1, add2);
assertEquals("Both shared object should be equal ", add2.getZip(),
add1.getZip());
}
@@ -206,27 +211,29 @@
{
log.info("testRelationshipWithList3() ....");
// 2 lists with shared objects
- List list1 = new ArrayList();
+ List<Address> list1 = new ArrayList<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
list1.add(addr);
- List list2 = new ArrayList();
+ List<Address> list2 = new ArrayList<Address>();
list2.add(addr);
cache1.attach("/address", addr);
cache1.attach("/list1", list1);
- Address add1 = (Address) ((List) cache2.find("/list1")).get(0);
+ @SuppressWarnings("unchecked")
+ Address add1 = ((List<Address>) cache2.find("/list1")).get(0);
Address add2 = (Address) cache2.find("/address");
assertEquals("Address should be the same", add1, add2);
assertEquals("Both shared object should be equal ", 95123,
add1.getZip());
}
+ @SuppressWarnings("unchecked")
public void testNullWithSharedList1() throws Exception
{
log.info("testNullWithSharedList1() ....");
- List list1 = new ArrayList();
+ List<String> list1 = new ArrayList<String>();
list1.add("element 0");
list1.add(null); // element 1
list1.add("element 2");
@@ -235,13 +242,13 @@
// Pure set
cache1.attach("/list", list1);
// We specifically need to use Proxy otherwise it won't work with multiple
references
- list1 = (List) cache1.find("/list");
+ list1 = (List<String>) cache1.find("/list");
cache1.attach("/alias", list1);
- List list2 = (List) cache1.find("/alias");
+ List<String> list2 = (List) cache1.find("/alias");
- list1 = (List) cache2.find("/list");
- list2 = (List) cache2.find("/alias");
+ list1 = (List<String>) cache2.find("/list");
+ list2 = (List<String>) cache2.find("/alias");
assertTrue("List size should not be 0 ", (list2.size() != 0));
assertEquals("Both listss should be equal ", list1, list2);
@@ -264,7 +271,7 @@
assertTrue("set first item to 'element 0'",
list2.get(0).equals("element 0"));
- ListIterator listIter = list1.listIterator();
+ ListIterator<String> listIter = list1.listIterator();
assertTrue("listiter has next", listIter.hasNext());
assertTrue("listiter 1st element is 'element 0'",
listIter.next().equals("element 0"));
assertTrue("listiter has next", listIter.hasNext());
@@ -275,14 +282,15 @@
}
+ @SuppressWarnings("unchecked")
public void testRecursion1() throws Exception
{
- List list = new ArrayList();
+ List<Object> list = new ArrayList<Object>();
list.add("1");
list.add("2");
cache1.attach("list", list);
- list = (List) cache1.find("list");
+ list = (List<Object>) cache1.find("list");
list.add(list);
assertEquals("size ", 3, list.size());
@@ -291,16 +299,17 @@
// assertEquals("ClassProxy instance", list, l2);
}
+ @SuppressWarnings("unchecked")
public void testRecursion2() throws Exception
{
- List list = new ArrayList();
+ List<Object> list = new ArrayList<Object>();
list.add("1");
list.add("2");
list.add(list);
cache1.attach("list", list);
- list = (List) cache1.find("list");
+ list = (List<Object>) cache1.find("list");
list.toString();
}
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncMapTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncMapTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncMapTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -83,10 +83,11 @@
*
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
public void testAttachDetach() throws Exception
{
log.info("testAttachDetach() ....");
- Map map1 = new HashMap();
+ Map<String, Address> map1 = new HashMap<String, Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
@@ -102,9 +103,9 @@
// Pure list
cache1.attach("/map", map1);
- map1 = (Map) cache1.find("/map");
+ map1 = (Map<String, Address>) cache1.find("/map");
map1.put("key2", addr2);
- map1 = (Map) cache1.detach("/map");
+ map1 = (Map<String, Address>) cache1.detach("/map");
assertEquals("Detached map should still be", 2, map1.size());
map1.put("key3", addr3);
cache1.attach("/map", map1);
@@ -113,10 +114,11 @@
assertEquals("Map size should be ", 3, map2.size());
}
+ @SuppressWarnings("unchecked")
public void testRelationshipWithSharedMap1() throws Exception
{
log.info("testRelationshipWithMap() ....");
- Map map1 = new HashMap();
+ Map<String, Address> map1 = new HashMap<String, Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
@@ -125,7 +127,7 @@
// Pure set
cache1.attach("/map", map1);
// We specifically need to use Proxy otherwise it won't work with multiple
references
- map1 = (Map) cache1.find("/map");
+ map1 = (Map<String, Address>) cache1.find("/map");
cache1.attach("/alias", map1);
Map map2 = (Map) cache1.find("/alias");
@@ -133,7 +135,7 @@
assertNotNull("Address should not be null", add1);
assertEquals("Zip ", 95123, add1.getZip());
- map1 = (Map) cache2.find("/map");
+ map1 = (Map<String, Address>) cache2.find("/map");
map2 = (Map) cache2.find("/alias");
assertTrue("Map size should not be 0 ", (map2.size() != 0));
assertEquals("Both maps should be equal ", map1, map2);
@@ -142,22 +144,23 @@
assertEquals("Zip ", 95123, add1.getZip());
}
+ @SuppressWarnings("unchecked")
public void testNullWithSharedMap1() throws Exception
{
log.info("testNullWithSharedMap1() ....");
- Map map1 = new HashMap();
+ Map<String, String> map1 = new HashMap<String, String>();
map1.put("null value test", null);
map1.put(null, "null key test");
// Pure set
cache1.attach("/map", map1);
// We specifically need to use Proxy otherwise it won't work with multiple
references
- map1 = (Map) cache1.find("/map");
+ map1 = (Map<String, String>) cache1.find("/map");
cache1.attach("/alias", map1);
Map map2 = (Map) cache1.find("/alias");
- map1 = (Map) cache2.find("/map");
+ map1 = (Map<String, String>) cache2.find("/map");
map2 = (Map) cache2.find("/alias");
assertTrue("Map size should not be 0 ", (map2.size() != 0));
assertEquals("Both maps should be equal ", map1, map2);
@@ -171,7 +174,7 @@
assertTrue("containsValue test for null value",
map2.containsValue(null));
assertTrue("values (positive) null test", map2.values().contains(null));
- Collection walk = map1.values();
+ Collection<String> walk = map1.values();
assertTrue(walk.remove(null));
assertFalse("values (negative) null test",
map2.values().contains(null));
@@ -190,23 +193,24 @@
}
+ @SuppressWarnings("unchecked")
public void testRelationshipWithSharedMap2() throws Exception
{
log.info("testRelationshipWithMap2() ....");
- Map map1 = new HashMap();
+ Map<String, Address> map1 = new HashMap<String, Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
map1.put("key1", addr);
- Map map2 = new HashMap();
+ Map<String, Address> map2 = new HashMap<String, Address>();
map2.put("key2", addr);
cache2.attach("/map1", map1);
cache2.attach("/map2", map2);
- map1 = (Map) cache2.find("/map1");
- map2 = (Map) cache2.find("/map2");
+ map1 = (Map<String, Address>) cache2.find("/map1");
+ map2 = (Map<String, Address>) cache2.find("/map2");
assertTrue("Map size should not be 0 ", (map2.size() != 0));
assertEquals("Both maps should be equal ", map1.get("key1"),
map2.get("key2"));
Address add1 = (Address) ((Map.Entry)
map2.entrySet().iterator().next()).getValue();
@@ -214,17 +218,18 @@
assertEquals("Zip ", 95123, add1.getZip());
}
+ @SuppressWarnings("unchecked")
public void testKeySetRemoveWithSharedMap1() throws Exception
{
log.info("testKeySetRemoveWithSharedMap1() ....");
- Map map1 = new HashMap();
+ Map<String, Object> map1 = new HashMap<String, Object>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
map1.put("key1_map1", addr);
map1.put("key2_map1", null);
map1.put(null, "null value test");
- Map map2 = new HashMap();
+ Map<String, Object> map2 = new HashMap<String, Object>();
map2.put("key1_map2", addr);
map2.put("key2_map2", "round");
@@ -234,15 +239,15 @@
cache2.attach("/map1", map1);
cache2.attach("/map2", map2);
- map1 = (Map) cache1.find("/map1");
- map2 = (Map) cache1.find("/map2");
+ map1 = (Map<String, Object>) cache1.find("/map1");
+ map2 = (Map<String, Object>) cache1.find("/map2");
assertTrue("key1 exists", map1.containsKey("key1_map1"));
assertTrue("null key exists", map1.containsKey(null));
assertTrue("key2 exists", map1.containsKey("key2_map1"));
- Set set = map1.keySet();
- Iterator iter = set.iterator();
+ Set<String> set = map1.keySet();
+ Iterator<String> iter = set.iterator();
while (iter.hasNext())
{
Object o = iter.next();
@@ -255,8 +260,8 @@
assertFalse("key1 doesn't exist",
map1.containsKey("key1_map1"));
assertFalse("null key doesn't exist", map1.containsKey(null));
- map1 = (Map) cache2.find("/map1");
- map2 = (Map) cache2.find("/map2");
+ map1 = (Map<String, Object>) cache2.find("/map1");
+ map2 = (Map<String, Object>) cache2.find("/map2");
assertTrue("key2 exists", map1.containsKey("key2_map1"));
assertFalse("key1 doesn't exist",
map1.containsKey("key1_map1"));
@@ -264,14 +269,15 @@
}
+ @SuppressWarnings("unchecked")
public void testRecursion1() throws Exception
{
- Map map = new HashMap();
+ Map<String, Object> map = new HashMap<String, Object>();
map.put("1", "1");
map.put("2", "2");
cache1.attach("map", map);
- map = (Map) cache1.find("map");
+ map = (Map<String, Object>) cache1.find("map");
map.put("map", map);
assertEquals("size ", 3, map.size());
@@ -280,9 +286,10 @@
// assertEquals("ClassProxy instance", list, l2);
}
- public void XtestRecursion2() throws Exception
+ @Test(enabled = false)
+ public void testRecursion2() throws Exception
{
- Map map = new HashMap();
+ Map<String, Object> map = new HashMap<String, Object>();
map.put("1", "1");
map.put("2", "2");
map.put("map", map);
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncSetTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncSetTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/ReplicatedSyncSetTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -76,10 +76,11 @@
*
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
public void testAttachDetach() throws Exception
{
log.info("testAttachDetach() ....");
- Set set1 = new HashSet();
+ Set<Address> set1 = new HashSet<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
@@ -95,9 +96,9 @@
// Pure list
cache1.attach("/set", set1);
- set1 = (Set) cache1.find("/set");
+ set1 = (Set<Address>) cache1.find("/set");
set1.add(addr2);
- set1 = (Set) cache1.detach("/set");
+ set1 = (Set<Address>) cache1.detach("/set");
assertEquals("Detached set should still be", 2, set1.size());
set1.add(addr3);
cache1.attach("/set", set1);
@@ -106,10 +107,11 @@
assertEquals("Set size should be ", 3, set2.size());
}
+ @SuppressWarnings("unchecked")
public void testRelationshipWithSharedSet1() throws Exception
{
log.info("testRelationshipWithSet() ....");
- Set set1 = new HashSet();
+ Set<Address> set1 = new HashSet<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
@@ -118,7 +120,7 @@
// Pure set
cache1.attach("/set", set1);
// We specifically need to use Proxy otherwise it won't work with multiple
references
- set1 = (Set) cache1.find("/set");
+ set1 = (Set<Address>) cache1.find("/set");
cache1.attach("/alias", set1);
Set set2 = (Set) cache1.find("/alias");
@@ -126,7 +128,7 @@
assertNotNull("Address should not be null", add1);
assertEquals("Zip ", 95123, add1.getZip());
- set1 = (Set) cache2.find("/set");
+ set1 = (Set<Address>) cache2.find("/set");
set2 = (Set) cache2.find("/alias");
assertTrue("Set size should not be 0 ", (set2.size() != 0));
assertEquals("Both sets should be equal ", set1, set2);
@@ -138,27 +140,30 @@
public void testRelationshipWithSharedSet2() throws Exception
{
log.info("testRelationshipWithSet2() ....");
- Set set1 = new HashSet();
+ Set<Address> set1 = new HashSet<Address>();
Address addr = new Address();
addr.setCity("San Jose");
addr.setZip(95123);
set1.add(addr);
- Set set2 = new HashSet();
+ Set<Address> set2 = new HashSet<Address>();
set2.add(addr);
cache1.attach("/set1", set1);
cache1.attach("/set2", set2);
- Address add2 = (Address) ((Set) cache2.find("/set2")).iterator().next();
- Address add1 = (Address) ((Set) cache2.find("/set1")).iterator().next();
+ @SuppressWarnings("unchecked")
+ Address add2 = ((Set<Address>)
cache2.find("/set2")).iterator().next();
+ @SuppressWarnings("unchecked")
+ Address add1 = ((Set<Address>)
cache2.find("/set1")).iterator().next();
assertEquals("Address should be the same", add1, add2);
assertEquals("Both shared object should be equal ", add2.getZip(),
add1.getZip());
}
+ @SuppressWarnings("unchecked")
public void testNullWithSharedSet1() throws Exception
{
log.info("testNullWithSharedSet1() ....");
- Set set1 = new HashSet();
+ Set<String> set1 = new HashSet<String>();
set1.add("element 0");
set1.add(null); // element 1
set1.add("element 2");
@@ -172,13 +177,13 @@
// Pure set
cache1.attach("/set", set1);
// We specifically need to use Proxy otherwise it won't work with multiple
references
- set1 = (Set) cache1.find("/set");
+ set1 = (Set<String>) cache1.find("/set");
cache1.attach("/alias", set1);
- Set set2 = (Set) cache1.find("/alias");
+ Set<String> set2 = (Set<String>) cache1.find("/alias");
- set1 = (Set) cache2.find("/set");
- set2 = (Set) cache2.find("/alias");
+ set1 = (Set<String>) cache2.find("/set");
+ set2 = (Set<String>) cache2.find("/alias");
assertTrue("Set size should not be 0 ", (set2.size() != 0));
assertEquals("Both sets should be equal ", set1, set2);
@@ -190,7 +195,7 @@
assertTrue("contains test for null value", set1.contains(null));
assertTrue("contains test for null value", set2.contains(null));
- Iterator iter = set1.iterator();
+ Iterator<String> iter = set1.iterator();
while (iter.hasNext())
{
Object val = iter.next();
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/integrated/NetworkManagementTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/integrated/NetworkManagementTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/integrated/NetworkManagementTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -33,7 +33,7 @@
*/
@Test(groups = {"functional"})
-public class NetworkManagementTest
+public class NetworkManagementTest
{
Log log = LogFactory.getLog(NetworkManagementTest.class);
PojoCache cache1;
@@ -138,12 +138,11 @@
cache1.attach("/tainan", tainan);
NetworkNode taipei1 = (NetworkNode) cache1.find("/taipei");
- NetworkNode tainan1 = (NetworkNode) cache1.find("/tainan");
taipei1.setIpAddress("192.168.10.100");
assertEquals("New admin id is ", "192.168.10.100",
taipei.getIpAddress());
- List l2 = taipei1.getElements();
+ List<NetworkElement> l2 = taipei1.getElements();
assertEquals("Size is ", 2, l2.size());
NetworkElement vibSens1 = (NetworkElement) l2.get(0);
NetworkElement tempSens1 = (NetworkElement) l2.get(1);
@@ -201,7 +200,7 @@
taipei1.setIpAddress("192.168.10.100");
assertEquals("New admin id is ", "192.168.10.100",
taipei.getIpAddress());
- List l2 = taipei2.getElements();
+ List<NetworkElement> l2 = taipei2.getElements();
assertEquals("Size is ", 2, l2.size());
NetworkElement vibSens1 = (NetworkElement) l2.get(0);
NetworkElement tempSens1 = (NetworkElement) l2.get(1);
@@ -335,19 +334,17 @@
// NetworkNode taipei1 = (NetworkNode)temp1.getNodes().get(1); this would fail on
equality
NetworkNode taipei2 = (NetworkNode) vib1.getNodes().get(0);
- List l1 = temp1.getNodes();
+ List<NetworkNode> l1 = temp1.getNodes();
assertEquals("Size is ", 2, l1.size());
+ assertEquals("Size is ", 2, taipei.getElements().size());
- l1 = taipei.getElements();
- assertEquals("Size is ", 2, l1.size());
-
assertEquals("IPAddress ", taipei.getIpAddress(),
taipei1.getIpAddress());
assertTrue("DataNode should be the same", (taipei1 == taipei2));
taipei2.setIpAddress("192.168.10.100");
assertEquals("New admin id is ", "192.168.10.100",
taipei.getIpAddress());
- List l2 = taipei1.getElements();
+ List<NetworkElement> l2 = taipei1.getElements();
assertEquals("Size is ", 2, l2.size());
NetworkElement vibSens1 = (NetworkElement) l2.get(0);
NetworkElement tempSens1 = (NetworkElement) l2.get(1);
@@ -359,8 +356,4 @@
assertEquals("Status ", vibSensor1.getStatus(), vibSens1.getStatus());
assertEquals("Status ", tempSensor1.getStatus(), tempSens1.getStatus());
}
-
-
-
-}
-
+}
\ No newline at end of file
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/integrated/ReplicatedNetworkManagementTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/integrated/ReplicatedNetworkManagementTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/integrated/ReplicatedNetworkManagementTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -157,7 +157,7 @@
tainan1.setIpAddress("192.168.10.200");
assertEquals("New admin id is ", "192.168.10.200",
tainan.getIpAddress());
- List l2 = taipei1.getElements();
+ List<NetworkElement> l2 = taipei1.getElements();
assertEquals("Size is ", 2, l2.size());
NetworkElement vibSens1 = (NetworkElement) l2.get(0);
NetworkElement tempSens1 = (NetworkElement) l2.get(1);
@@ -235,10 +235,10 @@
// NetworkNode taipei1 = (NetworkNode)temp1.getNodes().get(1); this would fail on
equality
NetworkNode taipei2 = (NetworkNode) vib1.getNodes().get(0);
- List l1 = temp1.getNodes();
+ List<NetworkNode> l1 = temp1.getNodes();
assertEquals("Size is ", 2, l1.size());
- l1 = taipei.getElements();
+ List<NetworkElement> l2 = taipei.getElements();
assertEquals("Size is ", 2, l1.size());
assertEquals("IPAddress ", taipei.getIpAddress(),
taipei1.getIpAddress());
@@ -247,7 +247,7 @@
taipei2.setIpAddress("192.168.10.100");
assertEquals("New admin id is ", "192.168.10.100",
taipei.getIpAddress());
- List l2 = taipei1.getElements();
+ l2 = taipei1.getElements();
assertEquals("Size is ", 2, l2.size());
NetworkElement vibSens1 = (NetworkElement) l2.get(0);
NetworkElement tempSens1 = (NetworkElement) l2.get(1);
@@ -259,8 +259,4 @@
assertEquals("Status ", vibSensor1.getStatus(), vibSens1.getStatus());
assertEquals("Status ", tempSensor1.getStatus(), tempSens1.getStatus());
}
-
-
-
-}
-
+}
\ No newline at end of file
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/LegacyConfigurationTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/LegacyConfigurationTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/LegacyConfigurationTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -71,6 +71,7 @@
@Test(groups = {"functional"})
public class LegacyConfigurationTest extends PojoCacheJmxWrapperTestBase
{
+ @SuppressWarnings("deprecation")
public void testLocalCache() throws Exception
{
PojoCacheJmxWrapperMBean wrapper = new PojoCacheJmxWrapper();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/NotificationTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/NotificationTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/jmx/NotificationTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -19,14 +19,14 @@
public class NotificationTest extends org.jboss.cache.jmx.NotificationTest
{
private PojoCache pojoCache;
-
-
+
+
@Override
protected Object createCacheAndJmxWrapper() throws Exception
{
pojoCache = createCache(CLUSTER_NAME);
- cache = (CacheImpl) pojoCache.getCache();
+ cache = (CacheImpl<Object, Object>) pojoCache.getCache();
return new PojoCacheJmxWrapper(pojoCache);
}
@@ -51,17 +51,12 @@
protected PojoCacheImpl createCache(String clusterName) throws Exception
{
Configuration config = createConfiguration(clusterName);
-
+
PojoCacheImpl cache = (PojoCacheImpl) PojoCacheFactory.createCache(config, false);
-
+
cache.create();
// start the cache after the listener has been registered
//cache.start();
return cache;
}
-
- private String getTempDir()
- {
- return System.getProperty("java.io.tempdir", "/tmp");
- }
-}
+}
\ No newline at end of file
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/ReplicatedTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/ReplicatedTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/ReplicatedTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -34,7 +34,7 @@
*/
@Test(groups = {"functional"})
-public class ReplicatedTest
+public class ReplicatedTest
{
Log log_ = LogFactory.getLog(ReplicatedTest.class);
PojoCache cache_;
@@ -71,14 +71,14 @@
add.setCity("Taipei");
ClassLoader cla = getClassLoader();
- WeakReference refa = new WeakReference(cla);
- cache_.getCache().getRegion(new Fqn("/aop"),
true).registerContextClassLoader(cla);
+ WeakReference<ClassLoader> refa = new WeakReference<ClassLoader>(cla);
+ cache_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(cla);
ClassLoader clb = getClassLoader();
- WeakReference refb = new WeakReference(clb);
- cache_.getCache().getRegion(new Fqn("/aop"),
true).registerContextClassLoader(clb);
+ WeakReference<ClassLoader> refb = new WeakReference<ClassLoader>(clb);
+ cache_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clb);
- Fqn fqn = new Fqn("/aop");
- cache_.getCache().put(new Fqn("/aop"), "add", add);
+ Fqn<String> fqn = new Fqn<String>("/aop");
+ cache_.getCache().put(new Fqn<String>("/aop"), "add",
add);
TestingUtil.sleepThread(100);
try
@@ -97,8 +97,8 @@
ClassLoader clc = getClassLoader();
cla = null;
clb = null;
- cache_.getCache().getRegion(new Fqn("/aop"),
true).registerContextClassLoader(clc);
- cache1_.getCache().getRegion(new Fqn("/aop"),
true).registerContextClassLoader(clc);
+ cache_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clc);
+ cache1_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clc);
System.gc(); // force gc
Thread.sleep(1000);
assertNull("Classloader should be gced ", refa.get());
@@ -107,7 +107,7 @@
private static void forceOutOfMemoryError() throws Exception
{
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
try
{
@@ -139,11 +139,11 @@
add.setCity("Taipei");
ClassLoader cla = getClassLoader();
- WeakReference refa = new WeakReference(cla);
- cache_.getCache().getRegion(new Fqn("/aop"),
true).registerContextClassLoader(cla);
+ WeakReference<ClassLoader> refa = new WeakReference<ClassLoader>(cla);
+ cache_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(cla);
ClassLoader clb = getClassLoader();
- cache1_.getCache().getRegion(new Fqn("/aop"),
true).registerContextClassLoader(clb);
- WeakReference refb = new WeakReference(clb);
+ cache1_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clb);
+ WeakReference<ClassLoader> refb = new WeakReference<ClassLoader>(clb);
cache_.attach("/aop", p);
@@ -161,8 +161,8 @@
cache_.detach("/aop");
ClassLoader clc = getClassLoader();
- cache_.getCache().getRegion(new Fqn("/aop"),
true).registerContextClassLoader(clc);
- cache1_.getCache().getRegion(new Fqn("/aop"),
true).registerContextClassLoader(clc);
+ cache_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clc);
+ cache1_.getCache().getRegion(new Fqn<String>("/aop"),
true).registerContextClassLoader(clc);
cla = null;
clb = null;
forceOutOfMemoryError();
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/SelectedClassnameClassLoader.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/SelectedClassnameClassLoader.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/memory/SelectedClassnameClassLoader.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -39,7 +39,7 @@
private String[] notFoundClasses = null;
private Log log = LogFactory.getLog(SelectedClassnameClassLoader.class);
- private Map classes = new java.util.HashMap();
+ private Map<String, Class<?>> classes = new java.util.HashMap<String,
Class<?>>();
/**
* Creates a new classloader that loads the given classes.
@@ -109,13 +109,13 @@
this.notFoundClasses = notFoundClasses;
}
- protected synchronized Class loadClass(String name, boolean resolve)
+ protected synchronized Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException
{
log.info("In SelectedClassnameClassLoader.loadClass(" + name +
"," + resolve + ")");
if (isIncluded(name) && (isExcluded(name) == false))
{
- Class c = findClass(name);
+ Class<?> c = findClass(name);
if (resolve)
{
@@ -128,11 +128,11 @@
}
}
- protected Class findClass(String name) throws ClassNotFoundException
+ protected Class<?> findClass(String name) throws ClassNotFoundException
{
log.info("In SelectedClassnameClassLoader.findClass()");
- Class result = (Class) classes.get(name);
+ Class<?> result = classes.get(name);
if (result != null)
{
return result;
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-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -46,7 +46,7 @@
* @author Jason T. Greene
*/
@Test(groups = {"functional"})
-public class ListTest
+public class ListTest
{
protected PojoCache cache;
protected Listener listener = new Listener();
@@ -82,6 +82,7 @@
assertEquals(true, notification.isLocal());
}
+ @SuppressWarnings("unchecked")
public void testListAddNotification() throws Exception
{
final String test1 = "test1";
@@ -91,7 +92,7 @@
list.add(test1);
list.add(test2);
cache.attach("a", list);
- list = (List) cache.find("a");
+ list = (List<String>) cache.find("a");
// String attach
AttachedEvent attach = (AttachedEvent) takeNotification(AttachedEvent.class);
@@ -119,6 +120,7 @@
}
+ @SuppressWarnings("unchecked")
public void testListSetNotification() throws Exception
{
final String test1 = "test1";
@@ -127,7 +129,7 @@
List<String> list = new ArrayList<String>();
list.add(test1);
cache.attach("a", list);
- list = (List) cache.find("a");
+ list = (List<String>) cache.find("a");
list.set(0, test2);
// String attach
@@ -159,6 +161,7 @@
assertEquals(0, modify.getIndex());
}
+ @SuppressWarnings("unchecked")
public void testListRemoveNotification() throws Exception
{
final String test1 = "test1";
@@ -168,7 +171,7 @@
list.add(test1);
list.add(test2);
cache.attach("a", list);
- list = (List) cache.find("a");
+ list = (List<String>) cache.find("a");
list.remove(1);
// String attach
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-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -46,7 +46,7 @@
* @author Jason T. Greene
*/
@Test(groups = {"functional"})
-public class MapTest
+public class MapTest
{
private PojoCache cache;
private Listener listener = new Listener();
@@ -83,6 +83,7 @@
assertEquals(true, notification.isLocal());
}
+ @SuppressWarnings("unchecked")
public void testMapAddNotification() throws Exception
{
final String key1 = "key1";
@@ -94,7 +95,7 @@
map.put(key1, test1);
map.put(key2, test2);
cache.attach("a", map);
- map = (Map) cache.find("a");
+ map = (Map<String, String>) cache.find("a");
// String attach
AttachedEvent attach = takeNotification(AttachedEvent.class);
@@ -122,6 +123,7 @@
}
+ @SuppressWarnings("unchecked")
public void testMapRemoveNotification() throws Exception
{
final String key1 = "key1";
@@ -133,7 +135,7 @@
map.put(key1, test1);
map.put(key2, test2);
cache.attach("a", map);
- map = (Map) cache.find("a");
+ map = (Map<String, String>) cache.find("a");
map.remove(key2);
// String attach
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/AbstractOptimisticTestCase.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/AbstractOptimisticTestCase.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/AbstractOptimisticTestCase.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -58,12 +58,12 @@
/**
* Base test for optimistic locking. Copied from Cache counterpart.
*/
-public abstract class AbstractOptimisticTestCase
+public abstract class AbstractOptimisticTestCase
{
private int instanceNumber;
// some test data shared among all the test cases
- protected Fqn fqn = Fqn.fromString("/blah");
+ protected Fqn<String> fqn = Fqn.fromString("/blah");
protected String key = "myKey", value = "myValue";
protected String getTempDir()
@@ -312,7 +312,7 @@
}
}
- protected Interceptor getAlteredInterceptorChain(Interceptor newLast, CacheSPI spi,
boolean replicated)
+ protected Interceptor getAlteredInterceptorChain(Interceptor newLast,
CacheSPI<Object, Object> spi, boolean replicated)
{
Interceptor ici = new InvocationContextInterceptor();
ici.setCache(spi);
@@ -360,7 +360,7 @@
}
}
- protected List injectDataVersion(List<MethodCall> modifications)
+ protected List<MethodCall> injectDataVersion(List<MethodCall>
modifications)
{
List<MethodCall> newList = new LinkedList<MethodCall>();
for (MethodCall c : modifications)
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/CachedListTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/CachedListTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/CachedListTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -52,8 +52,8 @@
{
Log log = LogFactory.getLog(CachedListTest.class);
PojoCache cache_;
- List languages;
- List languages2;
+ List<String> languages;
+ List<String> languages2;
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
@@ -76,10 +76,10 @@
languages.add(1, "Taiwanese");
assertEquals("Languages size ", 4, languages.size());
- assertEquals("Language ", (Object) "Taiwanese", (Object)
languages.get(1));
+ assertEquals("Language ", (Object) "Taiwanese",
languages.get(1));
languages.remove(2);
assertEquals("Languages size ", 3, languages.size());
- assertEquals("Language ", (Object) "English", (Object)
languages.get(2));
+ assertEquals("Language ", (Object) "English",
languages.get(2));
languages.add("Mandarin");
assertEquals("Languages size ", 4, languages.size());
@@ -87,18 +87,19 @@
assertEquals("Languages size ", 3, languages.size());
}
+ @SuppressWarnings("unchecked")
protected void stage() throws Throwable
{
- languages = new ArrayList();
+ languages = new ArrayList<String>();
languages.add("English");
languages.add("French");
languages.add("English");
cache_.attach("/person/test6", languages);
- languages = (List) cache_.find("/person/test6");
+ languages = (List<String>) cache_.find("/person/test6");
int size = languages.size();
assertEquals("Size of list ", 3, size);
- languages2 = new ArrayList();
+ languages2 = new ArrayList<String>();
languages2.addAll(languages);
assertEquals("New ArrayList().addAll(CachedList)", languages,
languages2);
}
@@ -106,7 +107,7 @@
public void testAddAllAndClear() throws Throwable
{
stage();
- List list = new ArrayList();
+ List<String> list = new ArrayList<String>();
list.add("Taiwanese");
list.add("Madarin");
@@ -126,13 +127,14 @@
assertTrue("Languages empty ", languages.isEmpty());
}
+ @SuppressWarnings("unchecked")
public void testEquals() throws Throwable
{
stage();
- List list = (List) cache_.find("/person/test6");
+ List<String> list = (List<String>)
cache_.find("/person/test6");
assertTrue("List should be the same ", list.equals(languages));
- list = new ArrayList();
+ list = new ArrayList<String>();
list.add("German");
list.add("test");
list.add("English");
@@ -142,14 +144,14 @@
public void testIterator() throws Throwable
{
- languages = new ArrayList();
- Iterator it0 = languages.iterator();
+ languages = new ArrayList<String>();
+ Iterator<String> it0 = languages.iterator();
assertFalse("Iterator should be empty ", it0.hasNext());
stage();
- Iterator it = languages.iterator();
- Iterator it2 = languages2.iterator();
+ Iterator<String> it = languages.iterator();
+ Iterator<String> it2 = languages2.iterator();
int counter = 0;
while (it.hasNext())
{
@@ -168,17 +170,18 @@
*
* @throws Throwable
*/
+ @Test(enabled = false)
public void XtestListIterator() throws Throwable
{
- languages = new ArrayList();
- ListIterator it0 = languages.listIterator();
+ languages = new ArrayList<String>();
+ ListIterator<String> it0 = languages.listIterator();
assertFalse("Iterator should be empty ", it0.hasNext());
assertFalse("Iterator should be empty ", it0.hasPrevious());
stage();
- ListIterator li = languages.listIterator();
- ListIterator li2 = languages2.listIterator();
+ ListIterator<String> li = languages.listIterator();
+ ListIterator<String> li2 = languages2.listIterator();
assertFalse("LI has no previous element ", li.hasPrevious());
assertFalse("LI2 has no previous element ", li2.hasPrevious());
assertTrue("LI has next element ", li.hasNext());
@@ -275,8 +278,8 @@
li.nextIndex(), li2.nextIndex());
li2.set("German");
li.set("German");
- String s1 = (String) li.previous();
- String s2 = (String) li2.previous();
+ String s1 = li.previous();
+ String s2 = li2.previous();
assertEquals(s1, s2);
assertEquals(s2, "German");
}
@@ -290,8 +293,8 @@
assertEquals(li.next(), li2.next());
li2.add("Vulcan");
li.add("Vulcan");
- String s1 = (String) li.previous();
- String s2 = (String) li2.previous();
+ String s1 = li.previous();
+ String s2 = li2.previous();
assertEquals(s1, s2);
assertEquals(s2, "Vulcan");
}
@@ -303,18 +306,19 @@
}
+ @SuppressWarnings("unchecked")
public void testAttachAndDetach() throws Exception
{
- List list = new ArrayList();
+ List<String> list = new ArrayList<String>();
list.add("English");
list.add("French");
list.add("Taiwanese");
cache_.attach("/test", list); // attach
- list = (List) cache_.find("/test");
+ list = (List<String>) cache_.find("/test");
assertEquals("Size ", 3, list.size());
- list = (List) cache_.detach("/test");
+ list = (List<String>) cache_.detach("/test");
assertEquals("Size ", 3, list.size());
System.out.println("**** End of cache content **** ");
@@ -329,6 +333,7 @@
assertEquals("Size ", 2, list.size());
}
+ @SuppressWarnings("unchecked")
public void testPojoAttachAndDetach() throws Exception
{
Address add1 = new Address();
@@ -343,16 +348,16 @@
add3.setCity("Santa Clara");
add3.setZip(951131);
- List list = new ArrayList();
+ List<Address> list = new ArrayList<Address>();
list.add(add1);
list.add(add2);
list.add(add3);
cache_.attach("/test", list); // attach
- list = (List) cache_.find("/test");
+ list = (List<Address>) cache_.find("/test");
assertEquals("Size ", 3, list.size());
- list = (List) cache_.detach("/test");
+ list = (List<Address>) cache_.detach("/test");
assertEquals("Size ", 3, list.size());
System.out.println("**** End of cache content **** ");
@@ -367,25 +372,26 @@
assertEquals("Size ", 2, list.size());
}
+ @SuppressWarnings("unchecked")
public void testEqual1() throws Exception
{
- List list1 = new ArrayList();
+ List<String> list1 = new ArrayList<String>();
list1.add("ID1");
list1.add("ID2");
cache_.attach("test1", list1);
- list1 = (List) cache_.find("test1");
+ list1 = (List<String>) cache_.find("test1");
- List list2 = new ArrayList();
+ List<String> list2 = new ArrayList<String>();
list2.add("ID1");
list2.add("ID2");
cache_.attach("test2", list2);
- list2 = (List) cache_.find("test2");
+ list2 = (List<String>) cache_.find("test2");
- List list3 = new ArrayList();
+ List<String> list3 = new ArrayList<String>();
list3.add("ID2");
list3.add("ID1");
cache_.attach("test3", list3);
- list3 = (List) cache_.find("test3");
+ list3 = (List<String>) cache_.find("test3");
assertEquals("List should be equal: ", list1, list1);
assertTrue("List should be equal: ", list1.equals(list1));
@@ -393,23 +399,24 @@
assertFalse("List should not be equal: ", list1.equals(list3));
}
+ @SuppressWarnings("unchecked")
public void testEqual2() throws Exception
{
- List list1 = new ArrayList();
+ List<String> list1 = new ArrayList<String>();
cache_.attach("test1", list1);
- list1 = (List) cache_.find("test1");
+ list1 = (List<String>) cache_.find("test1");
list1.add("ID1");
list1.add("ID2");
- List list2 = new ArrayList();
+ List<String> list2 = new ArrayList<String>();
cache_.attach("test2", list2);
- list2 = (List) cache_.find("test2");
+ list2 = (List<String>) cache_.find("test2");
list2.add("ID1");
list2.add("ID2");
- List list3 = new ArrayList();
+ List<String> list3 = new ArrayList<String>();
cache_.attach("test3", list3);
- list3 = (List) cache_.find("test3");
+ list3 = (List<String>) cache_.find("test3");
list3.add("ID2");
list3.add("ID1");
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/LocalTxTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/LocalTxTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/optimistic/LocalTxTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -37,7 +37,6 @@
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
-import javax.transaction.Transaction;
import javax.transaction.UserTransaction;
import org.apache.commons.logging.Log;
@@ -131,11 +130,11 @@
log.info("testFailure() ....");
UserTransaction tx = getTransaction();
tx.begin();
- Person p = createPerson("/person/test1", "Harald Gliebe", 32);
+ createPerson("/person/test1", "Harald Gliebe", 32);
tx.commit();
tx.begin();
- p = createPerson("/person/test1", "Harald Gliebe", 32);
+ createPerson("/person/test1", "Harald Gliebe", 32);
tx.commit();
}
@@ -143,7 +142,7 @@
{
log.info("testFailure1() ....");
UserTransaction tx = getTransaction();
- org.jboss.cache.Fqn f = new org.jboss.cache.Fqn("/person/test2");
+ Fqn<String> f = Fqn.fromString("/person/test2");
tx.begin();
cache.getCache().put(f, "test", "test");
tx.commit();
@@ -156,23 +155,23 @@
public void testFailure2() throws Exception
{
- Fqn f0 = Fqn.fromString("/person/test");
- Fqn f1 = new Fqn(f0, "1");
- Fqn f2 = new Fqn(f0, "2");
+ Fqn<String> f0 = Fqn.fromString("/person/test");
+ Fqn<String> f1 = new Fqn<String>(f0, "1");
+ Fqn<String> f2 = new Fqn<String>(f0, "2");
cache.getCache().put(f1, "test", "test");
cache.getCache().put(f2, "test", "test");
- int size = CacheApiUtil.getNodeChildren((CacheSPI) cache.getCache(), f0).size();
+ int size = CacheApiUtil.getNodeChildren((CacheSPI<Object, Object>)
cache.getCache(), f0).size();
assertEquals("Size ", 2, size);
UserTransaction tx = getTransaction();
tx.begin();
cache.getCache().removeNode(f1);
- size = CacheApiUtil.getNodeChildren((CacheSPI) cache.getCache(), f0).size();
+ size = CacheApiUtil.getNodeChildren((CacheSPI<Object, Object>)
cache.getCache(), f0).size();
assertEquals("Size ", 1, size);
cache.getCache().put(f1, "test", "test");
- size = CacheApiUtil.getNodeChildren((CacheSPI) cache.getCache(), f0).size();
+ size = CacheApiUtil.getNodeChildren((CacheSPI<Object, Object>)
cache.getCache(), f0).size();
assertEquals("Size ", 2, size);
tx.commit();
}
@@ -203,8 +202,6 @@
final CountDownLatch latch2 = new CountDownLatch(1);
Thread t1 = new Thread("t1")
{
- Transaction tx;
-
public void run()
{
try
@@ -212,7 +209,7 @@
Person p = createPerson("/person/test6", "p6", 41);
Address addr = new Address();
addr.setCity("San Jose");
- List list = new ArrayList();
+ List<String> list = new ArrayList<String>();
list.add("English");
list.add("French");
p.setLanguages(list);
@@ -240,8 +237,6 @@
Thread t2 = new Thread("t2")
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
@@ -280,7 +275,7 @@
}
};
- Person p = createPerson("/person/test5", "p5", 30);
+ createPerson("/person/test5", "p5", 30);
t1.start();
t2.start();
@@ -302,8 +297,6 @@
final CountDownLatch latch2 = new CountDownLatch(1);
Thread t1 = new Thread("t1")
{
- Transaction tx;
-
public void run()
{
try
@@ -335,8 +328,6 @@
Thread t2 = new Thread("t2")
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
@@ -401,8 +392,6 @@
final CountDownLatch latch2 = new CountDownLatch(1);
Thread t1 = new Thread("t1")
{
- Transaction tx;
-
public void run()
{
try
@@ -432,8 +421,6 @@
Thread t2 = new Thread("t2")
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -36,7 +36,7 @@
*/
@Test(groups = {"functional"})
-public class LocalTest
+public class LocalTest
{
Log log = LogFactory.getLog(org.jboss.cache.pojo.passivation.LocalTest.class);
PojoCache cache_;
@@ -62,7 +62,7 @@
protected void tearDown() throws Exception
{
cache_.getCache().removeNode(Fqn.ROOT);
- ((CacheSPI)
cache_.getCache()).getCacheLoaderManager().getCacheLoader().remove(Fqn.ROOT);
+ ((CacheSPI<Object, Object>)
cache_.getCache()).getCacheLoaderManager().getCacheLoader().remove(Fqn.ROOT);
cache_.getCache().removeCacheListener(listener_);
cache_.stop();
//Thread.sleep(1000);
@@ -101,7 +101,7 @@
cache_.attach(id, joe);
Thread.sleep(9100);// default is 3 seconds so joe should have been passivated.
- assertNull("Node should be evicted ", ((CacheSPI)
cache_.getCache()).peek(new Fqn(id), false));
+ assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(new Fqn<String>(id), false));
assertEquals("age ", 20, joe.getAge());
joe.setAge(30);
@@ -118,7 +118,7 @@
cache_.attach(id, joe);
Thread.sleep(9100);// default is 3 seconds so joe should have been passivated.
- assertNull("Node should be evicted ", ((CacheSPI)
cache_.getCache()).peek(new Fqn(id), false));
+ assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(new Fqn<String>(id), false));
Address addr = new Address();
addr.setCity("Taipei");
@@ -137,7 +137,7 @@
cache_.attach(id, joe);
Thread.sleep(9100);// default is 3 seconds so joe should have been passivated.
- assertNull("Node should be evicted ", ((CacheSPI)
cache_.getCache()).peek(new Fqn(id), false));
+ assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(new Fqn<String>(id), false));
Person p = (Person) cache_.find(id);
@@ -182,7 +182,7 @@
Thread.sleep(9100);// default is 3 seconds so joe should have been passivated.
- assertNull("Node should be evicted ", ((CacheSPI)
cache_.getCache()).peek(new Fqn(id), false));
+ assertNull("Node should be evicted ", ((CacheSPI<Object, Object>)
cache_.getCache()).peek(new Fqn<String>(id), false));
assertEquals("City is ", "Santa Clara", add2.getCity());
@@ -268,7 +268,7 @@
@NodeActivated
public void nodeActivated(NodeEvent ne)
{
- Fqn fqn = ne.getFqn();
+ Fqn<?> fqn = ne.getFqn();
if (!ne.isPre())
{
System.out.println("nodeActivated: " + fqn);
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -41,7 +41,7 @@
Properties p_;
String oldFactory_ = null;
final String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
- static ArrayList nodeList_;
+ static ArrayList<String> nodeList_;
static final int depth_ = 2;
static final int children_ = 2;
static final int MAX_LOOP = 100;
@@ -197,7 +197,7 @@
{
int i = random_.nextInt(nodeList_.size() - 1);
if (i == 0) return; // it is meaningless to test root
- String node = (String) nodeList_.get(i) + "/aop";
+ String node = nodeList_.get(i) + "/aop";
cache_.attach(node, person_);
TestingUtil.sleepThread(random_.nextInt(SLEEP_TIME)); // sleep for max 200
millis
TestingUtil.sleepThread(random_.nextInt(SLEEP_TIME)); // sleep for max 200
millis
@@ -210,7 +210,7 @@
* of the hierarchy and children is the number of children under each node.
* This strucutre is used to add, get, and remove for each node.
*/
- private ArrayList nodeGen(int depth, int children)
+ private ArrayList<String> nodeGen(int depth, int children)
{
ArrayList<String> strList = new ArrayList<String>();
ArrayList<String> oldList = new ArrayList<String>();
@@ -230,7 +230,7 @@
{
for (int j = 0; j < children; j++)
{
- String tmp = (String) oldList.get(i);
+ String tmp = oldList.get(i);
tmp += Integer.toString(j);
if (depth != 1)
{
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/region/LocalTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -42,7 +42,7 @@
*/
@Test(groups = {"functional"})
-public class LocalTest
+public class LocalTest
{
Log log = LogFactory.getLog(org.jboss.cache.pojo.region.LocalTest.class);
PojoCache cache_;
@@ -103,11 +103,11 @@
assertEquals((Object) "Joe Black", p.getName());
assertTrue("Region node should exist ",
- cache_.getCache().getRoot().hasChild(new Fqn(REGION)));
- Fqn fqn = new Fqn(Fqn.fromString(REGION), InternalConstant.JBOSS_INTERNAL);
+ cache_.getCache().getRoot().hasChild(new Fqn<String>(REGION)));
+ Fqn<String> fqn = new Fqn<String>(Fqn.fromString(REGION),
InternalConstant.JBOSS_INTERNAL);
assertTrue("Internal region node should exist ",
cache_.getCache().getRoot().hasChild(fqn));
- System.out.println("Cache content: "
+((org.jboss.cache.CacheImpl)cache_.getCache()).printDetails());
+ System.out.println("Cache content: "
+((org.jboss.cache.CacheImpl<Object, Object>)cache_.getCache()).printDetails());
}
public void testModification() throws Exception
@@ -120,14 +120,14 @@
public void testRemove() throws Exception
{
- Person joe = createPerson("person/test3", "Joe", 32);
+ createPerson("person/test3", "Joe", 32);
cache_.detach("person/test3");
- String str = ((CacheImpl) cache_.getCache()).printDetails();
+ String str = ((CacheImpl<Object, Object>) cache_.getCache()).printDetails();
System.out.println("**** Details ***/n" + str);
- Fqn fqn = new Fqn(Fqn.fromString(REGION), InternalConstant.JBOSS_INTERNAL);
- Node n = cache_.getCache().getRoot().getChild(fqn);
+ Fqn<String> fqn = new Fqn<String>(Fqn.fromString(REGION),
InternalConstant.JBOSS_INTERNAL);
+ Node<Object, Object> n = cache_.getCache().getRoot().getChild(fqn);
assertTrue("Internal region node should not exist ",
n.getChildren() != null);
}
@@ -138,7 +138,7 @@
try
{
person.setAge(30);
- List med = person.getMedication();
+ List<String> med = person.getMedication();
assertNull("Medication should be null ", med);
person.setAge(60);
med = person.getMedication();
@@ -201,8 +201,8 @@
cache_.detach("person/test1");
- Fqn fqn = new Fqn(Fqn.fromString(REGION), InternalConstant.JBOSS_INTERNAL);
- Node n = cache_.getCache().getRoot().getChild(fqn);
+ Fqn<String> fqn = new Fqn<String>(Fqn.fromString(REGION),
InternalConstant.JBOSS_INTERNAL);
+ Node<Object, Object> n = cache_.getCache().getRoot().getChild(fqn);
assertTrue("Internal region node should not exist ",
n.getChildren() != null);
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/region/NewLocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/region/NewLocalTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/region/NewLocalTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -31,7 +31,7 @@
*/
@Test(groups = {"functional"})
-public class NewLocalTest
+public class NewLocalTest
{
Log log_ = LogFactory.getLog(org.jboss.cache.pojo.region.NewLocalTest.class);
PojoCache cache_;
@@ -61,6 +61,7 @@
*
* @throws Exception
*/
+ @Test(enabled = false)
public void XtestBadFqn() throws Exception
{
log_.info("testBadFqn() ....");
@@ -128,7 +129,7 @@
public void testFindObjects() throws Exception
{
log_.info("testFindObjects() ....");
- Map map = cache_.findAll("/");
+ Map<?, ?> map = cache_.findAll("/");
assertEquals("Objects size should be ", 0, map.size());
Person ben = new Person();
ben.setName("Ben");
@@ -148,8 +149,4 @@
map = cache_.findAll("/");
assertEquals("Objects size should be ", 2, map.size());
}
-
-
-
-
-}
+}
\ No newline at end of file
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/region/ReplicatedTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/region/ReplicatedTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/region/ReplicatedTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -31,7 +31,7 @@
* @author Ben Wang
*/
@Test(groups = {"functional"})
-public class ReplicatedTest
+public class ReplicatedTest
{
Log log = LogFactory.getLog(org.jboss.cache.pojo.region.ReplicatedTest.class);
PojoCache cache, cache1;
@@ -95,7 +95,7 @@
try
{
person.setAge(30);
- List med = person.getMedication();
+ List<String> med = person.getMedication();
assertNull("Medication should be null ", med);
person.setAge(61);
med = person.getMedication();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/InMemoryTxUndoTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/InMemoryTxUndoTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/InMemoryTxUndoTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -150,7 +150,7 @@
test.setAge(10);
cache_.attach("/a", test);
- ArrayList lang = new ArrayList();
+ ArrayList<String> lang = new ArrayList<String>();
lang.add("English");
test.setLanguages(lang);
tx_mgr.begin();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListTxUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListTxUndoTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListTxUndoTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -61,7 +61,7 @@
public void testSimple() throws Exception
{
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
list.add("test1");
tx_mgr.begin();
@@ -78,7 +78,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
list.add("English");
test.setLanguages(list);
@@ -102,7 +102,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
list.add("English");
test.setLanguages(list);
@@ -122,7 +122,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
list.add("English");
test.setLanguages(list);
tx_mgr.begin();
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalExceptionUndoTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalExceptionUndoTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalExceptionUndoTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -53,7 +53,7 @@
*/
@Test(groups = {"functional"})
-public class LocalExceptionUndoTest
+public class LocalExceptionUndoTest
{
Log log_ = LogFactory.getLog(LocalExceptionUndoTest.class);
PojoCache cache_;
@@ -61,7 +61,7 @@
boolean isTrue = false;
@BeforeMethod(alwaysRun = true)
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
log_.info("setUp() ....");
String configFile = "META-INF/local-service.xml";
@@ -75,6 +75,7 @@
private void startLockThread() throws Exception
{
+ isTrue = false;
// Lock thread to lock underlying node.
(new LockThread()).start();
Thread.sleep(300);
@@ -87,7 +88,7 @@
}
@AfterMethod(alwaysRun = true)
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
cache_.stop();
}
@@ -98,7 +99,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
list.add("English");
test.setLanguages(list);
@@ -125,7 +126,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
list.add("English");
test.setLanguages(list);
@@ -166,21 +167,17 @@
return false;
}
-
-
-
-@Test(groups = {"functional"})
public class LockThread extends Thread
{
public void run()
{
try
{
- Fqn f = new Fqn(InternalConstant.JBOSS_INTERNAL_STRING);
- cache_.getCache().put(new Fqn(f, "123"), "key",
"test");
- cache_.getCache().put(new Fqn("a"), "key",
"test");
+ Fqn<String> f = new
Fqn<String>(InternalConstant.JBOSS_INTERNAL_STRING);
+ cache_.getCache().put(new Fqn<String>(f, "123"),
"key", "test");
+ cache_.getCache().put(new Fqn<String>("a"), "key",
"test");
tx_mgr.begin();
- cache_.getCache().put(new Fqn(f, "124"), "key",
"test");
+ cache_.getCache().put(new Fqn<String>(f, "124"),
"key", "test");
while (!isTrue)
{
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapTxUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapTxUndoTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapTxUndoTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -34,7 +34,7 @@
*/
@Test(groups = {"functional"})
-public class MapTxUndoTest
+public class MapTxUndoTest
{
Log log_ = LogFactory.getLog(MapTxUndoTest.class);
PojoCache cache_;
@@ -63,7 +63,7 @@
public void testSimple() throws Exception
{
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("1", "test1");
tx_mgr.begin();
@@ -80,7 +80,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("1", "English");
test.setHobbies(map);
@@ -104,7 +104,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("1", "English");
test.setHobbies(map);
@@ -124,7 +124,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("1", "English");
test.setHobbies(map);
tx_mgr.begin();
@@ -140,23 +140,24 @@
*
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
public void testNestedMapWithRollback() throws Exception
{
// create cached data objects
- Map obj1 = new HashMap();
+ Map<String, String> obj1 = new HashMap<String, String>();
obj1.put("id", "1");
cache_.attach("objs/1", obj1);
- obj1 = (Map) cache_.find("objs/1");
+ obj1 = (Map<String, String>) cache_.find("objs/1");
- Map obj2 = new HashMap();
+ Map<String, String> obj2 = new HashMap<String, String>();
obj2.put("id", "2");
cache_.attach("objs/2", obj2);
- obj2 = (Map) cache_.find("objs/2");
+ obj2 = (Map<String, String>) cache_.find("objs/2");
// create cached collection of data objects
- Map indexMap = new HashMap();
+ Map<String, Map<String, String>> indexMap = new HashMap<String,
Map<String, String>>();
cache_.attach("objsIndex", indexMap);
- indexMap = (Map) cache_.find("objsIndex");
+ indexMap = (Map<String, Map<String, String>>)
cache_.find("objsIndex");
// initialize collection by adding a data object
final String KEY = "KEY";
@@ -178,13 +179,14 @@
assertEquals(beforeModify, afterRollback);
}
+ @SuppressWarnings("unchecked")
public void testPlainMapRollback() throws Exception
{
// create cached data objects
- Map obj1 = new HashMap();
+ Map<String, String> obj1 = new HashMap<String, String>();
obj1.put("id", "1");
cache_.attach("objs/1", obj1);
- obj1 = (Map) cache_.find("objs/1");
+ obj1 = (Map<String, String>) cache_.find("objs/1");
tx_mgr.begin();
obj1.put("id", "newId");
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -67,7 +67,7 @@
public void testSimple() throws Exception
{
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("1", "test1");
setTxRollback(true);
@@ -83,7 +83,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("1", "English");
test.setHobbies(map);
@@ -106,7 +106,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
map.put("1", "English");
test.setHobbies(map);
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/PojoCollectionRollbackTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/PojoCollectionRollbackTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/PojoCollectionRollbackTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -30,7 +30,8 @@
* @author
*/
@Test(groups = {"functional"})
-public class PojoCollectionRollbackTest
+@SuppressWarnings("unchecked")
+public class PojoCollectionRollbackTest
{
private static final String ID = "id";
private static final String CONTAINER_FQN = "/objsIndex";
@@ -64,21 +65,21 @@
startTest();
// create cached data objects
- Map obj1 = new HashMap();
+ Map<String, String> obj1 = new HashMap<String, String>();
obj1.put(ID, "1");
cache_.attach("/objs/1", obj1);
- obj1 = (Map) cache_.find("/objs/1");
+ obj1 = (Map<String, String>) cache_.find("/objs/1");
// create cached collection of data objects
// initialize collection by adding a data object
- Map indexMap = null;
+ Map<String, Map> indexMap = null;
final String KEY = "KEY";
Object beforeModify;
Object afterRollback;
- indexMap = new HashMap();
+ indexMap = new HashMap<String, Map>();
cache_.attach(CONTAINER_FQN, indexMap);
- indexMap = (Map) cache_.find(CONTAINER_FQN);
+ indexMap = (Map<String, Map>) cache_.find(CONTAINER_FQN);
indexMap.put(KEY, obj1);
beforeModify = indexMap.get(KEY);
@@ -93,7 +94,7 @@
indexMap.remove(KEY);
tx_mgr.rollback();
- indexMap = (Map) cache_.find(CONTAINER_FQN);
+ indexMap = (Map<String, Map>) cache_.find(CONTAINER_FQN);
afterRollback = indexMap.get(KEY);
System.out.println("afterRollback: " + afterRollback + ", data
object id: " + ((Map) afterRollback).get(ID));
@@ -114,26 +115,26 @@
startTest();
// create cached data objects
- Map obj1 = new HashMap();
+ Map<String, String> obj1 = new HashMap<String, String>();
obj1.put(ID, "1");
cache_.attach("/objs/1", obj1);
- obj1 = (Map) cache_.find("/objs/1");
+ obj1 = (Map<String, String>) cache_.find("/objs/1");
- Map obj2 = new HashMap();
+ Map<String, String> obj2 = new HashMap<String, String>();
obj2.put(ID, "2");
cache_.attach("/objs/2", obj2);
- obj2 = (Map) cache_.find("/objs/2");
+ obj2 = (Map<String, String>) cache_.find("/objs/2");
// create cached collection of data objects
// initialize collection by adding a data object
- Map indexMap = null;
+ Map<String, Map> indexMap = null;
final String KEY = "KEY";
Object beforeModify;
Object afterRollback;
- indexMap = new HashMap();
+ indexMap = new HashMap<String, Map>();
cache_.attach(CONTAINER_FQN, indexMap);
- indexMap = (Map) cache_.find(CONTAINER_FQN);
+ indexMap = (Map<String, Map>) cache_.find(CONTAINER_FQN);
indexMap.put(KEY, obj1);
beforeModify = indexMap.get(KEY);
@@ -147,7 +148,7 @@
assertEquals(removedByModify, beforeModify);
tx_mgr.rollback();
- indexMap = (Map) cache_.find(CONTAINER_FQN);
+ indexMap = (Map<String, Map>) cache_.find(CONTAINER_FQN);
afterRollback = indexMap.get(KEY);
System.out.println("afterRollback: " + afterRollback + ", data
object id: " + ((Map) afterRollback).get(ID));
@@ -165,20 +166,20 @@
startTest();
// create cache_d data objects
- Map obj1 = new HashMap();
+ Map<String, String> obj1 = new HashMap<String, String>();
obj1.put(ID, "1");
cache_.attach("/objs/1", obj1);
- obj1 = (Map) cache_.find("/objs/1");
+ obj1 = (Map<String, String>) cache_.find("/objs/1");
- Map obj2 = new HashMap();
+ Map<String, String> obj2 = new HashMap<String, String>();
obj2.put(ID, "2");
cache_.attach("/objs/2", obj2);
- obj2 = (Map) cache_.find("/objs/2");
+ obj2 = (Map<String, String>) cache_.find("/objs/2");
// create cached collection of data objects
- Map indexMap = new HashMap();
+ Map<String, Map<String, String>> indexMap = new HashMap<String,
Map<String, String>>();
cache_.attach(CONTAINER_FQN, indexMap);
- indexMap = (Map) cache_.find(CONTAINER_FQN);
+ indexMap = (Map<String, Map<String, String>>)
cache_.find(CONTAINER_FQN);
// initialize collection by adding a data object
final String KEY = "KEY";
@@ -213,21 +214,21 @@
startTest();
// create cached data objects
- Map obj1 = new HashMap();
+ Map<String, String> obj1 = new HashMap<String, String>();
obj1.put(ID, "1");
cache_.attach("/objs/1", obj1);
- obj1 = (Map) cache_.find("/objs/1");
+ obj1 = (Map<String, String>) cache_.find("/objs/1");
- Map obj2 = new HashMap();
+ Map<String, String> obj2 = new HashMap<String, String>();
obj2.put(ID, "2");
cache_.attach("/objs/2", obj2);
- obj2 = (Map) cache_.find("/objs/2");
+ obj2 = (Map<String, String>) cache_.find("/objs/2");
assertFalse(obj1.equals(obj2));
// create cached collection of data objects
- List indexList = new ArrayList();
+ List<Map<String, String>> indexList = new ArrayList<Map<String,
String>>();
cache_.attach(CONTAINER_FQN, indexList);
- indexList = (List) cache_.find(CONTAINER_FQN);
+ indexList = (List<Map<String, String>>) cache_.find(CONTAINER_FQN);
// initialize collection by adding a data object
indexList.add(obj1);
@@ -267,20 +268,20 @@
startTest();
// create cached data objects
- Map obj1 = new HashMap();
+ Map<String, String> obj1 = new HashMap<String, String>();
obj1.put(ID, "1");
cache_.attach("/objs/1", obj1);
- obj1 = (Map) cache_.find("/objs/1");
+ obj1 = (Map<String, String>) cache_.find("/objs/1");
- Map obj2 = new HashMap();
+ Map<String, String> obj2 = new HashMap<String, String>();
obj2.put(ID, "2");
cache_.attach("/objs/2", obj2);
- obj2 = (Map) cache_.find("/objs/2");
+ obj2 = (Map<String, String>) cache_.find("/objs/2");
// create cached collection of data objects
- List indexList = new ArrayList();
+ List<Map<String, String>> indexList = new ArrayList<Map<String,
String>>();
cache_.attach(CONTAINER_FQN, indexList);
- indexList = (List) cache_.find(CONTAINER_FQN);
+ indexList = (List<Map<String, String>>) cache_.find(CONTAINER_FQN);
// initialize collection by adding a data object
indexList.add(obj1);
@@ -319,20 +320,20 @@
startTest();
// create cached data objects
- Map obj1 = new HashMap();
+ Map<String, String> obj1 = new HashMap<String, String>();
obj1.put(ID, "1");
cache_.attach("/objs/1", obj1);
- obj1 = (Map) cache_.find("/objs/1");
+ obj1 = (Map<String, String>) cache_.find("/objs/1");
- Map obj2 = new HashMap();
+ Map<String, String> obj2 = new HashMap<String, String>();
obj2.put(ID, "2");
cache_.attach("/objs/2", obj2);
- obj2 = (Map) cache_.find("/objs/2");
+ obj2 = (Map<String, String>) cache_.find("/objs/2");
// create cached collection of data objects
- List indexList = new ArrayList();
+ List<Map<String, String>> indexList = new ArrayList<Map<String,
String>>();
cache_.attach(CONTAINER_FQN, indexList);
- indexList = (List) cache_.find(CONTAINER_FQN);
+ indexList = (List<Map<String, String>>) cache_.find(CONTAINER_FQN);
// initialize collection by adding a data object
indexList.add(obj1);
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ReplicatedTxTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ReplicatedTxTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ReplicatedTxTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -20,7 +20,6 @@
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
-import javax.transaction.Transaction;
import javax.transaction.UserTransaction;
import org.apache.commons.logging.Log;
@@ -40,7 +39,7 @@
*/
@Test(groups = {"functional"})
-public class ReplicatedTxTest
+public class ReplicatedTxTest
{
Log log = LogFactory.getLog(org.jboss.cache.pojo.rollback.ReplicatedTxTest.class);
PojoCache cache, cache1;
@@ -123,8 +122,6 @@
{
Thread t1 = new Thread()
{
- Transaction tx;
-
public void run()
{
try
@@ -152,8 +149,6 @@
Thread t2 = new Thread()
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
@@ -216,8 +211,6 @@
{
Thread t1 = new Thread()
{
- Transaction tx;
-
public void run()
{
try
@@ -242,8 +235,6 @@
Thread t2 = new Thread()
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
@@ -306,8 +297,6 @@
{
Thread t1 = new Thread()
{
- Transaction tx;
-
public void run()
{
try
@@ -332,8 +321,6 @@
Thread t2 = new Thread()
{
- Transaction tx;
-
public void run()
{
UserTransaction tx = null;
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetTxUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetTxUndoTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetTxUndoTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -61,7 +61,7 @@
public void testSimple() throws Exception
{
- HashSet set = new HashSet();
+ HashSet<String> set = new HashSet<String>();
set.add("test1");
tx_mgr.begin();
@@ -78,7 +78,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashSet set = new HashSet();
+ HashSet<String> set = new HashSet<String>();
set.add("English");
test.setSkills(set);
@@ -102,7 +102,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashSet set = new HashSet();
+ HashSet<String> set = new HashSet<String>();
set.add("English");
test.setSkills(set);
@@ -122,7 +122,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashSet set = new HashSet();
+ HashSet<String> set = new HashSet<String>();
set.add("English");
test.setSkills(set);
tx_mgr.begin();
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -67,7 +67,7 @@
public void testSimple() throws Exception
{
- HashSet set = new HashSet();
+ HashSet<String> set = new HashSet<String>();
set.add("test1");
setTxRollback(true);
@@ -83,7 +83,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashSet set = new HashSet();
+ HashSet<String> set = new HashSet<String>();
set.add("English");
test.setSkills(set);
@@ -106,7 +106,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- HashSet set = new HashSet();
+ HashSet<String> set = new HashSet<String>();
set.add("English");
test.setSkills(set);
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/ReplicatedTest.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/ReplicatedTest.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/ReplicatedTest.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -32,7 +32,6 @@
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
import org.jboss.cache.pojo.test.Person;
-import org.jboss.cache.pojo.test.Student;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -43,7 +42,7 @@
* @author Ben Wang
*/
@Test(groups = {"functional"})
-public class ReplicatedTest
+public class ReplicatedTest
{
Log log = LogFactory.getLog(ReplicatedTest.class);
PojoCache cache, cache1;
@@ -74,16 +73,6 @@
return p;
}
- private Student createStudent(String id, String name, int age, String grade)
- {
- Student p = new Student();
- p.setName(name);
- p.setAge(age);
- p.setYear(grade);
- cache.attach(id, p);
- return p;
- }
-
public void testSimple() throws Exception
{
boolean toStart = true;
@@ -91,15 +80,13 @@
Person ben = createPerson("/person/test1", "Ben Wang", 40);
System.out.println("\n*** I ***");
- System.out.println(((CacheImpl) cache.getCache()).printDetails());
+ System.out.println(((CacheImpl<Object, Object>)
cache.getCache()).printDetails());
cache1 =
PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC),
toStart);
cache1.start();
System.out.println("\n*** II ***");
- System.out.println(((CacheImpl) cache1.getCache()).printDetails());
+ System.out.println(((CacheImpl<Object, Object>)
cache1.getCache()).printDetails());
- Person p = (Person) cache1.find("/person/test1");
-
log.info("testSimple() ....");
assertEquals("Ben Wang", ben.getName());
assertEquals("Ben Wang", ((Person)
cache1.find("/person/test1")).getName());
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransferAopTestBase.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransferAopTestBase.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/statetransfer/StateTransferAopTestBase.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -53,19 +53,19 @@
* @author <a href="mailto://brian.stansberry@jboss.com">Brian
Stansberry</a>
* @version $Revision$
*/
-public abstract class StateTransferAopTestBase
+public abstract class StateTransferAopTestBase
{
- private Map caches;
+ private Map<String, PojoCache> caches;
public static final String A_B_1 = "/a/b/1";
public static final String A_B_2 = "/a/b/2";
public static final String A_C_1 = "/a/c/1";
public static final String A_C_2 = "/a/c/2";
- public static final Fqn A_B_1_f = Fqn.fromString("/a/b/1");
- public static final Fqn A_B_2_f = Fqn.fromString("/a/b/2");
- public static final Fqn A_C_1_f = Fqn.fromString("/a/c/1");
- public static final Fqn A_C_2_f = Fqn.fromString("/a/c/2");
+ public static final Fqn<String> A_B_1_f = Fqn.fromString("/a/b/1");
+ public static final Fqn<String> A_B_2_f = Fqn.fromString("/a/b/2");
+ public static final Fqn<String> A_C_1_f = Fqn.fromString("/a/c/1");
+ public static final Fqn<String> A_C_2_f = Fqn.fromString("/a/c/2");
private static final int SUBTREE_SIZE = 10;
@@ -148,7 +148,7 @@
assertTrue("Bob and Jill have same Address", ac1.getAddress() ==
ac2.getAddress());
}
- private void createAndActivateRegion(Cache c, Fqn f)
+ private void createAndActivateRegion(Cache<Object, Object> c, Fqn<String>
f)
{
Region r = c.getRegion(f, true);
r.registerContextClassLoader(getClass().getClassLoader());
@@ -222,9 +222,9 @@
TestingUtil.blockUntilViewsReceived(new Cache[]
{cache1.getCache(), cache2.getCache()}, 60000);
- CacheLoader loader = ((CacheSPI)
cache2.getCache()).getCacheLoaderManager().getCacheLoader();
+ CacheLoader loader = ((CacheSPI<Object, Object>)
cache2.getCache()).getCacheLoaderManager().getCacheLoader();
- Map map = loader.get(A_B_1_f);
+ Map<Object, Object> map = loader.get(A_B_1_f);
if (map != null)
{
assertNull("/a/b/1 name not transferred per policy",
map.get("name"));
@@ -331,6 +331,7 @@
* @param sync use REPL_SYNC or REPL_ASYNC
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
private void concurrentActivationTest(boolean sync) throws Exception
{
String[] names = {"A", "B", "C", "D",
"E"};
@@ -436,7 +437,7 @@
// concurrentUseTest(false);
}
- /**
+ /*
* Initiates 5 caches, 4 with active trees and one with an inactive tree.
* Each of the active caches begins rapidly generating puts against nodes
* in a subtree for which it is responsible. The 5th cache activates
@@ -446,150 +447,150 @@
* @param sync whether to use REPL_SYNC or REPL_ASYNCE
* @throws Exception
*/
- private void XconcurrentUseTest(boolean sync) throws Exception
- {
- String[] names = {"B", "C", "D", "E"};
- int count = names.length;
- CacheStressor[] stressors = new CacheStressor[count];
-
- try
- {
-
- PojoCache cacheA = createCache("cacheA", sync, true, false, false);
-
- Cache[] caches = new Cache[count + 1];
- caches[0] = cacheA.getCache();
-
- // Create a semaphore and take all its tickets
- Semaphore semaphore = new Semaphore(count);
- for (int i = 0; i < count; i++)
- {
- semaphore.acquire();
- }
-
- // Create stressor threads that will block on the semaphore
-
- for (int i = 0; i < count; i++)
- {
- stressors[i] = new CacheStressor(semaphore, names[i], sync);
- caches[i + 1] = stressors[i].getCache();
- stressors[i].start();
- // Give each one a chance to stabilize
- TestingUtil.sleepThread(100);
- }
-
- // Make sure everyone's views are in sync
- TestingUtil.blockUntilViewsReceived(caches, 60000);
-
- // Repeat the basic test two times in order to involve inactivation
- for (int x = 0; x < 2; x++)
- {
-// if (x > 0)
+// private void XconcurrentUseTest(boolean sync) throws Exception
+// {
+// String[] names = {"B", "C", "D", "E"};
+// int count = names.length;
+// CacheStressor[] stressors = new CacheStressor[count];
+//
+// try
+// {
+//
+// PojoCache cacheA = createCache("cacheA", sync, true, false, false);
+//
+// Cache[] caches = new Cache[count + 1];
+// caches[0] = cacheA.getCache();
+//
+// // Create a semaphore and take all its tickets
+// Semaphore semaphore = new Semaphore(count);
+// for (int i = 0; i < count; i++)
+// {
+// semaphore.acquire();
+// }
+//
+// // Create stressor threads that will block on the semaphore
+//
+// for (int i = 0; i < count; i++)
+// {
+// stressors[i] = new CacheStressor(semaphore, names[i], sync);
+// caches[i + 1] = stressors[i].getCache();
+// stressors[i].start();
+// // Give each one a chance to stabilize
+// TestingUtil.sleepThread(100);
+// }
+//
+// // Make sure everyone's views are in sync
+// TestingUtil.blockUntilViewsReceived(caches, 60000);
+//
+// // Repeat the basic test two times in order to involve inactivation
+// for (int x = 0; x < 2; x++)
+// {
+//// if (x > 0)
+//// {
+// // Reset things by inactivating the region
+// // and enabling the stressors
+// for (int i = 0; i < count; i++)
// {
- // Reset things by inactivating the region
- // and enabling the stressors
- for (int i = 0; i < count; i++)
- {
- cacheA.getCache().getRegion(Fqn.fromString("/" + names[i]),
true).deactivate();
- log.info("TEST: Run " + x + "-- /" + names[i] + "
inactivated on A");
- stressors[i].startPuts();
- }
+// cacheA.getCache().getRegion(Fqn.fromString("/" + names[i]),
true).deactivate();
+// log.info("TEST: Run " + x + "-- /" + names[i] +
" inactivated on A");
+// stressors[i].startPuts();
// }
+//// }
+//
+// // Release the semaphore to allow the threads to start work
+// semaphore.release(count);
+//
+// // Sleep to ensure the threads get all the semaphore tickets
+// // and to ensure puts are actively in progress
+// TestingUtil.sleepThread(300);
+//
+// // Activate cacheA
+// for (int i = 0; i < count; i++)
+// {
+// log.info("TEST: Activating /" + names[i] + " on
A");
+// cacheA.getCache().getRegion(Fqn.fromString("/" + names[i]),
true).activate();
+// // Stop the stressor so we don't pollute cacheA's state
+// // with too many messages sent after activation -- we want
+// // to compare transferred state with the sender
+// stressors[i].stopPuts();
+// log.info("TEST: Run " + x + "-- /" + names[i] +
" activated on A");
+// // Reacquire one semaphore ticket
+// boolean acquired = semaphore.tryAcquire(60, TimeUnit.SECONDS);
+// if (!acquired)
+// fail("failed to acquire semaphore " + names[i]);
+// log.info("TEST: Run " + x + "-- acquired semaphore from
" + names[i]);
+//
+// // Pause to allow other work to proceed
+// TestingUtil.sleepThread(100);
+// }
+//
+// // Sleep to allow any in transit msgs to clear
+// if (!sync)
+// TestingUtil.sleepThread(2000);
+//
+// // Ensure the stressors saw no exceptions
+// for (int i = 0; i < count; i++)
+// {
+// Exception e = stressors[i].getException();
+// if (e != null)
+// {
+// log.error("Stressor " + names[i] + " caught an
exception",
+// e);
+// throw e;
+// }
+// }
+//
+//// log.info("Cache A details:\n" + cacheA.printDetails());
+//
+// // Compare cache contents
+// Person p1 = null;
+// Person p2 = null;
+// for (int i = 0; i < count; i++)
+// {
+//// log.info("Cache " + names[i] + " details:\n" +
+//// stressors[i].getTreeCache().printDetails());
+//
+// for (int j = 0; j < SUBTREE_SIZE; j++)
+// {
+//
+// String fqn = "/" + names[i] + "/" + j;
+// log.info("TEST: Getting A:" + fqn);
+// p1 = (Person) cacheA.find(fqn);
+// boolean p1Null = p1 == null;
+// log.info("TEST: Getting " + names[i] + ":" +
fqn);
+//// p2 = (Person) stressors[i].getCache().find(fqn);
+// boolean p2Null = p2 == null;
+// assertEquals("Run " + x + ": " + fqn +
+// " null status matches", p1Null, p2Null);
+// if (!p1Null)
+// {
+// assertEquals("Run " + x + ": A:" + fqn +
" age matches " + names[i] + ":" + fqn,
+// p1.getAge(), p2.getAge());
+// assertEquals("Run " + x + ": A:" + fqn +
" name matches " + names[i] + ":" + fqn,
+// p1.getName(), p2.getName());
+// assertEquals("Run " + x + ": A:" + fqn +
" address matches " + names[i] + ":" + fqn,
+// p1.getAddress().getStreet(),
+// p2.getAddress().getStreet());
+// }
+// }
+// }
+// }
+//
+// for (int i = 0; i < count; i++)
+// stressors[i].stopThread();
+//
+// }
+// finally
+// {
+// for (int i = 0; i < count; i++)
+// {
+// if (stressors[i] != null)
+// stressors[i].cleanup();
+// }
+// }
+//
+// }
- // Release the semaphore to allow the threads to start work
- semaphore.release(count);
-
- // Sleep to ensure the threads get all the semaphore tickets
- // and to ensure puts are actively in progress
- TestingUtil.sleepThread(300);
-
- // Activate cacheA
- for (int i = 0; i < count; i++)
- {
- log.info("TEST: Activating /" + names[i] + " on A");
- cacheA.getCache().getRegion(Fqn.fromString("/" + names[i]),
true).activate();
- // Stop the stressor so we don't pollute cacheA's state
- // with too many messages sent after activation -- we want
- // to compare transferred state with the sender
- stressors[i].stopPuts();
- log.info("TEST: Run " + x + "-- /" + names[i] + "
activated on A");
- // Reacquire one semaphore ticket
- boolean acquired = semaphore.tryAcquire(60, TimeUnit.SECONDS);
- if (!acquired)
- fail("failed to acquire semaphore " + names[i]);
- log.info("TEST: Run " + x + "-- acquired semaphore from
" + names[i]);
-
- // Pause to allow other work to proceed
- TestingUtil.sleepThread(100);
- }
-
- // Sleep to allow any in transit msgs to clear
- if (!sync)
- TestingUtil.sleepThread(2000);
-
- // Ensure the stressors saw no exceptions
- for (int i = 0; i < count; i++)
- {
- Exception e = stressors[i].getException();
- if (e != null)
- {
- log.error("Stressor " + names[i] + " caught an
exception",
- e);
- throw e;
- }
- }
-
-// log.info("Cache A details:\n" + cacheA.printDetails());
-
- // Compare cache contents
- Person p1 = null;
- Person p2 = null;
- for (int i = 0; i < count; i++)
- {
-// log.info("Cache " + names[i] + " details:\n" +
-// stressors[i].getTreeCache().printDetails());
-
- for (int j = 0; j < SUBTREE_SIZE; j++)
- {
-
- String fqn = "/" + names[i] + "/" + j;
- log.info("TEST: Getting A:" + fqn);
- p1 = (Person) cacheA.find(fqn);
- boolean p1Null = p1 == null;
- log.info("TEST: Getting " + names[i] + ":" + fqn);
-// p2 = (Person) stressors[i].getCache().find(fqn);
- boolean p2Null = p2 == null;
- assertEquals("Run " + x + ": " + fqn +
- " null status matches", p1Null, p2Null);
- if (!p1Null)
- {
- assertEquals("Run " + x + ": A:" + fqn + "
age matches " + names[i] + ":" + fqn,
- p1.getAge(), p2.getAge());
- assertEquals("Run " + x + ": A:" + fqn + "
name matches " + names[i] + ":" + fqn,
- p1.getName(), p2.getName());
- assertEquals("Run " + x + ": A:" + fqn + "
address matches " + names[i] + ":" + fqn,
- p1.getAddress().getStreet(),
- p2.getAddress().getStreet());
- }
- }
- }
- }
-
- for (int i = 0; i < count; i++)
- stressors[i].stopThread();
-
- }
- finally
- {
- for (int i = 0; i < count; i++)
- {
- if (stressors[i] != null)
- stressors[i].cleanup();
- }
- }
-
- }
-
protected PojoCache createCache(String cacheID, boolean sync, boolean useMarshalling,
boolean useCacheLoader)
throws Exception
{
@@ -694,7 +695,7 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- caches = new HashMap();
+ caches = new HashMap<String, PojoCache>();
addr1 = new Address();
addr1.setStreet("101 Oakview Dr");
@@ -710,7 +711,7 @@
joe.setName("Joe");
joe.setAge(TWENTY);
joe.setAddress(addr1);
- Set skills = new HashSet();
+ Set<String> skills = new HashSet<String>();
skills.add("TENNIS");
skills.add("CARPENTRY");
joe.setSkills(skills);
@@ -719,7 +720,7 @@
jane.setName("Jane");
jane.setAge(TWENTYFIVE);
jane.setAddress(addr1);
- skills = new HashSet();
+ skills = new HashSet<String>();
skills.add("JUJITSU");
skills.add("MACRAME");
jane.setSkills(skills);
@@ -728,7 +729,7 @@
bob.setName("Bob");
bob.setAge(FORTY);
bob.setAddress(addr2);
- skills = new HashSet();
+ skills = new HashSet<String>();
skills.add("LANGUAGES");
skills.add("LAWN BOWLING");
bob.setSkills(skills);
@@ -737,7 +738,7 @@
jill.setName("Jill");
jill.setAge(TWENTYFIVE);
jill.setAddress(addr2);
- skills = new HashSet();
+ skills = new HashSet<String>();
skills.add("FORTRAN");
skills.add("COBOL");
jane.setSkills(skills);
@@ -746,18 +747,18 @@
@AfterMethod(alwaysRun = true)
protected void tearDown() throws Exception
{
- Set keys = caches.keySet();
+ Set<String> keys = caches.keySet();
if (!keys.isEmpty())
{
String[] cacheIDs = new String[keys.size()];
- cacheIDs = (String[]) keys.toArray(cacheIDs);
- PojoCache cache = (PojoCache) caches.get(cacheIDs[0]);
- cache.getCache().removeNode(new Fqn("/"));
+ cacheIDs = keys.toArray(cacheIDs);
+ PojoCache cache = caches.get(cacheIDs[0]);
+ cache.getCache().removeNode(new Fqn<String>("/"));
Thread.sleep(200);
for (int i = 0; i < cacheIDs.length; i++)
{
- stopCache((PojoCache) caches.get(cacheIDs[i]));
+ stopCache(caches.get(cacheIDs[i]));
File file = new File(getTempLocation(cacheIDs[i]));
cleanFile(file);
}
@@ -850,6 +851,7 @@
}
}
+ @SuppressWarnings("unused")
private class CacheStressor extends CacheUser
{
private Random random;
@@ -1021,7 +1023,7 @@
throws Exception
{
this.cache = createCache(name, sync, true, false, !activateRoot);
- tm = ((CacheSPI) cache.getCache()).getTransactionManager();
+ tm = ((CacheSPI<Object, Object>)
cache.getCache()).getTransactionManager();
if (tm == null)
throw new IllegalStateException("TransactionManager required");
this.semaphore = semaphore;
@@ -1069,7 +1071,7 @@
return exception;
}
- public Cache getCache()
+ public Cache<Object, Object> getCache()
{
return cache.getCache();
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/test/CacheObject.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/test/CacheObject.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/test/CacheObject.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -9,13 +9,14 @@
*/
public class CacheObject implements Serializable
{
+ private static final long serialVersionUID = 1L;
private String id;
- private Set identities;
+ private Set<String> identities;
public CacheObject(String id)
{
this.id = id;
- this.identities = new HashSet();
+ this.identities = new HashSet<String>();
}
public String getId()
@@ -23,7 +24,7 @@
return id;
}
- public Set getIdentities()
+ public Set<String> getIdentities()
{
return identities;
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NetworkDomain.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NetworkDomain.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NetworkDomain.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -23,9 +23,9 @@
{
String name_;
// The associated nodes from the elements
- List nodes_;
+ List<NetworkNode> nodes_;
// All the elements to be managed in this domain
- List elements_;
+ List<NetworkElement> elements_;
// Adminstration such id, pass
NetworkAdmin admin_;
@@ -42,17 +42,17 @@
name_ = name;
}
- public List getNodes()
+ public List<NetworkNode> getNodes()
{
return nodes_;
}
- protected void setNodes(List nodes)
+ protected void setNodes(List<NetworkNode> nodes)
{
nodes_ = nodes;
}
- public List getElements()
+ public List<NetworkNode> getElements()
{
return nodes_;
}
@@ -60,7 +60,7 @@
protected void addNode(NetworkNode node)
{
if (nodes_ == null)
- nodes_ = new ArrayList();
+ nodes_ = new ArrayList<NetworkNode>();
nodes_.add(node);
}
@@ -68,7 +68,7 @@
public void addElement(NetworkElement element)
{
if (elements_ == null)
- elements_ = new ArrayList();
+ elements_ = new ArrayList<NetworkElement>();
elements_.add(element);
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NetworkNode.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NetworkNode.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NetworkNode.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -21,7 +21,7 @@
public class NetworkNode
{
String name_;
- List elements_;
+ List<NetworkElement> elements_;
String ipAddress_;
public String getName()
@@ -34,12 +34,12 @@
name_ = name;
}
- public List getElements()
+ public List<NetworkElement> getElements()
{
return elements_;
}
- protected void setElements(List elements)
+ protected void setElements(List<NetworkElement> elements)
{
elements_ = elements;
}
@@ -47,7 +47,7 @@
public void addElement(NetworkElement element)
{
if (elements_ == null)
- elements_ = new ArrayList();
+ elements_ = new ArrayList<NetworkElement>();
elements_.add(element);
element.setParentNode(this);
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NodeManager.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NodeManager.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/test/NodeManager.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -27,7 +27,7 @@
{
private TestNode rootNode_;
- private Map nodeMap_ = new HashMap();
+ private Map<String, TestNode> nodeMap_ = new HashMap<String, TestNode>();
public NodeManager()
{
@@ -60,7 +60,7 @@
public TestNode findNode(String fdn)
{
- return (TestNode) nodeMap_.get(fdn);
+ return nodeMap_.get(fdn);
}
private void registMap(TestNode node)
@@ -78,7 +78,7 @@
System.out.println(prefix + node.getNodeRDN());
String childPrefix = prefix + " + ";
- List children = node.getChildren();
+ List<TestNode> children = node.getChildren();
int size = children.size();
for (int idx = 0; idx < size; idx++)
{
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/test/Person.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/test/Person.java 2007-09-12 01:04:18 UTC
(rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/test/Person.java 2007-09-12 01:05:23 UTC
(rev 4456)
@@ -108,7 +108,7 @@
void addMedication(String name)
{
if (medication == null)
- medication = new ArrayList();
+ medication = new ArrayList<String>();
if (!medication.contains(name))
medication.add(name);
}
@@ -118,7 +118,7 @@
return hobbies;
}
- public void setHobbies(Map hobbies)
+ public void setHobbies(Map<String, String> hobbies)
{
this.hobbies = hobbies;
}
@@ -138,7 +138,7 @@
return skills;
}
- public void setSkills(Set skills)
+ public void setSkills(Set<String> skills)
{
this.skills = skills;
}
@@ -148,7 +148,7 @@
return medication;
}
- public void setMedication(List medication)
+ public void setMedication(List<String> medication)
{
this.medication = medication;
}
@@ -224,15 +224,15 @@
return result;
}
- public String print(Map m)
+ public String print(Map<?, ?> m)
{
StringBuffer sb = new StringBuffer();
- Map.Entry entry;
+ Map.Entry<?, ?> entry;
if (m != null)
{
- for (Iterator it = m.entrySet().iterator(); it.hasNext();)
+ for (Iterator<?> it = m.entrySet().iterator(); it.hasNext();)
{
- entry = (Map.Entry) it.next();
+ entry = (Map.Entry<?, ?>) it.next();
sb.append(entry.getKey()).append(": ").append(entry.getValue());
sb.append("\n");
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SerializedAddress.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SerializedAddress.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SerializedAddress.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -16,6 +16,7 @@
*/
public class SerializedAddress implements Serializable
{
+ private static final long serialVersionUID = 1L;
String street = null;
String city = null;
int zip = 0;
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SpecialAddress.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SpecialAddress.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SpecialAddress.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -18,6 +18,7 @@
@org.jboss.cache.pojo.annotation.Replicable
public class SpecialAddress implements Serializable
{
+ private static final long serialVersionUID = 1L;
String addr = null;
public String getAddr()
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SpecialSerializedAddress.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SpecialSerializedAddress.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/SpecialSerializedAddress.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -19,18 +19,19 @@
@org.jboss.cache.pojo.annotation.Replicable
public class SpecialSerializedAddress implements Serializable
{
+ private static final long serialVersionUID = 1L;
String street = null;
String city = null;
int zip = 0;
- List residents = new ArrayList();
+ List<String> residents = new ArrayList<String>();
- public List getResidents()
+ public List<String> getResidents()
{
return residents;
}
- public void setResidents(List residents)
+ public void setResidents(List<String> residents)
{
this.residents = residents;
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/test/TestNode.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/test/TestNode.java 2007-09-12 01:04:18
UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/test/TestNode.java 2007-09-12 01:05:23
UTC (rev 4456)
@@ -10,7 +10,7 @@
private String fdn_;
- private List childNodes_ = new ArrayList();
+ private List<TestNode> childNodes_ = new ArrayList<TestNode>();
private TestNode parentNode_;
@@ -43,7 +43,7 @@
childNodes_.add(child);
}
- public List getChildren()
+ public List<TestNode> getChildren()
{
return childNodes_;
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/Node.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/Node.java 2007-09-12
01:04:18 UTC (rev 4455)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/Node.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -19,7 +19,7 @@
public void addChildNode(Node child);
- public List getChildren();
+ public List<Node> getChildren();
public void setParentNode(Node parent);
@@ -31,7 +31,7 @@
public StateItem getSummaryStateItem();
- public List getStateItems();
+ public List<StateItem> getStateItems();
public StateItem findStateItem(long itemId);
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/NodeImpl.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/NodeImpl.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/NodeImpl.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -13,11 +13,11 @@
private String fdn_;
- private List childNodes_ = new ArrayList();
+ private List<Node> childNodes_ = new ArrayList<Node>();
private Node parentNode_;
- private List stateItems_ = new ArrayList();
+ private List<StateItem> stateItems_ = new ArrayList<StateItem>();
private StateItem summaryItem_;
@@ -53,7 +53,7 @@
childNodes_.add(child);
}
- public List getChildren()
+ public List<Node> getChildren()
{
return childNodes_;
}
@@ -94,7 +94,7 @@
}
- public List getStateItems()
+ public List<StateItem> getStateItems()
{
return this.stateItems_;
}
@@ -105,7 +105,7 @@
int size = stateItems_.size();
for (int idx = 0; idx < size; idx++)
{
- StateItem stateItem = (StateItem) stateItems_.get(idx);
+ StateItem stateItem = stateItems_.get(idx);
if (stateItem.getItemId() == itemId)
{
retItem = stateItem;
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/ORSummaryRule.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/ORSummaryRule.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/ORSummaryRule.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -13,7 +13,7 @@
{
long maxSeverity = 0;
- List stateItems = node.getStateItems();
+ List<StateItem> stateItems = node.getStateItems();
int size = stateItems.size();
for (int idx = 0; idx < size; idx++)
{
@@ -22,7 +22,7 @@
maxSeverity = updateMaxSeverity(maxSeverity, stateItem);
}
- List childNodes = node.getChildren();
+ List<Node> childNodes = node.getChildren();
size = childNodes.size();
for (int idx = 0; idx < size; idx++)
{
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/PropagationManagerImpl.java
===================================================================
---
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/PropagationManagerImpl.java 2007-09-12
01:04:18 UTC (rev 4455)
+++
pojo/trunk/src/test/java/org/jboss/cache/pojo/test/propagation/impl/PropagationManagerImpl.java 2007-09-12
01:05:23 UTC (rev 4456)
@@ -13,7 +13,7 @@
{
private Node rootNode_;
- private Map nodeMap_ = new HashMap();
+ private Map<String, Node> nodeMap_ = new HashMap<String, Node>();
private transient PropagationRule orRule_;
@@ -87,7 +87,7 @@
public Node findNode(String fdn)
{
- return (Node) nodeMap_.get(fdn);
+ return nodeMap_.get(fdn);
}
private void registMap(Node node)
@@ -106,20 +106,20 @@
+ node.getSummaryStateItem().getState() + ")");
String itemPrefix = prefix + " | ";
- List items = node.getStateItems();
+ List<StateItem> items = node.getStateItems();
int size = items.size();
for (int idx = 0; idx < size; idx++)
{
- StateItem item = (StateItem) items.get(idx);
+ StateItem item = items.get(idx);
printStateItem(item, itemPrefix);
}
String childPrefix = prefix + " + ";
- List children = node.getChildren();
+ List<Node> children = node.getChildren();
size = children.size();
for (int idx = 0; idx < size; idx++)
{
- Node child = (Node) children.get(idx);
+ Node child = children.get(idx);
printNode(child, childPrefix);
}
}
@@ -138,20 +138,20 @@
+ node.getSummaryStateItem().getState() + ")");
String itemPrefix = prefix + " | ";
- List items = node.getStateItems();
+ List<StateItem> items = node.getStateItems();
int size = items.size();
for (int idx = 0; idx < size; idx++)
{
- StateItem item = (StateItem) items.get(idx);
+ StateItem item = items.get(idx);
buf.append(toStateItemString(item, itemPrefix));
}
String childPrefix = prefix + " + ";
- List children = node.getChildren();
+ List<Node> children = node.getChildren();
size = children.size();
for (int idx = 0; idx < size; idx++)
{
- Node child = (Node) children.get(idx);
+ Node child = children.get(idx);
buf.append(toNodeString(child, childPrefix));
}