[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/buddyreplication ...
Manik Surtani
manik at jboss.org
Tue May 29 06:26:17 EDT 2007
User: msurtani
Date: 07/05/29 06:26:17
Modified: tests/functional/org/jboss/cache/buddyreplication
NextMemberBuddyLocatorTest.java
Log:
Fixed breaking UTs
Revision Changes Path
1.6 +42 -29 JBossCache/tests/functional/org/jboss/cache/buddyreplication/NextMemberBuddyLocatorTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NextMemberBuddyLocatorTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/NextMemberBuddyLocatorTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- NextMemberBuddyLocatorTest.java 23 May 2007 10:28:56 -0000 1.5
+++ NextMemberBuddyLocatorTest.java 29 May 2007 10:26:17 -0000 1.6
@@ -7,14 +7,15 @@
package org.jboss.cache.buddyreplication;
import junit.framework.TestCase;
+import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
-import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -26,11 +27,14 @@
public class NextMemberBuddyLocatorTest extends TestCase
{
private IpAddress dataOwner;
- private List buddies_localhost = new ArrayList();
- private List buddies_same_host_different_nic = new ArrayList();
- private List buddies_different_hosts = new ArrayList();
+ private List<Address> buddies_localhost, buddies_same_host_different_nic, buddies_different_hosts;
+ protected void setUp()
{
+ buddies_localhost = new LinkedList<Address>();
+ buddies_same_host_different_nic = new LinkedList<Address>();
+ buddies_different_hosts = new LinkedList<Address>();
+
try
{
dataOwner = new IpAddress(InetAddress.getByName("localhost"), 1000);
@@ -53,10 +57,11 @@
}
// now lets get some which are definitely on different hosts
- buddies_different_hosts.add(new IpAddress(InetAddress.getByName("www.amazon.com"), 1000));
- buddies_different_hosts.add(new IpAddress(InetAddress.getByName("www.cnn.com"), 1000));
- buddies_different_hosts.add(new IpAddress(InetAddress.getByName("www.google.com"), 1000));
- buddies_different_hosts.add(new IpAddress(InetAddress.getByName("www.microsoft.com"), 1000));
+ // don't bother with DNS lookups - just use dummy IP addresses.
+ buddies_different_hosts.add(new IpAddress(InetAddress.getByName("61.62.63.64"), 1000));
+ buddies_different_hosts.add(new IpAddress(InetAddress.getByName("81.82.83.84"), 1000));
+ buddies_different_hosts.add(new IpAddress(InetAddress.getByName("101.102.103.104"), 1000));
+ buddies_different_hosts.add(new IpAddress(InetAddress.getByName("121.122.123.124"), 1000));
}
catch (Exception e)
{
@@ -64,13 +69,21 @@
}
}
+ protected void tearDown()
+ {
+ buddies_localhost = null;
+ buddies_same_host_different_nic = null;
+ buddies_different_hosts = null;
+ dataOwner = null;
+ }
+
- private List getBuddies(int numBuddies, boolean ignoreColoc, List candidates)
+ private List getBuddies(int numBuddies, boolean ignoreColoc, List<Address> candidates)
{
return getBuddies(numBuddies, ignoreColoc, candidates, null);
}
- private List getBuddies(int numBuddies, boolean ignoreColoc, List candidates, Map buddyPool)
+ private List getBuddies(int numBuddies, boolean ignoreColoc, List<Address> candidates, Map<Address, String> buddyPool)
{
NextMemberBuddyLocatorConfig cfg = new NextMemberBuddyLocatorConfig();
cfg.setIgnoreColocatedBuddies(ignoreColoc);
@@ -84,7 +97,7 @@
public void testSingleBuddyNoColoc()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -96,7 +109,7 @@
public void testThreeBuddiesNoColoc()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -113,7 +126,7 @@
public void testMoreBuddiesThanAvblNoColoc()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -128,7 +141,7 @@
// with colocation, but all candidates are on the same host
public void testSingleBuddyWithColocAllCandidatesColoc()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -140,7 +153,7 @@
public void testThreeBuddiesWithColocAllCandidatesColoc()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -157,7 +170,7 @@
public void testMoreBuddiesThanAvblWithColocAllCandidatesColoc()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -172,7 +185,7 @@
// with colocation, all candidates are on the same host but with different NICs
public void testSingleBuddyWithColocAllCandidatesColocDiffNics()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -185,7 +198,7 @@
public void testThreeBuddiesWithColocAllCandidatesColocDiffNics()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -203,7 +216,7 @@
public void testMoreBuddiesThanAvblWithColocAllCandidatesColocDiffNics()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -221,7 +234,7 @@
// now for some non-colocated buddies to pick from
public void testSingleBuddyWithColocDiffHosts()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -235,7 +248,7 @@
public void testThreeBuddiesWithColocDiffHosts()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -254,7 +267,7 @@
public void testMoreBuddiesThanAvblWithColocDiffHosts()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -273,13 +286,13 @@
// now lets try this with a buddy pool
public void testSingleLocalBuddyWithPool()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
list.add(buddies_localhost.get(2));
- Map pool = new HashMap();
+ Map<Address, String> pool = new HashMap<Address, String>();
pool.put(dataOwner, "A");
pool.put(buddies_localhost.get(2), "A");
pool.put(buddies_localhost.get(0), "B");
@@ -295,7 +308,7 @@
// now lets try this with a buddy pool
public void testSingleLocalBuddyWithPoolMixed1()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -303,7 +316,7 @@
list.add(buddies_different_hosts.get(0));
list.add(buddies_different_hosts.get(1));
- Map pool = new HashMap();
+ Map<Address, String> pool = new HashMap<Address, String>();
pool.put(dataOwner, "A");
pool.put(buddies_localhost.get(2), "A");
pool.put(buddies_localhost.get(0), "B");
@@ -319,7 +332,7 @@
public void testSingleLocalBuddyWithPoolMixed2()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.add(dataOwner);
list.add(buddies_localhost.get(0));
list.add(buddies_localhost.get(1));
@@ -327,7 +340,7 @@
list.add(buddies_different_hosts.get(0));
list.add(buddies_different_hosts.get(1));
- Map pool = new HashMap();
+ Map<Address, String> pool = new HashMap<Address, String>();
pool.put(dataOwner, "A");
pool.put(buddies_localhost.get(2), "B");
pool.put(buddies_localhost.get(0), "B");
@@ -344,7 +357,7 @@
public void testWithDataOwnerAtEnd()
{
- List list = new ArrayList();
+ List<Address> list = new LinkedList<Address>();
list.addAll(buddies_localhost);
list.add(dataOwner);
More information about the jboss-cvs-commits
mailing list