use of org.apache.ignite.cluster.ClusterGroup in project ignite by apache.
the class GridProjectionForCachesOnDaemonNodeSelfTest method testForCacheNodes.
/**
* @throws Exception If failed.
*/
public void testForCacheNodes() throws Exception {
ClusterGroup grp = ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
assertFalse(grp.nodes().isEmpty());
try {
daemon.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
} catch (IllegalStateException ignored) {
return;
}
fail();
}
use of org.apache.ignite.cluster.ClusterGroup in project ignite by apache.
the class GridEventStorageSelfTest method testRemoteNodeEventStorage.
/**
* @throws Exception In case of error.
*/
public void testRemoteNodeEventStorage() throws Exception {
IgnitePredicate<Event> filter = new TestEventFilter();
generateEvents(ignite2);
ClusterGroup prj = ignite1.cluster().forPredicate(F.remoteNodes(ignite1.cluster().localNode().id()));
Collection<Event> evts = events(prj).remoteQuery(filter, 0);
assert evts != null;
assert evts.size() == 1;
}
use of org.apache.ignite.cluster.ClusterGroup in project ignite by apache.
the class GridSelfTest method testForOthers.
/**
* @throws Exception If failed.
*/
public void testForOthers() throws Exception {
ClusterNode node0 = grid(0).localNode();
ClusterNode node1 = grid(1).localNode();
ClusterNode node2 = grid(2).localNode();
ClusterNode node3 = grid(3).localNode();
ClusterGroup p1 = grid(0).cluster().forOthers(node0);
assertEquals(3, p1.nodes().size());
assertEquals(2, p1.forOthers(node1).nodes().size());
assertEquals(1, p1.forOthers(node1, node2).nodes().size());
assertEquals(1, grid(0).cluster().forOthers(node1, node2, node3).nodes().size());
}
use of org.apache.ignite.cluster.ClusterGroup in project ignite by apache.
the class GridProjectionForCachesSelfTest method testProjectionForNamedCache.
/**
* @throws Exception If failed.
*/
public void testProjectionForNamedCache() throws Exception {
ClusterGroup prj = ignite.cluster().forCacheNodes(CACHE_NAME);
assert prj != null;
assertEquals("Invalid projection: " + prj.nodes(), 3, prj.nodes().size());
assert !prj.nodes().contains(grid(0).localNode());
assert prj.nodes().contains(grid(1).localNode());
assert prj.nodes().contains(grid(2).localNode());
assert prj.nodes().contains(grid(3).localNode());
assert !prj.nodes().contains(grid(4).localNode());
}
use of org.apache.ignite.cluster.ClusterGroup in project ignite by apache.
the class GridCachePartitionedProjectionAffinitySelfTest method testProjectionAffinity.
/** @throws Exception If failed. */
@SuppressWarnings("deprecation")
public void testProjectionAffinity() throws Exception {
waitTopologyUpdate();
Ignite g0 = grid(0);
Ignite g1 = grid(1);
ClusterGroup g0Pinned = g0.cluster().forNodeIds(F.asList(g0.cluster().localNode().id()));
ClusterGroup g01Pinned = g1.cluster().forNodeIds(F.asList(g0.cluster().localNode().id(), g1.cluster().localNode().id()));
for (int i = 0; i < 100; i++) assertEquals(g0Pinned.ignite().affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).id(), g01Pinned.ignite().affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).id());
}
Aggregations