use of com.hazelcast.config.MemberGroupConfig in project hazelcast by hazelcast.
the class MemberGroupFactoryTest method testConfigMemberGroupFactoryCreateMemberGroups_withNonMatchingMembers.
/**
* When there is a matching {@link MemberGroupConfig} for a {@link Member}, it will be assigned to a {@link MemberGroup}.
* <p>
* In this test half of the members will have a matching configuration, so there will be 2 groups with 2 members each.
*/
@Test
public void testConfigMemberGroupFactoryCreateMemberGroups_withNonMatchingMembers() {
Collection<Member> members = createMembers();
Collection<MemberGroupConfig> groupConfigs = createMemberGroupConfigs(false);
MemberGroupFactory groupFactory = new ConfigMemberGroupFactory(groupConfigs);
Collection<MemberGroup> memberGroups = groupFactory.createMemberGroups(members);
assertEquals("Member Groups: " + String.valueOf(memberGroups), 2, memberGroups.size());
for (MemberGroup memberGroup : memberGroups) {
assertEquals("Member Group: " + String.valueOf(memberGroup), 2, memberGroup.size());
}
}
use of com.hazelcast.config.MemberGroupConfig in project hazelcast by hazelcast.
the class MemberGroupFactoryTest method createMemberGroupConfigs.
private Collection<MemberGroupConfig> createMemberGroupConfigs(boolean addHostnameConfigs) {
Collection<MemberGroupConfig> groupConfigs = new HashSet<MemberGroupConfig>();
MemberGroupConfig group1 = new MemberGroupConfig();
group1.addInterface("192.168.*.*");
MemberGroupConfig group2 = new MemberGroupConfig();
group2.addInterface("172.16.*.*");
MemberGroupConfig group3 = new MemberGroupConfig();
group3.addInterface("*.hazelcast.com");
MemberGroupConfig group4 = new MemberGroupConfig();
group4.addInterface("www.hazelcast.org");
groupConfigs.add(group1);
groupConfigs.add(group2);
if (addHostnameConfigs) {
groupConfigs.add(group3);
groupConfigs.add(group4);
}
return groupConfigs;
}
Aggregations