use of com.hazelcast.internal.partition.membergroup.SPIAwareMemberGroupFactory in project hazelcast by hazelcast.
the class DiscoverySpiTest method testSPIAwareMemberGroupFactoryCreateMemberGroups.
@Test
public void testSPIAwareMemberGroupFactoryCreateMemberGroups() throws Exception {
String xmlFileName = "test-hazelcast-discovery-spi-metadata.xml";
Config config = getDiscoverySPIConfig(xmlFileName, false);
// 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();
}
use of com.hazelcast.internal.partition.membergroup.SPIAwareMemberGroupFactory 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();
}
use of com.hazelcast.internal.partition.membergroup.SPIAwareMemberGroupFactory in project hazelcast by hazelcast.
the class DiscoverySpiTest method testSPIAwareMemberGroupFactoryInvalidConfig.
@Test(expected = RuntimeException.class)
public void testSPIAwareMemberGroupFactoryInvalidConfig() throws Exception {
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance();
try {
MemberGroupFactory groupFactory = new SPIAwareMemberGroupFactory(getNode(hazelcastInstance).getDiscoveryService());
Collection<Member> members = createMembers();
groupFactory.createMemberGroups(members);
} finally {
hazelcastInstance.shutdown();
}
}
Aggregations