Search in sources :

Example 11 with ServerSocketEndpointConfig

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

the class MemberDomConfigProcessor method handleMemberServerSocketEndpointConfig.

private void handleMemberServerSocketEndpointConfig(Node node) throws Exception {
    ServerSocketEndpointConfig config = (ServerSocketEndpointConfig) this.config.getAdvancedNetworkConfig().getEndpointConfigs().getOrDefault(EndpointQualifier.MEMBER, new ServerSocketEndpointConfig());
    config.setProtocolType(ProtocolType.MEMBER);
    handleServerSocketEndpointConfig(config, node);
}
Also used : ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig)

Example 12 with ServerSocketEndpointConfig

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

the class TestAdvancedNetworkApplicationContext method testAdvancedNetworkConfig.

@Test
public void testAdvancedNetworkConfig() {
    Config config = instance.getConfig();
    AdvancedNetworkConfig advancedNetworkConfig = config.getAdvancedNetworkConfig();
    assertTrue(advancedNetworkConfig.isEnabled());
    TcpIpConfig tcpIpConfig = advancedNetworkConfig.getJoin().getTcpIpConfig();
    assertTrue(tcpIpConfig.isEnabled());
    assertEquals("127.0.0.1:5700", tcpIpConfig.getRequiredMember());
    assertFalse(advancedNetworkConfig.getJoin().getMulticastConfig().isEnabled());
    assertFalse(advancedNetworkConfig.getJoin().getAutoDetectionConfig().isEnabled());
    MemberAddressProviderConfig addressProviderConfig = advancedNetworkConfig.getMemberAddressProviderConfig();
    assertFalse(addressProviderConfig.isEnabled());
    ServerSocketEndpointConfig memberEndpointConfig = (ServerSocketEndpointConfig) advancedNetworkConfig.getEndpointConfigs().get(EndpointQualifier.MEMBER);
    assertEquals(5700, memberEndpointConfig.getPort());
    assertEquals(99, memberEndpointConfig.getPortCount());
    assertFalse(memberEndpointConfig.isPortAutoIncrement());
    assertTrue(memberEndpointConfig.getInterfaces().isEnabled());
    assertContains(memberEndpointConfig.getInterfaces().getInterfaces(), "127.0.0.1");
    assertTrue(memberEndpointConfig.isReuseAddress());
    assertTrue(memberEndpointConfig.getSocketInterceptorConfig().isEnabled());
    assertEquals("com.hazelcast.SocketInterceptor", memberEndpointConfig.getSocketInterceptorConfig().getClassName());
    assertTrue(memberEndpointConfig.isSocketBufferDirect());
    assertTrue(memberEndpointConfig.isSocketKeepAlive());
    assertFalse(memberEndpointConfig.isSocketTcpNoDelay());
    EndpointConfig wanConfig = advancedNetworkConfig.getEndpointConfigs().get(EndpointQualifier.resolve(ProtocolType.WAN, "wan-tokyo"));
    assertFalse(wanConfig.getInterfaces().isEnabled());
    assertTrue(wanConfig.getSymmetricEncryptionConfig().isEnabled());
    assertEquals("PBEWithMD5AndDES", wanConfig.getSymmetricEncryptionConfig().getAlgorithm());
    assertEquals("thesalt", wanConfig.getSymmetricEncryptionConfig().getSalt());
    assertEquals("thepass", wanConfig.getSymmetricEncryptionConfig().getPassword());
    assertEquals(19, wanConfig.getSymmetricEncryptionConfig().getIterationCount());
    ServerSocketEndpointConfig clientEndpointConfig = (ServerSocketEndpointConfig) advancedNetworkConfig.getEndpointConfigs().get(EndpointQualifier.CLIENT);
    assertEquals(9919, clientEndpointConfig.getPort());
    assertEquals(10, clientEndpointConfig.getPortCount());
    assertFalse(clientEndpointConfig.isPortAutoIncrement());
    assertTrue(clientEndpointConfig.isReuseAddress());
    RestServerEndpointConfig restServerEndpointConfig = advancedNetworkConfig.getRestEndpointConfig();
    assertEquals(9999, restServerEndpointConfig.getPort());
    assertTrue(restServerEndpointConfig.isPortAutoIncrement());
    assertContainsAll(restServerEndpointConfig.getEnabledGroups(), Arrays.asList(HEALTH_CHECK, CLUSTER_READ));
    WanReplicationConfig testWan = config.getWanReplicationConfig("testWan");
    WanBatchPublisherConfig tokyoWanPublisherConfig = testWan.getBatchPublisherConfigs().stream().filter(pc -> pc.getPublisherId().equals("tokyoPublisherId")).findFirst().get();
    assertNotNull(tokyoWanPublisherConfig);
    assertEquals("wan-tokyo", tokyoWanPublisherConfig.getEndpoint());
}
Also used : WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig) MemberAddressProviderConfig(com.hazelcast.config.MemberAddressProviderConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) Config(com.hazelcast.config.Config) EndpointConfig(com.hazelcast.config.EndpointConfig) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig) MemberAddressProviderConfig(com.hazelcast.config.MemberAddressProviderConfig) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) EndpointConfig(com.hazelcast.config.EndpointConfig) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 13 with ServerSocketEndpointConfig

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

