use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MemberMapTest method testConstructor_whenMapsHaveDifferentMembers_thenThrowAssertionError.
@Test(expected = AssertionError.class)
@RequireAssertEnabled
public void testConstructor_whenMapsHaveDifferentMembers_thenThrowAssertionError() {
Map<Address, MemberImpl> addressMap = new HashMap<>();
Map<UUID, MemberImpl> uuidMap = new HashMap<>();
MemberImpl addressMember = newMember(5701);
MemberImpl uuidMember = newMember(5702);
addressMap.put(addressMember.getAddress(), addressMember);
uuidMap.put(uuidMember.getUuid(), uuidMember);
new MemberMap(0, addressMap, uuidMap);
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MemberMapTest method cloneAdding_failsWithDuplicateAddress.
@Test(expected = IllegalArgumentException.class)
public void cloneAdding_failsWithDuplicateAddress() {
MemberImpl[] members = newMembers(3);
MemberImpl member = newMember(5000);
MemberMap.cloneAdding(MemberMap.createNew(members), member);
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MemberMapTest method createSingleton.
@Test
public void createSingleton() {
MemberImpl member = newMember(5000);
MemberMap map = MemberMap.singleton(member);
assertEquals(1, map.getMembers().size());
assertEquals(1, map.getAddresses().size());
assertEquals(1, map.size());
assertContains(map, member.getAddress());
assertContains(map, member.getUuid());
assertSame(member, map.getMember(member.getAddress()));
assertSame(member, map.getMember(member.getUuid()));
assertMemberSet(map);
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MemberMapTest method headMemberSet_exclusive.
@Test
public void headMemberSet_exclusive() {
MemberImpl[] members = newMembers(7);
MemberMap map = MemberMap.createNew(members);
MemberImpl member = members[3];
Set<MemberImpl> set = map.headMemberSet(member, false);
assertEquals(3, set.size());
int k = 0;
for (MemberImpl m : set) {
assertEquals(members[k++], m);
}
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MemberMapTest method cloneAdding.
@Test
public void cloneAdding() {
MemberImpl[] members = newMembers(5);
MemberMap map = MemberMap.cloneAdding(MemberMap.createNew(members[0], members[1], members[2]), members[3], members[4]);
assertEquals(members.length, map.getMembers().size());
assertEquals(members.length, map.getAddresses().size());
assertEquals(members.length, map.size());
for (MemberImpl member : members) {
assertContains(map, member.getAddress());
assertContains(map, member.getUuid());
assertSame(member, map.getMember(member.getAddress()));
assertSame(member, map.getMember(member.getUuid()));
}
assertMemberSet(map);
}
Aggregations