Search in sources :

Example 1 with RestServerEndpointConfig

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());
}
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 2 with RestServerEndpointConfig

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

Example 3 with RestServerEndpointConfig

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);
            }
        }
    }
}
Also used : Node(org.w3c.dom.Node) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig)

Example 4 with RestServerEndpointConfig

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

Example 5 with RestServerEndpointConfig

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;
}
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