JBoss Cache SVN: r4459 - in core/trunk: src/main/resources and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-09-13 12:37:52 -0400 (Thu, 13 Sep 2007)
New Revision: 4459
Added:
core/trunk/src/main/resources/jboss-beans.xml
core/trunk/src/test/java/org/jboss/cache/ConcurrentPutRemoveTest.java
Removed:
core/trunk/.settings/
Log:
Removed IDE settings
Added: core/trunk/src/main/resources/jboss-beans.xml
===================================================================
--- core/trunk/src/main/resources/jboss-beans.xml (rev 0)
+++ core/trunk/src/main/resources/jboss-beans.xml 2007-09-13 16:37:52 UTC (rev 4459)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- Let's start with naming a few beans that we will always use regardless of configuration -->
+ <bean name="cache" class="org.jboss.cache.CacheImpl">
+ <!--<property name="notifier">-->
+ <!--<inject bean="notifier" />-->
+ <!--</property>-->
+ </bean>
+
+ <bean name="notifier" class="org.jboss.cache.notifications.Notifier">
+ <constructor>
+ <inject bean="cache" />
+ </constructor>
+ </bean>
+
+ <bean name="rpcManager" class="org.jboss.cache.RPCManagerImpl">
+ <property name="cache">
+ <inject bean="cache" />
+ </property>
+ </bean>
+
+
+
+</deployment>
Added: core/trunk/src/test/java/org/jboss/cache/ConcurrentPutRemoveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/ConcurrentPutRemoveTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/ConcurrentPutRemoveTest.java 2007-09-13 16:37:52 UTC (rev 4459)
@@ -0,0 +1,87 @@
+package org.jboss.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.transaction.TransactionManager;
+
+import junit.framework.TestCase;
+
+import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+
+public class ConcurrentPutRemoveTest extends TestCase {
+
+ private TransactionManager tm;
+
+ private Cache cache;
+
+ protected void setUp() throws Exception {
+ cache = DefaultCacheFactory.getInstance().createCache(false);
+ cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
+ cache.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
+ cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+ cache.getConfiguration().setLockAcquisitionTimeout(10000);
+ cache.start();
+ tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ cache.stop();
+ cache.destroy();
+ }
+
+ public void testLock() throws Exception {
+ List<SeparateThread> threads = new ArrayList<SeparateThread>();
+ for (int x = 0; x < 2; x++) {
+ SeparateThread t = new SeparateThread(x);
+ threads.add(t);
+ t.start();
+ }
+ for (SeparateThread separateThread : threads) {
+ separateThread.join();
+ if (separateThread.getException() != null) {
+ throw separateThread.getException();
+ }
+ }
+
+ }
+
+ private class SeparateThread extends Thread {
+ Exception e = null;
+
+ private int num = 0;
+
+ public SeparateThread(int num) {
+ this.num = num;
+ }
+
+ public Exception getException() {
+ return e;
+ }
+
+ public void run() {
+
+ Thread.currentThread().setName("Thread:" + num);
+ try {
+ for (int x = 0; x < 1000; x++) {
+ tm.begin();
+ System.out.println("R" + Thread.currentThread().getName());
+ //inside transaction
+ cache.removeNode(Fqn.fromString("/a"));
+ System.out.println("AR" + Thread.currentThread().getName());
+ tm.commit();
+ //outside transaction
+ System.out.println("P" + Thread.currentThread().getName());
+ cache.put(Fqn.fromString("/a/b/c/d"), "text"+x,"b");
+ System.out.println("AP" + Thread.currentThread().getName());
+ }
+ } catch (Exception e) {
+ this.e = e;
+ }
+ }
+ }
+
+}
17 years, 3 months
JBoss Cache SVN: r4458 - in core/trunk/src: main/java/org/jboss/cache/interceptors and 12 other directories.
by jbosscache-commits@lists.jboss.org
Author: genman
Date: 2007-09-13 01:47:28 -0400 (Thu, 13 Sep 2007)
New Revision: 4458
Added:
core/trunk/src/test/java/org/jboss/cache/options/TestVersion.java
Removed:
core/trunk/src/main/java/org/jboss/cache/MyClass.java
Modified:
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/UnlockInterceptor.java
core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java
core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java
core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java
core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java
core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
Log:
Clean up some additional warnings about null/non-null values; deprecation
Move TestVersion class to separate file
Deleted: core/trunk/src/main/java/org/jboss/cache/MyClass.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/MyClass.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/MyClass.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -1,60 +0,0 @@
-package org.jboss.cache;
-
-import org.jboss.kernel.plugins.bootstrap.standalone.StandaloneBootstrap;
-
-/**
- * // TODO: Add Javadocs
- *
- * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
- * @since 2.0.0
- */
-public class MyClass
-{
- private int x, y;
-
-
- public MyClass()
- {
- // some dummy dependency
- //
-
- org.jgroups.Address addr = new org.jgroups.stack.IpAddress();
- }
-
- public MyClass(int x, int y)
- {
- this.x = x;
- this.y = y;
- }
-
-
- public int getX()
- {
- return x;
- }
-
- public void setX(int x)
- {
- this.x = x;
- }
-
- public int getY()
- {
- return y;
- }
-
- public void setY(int y)
- {
- this.y = y;
- }
-
- public int add()
- {
- return x + y;
- }
-
- public int multiply()
- {
- return x * y;
- }
-}
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -35,6 +35,7 @@
// for now, we delegate RPC calls to deprecated methods in CacheImpl.
+ @SuppressWarnings("deprecation")
public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout) throws Exception
{
return c.callRemoteMethods(recipients, methodCall, mode, excludeSelf, timeout);
@@ -50,11 +51,13 @@
return c.getCoordinator();
}
+ @SuppressWarnings("deprecation")
public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, boolean synchronous, boolean excludeSelf, int timeout) throws Exception
{
return c.callRemoteMethods(recipients, methodCall, synchronous, excludeSelf, timeout);
}
+ @SuppressWarnings("deprecation")
public List callRemoteMethods(List<Address> recipients, Method method, Object[] arguments, boolean synchronous, boolean excludeSelf, long timeout) throws Exception
{
return c.callRemoteMethods(recipients, method, arguments, synchronous, excludeSelf, timeout);
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -251,27 +251,6 @@
}
}
- private List getFqnsFromModificationList(List<MethodCall> modifications)
- {
- List<Fqn> fqnList = new ArrayList<Fqn>();
-
- for (MethodCall mc : modifications)
- {
- Fqn fqn = findFqn(mc.getArgs());
- if (fqn != null && !fqnList.contains(fqn)) fqnList.add(fqn);
- }
- return fqnList;
- }
-
- private Fqn findFqn(Object[] args)
- {
- for (Object arg : args)
- {
- if (arg instanceof Fqn) return (Fqn) arg;
- }
- return null;
- }
-
public long getCacheLoaderStores()
{
return m_cacheStores;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -176,11 +176,7 @@
if (fqn != null && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.VISIT_NODE_EVENT))
{
- if (fqn != null
- && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.VISIT_NODE_EVENT))
- {
- return new EvictedEventNode(fqn, NodeEventType.VISIT_NODE_EVENT);
- }
+ return new EvictedEventNode(fqn, NodeEventType.VISIT_NODE_EVENT);
}
return null;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -137,9 +137,6 @@
log.debug("Found root node in workspace.");
}
- // we will always have one root node here, by this stage
- Fqn currentFqn = Fqn.ROOT;
-
// iterate through the target Fqn's elements.
int targetFqnSize = targetFqn.size(), currentDepth = 1;
for (Object childName : targetFqn.peekElements())
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/UnlockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/UnlockInterceptor.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/UnlockInterceptor.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -1,15 +1,15 @@
package org.jboss.cache.interceptors;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import javax.transaction.Transaction;
+
import org.jboss.cache.CacheSPI;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.lock.IdentityLock;
-import org.jboss.cache.marshall.MethodCall;
-import javax.transaction.Transaction;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
/**
* When a call returns, unlocks all locks held by the current thread in the
* LockTable. This is a no-op if a transaction is used.
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -807,7 +807,7 @@
this.config = (cache == null ? null : cache.getConfiguration());
synchronized (listenerCount)
{
- if (listenerCount.get() > 0)
+ if (listenerCount.get() > 0 && cache != null)
{
cache.addCacheListener(cacheNotificationListener);
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -274,6 +274,7 @@
{
CacheLoader cl = it.next();
CacheLoaderConfig.IndividualCacheLoaderConfig cfg = cfgIt.next();
+ cl.setConfig(cfg);
cl.create();
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -1,15 +1,6 @@
package org.jboss.cache.loader;
-import net.jcip.annotations.ThreadSafe;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.marshall.NodeData;
-
import java.io.InputStream;
-import java.io.ObjectInputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -18,6 +9,15 @@
import java.util.List;
import java.util.Map;
+import net.jcip.annotations.ThreadSafe;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.marshall.NodeData;
+
/**
* JDBC implementation of <tt>AdjListJDBCCacheLoader</tt>.
* Represents a faster alternative than JDBCCacheLoaderOld and relies on the same database structrure.
@@ -157,7 +157,6 @@
InputStream is = rs.getBinaryStream(index);
if (is != null && !rs.wasNull())
{
- ObjectInputStream ois;
try
{
Object marshalledNode = unmarshall(is);
Modified: core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -228,14 +228,11 @@
out.reset();
out.writeByte(TcpCacheOperations.PUT_LIST);
- int length = modifications != null ? modifications.size() : 0;
+ int length = modifications.size();
out.writeInt(length);
- if (length > 0)
+ for (Modification m : modifications)
{
- for (Modification m : modifications)
- {
- m.writeExternal(out);
- }
+ m.writeExternal(out);
}
out.flush();
Object retval = in.readObject();
Modified: core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -10,11 +10,9 @@
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.UnknownHostException;
@@ -46,8 +44,8 @@
assertTrue(tx1.equals(tx2));
}
+
@Test(groups = {"functional"})
-
public void testEqualityWithOtherObject() throws UnknownHostException
{
IpAddress a1 = new IpAddress("localhost", 4444);
@@ -90,7 +88,7 @@
}
@Test(groups = {"functional"})
- public void testExternalization() throws UnknownHostException
+ public void testExternalization() throws Exception
{
IpAddress a1 = new IpAddress("localhost", 4444);
IpAddress a2 = new IpAddress("localhost", 5555);
@@ -104,39 +102,20 @@
tx1 = GlobalTransaction.create(a1);
tx2 = GlobalTransaction.create(a2);
- try
- {
- bos = new ByteArrayOutputStream(1024);
- out = new ObjectOutputStream(bos);
- out.writeObject(tx1);
- out.writeObject(tx2);
- out.flush();
- buf = bos.toByteArray();
- }
- catch (IOException ex)
- {
- fail("creation of output stream");
- }
+ bos = new ByteArrayOutputStream(1024);
+ out = new ObjectOutputStream(bos);
+ out.writeObject(tx1);
+ out.writeObject(tx2);
+ out.flush();
+ buf = bos.toByteArray();
- try
- {
- bis = new ByteArrayInputStream(buf);
- in = new ObjectInputStream(bis);
- tx1_copy = (GlobalTransaction) in.readObject();
- tx2_copy = (GlobalTransaction) in.readObject();
- }
- catch (IOException ex)
- {
- fail("creation of input stream");
- }
- catch (ClassNotFoundException e)
- {
- e.printStackTrace();
- fail();
- }
+ bis = new ByteArrayInputStream(buf);
+ in = new ObjectInputStream(bis);
+ tx1_copy = (GlobalTransaction) in.readObject();
+ tx2_copy = (GlobalTransaction) in.readObject();
System.out.println("\ntx1: " + tx1 + ", tx1_copy: " + tx1_copy +
- "\ntx2: " + tx2 + ", tx2_copy: " + tx2_copy);
+ "\ntx2: " + tx2 + ", tx2_copy: " + tx2_copy);
assertNotNull(tx1_copy);
assertNotNull(tx2_copy);
Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -10,7 +10,6 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
import java.util.HashMap;
import java.util.Map;
@@ -140,13 +139,12 @@
{
InvocationContext ctx = c.getInvocationContext();
InvocationContext control = null;
- try
- {
+ try {
control = ctx.clone();
}
catch (CloneNotSupportedException e)
{
- fail("Unable to clone InvocationContext");
+ throw new RuntimeException(e);
}
control.reset();
Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -10,7 +10,6 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
import java.util.ArrayList;
import java.util.List;
@@ -158,7 +157,7 @@
}
catch (CloneNotSupportedException e)
{
- fail("Unable to clone InvocationCOntext");
+ throw new RuntimeException(e);
}
control.reset();
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -412,29 +412,14 @@
@SuppressWarnings("unchecked")
- public void testCacheLoading2() throws CacheException
+ public void testCacheLoading2() throws Exception
{
Set keys = null;
cache.put("/a/b/c", "key", "val");
- try
- {
- keys = cache.getKeys("/a/b/c");
- assertNotNull(keys);
- assertEquals(1, keys.size());
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
-
- try
- {
- keys.add("myKey");
- }
- catch (UnsupportedOperationException ex)
- {
- fail("unsupported operation: " + ex);
- }
+ keys = cache.getKeys("/a/b/c");
+ assertNotNull(keys);
+ assertEquals(1, keys.size());
+ keys.add("myKey");
}
@@ -1847,12 +1832,10 @@
// Save state
byte[] state;
- ByteArrayOutputStream baos = null;
- MarshalledValueOutputStream os = null;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ MarshalledValueOutputStream os = new MarshalledValueOutputStream(baos);
try
{
- baos = new ByteArrayOutputStream(1024);
- os = new MarshalledValueOutputStream(baos);
loader.loadEntireState(os);
}
catch (UnsupportedOperationException ex)
@@ -1868,11 +1851,10 @@
}
/* Restore state. */
- MarshalledValueInputStream is = null;
+ ByteArrayInputStream bais = new ByteArrayInputStream(state);
+ MarshalledValueInputStream is = new MarshalledValueInputStream(bais);
try
{
- ByteArrayInputStream bais = new ByteArrayInputStream(state);
- is = new MarshalledValueInputStream(bais);
loader.storeEntireState(is);
}
catch (UnsupportedOperationException ex)
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -62,6 +62,7 @@
}
}
+ @SuppressWarnings("deprecation")
public void testClassloader() throws Exception
{
String jarDir = System.getProperty("test.jar.dir");
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -123,6 +123,7 @@
region.unregisterContextClassLoader();
}
+ @SuppressWarnings("deprecation")
private URLClassLoader createOrphanClassLoader() throws MalformedURLException
{
File f;
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -24,6 +24,7 @@
displayClassInfo(clazz, results, true);
}
+ @SuppressWarnings("null")
public static void displayClassInfo(Class clazz, StringBuffer results,
boolean showParentClassLoaders)
{
@@ -44,10 +45,7 @@
{
break;
}
- if (parent != null)
- {
- parent = parent.getParent();
- }
+ parent = parent.getParent();
}
CodeSource clazzCS = clazz.getProtectionDomain().getCodeSource();
if (clazzCS != null)
Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -205,58 +205,4 @@
assertEquals(vChild, ((NodeSPI)cache.get("/parent/child")).getVersion());
}
-}
-
-/**
- * Note that this uses STRING comparisons!!
- */
-class TestVersion implements DataVersion
-{
- private static final long serialVersionUID = -5577530957664493161L;
- private String myVersion;
-
- public TestVersion(String version)
- {
- myVersion = version;
- }
-
- public String getInternalVersion()
- {
- return myVersion;
- }
-
- public void setInternalVersion(String version)
- {
- myVersion = version;
- }
-
- public boolean newerThan(DataVersion other)
- {
- if (other instanceof TestVersion)
- {
- return myVersion.compareTo(((TestVersion)other).getInternalVersion()) > 0;
- }
- else
- {
- throw new IllegalArgumentException("version type mismatch");
- }
- }
-
- public String toString()
- {
- return "TestVersion-" + myVersion;
- }
-
- public boolean equals(Object other)
- {
- if (other instanceof TestVersion)
- {
- TestVersion oVersion = (TestVersion)other;
- if (oVersion.myVersion == null && myVersion == null)
- return true;
- if (myVersion != null)
- return myVersion.equals(oVersion.myVersion);
- }
- return false;
- }
}
\ No newline at end of file
Added: core/trunk/src/test/java/org/jboss/cache/options/TestVersion.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/TestVersion.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/options/TestVersion.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -0,0 +1,58 @@
+package org.jboss.cache.options;
+
+import org.jboss.cache.optimistic.DataVersion;
+
+/**
+ * Note that this uses STRING comparisons!!
+ */
+public class TestVersion implements DataVersion
+{
+
+ private static final long serialVersionUID = -5577530957664493161L;
+
+ private String myVersion;
+
+ public TestVersion(String version)
+ {
+ myVersion = version;
+ }
+
+ public String getInternalVersion()
+ {
+ return myVersion;
+ }
+
+ public void setInternalVersion(String version)
+ {
+ myVersion = version;
+ }
+
+ public boolean newerThan(DataVersion other)
+ {
+ if (other instanceof TestVersion)
+ {
+ return myVersion.compareTo(((TestVersion) other).getInternalVersion()) > 0;
+ }
+ else
+ {
+ throw new IllegalArgumentException("version type mismatch");
+ }
+ }
+
+
+ public String toString()
+ {
+ return "TestVersion-" + myVersion;
+ }
+
+ public boolean equals(Object other)
+ {
+ if (other instanceof TestVersion)
+ {
+ TestVersion oVersion = (TestVersion) other;
+ if (oVersion.myVersion == null && myVersion == null) return true;
+ if (myVersion != null) return myVersion.equals(oVersion.myVersion);
+ }
+ return false;
+ }
+}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -289,29 +289,14 @@
}
- public void testCacheLoading2() throws CacheException
+ public void testCacheLoading2() throws Exception
{
Set<Object> keys = null;
cache.put("/a/b/c", "key", "val");
- try
- {
- keys = cache.getKeys(Fqn.fromString("/a/b/c"));
- assertNotNull(keys);
- assertEquals(1, keys.size());
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
-
- try
- {
- keys.add("myKey");
- }
- catch (UnsupportedOperationException ex)
- {
- fail("unsupported operation: " + ex);
- }
+ keys = cache.getKeys(Fqn.fromString("/a/b/c"));
+ assertNotNull(keys);
+ assertEquals(1, keys.size());
+ keys.add("myKey");
}
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -9,7 +9,6 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
@@ -53,7 +52,6 @@
for (Cache c : caches)
{
c.stop();
- c = null;
}
caches = null;
}
@@ -129,7 +127,7 @@
}
catch (CloneNotSupportedException e)
{
- fail("Unable to clone InvocationCOntext");
+ throw new RuntimeException(e);
}
control.reset();
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -9,7 +9,6 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertNull;
import static org.testng.AssertJUnit.fail;
@@ -98,6 +97,7 @@
assertEquals("/a/c state should have integrated in backup region " + test, JANE, cache2.get(test, "name"));
}
+ @SuppressWarnings("null")
public void testCacheLoaderFailure() throws Exception
{
CacheSPI<Object, Object> cache1 = createCache("cache1", false, false, "org.jboss.cache.statetransfer.CorruptedFileCacheLoader", false, true);
@@ -117,7 +117,6 @@
}
catch (Exception e)
{
- assertNotNull(e);
}
//when persistent transfer fails as in this case state recipient cacheloader should be wiped clean
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -126,10 +126,7 @@
}
finally
{
- if (writer != null)
- {
- writer.stop();
- }
+ writer.stop();
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java 2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java 2007-09-13 05:47:28 UTC (rev 4458)
@@ -584,15 +584,14 @@
cache.remove("/a/b/c");
// this node should now be locked.
Transaction t = cache.getTransactionManager().suspend();
- Transaction t2 = null;
+ Transaction t2;
+ System.out.println(cache.printLockInfo());
+ // start a new tx
+ cache.getTransactionManager().begin();
+ t2 = cache.getTransactionManager().getTransaction();
try
{
- System.out.println(cache.printLockInfo());
- // start a new tx
- cache.getTransactionManager().begin();
- t2 = cache.getTransactionManager().getTransaction();
cache.get("/a/b/c");// should fail
- t2.commit();
fail("Should not be able to get a hold of /a/b/c until the deleting tx completes");
}
catch (Exception e)
17 years, 3 months
JBoss Cache SVN: r4457 - core/trunk.
by jbosscache-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2007-09-12 01:07:16 -0400 (Wed, 12 Sep 2007)
New Revision: 4457
Modified:
core/trunk/README-Maven.txt
Log:
Add testing instructions
Modified: core/trunk/README-Maven.txt
===================================================================
--- core/trunk/README-Maven.txt 2007-09-12 01:05:23 UTC (rev 4456)
+++ core/trunk/README-Maven.txt 2007-09-12 05:07:16 UTC (rev 4457)
@@ -16,7 +16,7 @@
* mvn compile: compiles java source code.
-* mvn test: runs the TestNG unit test suite on the compiled code. Will also compile the tests.
+* mvn test: runs the TestNG unit test suite on the compiled code. Will also compile the tests. See the testing section below for more information.
* mvn package: packages the module as a jar file and builds the javadocs and user documentation from docbook sources.
@@ -93,11 +93,68 @@
</settings>
+Testing
+=======
+Tests are written against the TestNG testing framework. Each test should belong to one or more group. The group acts as a filter, and is used to select which tests are ran as part of the maven test lifecycle. There are 3 groups that are currently in use, but there is not formal, you can make up any group name if you like.
-Integration with CruiseControl
+Current Groups
+--------------
+* functional - Tests which test the general functionality of JBoss Cache
+* jgroups - Tests which need to send data on a JGroups Channel
+* transaction - Tests which use a transaction manager
+
+It should be noted that every test should at least be in the functional group, since this is the default test group that is executed by maven, and the one that is required to prepare a release.
+
+Executing the default test run
------------------------------
+The default run executes all tests in the functional group. To just run the tests with txt and xml output the command is:
+mvn test
+
+Alternatively, you can execute the tests AND generate a report with:
+
+mvn surefire-report:report
+
+If you already have ran a test cycle, and you want to generate a report off the current reports, then you use the report-only goal, ike so:
+
+mvn surefire-report:report-only
+
+Executing different groups
+--------------------------
+A group can be executed (using the default configuration) by simply using the groups property like so:
+
+mvn -Dgroups=jgroups surefire-report:report
+
+Mutiple groups can also be executed, although if a test is in more than of the selected groups, it is executed only once:
+
+mvn -Dgroups=jgroups,transaction surefire-report:report
+
+Executing a single test
+-----------------------
+A single test can be executed using the test property. The value is the short name (not the fully qualified package name) of the test.
+
+mvn -Dtest=FqnTest
+
+Skipping the test run
+---------------------
+It is sometimes desirable to install the jboss cache package in your local repository without performing a full test run. To do this, simply use the maven.test.skip.exec property:
+
+mvn -Dmaven.test.skip.exec=true install
+
+Again, this is just a shortcut for local use. It SHOULD NEVER BE USED when releasing. Also, make sure "exec" is included in the property, if not the tests will not be built, which will prevent a test jar being produced (POJO Cache needs the Core Cache test jar).
+
+Permutations
+------------
+We use the term permutation to describe a group execution against a particular config. This allows us to test a variety of environments and configurations without rewriting the same basic test over and over again. For example, the jgroups-tcp permutation executes the jgroups group using the TCP config. Each permutation requires a maven profile which defines the various options, environmental variables, etc. The command to run the jgroups-tcp permutatin is:
+
+mvn -Pjgroups-tcp surefire-report:report
+
+Each permutation uses its own report directory, and its own html output file name. This allows you to execute multiple permutations without wiping the results from the previous run. Note that due to the way maven operates, only one permutation can be executed per mvn command. So automating multiple runs requires shell scripting, or some other execution framework to make multiple called to maven.
+
+Integration with CruiseControl / Hudson
+---------------------------------------
+
CruiseControl should do the following:
* Run "mvn clean site" - will clean and run tests, and then prepare reports. In addition to unit tests, this project is set up to run FindBugs, PMD, jxr, and a bunch of other code analysis tools and provide a report in target/site/project-reports.html - which should be linked from the CruiseControl summary page.
17 years, 3 months
JBoss Cache SVN: r4456 - in pojo/trunk/src: test/java/org/jboss/cache/pojo and 14 other directories.
by jbosscache-commits@lists.jboss.org
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));
}
17 years, 3 months
JBoss Cache SVN: r4455 - pojo/trunk/src/main/java/org/jboss/cache/pojo/impl.
by jbosscache-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2007-09-11 21:04:18 -0400 (Tue, 11 Sep 2007)
New Revision: 4455
Modified:
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java
Log:
Fix NPE in AOP 2
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java 2007-09-11 19:13:54 UTC (rev 4454)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java 2007-09-12 01:04:18 UTC (rev 4455)
@@ -96,7 +96,7 @@
try
{
Region region = cache.getRegion(fqn, false);
- if (region != null)
+ if (region != null && region.getClassLoader() != null)
Thread.currentThread().setContextClassLoader(region.getClassLoader());
return getObjectInternal(fqn, field);
17 years, 3 months
JBoss Cache SVN: r4454 - core/trunk/src/main/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-09-11 15:13:54 -0400 (Tue, 11 Sep 2007)
New Revision: 4454
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java
Log:
Fix error message
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java 2007-09-10 18:07:31 UTC (rev 4453)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java 2007-09-11 19:13:54 UTC (rev 4454)
@@ -57,7 +57,7 @@
return null;
}
- if (log.isErrorEnabled()) log.error("exception marshalling object", e);
+ if (log.isErrorEnabled()) log.error("exception unmarshalling object", e);
return e;
}
17 years, 3 months
JBoss Cache SVN: r4453 - pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx.
by jbosscache-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-09-10 14:07:31 -0400 (Mon, 10 Sep 2007)
New Revision: 4453
Modified:
pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java
Log:
[JBCACHE-1182] Don't log WARN messages on calling getter for deprecated attributes
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java 2007-09-10 18:05:26 UTC (rev 4452)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java 2007-09-10 18:07:31 UTC (rev 4453)
@@ -331,8 +331,6 @@
public Element getCacheLoaderConfiguration()
{
- log.warn("MBean attribute 'CacheLoaderConfiguration' is deprecated; " +
- "use 'CacheLoaderConfig'");
return getCacheLoaderConfig();
}
@@ -368,8 +366,6 @@
public boolean getUseInterceptorMbeans()
{
- log.warn("MBean attribute 'UseInterceptorMbeans' is deprecated; " +
- "use 'ExposeManagementStatistics'");
return getExposeManagementStatistics();
}
17 years, 3 months
JBoss Cache SVN: r4452 - core/trunk/src/main/java/org/jboss/cache/jmx.
by jbosscache-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-09-10 14:05:26 -0400 (Mon, 10 Sep 2007)
New Revision: 4452
Modified:
core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
Log:
[JBCACHE-1182] Don't log WARN messages on calling getter for deprecated attributes
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2007-09-10 17:48:14 UTC (rev 4451)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2007-09-10 18:05:26 UTC (rev 4452)
@@ -233,8 +233,6 @@
public Element getCacheLoaderConfiguration()
{
- log.warn("MBean attribute 'CacheLoaderConfiguration' is deprecated; " +
- "use 'CacheLoaderConfig'");
return getCacheLoaderConfig();
}
@@ -270,8 +268,6 @@
public boolean getUseInterceptorMbeans()
{
- log.warn("MBean attribute 'UseInterceptorMbeans' is deprecated; " +
- "use 'ExposeManagementStatistics'");
return getExposeManagementStatistics();
}
17 years, 3 months
JBoss Cache SVN: r4451 - core/trunk/src/main/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-09-10 13:48:14 -0400 (Mon, 10 Sep 2007)
New Revision: 4451
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
Log:
[JBCACHE-1180] CacheImpl.toString() should not print cache details
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-09-08 03:27:02 UTC (rev 4450)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-09-10 17:48:14 UTC (rev 4451)
@@ -1871,7 +1871,7 @@
*/
public String toString()
{
- return toString(true);
+ return toString(false);
}
17 years, 3 months
JBoss Cache SVN: r4450 - core/trunk/src/test/java/org/jboss/cache/jmx.
by jbosscache-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2007-09-07 23:27:02 -0400 (Fri, 07 Sep 2007)
New Revision: 4450
Modified:
core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java
Log:
Fix test
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java 2007-09-08 03:26:15 UTC (rev 4449)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/NotificationTest.java 2007-09-08 03:27:02 UTC (rev 4450)
@@ -75,7 +75,7 @@
m_server.registerMBean(cacheMBean, mgmt);
}
- private Object createCacheAndJmxWrapper() throws Exception
+ protected Object createCacheAndJmxWrapper() throws Exception
{
cache = createCache(CLUSTER_NAME);
return new CacheJmxWrapper<Object, Object>(cache);
17 years, 3 months