use of com.hazelcast.spi.partitiongroup.MemberGroup 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.spi.partitiongroup.MemberGroup in project hazelcast by hazelcast.
the class MemberGroupFactoryTest method testZoneMetadataAwareMemberGroupFactoryCreateMemberGroups.
@Test
public void testZoneMetadataAwareMemberGroupFactoryCreateMemberGroups() {
MemberGroupFactory groupFactory = new ZoneAwareMemberGroupFactory();
Collection<Member> members = createMembersWithZoneAwareMetadata();
Collection<MemberGroup> memberGroups = groupFactory.createMemberGroups(members);
assertEquals("Member Groups: " + String.valueOf(memberGroups), 3, memberGroups.size());
for (MemberGroup memberGroup : memberGroups) {
assertEquals("Member Group: " + String.valueOf(memberGroup), 1, memberGroup.size());
}
}
use of com.hazelcast.spi.partitiongroup.MemberGroup in project hazelcast by hazelcast.
the class DiscoverySpiTest method testSPIAwareMemberGroupFactoryCreateMemberGroups_withDeprecated.
@Test
public void testSPIAwareMemberGroupFactoryCreateMemberGroups_withDeprecated() throws Exception {
String xmlFileName = "test-hazelcast-discovery-spi-metadata.xml";
Config config = getDiscoverySPIConfig(xmlFileName, true);
// we create this instance in order to fully create Node
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);
Node node = getNode(hazelcastInstance);
assertNotNull(node);
MemberGroupFactory groupFactory = new SPIAwareMemberGroupFactory(node.getDiscoveryService());
Collection<Member> members = createMembers();
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());
}
hazelcastInstance.shutdown();
}
Aggregations