Skip to content

Commit

Permalink
ISPN-7111 Avoid using InetAddress.getLocalHost() in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danberindei committed Oct 13, 2016
1 parent 4372f1e commit d2a004f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.infinispan.test.AbstractInfinispanTest;
import org.infinispan.test.fwk.TestCacheManagerFactory;
import org.jgroups.stack.IpAddress;
import org.jgroups.util.UUID;
import org.testng.annotations.Test;

/**
Expand All @@ -35,7 +36,7 @@ public class SharedStreamMultiMarshallerTest extends AbstractInfinispanTest {
public void testSharingStream() throws Exception {
EmbeddedCacheManager cm = TestCacheManagerFactory.createClusteredCacheManager();
cm.getCache(); // Start cache so that global marshaller is resolved
JGroupsAddress address = new JGroupsAddress(new IpAddress(12345));
JGroupsAddress address = new JGroupsAddress(UUID.randomUUID());
PutKeyValueCommand cmd = new PutKeyValueCommand(
"k", "v", false, null, new EmbeddedMetadata.Builder().build(), EnumUtil.EMPTY_BIT_SET, AnyEquivalence.getInstance(),
CommandInvocationId.generateId(null));
Expand Down Expand Up @@ -98,7 +99,7 @@ public void testSharingStream() throws Exception {
public void testIndividualStream() throws Exception {
EmbeddedCacheManager cm = TestCacheManagerFactory.createClusteredCacheManager();
cm.getCache(); // Start cache so that global marshaller is resolved
JGroupsAddress address = new JGroupsAddress(new IpAddress(12345));
JGroupsAddress address = new JGroupsAddress(UUID.randomUUID());
try {
// Write
StreamingMarshaller globalMarshal = extractGlobalMarshaller(cm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ public void tearDown() {
}

public void testJGroupsAddressMarshalling() throws Exception {
JGroupsAddress address = new JGroupsAddress(new IpAddress(12345));
JGroupsAddress address = new JGroupsAddress(UUID.randomUUID());
marshallAndAssertEquality(address);
}

public void testGlobalTransactionMarshalling() throws Exception {
JGroupsAddress jGroupsAddress = new JGroupsAddress(new IpAddress(12345));
JGroupsAddress jGroupsAddress = new JGroupsAddress(UUID.randomUUID());
GlobalTransaction gtx = gtf.newGlobalTransaction(jGroupsAddress, false);
marshallAndAssertEquality(gtx);
}
Expand All @@ -161,7 +161,7 @@ public void testMapMarshalling() throws Exception {
Map<Integer, GlobalTransaction> m3 = new HashMap<Integer, GlobalTransaction>();
Map<Integer, GlobalTransaction> m4 = new FastCopyHashMap<Integer, GlobalTransaction>();
for (int i = 0; i < 10; i++) {
JGroupsAddress jGroupsAddress = new JGroupsAddress(new IpAddress(1000 * i));
JGroupsAddress jGroupsAddress = new JGroupsAddress(UUID.randomUUID());
GlobalTransaction gtx = gtf.newGlobalTransaction(jGroupsAddress, false);
m1.put(1000 * i, gtx);
m2.put(1000 * i, gtx);
Expand Down Expand Up @@ -216,7 +216,7 @@ public void testMarshalledValueGetMarshalling() throws Exception {
}

public void testSingletonListMarshalling() throws Exception {
GlobalTransaction gtx = gtf.newGlobalTransaction(new JGroupsAddress(new IpAddress(12345)), false);
GlobalTransaction gtx = gtf.newGlobalTransaction(new JGroupsAddress(UUID.randomUUID()), false);
List<GlobalTransaction> l = Collections.singletonList(gtx);
marshallAndAssertEquality(l);
}
Expand Down Expand Up @@ -260,13 +260,13 @@ public void testReplicableCommandsMarshalling() throws Exception {

Map<Integer, GlobalTransaction> m1 = new HashMap<Integer, GlobalTransaction>();
for (int i = 0; i < 10; i++) {
GlobalTransaction gtx = gtf.newGlobalTransaction(new JGroupsAddress(new IpAddress(1000 * i)), false);
GlobalTransaction gtx = gtf.newGlobalTransaction(new JGroupsAddress(UUID.randomUUID()), false);
m1.put(1000 * i, gtx);
}
PutMapCommand c10 = new PutMapCommand(m1, null, new EmbeddedMetadata.Builder().build(), EnumUtil.EMPTY_BIT_SET, CommandInvocationId.generateId(null));
marshallAndAssertEquality(c10);

Address local = new JGroupsAddress(new IpAddress(12345));
Address local = new JGroupsAddress(UUID.randomUUID());
GlobalTransaction gtx = gtf.newGlobalTransaction(local, false);
PrepareCommand c11 = new PrepareCommand(cacheName, gtx, true, c5, c6, c8, c10);
marshallAndAssertEquality(c11);
Expand Down

0 comments on commit d2a004f

Please sign in to comment.