Search in sources :

Example 6 with IgniteClusterNode

use of org.apache.ignite.internal.managers.discovery.IgniteClusterNode in project ignite by apache.

the class CacheMetricsForClusterGroupSelfTest method testMetricsDiscoveryUpdatesDisabled.

/**
 * Tests that only local metrics are updating if discovery updates disabled.
 */
@Test
public void testMetricsDiscoveryUpdatesDisabled() throws Exception {
    System.setProperty(IgniteSystemProperties.IGNITE_DISCOVERY_DISABLE_CACHE_METRICS_UPDATE, "true");
    try {
        startGrids();
        try {
            createCaches(true);
            populateCacheData(cache1, ENTRY_CNT_CACHE1);
            populateCacheData(cache2, ENTRY_CNT_CACHE2);
            readCacheData(cache1, ENTRY_CNT_CACHE1);
            readCacheData(cache2, ENTRY_CNT_CACHE2);
            awaitMetricsUpdate(1);
            Collection<ClusterNode> nodes = grid(0).cluster().forRemotes().nodes();
            for (ClusterNode node : nodes) {
                Map<Integer, CacheMetrics> metrics = ((IgniteClusterNode) node).cacheMetrics();
                assertNotNull(metrics);
                assertTrue(metrics.isEmpty());
            }
            assertOnlyLocalMetricsUpdating(CACHE1);
            assertOnlyLocalMetricsUpdating(CACHE2);
        } finally {
            stopAllGrids();
        }
    } finally {
        System.setProperty(IgniteSystemProperties.IGNITE_DISCOVERY_DISABLE_CACHE_METRICS_UPDATE, "false");
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteClusterNode(org.apache.ignite.internal.managers.discovery.IgniteClusterNode) CacheMetrics(org.apache.ignite.cache.CacheMetrics) IgniteClusterNode(org.apache.ignite.internal.managers.discovery.IgniteClusterNode) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

IgniteClusterNode (org.apache.ignite.internal.managers.discovery.IgniteClusterNode)6 ClusterNode (org.apache.ignite.cluster.ClusterNode)5 CacheMetrics (org.apache.ignite.cache.CacheMetrics)3 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)3 Test (org.junit.Test)3 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 InetAddress (java.net.InetAddress)1 ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1 BaselineNode (org.apache.ignite.cluster.BaselineNode)1 ClusterTopologyCheckedException (org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)1