Search in sources :

Example 6 with MulticastConfig

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

the class DiscoverySpiTest method testParsing.

@Test
public void testParsing() throws Exception {
    String xmlFileName = "test-hazelcast-discovery-spi.xml";
    InputStream xmlResource = DiscoverySpiTest.class.getClassLoader().getResourceAsStream(xmlFileName);
    Config config = new XmlConfigBuilder(xmlResource).build();
    JoinConfig joinConfig = config.getNetworkConfig().getJoin();
    AwsConfig awsConfig = joinConfig.getAwsConfig();
    assertFalse(awsConfig.isEnabled());
    TcpIpConfig tcpIpConfig = joinConfig.getTcpIpConfig();
    assertFalse(tcpIpConfig.isEnabled());
    MulticastConfig multicastConfig = joinConfig.getMulticastConfig();
    assertFalse(multicastConfig.isEnabled());
    DiscoveryConfig discoveryConfig = joinConfig.getDiscoveryConfig();
    assertTrue(discoveryConfig.isEnabled());
    assertEquals(1, discoveryConfig.getDiscoveryStrategyConfigs().size());
    DiscoveryStrategyConfig providerConfig = discoveryConfig.getDiscoveryStrategyConfigs().iterator().next();
    assertEquals(3, providerConfig.getProperties().size());
    assertEquals("foo", providerConfig.getProperties().get("key-string"));
    assertEquals("123", providerConfig.getProperties().get("key-int"));
    assertEquals("true", providerConfig.getProperties().get("key-boolean"));
}
Also used : AwsConfig(com.hazelcast.config.AwsConfig) XmlConfigBuilder(com.hazelcast.config.XmlConfigBuilder) DiscoveryStrategyConfig(com.hazelcast.config.DiscoveryStrategyConfig) InputStream(java.io.InputStream) AwsConfig(com.hazelcast.config.AwsConfig) DiscoveryStrategyConfig(com.hazelcast.config.DiscoveryStrategyConfig) MulticastConfig(com.hazelcast.config.MulticastConfig) JoinConfig(com.hazelcast.config.JoinConfig) Config(com.hazelcast.config.Config) DiscoveryConfig(com.hazelcast.config.DiscoveryConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig) InterfacesConfig(com.hazelcast.config.InterfacesConfig) JoinConfig(com.hazelcast.config.JoinConfig) MulticastConfig(com.hazelcast.config.MulticastConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig) DiscoveryConfig(com.hazelcast.config.DiscoveryConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 7 with MulticastConfig

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

the class MulticastJoinTest method test_whenDifferentBuildNumber.

@Test
public void test_whenDifferentBuildNumber() {
    Config config = new Config();
    JoinConfig join = config.getNetworkConfig().getJoin();
    MulticastConfig multicastConfig = join.getMulticastConfig();
    multicastConfig.setEnabled(true);
    join.getTcpIpConfig().setEnabled(false);
    testJoin_With_DifferentBuildNumber(config);
}
Also used : Config(com.hazelcast.config.Config) MulticastConfig(com.hazelcast.config.MulticastConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig) InterfacesConfig(com.hazelcast.config.InterfacesConfig) PartitionGroupConfig(com.hazelcast.config.PartitionGroupConfig) JoinConfig(com.hazelcast.config.JoinConfig) MulticastConfig(com.hazelcast.config.MulticastConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with MulticastConfig

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

the class MulticastJoinTest method test.

@Test
public void test() throws Exception {
    Config config = new Config();
    NetworkConfig networkConfig = config.getNetworkConfig();
    JoinConfig join = networkConfig.getJoin();
    join.getTcpIpConfig().setEnabled(false);
    MulticastConfig multicastConfig = join.getMulticastConfig();
    multicastConfig.setEnabled(true);
    testJoin(config);
}
Also used : Config(com.hazelcast.config.Config) MulticastConfig(com.hazelcast.config.MulticastConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig) InterfacesConfig(com.hazelcast.config.InterfacesConfig) PartitionGroupConfig(com.hazelcast.config.PartitionGroupConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig) MulticastConfig(com.hazelcast.config.MulticastConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

MulticastConfig (com.hazelcast.config.MulticastConfig)8 JoinConfig (com.hazelcast.config.JoinConfig)7 Config (com.hazelcast.config.Config)6 InterfacesConfig (com.hazelcast.config.InterfacesConfig)4 NetworkConfig (com.hazelcast.config.NetworkConfig)4 QuickTest (com.hazelcast.test.annotation.QuickTest)4 Test (org.junit.Test)4 PartitionGroupConfig (com.hazelcast.config.PartitionGroupConfig)3 TcpIpConfig (com.hazelcast.config.TcpIpConfig)3 XmlConfigBuilder (com.hazelcast.config.XmlConfigBuilder)2 AwsConfig (com.hazelcast.config.AwsConfig)1 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)1 DiscoveryStrategyConfig (com.hazelcast.config.DiscoveryStrategyConfig)1 MapConfig (com.hazelcast.config.MapConfig)1 MaxSizeConfig (com.hazelcast.config.MaxSizeConfig)1 HazelcastSerializationException (com.hazelcast.nio.serialization.HazelcastSerializationException)1 EOFException (java.io.EOFException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InetSocketAddress (java.net.InetSocketAddress)1