use of com.hazelcast.config.NetworkConfig in project hazelcast by hazelcast.
the class TcpIpJoinTest method test_whenHostUnresolvable.
@Test
public void test_whenHostUnresolvable() {
Config config = new Config();
NetworkConfig networkConfig = config.getNetworkConfig();
JoinConfig join = networkConfig.getJoin();
join.getMulticastConfig().setEnabled(false);
TcpIpConfig tcpIpConfig = join.getTcpIpConfig();
tcpIpConfig.setEnabled(true);
tcpIpConfig.addMember("localhost");
tcpIpConfig.addMember("nonexistinghost");
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
assertClusterSize(1, hz);
}
use of com.hazelcast.config.NetworkConfig in project hazelcast by hazelcast.
the class TcpIpJoinTest method test_whenHostAndInterfacesConfigured.
@Test
public void test_whenHostAndInterfacesConfigured() throws Exception {
System.clearProperty("hazelcast.local.localAddress");
final Config config = new Config();
config.setProperty("hazelcast.socket.bind.any", "false");
final NetworkConfig networkConfig = config.getNetworkConfig();
networkConfig.setPort(5701).setPortAutoIncrement(true).getInterfaces().addInterface("127.0.0.1").setEnabled(true);
final JoinConfig joinConfig = networkConfig.getJoin();
joinConfig.getMulticastConfig().setEnabled(false);
joinConfig.getAwsConfig().setEnabled(false);
joinConfig.getTcpIpConfig().addMember("localhost:5701").addMember("localhost:5702").setEnabled(true);
testJoin(config);
}
use of com.hazelcast.config.NetworkConfig in project hazelcast by hazelcast.
the class TcpIpJoinTest method test_whenExplicitPortConfigured.
@Test
public void test_whenExplicitPortConfigured() throws Exception {
Config config = new Config();
NetworkConfig networkConfig = config.getNetworkConfig();
JoinConfig join = networkConfig.getJoin();
join.getMulticastConfig().setEnabled(false);
TcpIpConfig tcpIpConfig = join.getTcpIpConfig();
tcpIpConfig.setEnabled(true);
tcpIpConfig.addMember("127.0.0.1:5701");
tcpIpConfig.addMember("127.0.0.1:5702");
testJoin(config);
}
use of com.hazelcast.config.NetworkConfig in project hazelcast by hazelcast.
the class PartitionServiceBeanDTOTest method createInstanceWithPublicAddress.
private HazelcastInstance createInstanceWithPublicAddress(String publicAddress) {
try {
Config config = getConfig();
NetworkConfig networkConfig = config.getNetworkConfig();
networkConfig.setPublicAddress(publicAddress);
return Hazelcast.newHazelcastInstance(config);
} catch (RuntimeException e) {
if (e.getCause() instanceof UnknownHostException) {
// internet access and/or DNS resolver are not available
return null;
}
throw e;
}
}
use of com.hazelcast.config.NetworkConfig in project hazelcast by hazelcast.
the class NodeIOServiceTest method setUp.
@Before
public void setUp() {
Node mockNode = mock(Node.class);
NodeEngineImpl mockNodeEngine = mock(NodeEngineImpl.class);
ioService = new NodeIOService(mockNode, mockNodeEngine);
Config config = new Config();
networkConfig = config.getNetworkConfig();
when(mockNode.getConfig()).thenReturn(config);
}
Aggregations