Search in sources :

Example 26 with RestApiConfig

use of com.hazelcast.config.RestApiConfig in project hazelcast by hazelcast.

the class RestLogLevelTest method createReadOnlyConfig.

protected Config createReadOnlyConfig() {
    Config config = createConfig();
    RestApiConfig restApiConfig = new RestApiConfig().setEnabled(true).enableGroups(RestEndpointGroup.CLUSTER_READ).disableGroups(RestEndpointGroup.CLUSTER_WRITE);
    config.getNetworkConfig().setRestApiConfig(restApiConfig);
    return config;
}
Also used : RestApiConfig(com.hazelcast.config.RestApiConfig) Config(com.hazelcast.config.Config) RestApiConfig(com.hazelcast.config.RestApiConfig)

Example 27 with RestApiConfig

use of com.hazelcast.config.RestApiConfig in project hazelcast by hazelcast.

the class RestNodeStateTest method testStartingNodeState_regression.

/**
 * This test does a node-state REST call before the Node is switched to the {@link NodeState#ACTIVE}. A custom discovery
 * strategy is used to block the processing in a point when REST is already running, but the node is not yet active. During
 * the blocked discovery initialization the HTTP call is done.
 * <p>
 * See
 * <a href="https://github.com/hazelcast/hazelcast/issues/17773">https://github.com/hazelcast/hazelcast/issues/17773</a>.
 */
@Test
public void testStartingNodeState_regression() throws Exception {
    Config config = smallInstanceConfig().setProperty(ClusterProperty.DISCOVERY_SPI_ENABLED.getName(), "true");
    RestApiConfig restApiConfig = new RestApiConfig().setEnabled(true).enableAllGroups();
    NetworkConfig networkConfig = config.getNetworkConfig();
    int port = TestUtil.getAvailablePort(BASE_PORT);
    networkConfig.setPort(port).setPortAutoIncrement(false);
    networkConfig.getJoin().getMulticastConfig().setEnabled(false);
    networkConfig.setRestApiConfig(restApiConfig);
    StrategyFactory discoveryStrategyFactory = new StrategyFactory();
    networkConfig.getJoin().getDiscoveryConfig().addDiscoveryStrategyConfig(new DiscoveryStrategyConfig(discoveryStrategyFactory));
    HazelcastTestSupport.spawn(() -> Hazelcast.newHazelcastInstance(config));
    discoveryStrategyFactory.getNodeStartingLatch().await();
    HTTPCommunicator communicator = new HTTPCommunicator(port);
    assertEquals("\"STARTING\"", communicator.getClusterHealth("/node-state"));
    discoveryStrategyFactory.getTestDoneLatch().countDown();
}
Also used : RestApiConfig(com.hazelcast.config.RestApiConfig) DiscoveryStrategyConfig(com.hazelcast.config.DiscoveryStrategyConfig) RestApiConfig(com.hazelcast.config.RestApiConfig) HazelcastTestSupport.smallInstanceConfig(com.hazelcast.test.HazelcastTestSupport.smallInstanceConfig) Config(com.hazelcast.config.Config) DiscoveryStrategyConfig(com.hazelcast.config.DiscoveryStrategyConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) DiscoveryStrategyFactory(com.hazelcast.spi.discovery.DiscoveryStrategyFactory) NetworkConfig(com.hazelcast.config.NetworkConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 28 with RestApiConfig

use of com.hazelcast.config.RestApiConfig in project hazelcast by hazelcast.

the class RestCPSubsystemTest method setup.

@Before
public void setup() {
    RestApiConfig restApiConfig = new RestApiConfig().setEnabled(true).enableGroups(RestEndpointGroup.CP);
    config.getNetworkConfig().setRestApiConfig(restApiConfig);
    JoinConfig join = config.getNetworkConfig().getJoin();
    join.getMulticastConfig().setEnabled(false);
    join.getTcpIpConfig().setEnabled(true).clear().addMember("127.0.0.1");
    config.getCPSubsystemConfig().setCPMemberCount(3);
}
Also used : RestApiConfig(com.hazelcast.config.RestApiConfig) JoinConfig(com.hazelcast.config.JoinConfig) Before(org.junit.Before)

Example 29 with RestApiConfig

use of com.hazelcast.config.RestApiConfig in project hazelcast by hazelcast.

the class WanOpenSourceAntiEntropyMcEventsTest method getConfigWithRest.

private Config getConfigWithRest() {
    Config config = smallInstanceConfig();
    RestApiConfig restApiConfig = config.getNetworkConfig().getRestApiConfig();
    restApiConfig.setEnabled(true);
    restApiConfig.enableGroups(RestEndpointGroup.WAN);
    JoinConfig joinConfig = config.getNetworkConfig().getJoin();
    joinConfig.getMulticastConfig().setEnabled(false);
    joinConfig.getTcpIpConfig().setEnabled(true).addMember("127.0.0.1");
    return config;
}
Also used : RestApiConfig(com.hazelcast.config.RestApiConfig) RestApiConfig(com.hazelcast.config.RestApiConfig) JoinConfig(com.hazelcast.config.JoinConfig) Config(com.hazelcast.config.Config) JoinConfig(com.hazelcast.config.JoinConfig)

Aggregations

RestApiConfig (com.hazelcast.config.RestApiConfig)29 Config (com.hazelcast.config.Config)22 QuickTest (com.hazelcast.test.annotation.QuickTest)11 Test (org.junit.Test)11 HazelcastInstance (com.hazelcast.core.HazelcastInstance)8 MemcacheProtocolConfig (com.hazelcast.config.MemcacheProtocolConfig)6 JoinConfig (com.hazelcast.config.JoinConfig)4 RestEndpointGroup (com.hazelcast.config.RestEndpointGroup)3 HazelcastTestSupport.smallInstanceConfig (com.hazelcast.test.HazelcastTestSupport.smallInstanceConfig)3 RestServerEndpointConfig (com.hazelcast.config.RestServerEndpointConfig)2 AdvancedNetworkConfig (com.hazelcast.config.AdvancedNetworkConfig)1 DiscoveryStrategyConfig (com.hazelcast.config.DiscoveryStrategyConfig)1 NetworkConfig (com.hazelcast.config.NetworkConfig)1 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)1 StringUtil.bytesToString (com.hazelcast.internal.util.StringUtil.bytesToString)1 DiscoveryStrategyFactory (com.hazelcast.spi.discovery.DiscoveryStrategyFactory)1 Before (org.junit.Before)1