use of com.hazelcast.config.RestServerEndpointConfig in project hazelcast by hazelcast.
the class InvalidEndpointTest method createRestEndpointConfig.
protected Config createRestEndpointConfig() {
RestServerEndpointConfig restEndpoint = new RestServerEndpointConfig();
restEndpoint.setName("Text").setPort(10000).setPortAutoIncrement(true).enableAllGroups();
Config config = new Config();
config.getAdvancedNetworkConfig().setRestEndpointConfig(restEndpoint).setEnabled(true);
return config;
}
use of com.hazelcast.config.RestServerEndpointConfig in project hazelcast by hazelcast.
the class ExternalMemberConfigurationOverrideEnvTest method shouldHandleAdvancedNetworkEndpointConfiguration.
@Test
public void shouldHandleAdvancedNetworkEndpointConfiguration() throws Exception {
Config config = new Config();
config.getAdvancedNetworkConfig().setClientEndpointConfig(new ServerSocketEndpointConfig().setPort(9000).setPublicAddress("172.29.1.1"));
config.getAdvancedNetworkConfig().setMemberEndpointConfig(new ServerSocketEndpointConfig().setPort(9001).setPublicAddress("172.29.1.1"));
config.getAdvancedNetworkConfig().setRestEndpointConfig(new RestServerEndpointConfig().setPort(9002).setPublicAddress("172.29.1.1"));
config.getAdvancedNetworkConfig().setMemcacheEndpointConfig(new ServerSocketEndpointConfig().setPort(9003).setPublicAddress("172.29.1.1"));
Map<String, String> envVariables = new HashMap<>();
envVariables.put("HZ_ADVANCEDNETWORK_CLIENTSERVERSOCKETENDPOINTCONFIG.PUBLICADDRESS", "127.0.0.1");
envVariables.put("HZ_ADVANCEDNETWORK_MEMBERSERVERSOCKETENDPOINTCONFIG.PUBLICADDRESS", "127.0.0.2");
envVariables.put("HZ_ADVANCEDNETWORK_RESTSERVERSOCKETENDPOINTCONFIG.PUBLICADDRESS", "127.0.0.3");
envVariables.put("HZ_ADVANCEDNETWORK_MEMCACHESERVERSOCKETENDPOINTCONFIG.PUBLICADDRESS", "127.0.0.4");
new ExternalConfigurationOverride(envVariables, System::getProperties).overwriteMemberConfig(config);
ServerSocketEndpointConfig clientEndpointConfig = (ServerSocketEndpointConfig) config.getAdvancedNetworkConfig().getEndpointConfigs().get(EndpointQualifier.CLIENT);
ServerSocketEndpointConfig memberEndpointConfig = (ServerSocketEndpointConfig) config.getAdvancedNetworkConfig().getEndpointConfigs().get(EndpointQualifier.MEMBER);
ServerSocketEndpointConfig restEndpointConfig = (ServerSocketEndpointConfig) config.getAdvancedNetworkConfig().getEndpointConfigs().get(EndpointQualifier.REST);
ServerSocketEndpointConfig memcacheEndpointConfig = (ServerSocketEndpointConfig) config.getAdvancedNetworkConfig().getEndpointConfigs().get(EndpointQualifier.MEMCACHE);
assertEquals(9000, clientEndpointConfig.getPort());
assertEquals("127.0.0.1", clientEndpointConfig.getPublicAddress());
assertEquals(9001, memberEndpointConfig.getPort());
assertEquals("127.0.0.2", memberEndpointConfig.getPublicAddress());
assertEquals(9002, restEndpointConfig.getPort());
assertEquals("127.0.0.3", restEndpointConfig.getPublicAddress());
assertEquals(9003, memcacheEndpointConfig.getPort());
assertEquals("127.0.0.4", memcacheEndpointConfig.getPublicAddress());
}
use of com.hazelcast.config.RestServerEndpointConfig in project hazelcast by hazelcast.
the class RestClusterTest method testClusterInfo_whenAdvancedNetworkWithoutClientEndpoint.
@Test
public void testClusterInfo_whenAdvancedNetworkWithoutClientEndpoint() throws Exception {
// when advanced network config is enabled and no client endpoint is defined
// then client connections are reported as 0
Config config = createConfig();
config.getAdvancedNetworkConfig().setEnabled(true).setRestEndpointConfig(new RestServerEndpointConfig().setPort(9999).enableAllGroups());
HazelcastInstance instance = factory.newHazelcastInstance(config);
HTTPCommunicator communicator = new HTTPCommunicator(instance);
String response = communicator.getClusterInfo();
JsonObject json = Json.parse(response).asObject();
assertEquals(0, json.getInt("connectionCount", -1));
}
use of com.hazelcast.config.RestServerEndpointConfig in project hazelcast by hazelcast.
the class DelegatingAddressPickerTest method createAdvancedNetworkConfig.
private Config createAdvancedNetworkConfig() {
Config config = new Config();
config.getAdvancedNetworkConfig().setEnabled(true);
config.getAdvancedNetworkConfig().getMemberAddressProviderConfig().setEnabled(true).setImplementation(new AnAddressProvider());
config.getAdvancedNetworkConfig().setMemberEndpointConfig(new ServerSocketEndpointConfig().setPort(3000));
config.getAdvancedNetworkConfig().setClientEndpointConfig(new ServerSocketEndpointConfig().setPort(3001));
config.getAdvancedNetworkConfig().setRestEndpointConfig(new RestServerEndpointConfig().setPort(3002));
config.getAdvancedNetworkConfig().addWanEndpointConfig(new ServerSocketEndpointConfig().setName("wan1").setPort(3003));
return config;
}
use of com.hazelcast.config.RestServerEndpointConfig in project hazelcast by hazelcast.
the class RestClusterMultiendpointTest method createConfigWithRestEnabled.
@Override
protected Config createConfigWithRestEnabled() {
Config config = createConfig();
config.getAdvancedNetworkConfig().setRestEndpointConfig(new RestServerEndpointConfig().enableAllGroups());
return config;
}
Aggregations