@Test
 public void testPartitionGroupConfig() {
   PartitionGroupConfig pgc = config.getPartitionGroupConfig();
   assertTrue(pgc.isEnabled());
   assertEquals(PartitionGroupConfig.MemberGroupType.CUSTOM, pgc.getGroupType());
   assertEquals(2, pgc.getMemberGroupConfigs().size());
   Iterator<MemberGroupConfig> iter = pgc.getMemberGroupConfigs().iterator();
   while (iter.hasNext()) {
     MemberGroupConfig mgc = iter.next();
     assertEquals(2, mgc.getInterfaces().size());
   }
 }
Exemple #2
0
  public ConfigCheck createConfigCheck() {
    final ConfigCheck configCheck = new ConfigCheck();
    final GroupConfig groupConfig = config.getGroupConfig();
    final PartitionGroupConfig partitionGroupConfig = config.getPartitionGroupConfig();
    final boolean partitionGroupEnabled =
        partitionGroupConfig != null && partitionGroupConfig.isEnabled();

    PartitionGroupConfig.MemberGroupType memberGroupType =
        partitionGroupEnabled
            ? partitionGroupConfig.getGroupType()
            : PartitionGroupConfig.MemberGroupType.PER_MEMBER;
    configCheck
        .setGroupName(groupConfig.getName())
        .setGroupPassword(groupConfig.getPassword())
        .setJoinerType(joiner != null ? joiner.getType() : "")
        .setPartitionGroupEnabled(partitionGroupEnabled)
        .setMemberGroupType(memberGroupType);
    return configCheck;
  }