use of com.hazelcast.client.config.ClientFailoverConfig in project hazelcast by hazelcast.
the class FailoverTest method testFailoverNotSupportedInCommunityVersion.
@Test(expected = IllegalStateException.class)
public void testFailoverNotSupportedInCommunityVersion() {
Config config1 = new Config();
config1.setClusterName("dev1");
config1.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config1.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true);
HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config1);
Config config2 = new Config();
config2.setClusterName("dev2");
config2.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config2.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true);
HazelcastInstance instance2 = Hazelcast.newHazelcastInstance(config2);
ClientConfig clientConfig = new ClientConfig();
clientConfig.setClusterName("dev1");
ClientNetworkConfig networkConfig = clientConfig.getNetworkConfig();
Member member1 = (Member) instance1.getLocalEndpoint();
Address address1 = member1.getAddress();
networkConfig.setAddresses(Collections.singletonList(address1.getHost() + ":" + address1.getPort()));
ClientConfig clientConfig2 = new ClientConfig();
clientConfig2.setClusterName("dev2");
ClientNetworkConfig networkConfig2 = clientConfig2.getNetworkConfig();
Member member2 = (Member) instance2.getLocalEndpoint();
Address address2 = member2.getAddress();
networkConfig2.setAddresses(Collections.singletonList(address2.getHost() + ":" + address2.getPort()));
ClientFailoverConfig clientFailoverConfig = new ClientFailoverConfig();
clientFailoverConfig.addClientConfig(clientConfig).addClientConfig(clientConfig2).setTryCount(1);
HazelcastClient.newHazelcastFailoverClient(clientFailoverConfig);
}
use of com.hazelcast.client.config.ClientFailoverConfig in project hazelcast by hazelcast.
the class FailoverConfigTest method testClientConfigWithDifferentClusterName.
@Test
public void testClientConfigWithDifferentClusterName() {
ClientFailoverConfig clientFailoverConfig = new ClientFailoverConfig();
clientFailoverConfig.addClientConfig(new ClientConfig());
ClientConfig alternativeConfig = new ClientConfig();
alternativeConfig.setClusterName("alternative");
clientFailoverConfig.addClientConfig(alternativeConfig);
resolveClientFailoverConfig(clientFailoverConfig);
}
Aggregations