Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISPN-7111 Avoid using InetAddress.getLocalHost() in the tests #4615

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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