Java 类com.hazelcast.config.PartitionGroupConfig.MemberGroupType 实例源码

项目:eet.osslite.cz    文件:HazelcastConfiguration.java   
private void setPartitionGroup(PartitionGroupConfig partitionGroup) {
    partitionGroup.setEnabled(false);
    partitionGroup.setGroupType(MemberGroupType.CUSTOM);

    MemberGroupConfig memberGroupConfig = new MemberGroupConfig();
    memberGroupConfig.addInterface("10.10.0.*").addInterface("10.10.3.*").addInterface("10.10.5.*");
    partitionGroup.addMemberGroupConfig(memberGroupConfig);
}
项目:runrightfast-vertx    文件:TypesafeHazelcastConfig.java   
private PartitionGroupConfig partitionConfig(final com.typesafe.config.Config c) {
    final PartitionGroupConfig partitionGroupConfig = new PartitionGroupConfig();
    partitionGroupConfig.setEnabled(true);
    partitionGroupConfig.setGroupType(ConfigUtils.getString(c, "group-type").map(MemberGroupType::valueOf).orElseThrow(new ConfigurationExceptionSupplier("name is required")));
    if (partitionGroupConfig.getGroupType().equals(CUSTOM)) {
        ConfigUtils.getConfigList(c, "member-group-configs").ifPresent(memberGroupConfigs -> {
            memberGroupConfigs.stream().forEach(memberGroupConfig -> {
                final MemberGroupConfig _memberGroupConfig = new MemberGroupConfig();
                _memberGroupConfig.setInterfaces(ConfigUtils.getStringList(memberGroupConfig, "interfaces").orElseThrow(new ConfigurationExceptionSupplier("no interfaces were defined for the MemberGroupConfig")));
                partitionGroupConfig.addMemberGroupConfig(_memberGroupConfig);
            });
        });
    }
    return partitionGroupConfig;
}
项目:hazelcast-archive    文件:XmlConfigBuilder.java   
private void handlePartitionGroup(Node node) {
    final NamedNodeMap atts = node.getAttributes();
    final Node enabledNode = atts.getNamedItem("enabled");
    final boolean enabled = enabledNode != null ? checkTrue(getTextContent(enabledNode).trim()) : false;
    config.getPartitionGroupConfig().setEnabled(enabled);
    final Node groupTypeNode = atts.getNamedItem("group-type");
    final MemberGroupType groupType = groupTypeNode != null ? MemberGroupType.valueOf(getValue(groupTypeNode).toUpperCase()) : null;
    config.getPartitionGroupConfig().setGroupType(groupType);
    for (org.w3c.dom.Node child : new IterableNodeList(node.getChildNodes())) {
        if ("member-group".equals(cleanNodeName(child))) {
            handleMemberGroup(child);
        }
    }
}
项目:hazelcast-archive    文件:PartitionStateGeneratorTest.java   
@Test
public void testConfigCustomPartitionStateGenerator() throws Exception {
    PartitionGroupConfig config = new PartitionGroupConfig();
    config.setEnabled(true);
    config.setGroupType(MemberGroupType.CUSTOM);
    config.addMemberGroupConfig(new MemberGroupConfig().addInterface("10.10.0.0").addInterface("10.10.0.2"))
            .addMemberGroupConfig(new MemberGroupConfig().addInterface("10.10.0.3-5"))
            .addMemberGroupConfig(new MemberGroupConfig().addInterface("10.10.0.6").addInterface("10.10.0.7").addInterface("10.10.0.8"))
            .addMemberGroupConfig(new MemberGroupConfig().addInterface("10.10.0.9-100"));
    PartitionStateGenerator generator = PartitionStateGeneratorFactory.newConfigPartitionStateGenerator(config);
    test(generator, new ConfigMemberGroupFactory(config.getMemberGroupConfigs()));
}
项目:hazelcast-archive    文件:PartitionStateGeneratorTest.java   
@Test
public void testXmlPartitionGroupConfig() {
    Config config = new ClasspathXmlConfig("hazelcast-fullconfig.xml");
    PartitionGroupConfig partitionGroupConfig = config.getPartitionGroupConfig();
    Assert.assertFalse(partitionGroupConfig.isEnabled());
    Assert.assertEquals(MemberGroupType.CUSTOM, partitionGroupConfig.getGroupType());
    Assert.assertEquals(2, partitionGroupConfig.getMemberGroupConfigs().size());
}
项目:health-and-care-developer-network    文件:XmlConfigBuilder.java   
private void handlePartitionGroup(Node node) {
    final NamedNodeMap atts = node.getAttributes();
    final Node enabledNode = atts.getNamedItem("enabled");
    final boolean enabled = enabledNode != null ? checkTrue(getTextContent(enabledNode).trim()) : false;
    config.getPartitionGroupConfig().setEnabled(enabled);
    final Node groupTypeNode = atts.getNamedItem("group-type");
    final MemberGroupType groupType = groupTypeNode != null ? MemberGroupType.valueOf(getValue(groupTypeNode).toUpperCase()) : null;
    config.getPartitionGroupConfig().setGroupType(groupType);
    for (org.w3c.dom.Node child : new IterableNodeList(node.getChildNodes())) {
        if ("member-group".equals(cleanNodeName(child))) {
            handleMemberGroup(child);
        }
    }
}
项目:health-and-care-developer-network    文件:PartitionStateGeneratorTest.java   
@Test
public void testConfigCustomPartitionStateGenerator() throws Exception {
    PartitionGroupConfig config = new PartitionGroupConfig();
    config.setEnabled(true);
    config.setGroupType(MemberGroupType.CUSTOM);
    config.addMemberGroupConfig(new MemberGroupConfig().addInterface("10.10.0.0").addInterface("10.10.0.2"))
            .addMemberGroupConfig(new MemberGroupConfig().addInterface("10.10.0.3-5"))
            .addMemberGroupConfig(new MemberGroupConfig().addInterface("10.10.0.6").addInterface("10.10.0.7").addInterface("10.10.0.8"))
            .addMemberGroupConfig(new MemberGroupConfig().addInterface("10.10.0.9-100"));
    PartitionStateGenerator generator = PartitionStateGeneratorFactory.newConfigPartitionStateGenerator(config);
    test(generator, new ConfigMemberGroupFactory(config.getMemberGroupConfigs()));
}
项目:health-and-care-developer-network    文件:PartitionStateGeneratorTest.java   
@Test
public void testXmlPartitionGroupConfig() {
    Config config = new ClasspathXmlConfig("hazelcast-fullconfig.xml");
    PartitionGroupConfig partitionGroupConfig = config.getPartitionGroupConfig();
    Assert.assertFalse(partitionGroupConfig.isEnabled());
    Assert.assertEquals(MemberGroupType.CUSTOM, partitionGroupConfig.getGroupType());
    Assert.assertEquals(2, partitionGroupConfig.getMemberGroupConfigs().size());
}