use of com.hazelcast.config.RestServerEndpointConfig 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.RestServerEndpointConfig in project hazelcast by hazelcast.
the class TcpServerContext method initRestApiConfig.
private static RestApiConfig initRestApiConfig(Config config) {
AdvancedNetworkConfig advancedNetworkConfig = config.getAdvancedNetworkConfig();
boolean isAdvancedNetwork = advancedNetworkConfig.isEnabled();
RestApiConfig restApiConfig = config.getNetworkConfig().getRestApiConfig();
if (isAdvancedNetwork && advancedNetworkConfig.getEndpointConfigs().get(REST) != null) {
RestServerEndpointConfig restServerEndpointConfig = advancedNetworkConfig.getRestEndpointConfig();
restApiConfig.setEnabled(true).setEnabledGroups(restServerEndpointConfig.getEnabledGroups());
}
return restApiConfig;
}
use of com.hazelcast.config.RestServerEndpointConfig in project hazelcast by hazelcast.
the class MemberDomConfigProcessor method handleRestServerSocketEndpointConfig.
private void handleRestServerSocketEndpointConfig(Node node) throws Exception {
RestServerEndpointConfig config = (RestServerEndpointConfig) this.config.getAdvancedNetworkConfig().getEndpointConfigs().getOrDefault(EndpointQualifier.REST, new RestServerEndpointConfig());
handleServerSocketEndpointConfig(config, node);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if (matches("endpoint-groups", nodeName)) {
for (Node endpointGroup : childElements(child)) {
handleRestEndpointGroup(config, endpointGroup);
}
}
}
}
use of com.hazelcast.config.RestServerEndpointConfig in project hazelcast by hazelcast.
the class RestMultiendpointTest method getConfig.
@Override
public Config getConfig() {
Config config = super.getConfig();
config.setClusterName(randomString());
ServerSocketEndpointConfig memberEndpointConfig = new ServerSocketEndpointConfig();
memberEndpointConfig.setName("MEMBER").setPort(6000).setPortAutoIncrement(true);
ServerSocketEndpointConfig clientEndpointConfig = new ServerSocketEndpointConfig();
clientEndpointConfig.setName("CLIENT").setPort(5000).setPortAutoIncrement(true);
RestServerEndpointConfig restEndpoint = new RestServerEndpointConfig();
restEndpoint.setName("Text").setPort(10000).setPortAutoIncrement(true).enableAllGroups();
config.getAdvancedNetworkConfig().setEnabled(true).setMemberEndpointConfig(memberEndpointConfig).setClientEndpointConfig(clientEndpointConfig).setRestEndpointConfig(restEndpoint);
// we start pairs of HazelcastInstances which form a cluster to have remote invocations for all operations
JoinConfig join = config.getAdvancedNetworkConfig().getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().setEnabled(true).addMember("127.0.0.1:6000").addMember("127.0.0.1:6001");
instance = factory.newHazelcastInstance(config);
remoteInstance = factory.newHazelcastInstance(config);
communicator = new HTTPCommunicator(instance);
return config;
}
use of com.hazelcast.config.RestServerEndpointConfig in project hazelcast by hazelcast.
the class RestInstanceMultiendpointTest method createConfigWithRestEnabledAndClusterReadDisabled.
@Override
protected Config createConfigWithRestEnabledAndClusterReadDisabled() {
Config config = createConfig();
RestServerEndpointConfig restApiConfig = new RestServerEndpointConfig().disableGroups(RestEndpointGroup.CLUSTER_READ).enableGroups(RestEndpointGroup.CLUSTER_WRITE);
config.getAdvancedNetworkConfig().setRestEndpointConfig(restApiConfig);
return config;
}
Aggregations