the class MemberDomConfigProcessor method handleWanServerSocketEndpointConfig.

protected void handleWanServerSocketEndpointConfig(Node node) throws Exception {
    ServerSocketEndpointConfig config = new ServerSocketEndpointConfig();
    config.setProtocolType(ProtocolType.WAN);
    handleServerSocketEndpointConfig(config, node);
}
Also used : ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig)

Example 14 with ServerSocketEndpointConfig

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

the class MemberDomConfigProcessor method handleMemcacheServerSocketEndpointConfig.

private void handleMemcacheServerSocketEndpointConfig(Node node) throws Exception {
    ServerSocketEndpointConfig config = (ServerSocketEndpointConfig) this.config.getAdvancedNetworkConfig().getEndpointConfigs().getOrDefault(EndpointQualifier.MEMCACHE, new ServerSocketEndpointConfig());
    config.setProtocolType(ProtocolType.MEMCACHE);
    handleServerSocketEndpointConfig(config, node);
}
Also used : ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig)

Example 15 with ServerSocketEndpointConfig

use of com.hazelcast.config.ServerSocketEndpointConfig 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)

Aggregations

ServerSocketEndpointConfig (com.hazelcast.config.ServerSocketEndpointConfig)20 Config (com.hazelcast.config.Config)12 AdvancedNetworkConfig (com.hazelcast.config.AdvancedNetworkConfig)5 JoinConfig (com.hazelcast.config.JoinConfig)5 RestServerEndpointConfig (com.hazelcast.config.RestServerEndpointConfig)5 EndpointConfig (com.hazelcast.config.EndpointConfig)3 TcpIpConfig (com.hazelcast.config.TcpIpConfig)2 WanBatchPublisherConfig (com.hazelcast.config.WanBatchPublisherConfig)2 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)2 EndpointQualifier (com.hazelcast.instance.EndpointQualifier)2 HazelcastTestSupport.smallInstanceConfig (com.hazelcast.test.HazelcastTestSupport.smallInstanceConfig)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 Test (org.junit.Test)2 ClientConfig (com.hazelcast.client.config.ClientConfig)1 EventJournalConfig (com.hazelcast.config.EventJournalConfig)1 InvalidConfigurationException (com.hazelcast.config.InvalidConfigurationException)1 MemberAddressProviderConfig (com.hazelcast.config.MemberAddressProviderConfig)1 MerkleTreeConfig (com.hazelcast.config.MerkleTreeConfig)1 NearCacheConfig (com.hazelcast.config.NearCacheConfig)1 NetworkConfig (com.hazelcast.config.NetworkConfig)1