use of org.apache.ignite.client.ClientClusterGroup in project ignite by apache.
the class ClusterGroupTest method testClusterNodeCaching.
/**
* Test that ClusterNode doesn't requested each time from the server.
*/
@Test
public void testClusterNodeCaching() {
ClientClusterGroup grp = client.cluster().forServers();
Collection<ClusterNode> nodes1 = grp.nodes();
Collection<ClusterNode> nodes2 = grp.nodes();
assertEquals(3, nodes1.size());
assertEquals(3, nodes2.size());
int foundCnt = 0;
for (ClusterNode node1 : nodes1) {
for (ClusterNode node2 : nodes2) {
if (F.eq(node1.id(), node2.id())) {
// Should be exactly the same instance.
assertTrue(node1 == node2);
foundCnt++;
}
}
}
assertEquals(3, foundCnt);
}
Aggregations