Search in sources :

Example 1 with ConfigMemberGroupFactory

use of com.hazelcast.internal.partition.membergroup.ConfigMemberGroupFactory in project hazelcast by hazelcast.

the class PartitionStateGeneratorTest method testConfigCustomPartitionStateGenerator.

@Test
public void testConfigCustomPartitionStateGenerator() throws Exception {
    PartitionGroupConfig config = new PartitionGroupConfig();
    config.setEnabled(true);
    config.setGroupType(PartitionGroupConfig.MemberGroupType.CUSTOM);
    MemberGroupConfig mgCfg0 = new MemberGroupConfig();
    MemberGroupConfig mgCfg1 = new MemberGroupConfig();
    MemberGroupConfig mgCfg2 = new MemberGroupConfig();
    MemberGroupConfig mgCfg3 = new MemberGroupConfig();
    config.addMemberGroupConfig(mgCfg0);
    config.addMemberGroupConfig(mgCfg1);
    config.addMemberGroupConfig(mgCfg2);
    config.addMemberGroupConfig(mgCfg3);
    for (int k = 0; k < 3; k++) {
        for (int i = 0; i < 255; i++) {
            MemberGroupConfig mg;
            switch(i % 4) {
                case 0:
                    mg = mgCfg0;
                    break;
                case 1:
                    mg = mgCfg1;
                    break;
                case 2:
                    mg = mgCfg2;
                    break;
                case 3:
                    mg = mgCfg3;
                    break;
                default:
                    throw new IllegalArgumentException();
            }
            mg.addInterface("10.10." + k + "." + i);
        }
    }
    test(new ConfigMemberGroupFactory(config.getMemberGroupConfigs()));
}
Also used : PartitionGroupConfig(com.hazelcast.config.PartitionGroupConfig) ConfigMemberGroupFactory(com.hazelcast.internal.partition.membergroup.ConfigMemberGroupFactory) MemberGroupConfig(com.hazelcast.config.MemberGroupConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

MemberGroupConfig (com.hazelcast.config.MemberGroupConfig)1 PartitionGroupConfig (com.hazelcast.config.PartitionGroupConfig)1 ConfigMemberGroupFactory (com.hazelcast.internal.partition.membergroup.ConfigMemberGroupFactory)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1