Search in sources :

Example 81 with JoinConfig

use of com.hazelcast.config.JoinConfig in project hazelcast by hazelcast.

the class AdvancedNetworkIntegrationTest method prepareConfigs.

private Tuple2<Config, Config> prepareConfigs() {
    Config config = smallInstanceConfig();
    config.getAdvancedNetworkConfig().setEnabled(true);
    config.getAdvancedNetworkConfig().setMemberEndpointConfig(createServerSocketConfig(firstMemberPort)).setClientEndpointConfig(createServerSocketConfig(firstClientPort));
    JoinConfig joinConfig = config.getAdvancedNetworkConfig().getJoin();
    joinConfig.getTcpIpConfig().setEnabled(true).addMember("127.0.0.1:" + secondMemberPort);
    Config other = smallInstanceConfig();
    other.getAdvancedNetworkConfig().setEnabled(true);
    other.getAdvancedNetworkConfig().setMemberEndpointConfig(createServerSocketConfig(secondMemberPort));
    other.setProperty(ClusterProperty.MAX_JOIN_SECONDS.getName(), "1");
    return Tuple2.tuple2(config, other);
}
Also used : HazelcastTestSupport.smallInstanceConfig(com.hazelcast.test.HazelcastTestSupport.smallInstanceConfig) JoinConfig(com.hazelcast.config.JoinConfig) Config(com.hazelcast.config.Config) JoinConfig(com.hazelcast.config.JoinConfig)

Example 82 with JoinConfig

use of com.hazelcast.config.JoinConfig in project hazelcast by hazelcast.

the class AbstractAdvancedNetworkIntegrationTest method configureTcpIpConfig.

void configureTcpIpConfig(Config config) {
    JoinConfig join = config.getAdvancedNetworkConfig().getJoin();
    join.getTcpIpConfig().addMember("127.0.0.1:" + NOT_OPENED_PORT).setEnabled(true);
}
Also used : JoinConfig(com.hazelcast.config.JoinConfig)

Example 83 with JoinConfig

use of com.hazelcast.config.JoinConfig in project hazelcast by hazelcast.

the class NioChannelMemoryLeakTest method getConfig.

@Override
protected Config getConfig() {
    Config config = new Config();
    JoinConfig join = config.getNetworkConfig().getJoin();
    join.getTcpIpConfig().addMember("127.0.0.1").setEnabled(true);
    join.getMulticastConfig().setEnabled(false);
    return config;
}
Also used : Config(com.hazelcast.config.Config) JoinConfig(com.hazelcast.config.JoinConfig) JoinConfig(com.hazelcast.config.JoinConfig)

Example 84 with JoinConfig

use of com.hazelcast.config.JoinConfig in project hazelcast by hazelcast.

the class TestAwareInstanceFactory method newHazelcastInstance.

/**
 * Creates new member instance with TCP join configured. Uses
 * {@link com.hazelcast.test.AbstractHazelcastClassRunner#getTestMethodName()}
 * as the cluster name if it's not changed already.
 */
