Author: tv
Date: Sun Oct 30 18:08:46 2011
New Revision: 1195205
URL: http://svn.apache.org/viewvc?rev=1195205&view=rev
Log:
Start generification of the test classes
Modified:
commons/proper/jcs/trunk/auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCache.java
commons/proper/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCache.java
commons/proper/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGService.java
commons/proper/jcs/trunk/src/experimental/org/apache/jcs/auxiliary/lateral/socket/udp/LateralUDPService.java
commons/proper/jcs/trunk/src/experimental/org/apache/jcs/auxiliary/lateral/xmlrpc/LateralXMLRPCService.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSThrashTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/MockDiscoveryListener.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoveryServiceUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoveryUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/BoundedQueueUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/DoubleLinkedListUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/SortedPrefArrayUnitTest.java
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java
Modified:
commons/proper/jcs/trunk/auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCache.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCache.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCache.java
(original)
+++
commons/proper/jcs/trunk/auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCache.java
Sun Oct 30 18:08:46 2011
@@ -270,7 +270,7 @@ public class JavaGroupsCache
* @param group Ignored
* @return Always reurns null
*/
- public Set getGroupKeys( String group )
+ public Set<Serializable> getGroupKeys( String group )
{
return null;
}
Modified:
commons/proper/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCache.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCache.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCache.java
(original)
+++
commons/proper/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/javagroups/JavaGroupsCache.java
Sun Oct 30 18:08:46 2011
@@ -282,7 +282,7 @@ public class JavaGroupsCache
* Ignored
* @return Always reurns null
*/
- public Set getGroupKeys( String group )
+ public Set<Serializable> getGroupKeys( String group )
{
return null;
}
Modified:
commons/proper/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGService.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGService.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGService.java
(original)
+++
commons/proper/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGService.java
Sun Oct 30 18:08:46 2011
@@ -201,7 +201,7 @@ public class LateralJGService
* Gets the set of keys of objects currently in the group throws
* UnsupportedOperationException
*/
- public Set getGroupKeys( String cacheName, String group )
+ public Set<Serializable> getGroupKeys( String cacheName, String group )
{
if ( true )
{
Modified:
commons/proper/jcs/trunk/src/experimental/org/apache/jcs/auxiliary/lateral/socket/udp/LateralUDPService.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/experimental/org/apache/jcs/auxiliary/lateral/socket/udp/LateralUDPService.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/experimental/org/apache/jcs/auxiliary/lateral/socket/udp/LateralUDPService.java
(original)
+++
commons/proper/jcs/trunk/src/experimental/org/apache/jcs/auxiliary/lateral/socket/udp/LateralUDPService.java
Sun Oct 30 18:08:46 2011
@@ -165,7 +165,7 @@ public class LateralUDPService implement
* Gets the set of keys of objects currently in the group
* throws UnsupportedOperationException
*/
- public Set getGroupKeys(String cacheName, String group)
+ public Set<Serializable> getGroupKeys(String cacheName, String group)
{
if (true)
{
Modified:
commons/proper/jcs/trunk/src/experimental/org/apache/jcs/auxiliary/lateral/xmlrpc/LateralXMLRPCService.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/experimental/org/apache/jcs/auxiliary/lateral/xmlrpc/LateralXMLRPCService.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/experimental/org/apache/jcs/auxiliary/lateral/xmlrpc/LateralXMLRPCService.java
(original)
+++
commons/proper/jcs/trunk/src/experimental/org/apache/jcs/auxiliary/lateral/xmlrpc/LateralXMLRPCService.java
Sun Oct 30 18:08:46 2011
@@ -196,7 +196,7 @@ public class LateralXMLRPCService
* Gets the set of keys of objects currently in the group
* throws UnsupportedOperationException
*/
- public Set getGroupKeys(String cacheName, String group)
+ public Set<Serializable> getGroupKeys(String cacheName, String group)
{
if (true)
{
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSThrashTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSThrashTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSThrashTest.java
(original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSThrashTest.java Sun Oct
30 18:08:46 2011
@@ -165,7 +165,7 @@ public class JCSThrashTest
jcs.put( key, value );
// Create 15 threads that read the keys;
- final List executables = new ArrayList();
+ final List<Executable> executables = new ArrayList<Executable>();
for ( int i = 0; i < 15; i++ )
{
final JCSThrashTest.Executable executable = new
JCSThrashTest.Executable()
@@ -221,7 +221,7 @@ public class JCSThrashTest
* @param executables
* @throws Exception
*/
- protected void runThreads( final List executables )
+ protected void runThreads( final List<Executable> executables )
throws Exception
{
@@ -232,7 +232,7 @@ public class JCSThrashTest
final Thread[] threads = new Thread[executables.size()];
for ( int i = 0; i < threads.length; i++ )
{
- final JCSThrashTest.Executable executable =
(JCSThrashTest.Executable) executables.get( i );
+ final JCSThrashTest.Executable executable = executables.get( i );
threads[i] = new Thread()
{
public void run()
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/JCSUnitTest.java Sun Oct
30 18:08:46 2011
@@ -69,7 +69,7 @@ public class JCSUnitTest
{
JCS jcs = JCS.getInstance( "testCache1" );
- LinkedList list = buildList();
+ LinkedList<HashMap<String, String>> list = buildList();
jcs.put( "some:key", list );
@@ -79,9 +79,9 @@ public class JCSUnitTest
/**
* @return builds a list
*/
- private LinkedList buildList()
+ private LinkedList<HashMap<String, String>> buildList()
{
- LinkedList list = new LinkedList();
+ LinkedList<HashMap<String, String>> list = new
LinkedList<HashMap<String,String>>();
for ( int i = 0; i < 100; i++ )
{
@@ -94,9 +94,9 @@ public class JCSUnitTest
/**
* @return a map
*/
- private HashMap buildMap()
+ private HashMap<String, String> buildMap()
{
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
byte[] keyBytes = new byte[32];
byte[] valBytes = new byte[128];
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java
Sun Oct 30 18:08:46 2011
@@ -82,7 +82,7 @@ public class MockAuxiliaryCache
throws IOException
{
getMatchingCallCount++;
- return new HashMap();
+ return new HashMap<Serializable, ICacheElement>();
}
/**
@@ -94,7 +94,7 @@ public class MockAuxiliaryCache
*/
public Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
{
- return new HashMap();
+ return new HashMap<Serializable, ICacheElement>();
}
/**
@@ -159,7 +159,7 @@ public class MockAuxiliaryCache
* @return null
* @throws IOException
*/
- public Set getGroupKeys( String group )
+ public Set<Serializable> getGroupKeys( String group )
throws IOException
{
return null;
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java
Sun Oct 30 18:08:46 2011
@@ -27,9 +27,9 @@ public class MockCacheEventLogger
/** times called */
public int errorEventCalls = 0;
-
+
/** list of messages */
- public List errorMessages = new ArrayList();
+ public List<String> errorMessages = new ArrayList<String>();
/**
* @param source
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
Sun Oct 30 18:08:46 2011
@@ -152,7 +152,7 @@ public class AbstractDiskCacheUnitTest
extends AbstractDiskCache
{
/** Internal map */
- protected Map map = new HashMap();
+ protected Map<Serializable, ICacheElement> map = new
HashMap<Serializable, ICacheElement>();
/** used by the abstract aux class */
protected IDiskCacheAttributes diskCacheAttributes;
@@ -190,7 +190,7 @@ public class AbstractDiskCacheUnitTest
@Override
public Set<Serializable> getGroupKeys(String groupName)
{
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
/**
@@ -222,7 +222,7 @@ public class AbstractDiskCacheUnitTest
throws IOException
{
//System.out.println( "processGet: " + key );
- return (ICacheElement) map.get( key );
+ return map.get( key );
}
/**
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java
Sun Oct 30 18:08:46 2011
@@ -172,7 +172,7 @@ public class LateralTCPDiscoveryListener
// DO WORK
boolean result = listener.removeNoWait( noWait );
- // VERIFY
+ // VERIFY
assertTrue( "Should have removed the no wait.", result );
}
@@ -184,7 +184,7 @@ public class LateralTCPDiscoveryListener
// SETUP
String cacheName = "testAddDiscoveredService_FacadeInList_NoWaitNot";
- ArrayList cacheNames = new ArrayList();
+ ArrayList<String> cacheNames = new ArrayList<String>();
cacheNames.add( cacheName );
DiscoveredService service = new DiscoveredService();
@@ -222,7 +222,7 @@ public class LateralTCPDiscoveryListener
// SETUP
String cacheName = "testRemoveDiscoveredService_FacadeInList_NoWaitIs";
- ArrayList cacheNames = new ArrayList();
+ ArrayList<String> cacheNames = new ArrayList<String>();
cacheNames.add( cacheName );
DiscoveredService service = new DiscoveredService();
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java
Sun Oct 30 18:08:46 2011
@@ -198,7 +198,7 @@ public class MockRemoteCacheClient
* @param group
* @return null
*/
- public Set getGroupKeys( String group )
+ public Set<Serializable> getGroupKeys( String group )
{
return null;
}
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java
Sun Oct 30 18:08:46 2011
@@ -44,16 +44,16 @@ public class MockRemoteCacheService
public String lastGetMatchingPattern;
/** The keya last passed to getMatching */
- public Set lastGetMultipleKeys;
+ public Set<Serializable> lastGetMultipleKeys;
/** The object that was last passed to update. */
public Object lastUpdate;
/** List of updates. */
- public List updateRequestList = new ArrayList();
+ public List<ICacheElement> updateRequestList = new
ArrayList<ICacheElement>();
/** List of request ids. */
- public List updateRequestIdList = new ArrayList();
+ public List<Long> updateRequestIdList = new ArrayList<Long>();
/** The key that was last passed to remove. */
public Object lastRemoveKey;
@@ -78,9 +78,9 @@ public class MockRemoteCacheService
* @param groupName
* @return empty set
*/
- public Set getGroupKeys( String cacheName, String groupName )
+ public Set<Serializable> getGroupKeys( String cacheName, String groupName )
{
- return new HashSet();
+ return new HashSet<Serializable>();
}
/**
@@ -186,10 +186,10 @@ public class MockRemoteCacheService
* @param requesterId
* @return empty map
*/
- public Map getMultiple( String cacheName, Set keys, long requesterId )
+ public Map<Serializable, ICacheElement> getMultiple( String cacheName,
Set<Serializable> keys, long requesterId )
{
lastGetMultipleKeys = keys;
- return new HashMap();
+ return new HashMap<Serializable, ICacheElement>();
}
/**
@@ -197,7 +197,7 @@ public class MockRemoteCacheService
* @param keys
* @return empty map
*/
- public Map getMultiple( String cacheName, Set keys )
+ public Map<Serializable, ICacheElement> getMultiple( String cacheName,
Set<Serializable> keys )
{
return getMultiple( cacheName, keys, 0 );
}
@@ -210,7 +210,7 @@ public class MockRemoteCacheService
* @return an empty map
* @throws IOException
*/
- public Map getMatching( String cacheName, String pattern )
+ public Map<Serializable, ICacheElement> getMatching( String cacheName,
String pattern )
throws IOException
{
return getMatching( cacheName, pattern, 0 );
@@ -223,10 +223,10 @@ public class MockRemoteCacheService
* @return Map
* @throws IOException
*/
- public Map getMatching( String cacheName, String pattern, long requesterId
)
+ public Map<Serializable, ICacheElement> getMatching( String cacheName,
String pattern, long requesterId )
throws IOException
{
lastGetMatchingPattern = pattern;
- return new HashMap();
+ return new HashMap<Serializable, ICacheElement>();
}
}
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java
Sun Oct 30 18:08:46 2011
@@ -44,16 +44,16 @@ public class MockCacheServiceNonLocal
public String lastGetMatchingPattern;
/** The keya last passed to getMatching */
- public Set lastGetMultipleKeys;
+ public Set<Serializable> lastGetMultipleKeys;
/** The object that was last passed to update. */
public Object lastUpdate;
/** List of updates. */
- public List updateRequestList = new ArrayList();
+ public List<ICacheElement> updateRequestList = new
ArrayList<ICacheElement>();
/** List of request ids. */
- public List updateRequestIdList = new ArrayList();
+ public List<Long> updateRequestIdList = new ArrayList<Long>();
/** The key that was last passed to remove. */
public Object lastRemoveKey;
@@ -78,9 +78,9 @@ public class MockCacheServiceNonLocal
* @param groupName
* @return empty set
*/
- public Set getGroupKeys( String cacheName, String groupName )
+ public Set<Serializable> getGroupKeys( String cacheName, String groupName )
{
- return new HashSet();
+ return new HashSet<Serializable>();
}
/**
@@ -100,7 +100,7 @@ public class MockCacheServiceNonLocal
* <p>
* @param cacheName - region name
* @param requesterId - identity of requester
- * @throws IOException
+ * @throws IOException
*/
public void removeAll( String cacheName, long requesterId )
throws IOException
@@ -186,10 +186,10 @@ public class MockCacheServiceNonLocal
* @param requesterId - identity of requester
* @return empty map
*/
- public Map getMultiple( String cacheName, Set keys, long requesterId )
+ public Map<Serializable, ICacheElement> getMultiple( String cacheName,
Set<Serializable> keys, long requesterId )
{
lastGetMultipleKeys = keys;
- return new HashMap();
+ return new HashMap<Serializable, ICacheElement>();
}
/**
@@ -197,7 +197,7 @@ public class MockCacheServiceNonLocal
* @param keys
* @return empty map
*/
- public Map getMultiple( String cacheName, Set keys )
+ public Map<Serializable, ICacheElement> getMultiple( String cacheName,
Set<Serializable> keys )
{
return getMultiple( cacheName, keys, 0 );
}
@@ -210,7 +210,7 @@ public class MockCacheServiceNonLocal
* @return an empty map
* @throws IOException
*/
- public Map getMatching( String cacheName, String pattern )
+ public Map<Serializable, ICacheElement> getMatching( String cacheName,
String pattern )
throws IOException
{
return getMatching( cacheName, pattern, 0 );
@@ -223,10 +223,10 @@ public class MockCacheServiceNonLocal
* @return Map
* @throws IOException
*/
- public Map getMatching( String cacheName, String pattern, long requesterId
)
+ public Map<Serializable, ICacheElement> getMatching( String cacheName,
String pattern, long requesterId )
throws IOException
{
lastGetMatchingPattern = pattern;
- return new HashMap();
+ return new HashMap<Serializable, ICacheElement>();
}
}
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
Sun Oct 30 18:08:46 2011
@@ -344,7 +344,7 @@ public class CompositeCacheDiskUsageUnit
*/
public Map<Serializable, ICacheElement> getMultiple(Set<Serializable>
keys)
{
- return new HashMap();
+ return new HashMap<Serializable, ICacheElement>();
}
/**
@@ -395,7 +395,7 @@ public class CompositeCacheDiskUsageUnit
* @return null
* @throws IOException
*/
- public Set getGroupKeys( String group )
+ public Set<Serializable> getGroupKeys( String group )
throws IOException
{
return null;
@@ -468,7 +468,7 @@ public class CompositeCacheDiskUsageUnit
public Map<Serializable, ICacheElement> getMatching(String pattern)
throws IOException
{
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
}
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java
Sun Oct 30 18:08:46 2011
@@ -29,6 +29,7 @@ import java.util.Set;
import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.control.CompositeCache;
+import org.apache.jcs.engine.memory.util.MemoryElementDescriptor;
import org.apache.jcs.engine.stats.behavior.IStats;
/**
@@ -43,7 +44,7 @@ public class MockMemoryCache
private ICompositeCacheAttributes cacheAttr;
/** Internal map */
- private final HashMap map = new HashMap();
+ private final HashMap<Serializable, ICacheElement> map = new
HashMap<Serializable, ICacheElement>();
/** The number of times waterfall was called. */
public int waterfallCallCount = 0;
@@ -57,7 +58,7 @@ public class MockMemoryCache
*/
public void initialize( CompositeCache cache )
{
- // nothinh
+ // nothing
}
/**
@@ -84,7 +85,7 @@ public class MockMemoryCache
}
/** @return null */
- public Iterator getIterator()
+ public Iterator<Map.Entry<Serializable, MemoryElementDescriptor>>
getIterator()
{
return null;
}
@@ -124,7 +125,7 @@ public class MockMemoryCache
public ICacheElement get( Serializable key )
throws IOException
{
- return (ICacheElement) map.get( key );
+ return map.get( key );
}
/**
@@ -135,15 +136,15 @@ public class MockMemoryCache
public Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
throws IOException
{
- Map elements = new HashMap();
+ Map<Serializable, ICacheElement> elements = new HashMap<Serializable,
ICacheElement>();
if ( keys != null && !keys.isEmpty() )
{
- Iterator iterator = keys.iterator();
+ Iterator<Serializable> iterator = keys.iterator();
while ( iterator.hasNext() )
{
- Serializable key = (Serializable) iterator.next();
+ Serializable key = iterator.next();
ICacheElement element = get( key );
@@ -165,7 +166,7 @@ public class MockMemoryCache
public ICacheElement getQuiet( Serializable key )
throws IOException
{
- return (ICacheElement) map.get( key );
+ return map.get( key );
}
/**
@@ -217,7 +218,7 @@ public class MockMemoryCache
* @param group
* @return null
*/
- public Set getGroupKeys( String group )
+ public Set<Serializable> getGroupKeys( String group )
{
return null;
}
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/MockDiscoveryListener.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/MockDiscoveryListener.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/MockDiscoveryListener.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/MockDiscoveryListener.java
Sun Oct 30 18:08:46 2011
@@ -29,7 +29,7 @@ public class MockDiscoveryListener
implements IDiscoveryListener
{
/** discovered services. */
- public List discoveredServices = new ArrayList();
+ public List<DiscoveredService> discoveredServices = new
ArrayList<DiscoveredService>();
/**
* Adds the entry to a list. I'm not using a set. I want to see if we get
dupes.
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java
Sun Oct 30 18:08:46 2011
@@ -83,8 +83,8 @@ public class UDPDiscoverySenderUnitTest
throws Exception
{
// SETUP
- ArrayList cacheNames = new ArrayList();
-
+ ArrayList<String> cacheNames = new ArrayList<String>();
+
// DO WORK
sender.passiveBroadcast( SENDING_HOST, SENDING_PORT, cacheNames, 1L );
@@ -109,8 +109,8 @@ public class UDPDiscoverySenderUnitTest
throws Exception
{
// SETUP
- ArrayList cacheNames = new ArrayList();
-
+ ArrayList<String> cacheNames = new ArrayList<String>();
+
// DO WORK
sender.removeBroadcast( SENDING_HOST, SENDING_PORT, cacheNames, 1L );
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoveryServiceUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoveryServiceUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoveryServiceUnitTest.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoveryServiceUnitTest.java
Sun Oct 30 18:08:46 2011
@@ -20,7 +20,6 @@ package org.apache.jcs.utils.discovery;
*/
import java.util.ArrayList;
-import java.util.Iterator;
import junit.framework.TestCase;
@@ -50,7 +49,7 @@ public class UDPDiscoveryServiceUnitTest
DiscoveredService discoveredService = new DiscoveredService();
discoveredService.setServiceAddress( host );
- discoveredService.setCacheNames( new ArrayList() );
+ discoveredService.setCacheNames( new ArrayList<String>() );
discoveredService.setServicePort( 1000 );
discoveredService.setLastHearFromTime( 100 );
@@ -82,9 +81,9 @@ public class UDPDiscoveryServiceUnitTest
MockDiscoveryListener discoveryListener = new MockDiscoveryListener();
service.addDiscoveryListener( discoveryListener );
- ArrayList sametCacheNames = new ArrayList();
+ ArrayList<String> sametCacheNames = new ArrayList<String>();
sametCacheNames.add( "name1" );
-
+
DiscoveredService discoveredService = new DiscoveredService();
discoveredService.setServiceAddress( host );
discoveredService.setCacheNames( sametCacheNames );
@@ -110,11 +109,9 @@ public class UDPDiscoveryServiceUnitTest
assertTrue( "Service should be in the listener list.",
discoveryListener.discoveredServices
.contains( discoveredService ) );
- Iterator it = service.getDiscoveredServices().iterator();
// need to update the time this sucks. add has no effect convert to a
map
- while ( it.hasNext() )
+ for (DiscoveredService service1 : service.getDiscoveredServices())
{
- DiscoveredService service1 = (DiscoveredService) it.next();
if ( discoveredService.equals( service1 ) )
{
assertEquals( "The match should have the new last heard from
time.", service1.getLastHearFromTime(),
@@ -148,11 +145,11 @@ public class UDPDiscoveryServiceUnitTest
DiscoveredService discoveredService = new DiscoveredService();
discoveredService.setServiceAddress( host );
- discoveredService.setCacheNames( new ArrayList() );
+ discoveredService.setCacheNames( new ArrayList<String>() );
discoveredService.setServicePort( 1000 );
discoveredService.setLastHearFromTime( 100 );
- ArrayList differentCacheNames = new ArrayList();
+ ArrayList<String> differentCacheNames = new ArrayList<String>();
differentCacheNames.add( "name1" );
DiscoveredService discoveredService2 = new DiscoveredService();
discoveredService2.setServiceAddress( host );
@@ -172,11 +169,9 @@ public class UDPDiscoveryServiceUnitTest
assertTrue( "Service should be in the listener list.",
discoveryListener.discoveredServices
.contains( discoveredService ) );
- Iterator it = service.getDiscoveredServices().iterator();
// need to update the time this sucks. add has no effect convert to a
map
- while ( it.hasNext() )
+ for (DiscoveredService service1 : service.getDiscoveredServices())
{
- DiscoveredService service1 = (DiscoveredService) it.next();
if ( discoveredService.equals( service1 ) )
{
assertEquals( "The match should have the new last heard from
time.", service1.getLastHearFromTime(),
@@ -190,7 +185,7 @@ public class UDPDiscoveryServiceUnitTest
assertEquals( "The second mock listener add should be
discoveredService2", discoveredService2,
discoveryListener.discoveredServices.get( 1 ) );
}
-
+
/** Verify that the list is updated. */
public void testRemoveDiscoveredService()
{
@@ -211,7 +206,7 @@ public class UDPDiscoveryServiceUnitTest
DiscoveredService discoveredService = new DiscoveredService();
discoveredService.setServiceAddress( host );
- discoveredService.setCacheNames( new ArrayList() );
+ discoveredService.setCacheNames( new ArrayList<String>() );
discoveredService.setServicePort( 1000 );
discoveredService.setLastHearFromTime( 100 );
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoveryUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoveryUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoveryUnitTest.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/discovery/UDPDiscoveryUnitTest.java
Sun Oct 30 18:08:46 2011
@@ -63,7 +63,7 @@ public class UDPDiscoveryUnitTest
// create more names than we have no wait facades for
// the only one that gets added should be testCache1
- ArrayList cacheNames = new ArrayList();
+ ArrayList<String> cacheNames = new ArrayList<String>();
int numJunk = 10;
for ( int i = 0; i < numJunk; i++ )
{
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/BoundedQueueUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/BoundedQueueUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/BoundedQueueUnitTest.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/BoundedQueueUnitTest.java
Sun Oct 30 18:08:46 2011
@@ -36,7 +36,7 @@ public class BoundedQueueUnitTest
{
// SETUP
int maxSize = 10;
- BoundedQueue queue = new BoundedQueue( maxSize );
+ BoundedQueue<Object> queue = new BoundedQueue<Object>( maxSize );
// DO WORK
Object result = queue.take();
@@ -52,7 +52,7 @@ public class BoundedQueueUnitTest
{
// SETUP
int maxSize = 10;
- BoundedQueue queue = new BoundedQueue( maxSize );
+ BoundedQueue<String> queue = new BoundedQueue<String>( maxSize );
// DO WORK
for ( int i = 0; i < maxSize * 2; i++ )
@@ -73,7 +73,7 @@ public class BoundedQueueUnitTest
{
// SETUP
int maxSize = 10;
- BoundedQueue queue = new BoundedQueue( maxSize );
+ BoundedQueue<String> queue = new BoundedQueue<String>( maxSize );
// DO WORK
for ( int i = 0; i < maxSize; i++ )
@@ -86,7 +86,7 @@ public class BoundedQueueUnitTest
for ( int i = 0; i < maxSize; i++ )
{
- String result = (String)queue.take();
+ String result = queue.take();
assertEquals( "Result not as expected", String.valueOf( i ) ,
result );
}
}
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/DoubleLinkedListUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/DoubleLinkedListUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/DoubleLinkedListUnitTest.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/DoubleLinkedListUnitTest.java
Sun Oct 30 18:08:46 2011
@@ -14,156 +14,156 @@ public class DoubleLinkedListUnitTest
public void testAddLast_Empty()
{
// SETUP
- DoubleLinkedList list = new DoubleLinkedList();
-
+ DoubleLinkedList<DoubleLinkedListNode<String>> list = new
DoubleLinkedList<DoubleLinkedListNode<String>>();
+
String payload1 = "payload1";
- DoubleLinkedListNode node1 = new DoubleLinkedListNode( payload1 );
-
+ DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>(
payload1 );
+
// WO WORK
list.addLast( node1 );
-
+
// VERIFY
assertEquals( "Wrong last", node1, list.getLast() );
}
-
+
/** verify that the last is added when the list is empty. */
public void testAddLast_NotEmpty()
{
// SETUP
- DoubleLinkedList list = new DoubleLinkedList();
-
+ DoubleLinkedList<DoubleLinkedListNode<String>> list = new
DoubleLinkedList<DoubleLinkedListNode<String>>();
+
String payload1 = "payload1";
- DoubleLinkedListNode node1 = new DoubleLinkedListNode( payload1 );
-
+ DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>(
payload1 );
+
String payload2 = "payload2";
- DoubleLinkedListNode node2 = new DoubleLinkedListNode( payload2 );
-
+ DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<String>(
payload2 );
+
// WO WORK
list.addLast( node1 );
list.addLast( node2 );
-
+
// VERIFY
assertEquals( "Wrong last", node2, list.getLast() );
}
-
+
/** verify that it's added last. */
public void testMakeLast_wasFirst()
{
// SETUP
- DoubleLinkedList list = new DoubleLinkedList();
-
+ DoubleLinkedList<DoubleLinkedListNode<String>> list = new
DoubleLinkedList<DoubleLinkedListNode<String>>();
+
String payload1 = "payload1";
- DoubleLinkedListNode node1 = new DoubleLinkedListNode( payload1 );
+ DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>(
payload1 );
String payload2 = "payload2";
- DoubleLinkedListNode node2 = new DoubleLinkedListNode( payload2 );
+ DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<String>(
payload2 );
list.addFirst( node2 );
list.addFirst( node1 );
-
+
// DO WORK
list.makeLast( node1 );
-
+
// VERIFY
assertEquals( "Wrong size", 2, list.size() );
assertEquals( "Wrong last", node1, list.getLast() );
assertEquals( "Wrong first", node2, list.getFirst() );
}
-
+
/** verify that it's added last. */
public void testMakeLast_wasLast()
{
// SETUP
- DoubleLinkedList list = new DoubleLinkedList();
-
+ DoubleLinkedList<DoubleLinkedListNode<String>> list = new
DoubleLinkedList<DoubleLinkedListNode<String>>();
+
String payload1 = "payload1";
- DoubleLinkedListNode node1 = new DoubleLinkedListNode( payload1 );
+ DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>(
payload1 );
String payload2 = "payload2";
- DoubleLinkedListNode node2 = new DoubleLinkedListNode( payload2 );
+ DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<String>(
payload2 );
list.addFirst( node1 );
list.addFirst( node2 );
-
+
// DO WORK
list.makeLast( node1 );
-
+
// VERIFY
assertEquals( "Wrong size", 2, list.size() );
assertEquals( "Wrong last", node1, list.getLast() );
assertEquals( "Wrong first", node2, list.getFirst() );
}
-
+
/** verify that it's added last. */
public void testMakeLast_wasAlone()
{
// SETUP
- DoubleLinkedList list = new DoubleLinkedList();
-
+ DoubleLinkedList<DoubleLinkedListNode<String>> list = new
DoubleLinkedList<DoubleLinkedListNode<String>>();
+
String payload1 = "payload1";
- DoubleLinkedListNode node1 = new DoubleLinkedListNode( payload1 );
+ DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>(
payload1 );
list.addFirst( node1 );
-
+
// DO WORK
list.makeLast( node1 );
-
+
// VERIFY
assertEquals( "Wrong size", 1, list.size() );
assertEquals( "Wrong last", node1, list.getLast() );
assertEquals( "Wrong first", node1, list.getFirst() );
}
-
+
/** verify that it's added last. */
public void testMakeLast_wasInMiddle()
{
// SETUP
- DoubleLinkedList list = new DoubleLinkedList();
-
+ DoubleLinkedList<DoubleLinkedListNode<String>> list = new
DoubleLinkedList<DoubleLinkedListNode<String>>();
+
String payload1 = "payload1";
- DoubleLinkedListNode node1 = new DoubleLinkedListNode( payload1 );
+ DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>(
payload1 );
String payload2 = "payload2";
- DoubleLinkedListNode node2 = new DoubleLinkedListNode( payload2 );
-
+ DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<String>(
payload2 );
+
String payload3 = "payload3";
- DoubleLinkedListNode node3 = new DoubleLinkedListNode( payload3 );
+ DoubleLinkedListNode<String> node3 = new DoubleLinkedListNode<String>(
payload3 );
list.addFirst( node2 );
list.addFirst( node1 );
list.addFirst( node3 );
-
+
// DO WORK
list.makeLast( node1 );
-
+
// VERIFY
assertEquals( "Wrong size", 3, list.size() );
assertEquals( "Wrong last", node1, list.getLast() );
assertEquals( "Wrong first", node3, list.getFirst() );
}
-
+
/** verify that the entries are dumped. */
public void testDumpEntries_DebugTrue()
{
// SETUP
StringWriter stringWriter = new StringWriter();
TestLogConfigurationUtil.configureLogger( stringWriter,
DoubleLinkedList.class.getName() );
-
- DoubleLinkedList list = new DoubleLinkedList();
-
+
+ DoubleLinkedList<DoubleLinkedListNode<String>> list = new
DoubleLinkedList<DoubleLinkedListNode<String>>();
+
String payload1 = "payload1";
- DoubleLinkedListNode node1 = new DoubleLinkedListNode( payload1 );
-
+ DoubleLinkedListNode<String> node1 = new DoubleLinkedListNode<String>(
payload1 );
+
String payload2 = "payload2";
- DoubleLinkedListNode node2 = new DoubleLinkedListNode( payload2 );
-
+ DoubleLinkedListNode<String> node2 = new DoubleLinkedListNode<String>(
payload2 );
+
list.addLast( node1 );
list.addLast( node2 );
list.debugDumpEntries();
-
+
// WO WORK
String result = stringWriter.toString();
-
+
// VERIFY
assertTrue( "Missing node in log dump", result.indexOf( payload1 ) !=
-1 );
assertTrue( "Missing node in log dump", result.indexOf( payload2 ) !=
-1 );
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/SortedPrefArrayUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/SortedPrefArrayUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/SortedPrefArrayUnitTest.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/struct/SortedPrefArrayUnitTest.java
Sun Oct 30 18:08:46 2011
@@ -56,7 +56,7 @@ public class SortedPrefArrayUnitTest
{
int maxSize = 25;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
// array.setPreferLarge( false );
array.setPreferLarge( true );
String[] elem = {
@@ -104,14 +104,14 @@ public class SortedPrefArrayUnitTest
assertEquals( "Size was not as expected.", maxSize, array.size() );
// this is a fragile test, since it relies on a hardcoded array
- String smallest = (String) array.getSmallest();
+ String smallest = array.getSmallest();
assertEquals( "smallest should be 08", "08", smallest );
- String largest = (String) array.getLargest();
+ String largest = array.getLargest();
assertEquals( "Largest should be 96", "96", largest );
// this should take 96;
- String taken = (String) array.takeNearestLargerOrEqual( "95" );
+ String taken = array.takeNearestLargerOrEqual( "95" );
assertEquals( "Taken should be 96", "96", taken );
assertEquals( "Size was not as expected.", ( maxSize - 1 ),
array.size() );
@@ -126,11 +126,11 @@ public class SortedPrefArrayUnitTest
throws Exception
{
int maxSize = 25;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
array.setPreferLarge( true );
for ( int i = 0; i < maxSize; i++ )
{
- String taken = (String) array.takeNearestLargerOrEqual(
String.valueOf( i ) );
+ String taken = array.takeNearestLargerOrEqual( String.valueOf( i )
);
assertNull( "taken should be null, since nothing was in the
array", taken );
}
}
@@ -143,7 +143,7 @@ public class SortedPrefArrayUnitTest
throws Exception
{
int maxSize = 25;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
array.setPreferLarge( true );
String[] elem = {
@@ -210,12 +210,12 @@ public class SortedPrefArrayUnitTest
throws Exception
{
int maxSize = 25;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
array.setPreferLarge( true );
try
{
- String taken = (String) array.takeNearestLargerOrEqual( null );
+ String taken = array.takeNearestLargerOrEqual( null );
assertNull( "taken should be null, since nothing was in the
array", taken );
}
catch ( NullPointerException e )
@@ -232,7 +232,7 @@ public class SortedPrefArrayUnitTest
throws Exception
{
int maxSize = 25;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
array.setPreferLarge( true );
array.add( "10" );
@@ -240,7 +240,7 @@ public class SortedPrefArrayUnitTest
try
{
- String taken = (String) array.takeNearestLargerOrEqual( "09" );
+ String taken = array.takeNearestLargerOrEqual( "09" );
System.out.println( taken );
assertNotNull( "taken should not be null, since nothing was in the
array", taken );
}
@@ -258,14 +258,14 @@ public class SortedPrefArrayUnitTest
throws Exception
{
int maxSize = 25;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
array.setPreferLarge( true );
array.add( "10" );
try
{
- String taken = (String) array.takeNearestLargerOrEqual( "11" );
+ String taken = array.takeNearestLargerOrEqual( "11" );
assertNull( "taken should be null, since nothing smaller was in
the array", taken );
}
catch ( NullPointerException e )
@@ -282,12 +282,12 @@ public class SortedPrefArrayUnitTest
throws Exception
{
int maxSize = 25;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
array.setPreferLarge( true );
try
{
- String taken = (String) array.takeNearestLargerOrEqual( "11" );
+ String taken = array.takeNearestLargerOrEqual( "11" );
assertNull( "taken should be null, since nothing was in the
array", taken );
}
catch ( NullPointerException e )
@@ -305,7 +305,7 @@ public class SortedPrefArrayUnitTest
{
int maxSize = 9;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
// array.setPreferLarge( false );
array.setPreferLarge( true );
String[] elem = { "01", "02", "03", "04", "05", "08", "07", "06",
"09", };
@@ -320,14 +320,14 @@ public class SortedPrefArrayUnitTest
assertEquals( "Size was not as expected.", maxSize, array.size() );
// this is a fragile test, since it relies on a hardcoded array
- String smallest = (String) array.getSmallest();
+ String smallest = array.getSmallest();
assertEquals( "smallest is not as expected", "01", smallest );
- String largest = (String) array.getLargest();
+ String largest = array.getLargest();
assertEquals( "Largest is not as expected", "09", largest );
// this should take 96;
- String taken = (String) array.takeNearestLargerOrEqual( "09" );
+ String taken = array.takeNearestLargerOrEqual( "09" );
assertEquals( "Taken is not as expected", "09", taken );
assertEquals( "Size was not as expected.", ( maxSize - 1 ),
array.size() );
@@ -344,7 +344,7 @@ public class SortedPrefArrayUnitTest
{
int maxSize = 9;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
// array.setPreferLarge( false );
array.setPreferLarge( true );
String[] elem = { "01", "02", "03", "04", "05", "08", "07", "06",
"09", };
@@ -359,14 +359,14 @@ public class SortedPrefArrayUnitTest
assertEquals( "Size was not as expected.", maxSize, array.size() );
// this is a fragile test, since it relies on a hardcoded array
- String smallest = (String) array.getSmallest();
+ String smallest = array.getSmallest();
assertEquals( "smallest is not as expected", "01", smallest );
- String largest = (String) array.getLargest();
+ String largest = array.getLargest();
assertEquals( "Largest is not as expected", "09", largest );
// this should take 96;
- String taken = (String) array.takeNearestLargerOrEqual( "09" );
+ String taken = array.takeNearestLargerOrEqual( "09" );
assertEquals( "Taken is not as expected", "09", taken );
assertEquals( "Size was not as expected. " + array.dumpArray(), (
maxSize - 1 ), array.size() );
@@ -390,7 +390,7 @@ public class SortedPrefArrayUnitTest
{
int maxSize = 3;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
// array.setPreferLarge( false );
array.setPreferLarge( true );
String[] elem = { "01", "02", "03" };
@@ -403,7 +403,7 @@ public class SortedPrefArrayUnitTest
}
// DO WORK
- Comparable taken = array.takeNearestLargerOrEqual( "04" );
+ Comparable<String> taken = array.takeNearestLargerOrEqual( "04" );
System.out.println( "testTakeLargerThanGreatest" + array.dumpArray() );
assertNull( "We should have nothing since the largest element was
smaller than what we asked for. "
@@ -417,7 +417,7 @@ public class SortedPrefArrayUnitTest
{
int maxSize = 3;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
// array.setPreferLarge( false );
array.setPreferLarge( true );
String[] elem = { "01", "02", "03", "03" };
@@ -430,7 +430,7 @@ public class SortedPrefArrayUnitTest
}
// DO WORK
- Comparable taken = array.takeNearestLargerOrEqual( "03" );
+ Comparable<String> taken = array.takeNearestLargerOrEqual( "03" );
System.out.println( "testEqualToGreatest_LastTwoSameSize" +
array.dumpArray() );
assertNotNull( "We should have something since the largest element was
equal to what we asked for.", taken );
@@ -443,7 +443,7 @@ public class SortedPrefArrayUnitTest
{
int maxSize = 3;
- SortedPreferentialArray array = new SortedPreferentialArray( maxSize );
+ SortedPreferentialArray<String> array = new
SortedPreferentialArray<String>( maxSize );
// array.setPreferLarge( false );
array.setPreferLarge( true );
String[] elem = { "01", "02", "03" };
@@ -456,7 +456,7 @@ public class SortedPrefArrayUnitTest
}
// DO WORK
- Comparable taken = array.takeNearestLargerOrEqual( "03" );
+ Comparable<String> taken = array.takeNearestLargerOrEqual( "03" );
System.out.println( "testEqualToGreatest" + array.dumpArray() );
assertNotNull( "We should have something since the largest element was
equal to what we asked for.", taken );
Modified:
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java?rev=1195205&r1=1195204&r2=1195205&view=diff
==============================================================================
---
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java
(original)
+++
commons/proper/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java
Sun Oct 30 18:08:46 2011
@@ -124,7 +124,7 @@ public class ThreadPoolManagerUnitTest
String poolName2 = "testGetPoolNames2";
mgr.getPool( poolName2 );
- ArrayList names = mgr.getPoolNames();
+ ArrayList<String> names = mgr.getPoolNames();
assertTrue( "Should have name in list.", names.contains( poolName1 ) );
assertTrue( "Should have name in list.", names.contains( poolName2 ) );
}