Search in sources :

Example 16 with ClusterGroup

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();
}
Also used : ClusterGroup(org.apache.ignite.cluster.ClusterGroup)

Example 17 with ClusterGroup

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;
}
Also used : JobEvent(org.apache.ignite.events.JobEvent) TaskEvent(org.apache.ignite.events.TaskEvent) Event(org.apache.ignite.events.Event) ClusterGroup(org.apache.ignite.cluster.ClusterGroup)

Example 18 with ClusterGroup

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());
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) ClusterGroup(org.apache.ignite.cluster.ClusterGroup)

Example 19 with ClusterGroup

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());
}
Also used : ClusterGroup(org.apache.ignite.cluster.ClusterGroup)

Example 20 with ClusterGroup

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());
}
Also used : ClusterGroup(org.apache.ignite.cluster.ClusterGroup) Ignite(org.apache.ignite.Ignite)

Aggregations

ClusterGroup (org.apache.ignite.cluster.ClusterGroup)80 Ignite (org.apache.ignite.Ignite)42 UUID (java.util.UUID)21 CountDownLatch (java.util.concurrent.CountDownLatch)16 ClusterNode (org.apache.ignite.cluster.ClusterNode)14 IgniteException (org.apache.ignite.IgniteException)8 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 IgniteCompute (org.apache.ignite.IgniteCompute)5 GridConcurrentHashSet (org.apache.ignite.internal.util.GridConcurrentHashSet)5 ArrayList (java.util.ArrayList)4 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)4 IgniteEx (org.apache.ignite.internal.IgniteEx)4 Map (java.util.Map)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 IgniteClusterEx (org.apache.ignite.internal.cluster.IgniteClusterEx)3 GridAbsPredicate (org.apache.ignite.internal.util.lang.GridAbsPredicate)3 List (java.util.List)2 CacheException (javax.cache.CacheException)2 IgniteClientDisconnectedException (org.apache.ignite.IgniteClientDisconnectedException)2 IgniteCluster (org.apache.ignite.IgniteCluster)2