use of org.apache.ignite.client.ClientCluster in project ignite by apache.
the class JavaThinClient method cientCluster.
@Test
void cientCluster() throws Exception {
ClientConfiguration clientCfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");
// tag::client-cluster[]
try (IgniteClient client = Ignition.startClient(clientCfg)) {
ClientCluster clientCluster = client.cluster();
clientCluster.state(ClusterState.ACTIVE);
}
// end::client-cluster[]
}
use of org.apache.ignite.client.ClientCluster in project ignite by apache.
the class ClusterApiTest method testClusterState.
/**
* Test change cluster state operation by thin client.
*/
@Test
public void testClusterState() throws Exception {
try (IgniteClient client = startClient(0)) {
ClientCluster clientCluster = client.cluster();
IgniteCluster igniteCluster = grid(0).cluster();
changeAndCheckState(clientCluster, igniteCluster, ClusterState.INACTIVE);
changeAndCheckState(clientCluster, igniteCluster, ClusterState.ACTIVE_READ_ONLY);
changeAndCheckState(clientCluster, igniteCluster, ClusterState.ACTIVE);
changeAndCheckState(clientCluster, igniteCluster, ClusterState.INACTIVE);
}
}
use of org.apache.ignite.client.ClientCluster in project ignite by apache.
the class ClusterApiTest method testWalState.
/**
* Test change WAL state for cache operation by thin client.
*/
@Test
public void testWalState() throws Exception {
try (IgniteClient client = startClient(0)) {
ClientCluster clientCluster = client.cluster();
IgniteCluster igniteCluster = grid(0).cluster();
igniteCluster.state(ClusterState.ACTIVE);
grid(0).getOrCreateCache(DEFAULT_CACHE_NAME);
igniteCluster.disableWal(DEFAULT_CACHE_NAME);
// Check enable WAL operation.
assertTrue(clientCluster.enableWal(DEFAULT_CACHE_NAME));
assertTrue(clientCluster.isWalEnabled(DEFAULT_CACHE_NAME));
assertTrue(igniteCluster.isWalEnabled(DEFAULT_CACHE_NAME));
// Check enable WAL operation on already enabled WAL.
assertFalse(clientCluster.enableWal(DEFAULT_CACHE_NAME));
assertTrue(clientCluster.isWalEnabled(DEFAULT_CACHE_NAME));
assertTrue(igniteCluster.isWalEnabled(DEFAULT_CACHE_NAME));
// Check disable WAL operation.
assertTrue(clientCluster.disableWal(DEFAULT_CACHE_NAME));
assertFalse(clientCluster.isWalEnabled(DEFAULT_CACHE_NAME));
assertFalse(igniteCluster.isWalEnabled(DEFAULT_CACHE_NAME));
// Check disable WAL operation on already disabled WAL.
assertFalse(clientCluster.disableWal(DEFAULT_CACHE_NAME));
assertFalse(clientCluster.isWalEnabled(DEFAULT_CACHE_NAME));
assertFalse(igniteCluster.isWalEnabled(DEFAULT_CACHE_NAME));
}
}
Aggregations