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);
}
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());
}
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);
}
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);
}
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;
}
Aggregations