Search in sources :

Example 6 with RestServerEndpointConfig

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;
}
Also used : Config(com.hazelcast.config.Config) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig)

Example 7 with RestServerEndpointConfig

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());
}
Also used : HashMap(java.util.HashMap) EventJournalConfig(com.hazelcast.config.EventJournalConfig) UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) Config(com.hazelcast.config.Config) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MerkleTreeConfig(com.hazelcast.config.MerkleTreeConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with RestServerEndpointConfig

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));
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) RestApiConfig(com.hazelcast.config.RestApiConfig) HazelcastTestSupport.smallInstanceConfig(com.hazelcast.test.HazelcastTestSupport.smallInstanceConfig) Config(com.hazelcast.config.Config) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) JsonObject(com.hazelcast.internal.json.JsonObject) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 9 with RestServerEndpointConfig

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;
}
Also used : Config(com.hazelcast.config.Config) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig)

Example 10 with RestServerEndpointConfig

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;
}
Also used : Config(com.hazelcast.config.Config) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig)

Aggregations

RestServerEndpointConfig (com.hazelcast.config.RestServerEndpointConfig)12 Config (com.hazelcast.config.Config)9 AdvancedNetworkConfig (com.hazelcast.config.AdvancedNetworkConfig)5 ServerSocketEndpointConfig (com.hazelcast.config.ServerSocketEndpointConfig)5 QuickTest (com.hazelcast.test.annotation.QuickTest)3 Test (org.junit.Test)3 RestApiConfig (com.hazelcast.config.RestApiConfig)2 EndpointConfig (com.hazelcast.config.EndpointConfig)1 EventJournalConfig (com.hazelcast.config.EventJournalConfig)1 JoinConfig (com.hazelcast.config.JoinConfig)1 MemberAddressProviderConfig (com.hazelcast.config.MemberAddressProviderConfig)1 MerkleTreeConfig (com.hazelcast.config.MerkleTreeConfig)1 NearCacheConfig (com.hazelcast.config.NearCacheConfig)1 TcpIpConfig (com.hazelcast.config.TcpIpConfig)1 UserCodeDeploymentConfig (com.hazelcast.config.UserCodeDeploymentConfig)1 WanBatchPublisherConfig (com.hazelcast.config.WanBatchPublisherConfig)1 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 JsonObject (com.hazelcast.internal.json.JsonObject)1 HazelcastTestSupport.smallInstanceConfig (com.hazelcast.test.HazelcastTestSupport.smallInstanceConfig)1