public HazelcastInstance newHazelcastInstance(Config config, NodeContext nodeCtx) {
    if (config == null) {
        config = new Config();
    }
    if (DEFAULT_CLUSTER_NAME.equals(config.getClusterName())) {
        config.setClusterName(getTestMethodName());
    }
    List<HazelcastInstance> members = getOrInitInstances(perMethodMembers);
    // Prepare Unified Networking (legacy)
    NetworkConfig unifiedNetworkingConfig = config.getNetworkConfig();
    unifiedNetworkingConfig.setPort(PORT.getAndIncrement());
    JoinConfig unifiedJoinConfig = unifiedNetworkingConfig.getJoin();
    unifiedJoinConfig.getMulticastConfig().setEnabled(false);
    TcpIpConfig unifiedTcpIpConfig = unifiedJoinConfig.getTcpIpConfig().setEnabled(true);
    for (HazelcastInstance member : members) {
        unifiedTcpIpConfig.addMember("127.0.0.1:" + getPort(member, MEMBER));
    }
    // Prepare Advanced Networking - Will be disabled by default but properly configured if needed
    AdvancedNetworkConfig advancedNetworkConfig = config.getAdvancedNetworkConfig();
    ServerSocketEndpointConfig memberEndpointConfig = (ServerSocketEndpointConfig) advancedNetworkConfig.getEndpointConfigs().get(MEMBER);
    memberEndpointConfig.setPort(PORT.getAndIncrement());
    JoinConfig advancedJoinConfig = advancedNetworkConfig.getJoin();
    advancedJoinConfig.getMulticastConfig().setEnabled(false);
    TcpIpConfig advancedTcpIpConfig = advancedJoinConfig.getTcpIpConfig().setEnabled(true);
    for (HazelcastInstance member : members) {
        advancedTcpIpConfig.addMember("127.0.0.1:" + getPort(member, MEMBER));
    }
    HazelcastInstance hz = HazelcastInstanceFactory.newHazelcastInstance(config, config.getInstanceName(), nodeCtx);
    members.add(hz);
    int nextPort = getPort(hz, MEMBER) + 1;
    int current;
    while (nextPort > (current = PORT.get())) {
        PORT.compareAndSet(current, nextPort);
    }
    return hz;
}
Also used : AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig) JoinConfig(com.hazelcast.config.JoinConfig) AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig)

Example 85 with JoinConfig

use of com.hazelcast.config.JoinConfig in project hazelcast by hazelcast.

the class WanOpenSourceAntiEntropyMcEventsTest method getConfigWithRest.

private Config getConfigWithRest() {
    Config config = smallInstanceConfig();
    RestApiConfig restApiConfig = config.getNetworkConfig().getRestApiConfig();
    restApiConfig.setEnabled(true);
    restApiConfig.enableGroups(RestEndpointGroup.WAN);
    JoinConfig joinConfig = config.getNetworkConfig().getJoin();
    joinConfig.getMulticastConfig().setEnabled(false);
    joinConfig.getTcpIpConfig().setEnabled(true).addMember("127.0.0.1");
    return config;
}
Also used : RestApiConfig(com.hazelcast.config.RestApiConfig) RestApiConfig(com.hazelcast.config.RestApiConfig) JoinConfig(com.hazelcast.config.JoinConfig) Config(com.hazelcast.config.Config) JoinConfig(com.hazelcast.config.JoinConfig)

Aggregations

JoinConfig (com.hazelcast.config.JoinConfig)90 Config (com.hazelcast.config.Config)64 NetworkConfig (com.hazelcast.config.NetworkConfig)32 Test (org.junit.Test)32 TcpIpConfig (com.hazelcast.config.TcpIpConfig)27 QuickTest (com.hazelcast.test.annotation.QuickTest)20 InterfacesConfig (com.hazelcast.config.InterfacesConfig)18 HazelcastInstance (com.hazelcast.core.HazelcastInstance)18 MulticastConfig (com.hazelcast.config.MulticastConfig)15 PartitionGroupConfig (com.hazelcast.config.PartitionGroupConfig)15 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)13 SlowTest (com.hazelcast.test.annotation.SlowTest)12 DiscoveryStrategyConfig (com.hazelcast.config.DiscoveryStrategyConfig)11 RealmConfig (com.hazelcast.config.security.RealmConfig)11 ClientConfig (com.hazelcast.client.config.ClientConfig)9 ListenerConfig (com.hazelcast.config.ListenerConfig)8 AwsConfig (com.hazelcast.config.AwsConfig)7 MemberAttributeConfig (com.hazelcast.config.MemberAttributeConfig)7 ServerSocketEndpointConfig (com.hazelcast.config.ServerSocketEndpointConfig)6 CountDownLatch (java.util.concurrent.CountDownLatch)6