Search in sources :

Example 1 with ClientFailoverConfig

use of com.hazelcast.client.config.ClientFailoverConfig in project hazelcast by hazelcast.

the class TestSpringClientFailoverContext method testBlueGreenClient.

@Test
public void testBlueGreenClient() {
    HazelcastClientProxy blueGreenClient = applicationContext.getBean("blueGreenClient", HazelcastClientProxy.class);
    ClientFailoverConfig failoverConfig = blueGreenClient.client.getFailoverConfig();
    List<ClientConfig> clientConfigs = failoverConfig.getClientConfigs();
    assertEquals(2, clientConfigs.size());
    assertEquals("spring-cluster", clientConfigs.get(0).getClusterName());
    assertEquals("alternativeClusterName", clientConfigs.get(1).getClusterName());
    assertEquals(5, failoverConfig.getTryCount());
    blueGreenClient.shutdown();
}
Also used : ClientFailoverConfig(com.hazelcast.client.config.ClientFailoverConfig) HazelcastClientProxy(com.hazelcast.client.impl.clientside.HazelcastClientProxy) ClientConfig(com.hazelcast.client.config.ClientConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 2 with ClientFailoverConfig

use of com.hazelcast.client.config.ClientFailoverConfig in project hazelcast by hazelcast.

the class FailoverConfigTest method testClientConfigWith_withAnInvalidChange.

@Test(expected = InvalidConfigurationException.class)
public void testClientConfigWith_withAnInvalidChange() {
    ClientFailoverConfig clientFailoverConfig = new ClientFailoverConfig();
    clientFailoverConfig.addClientConfig(new ClientConfig());
    ClientConfig alternativeConfig = new ClientConfig();
    alternativeConfig.setClusterName("alternative");
    alternativeConfig.setProperty("newProperty", "newValue");
    clientFailoverConfig.addClientConfig(alternativeConfig);
    resolveClientFailoverConfig(clientFailoverConfig);
}
Also used : ClientFailoverConfig(com.hazelcast.client.config.ClientFailoverConfig) FailoverClientConfigSupport.resolveClientFailoverConfig(com.hazelcast.client.impl.clientside.FailoverClientConfigSupport.resolveClientFailoverConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 3 with ClientFailoverConfig

use of com.hazelcast.client.config.ClientFailoverConfig in project hazelcast by hazelcast.

the class FailoverConfigTest method testClientConfigWithSameClusterName.

@Test
public void testClientConfigWithSameClusterName() {
    ClientFailoverConfig clientFailoverConfig = new ClientFailoverConfig();
    clientFailoverConfig.addClientConfig(new ClientConfig());
    clientFailoverConfig.addClientConfig(new ClientConfig());
    resolveClientFailoverConfig(clientFailoverConfig);
}
Also used : ClientFailoverConfig(com.hazelcast.client.config.ClientFailoverConfig) FailoverClientConfigSupport.resolveClientFailoverConfig(com.hazelcast.client.impl.clientside.FailoverClientConfigSupport.resolveClientFailoverConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 4 with ClientFailoverConfig

use of com.hazelcast.client.config.ClientFailoverConfig in project hazelcast by hazelcast.

the class FailoverConfigTest method test_throwsException_whenFailoverConfigIsIntended_butPassedNull.

@Test(expected = HazelcastException.class)
public void test_throwsException_whenFailoverConfigIsIntended_butPassedNull() {
    ClientFailoverConfig clientFailoverConfig = resolveClientFailoverConfig(null);
    assertEquals(1, clientFailoverConfig.getClientConfigs().size());
    assertEquals("dev", clientFailoverConfig.getClientConfigs().get(0).getClusterName());
}
Also used : ClientFailoverConfig(com.hazelcast.client.config.ClientFailoverConfig) FailoverClientConfigSupport.resolveClientFailoverConfig(com.hazelcast.client.impl.clientside.FailoverClientConfigSupport.resolveClientFailoverConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 5 with ClientFailoverConfig

use of com.hazelcast.client.config.ClientFailoverConfig in project hazelcast by hazelcast.

the class FailoverConfigTest method testClientConfigWith_withAValidChange.

@Test
public void testClientConfigWith_withAValidChange() {
    ClientFailoverConfig clientFailoverConfig = new ClientFailoverConfig();
    clientFailoverConfig.addClientConfig(new ClientConfig());
    ClientConfig alternativeConfig = new ClientConfig();
    alternativeConfig.setClusterName("alternative");
    CredentialsFactoryConfig credentialsFactoryConfig = new CredentialsFactoryConfig();
    credentialsFactoryConfig.setClassName("CustomCredentials");
    alternativeConfig.getSecurityConfig().setCredentialsFactoryConfig(credentialsFactoryConfig);
    clientFailoverConfig.addClientConfig(alternativeConfig);
    resolveClientFailoverConfig(clientFailoverConfig);
}
Also used : CredentialsFactoryConfig(com.hazelcast.config.CredentialsFactoryConfig) ClientFailoverConfig(com.hazelcast.client.config.ClientFailoverConfig) FailoverClientConfigSupport.resolveClientFailoverConfig(com.hazelcast.client.impl.clientside.FailoverClientConfigSupport.resolveClientFailoverConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

ClientFailoverConfig (com.hazelcast.client.config.ClientFailoverConfig)7 QuickTest (com.hazelcast.test.annotation.QuickTest)7 Test (org.junit.Test)7 ClientConfig (com.hazelcast.client.config.ClientConfig)6 FailoverClientConfigSupport.resolveClientFailoverConfig (com.hazelcast.client.impl.clientside.FailoverClientConfigSupport.resolveClientFailoverConfig)5 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)5 ClientNetworkConfig (com.hazelcast.client.config.ClientNetworkConfig)1 HazelcastClientProxy (com.hazelcast.client.impl.clientside.HazelcastClientProxy)1 Address (com.hazelcast.cluster.Address)1 Member (com.hazelcast.cluster.Member)1 Config (com.hazelcast.config.Config)1 CredentialsFactoryConfig (com.hazelcast.config.CredentialsFactoryConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1