Search in sources :

Example 1 with CacheGroupView

use of org.apache.ignite.spi.systemview.view.CacheGroupView in project ignite by apache.

the class SystemViewSelfTest method testCacheGroupsView.

/**
 * Tests work of {@link SystemView} for cache groups.
 */
@Test
public void testCacheGroupsView() throws Exception {
    try (IgniteEx g = startGrid()) {
        Set<String> grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2"));
        for (String grpName : grpNames) g.createCache(new CacheConfiguration<>("cache-" + grpName).setGroupName(grpName));
        SystemView<CacheGroupView> grps = g.context().systemView().view(CACHE_GRPS_VIEW);
        assertEquals(g.context().cache().cacheGroupDescriptors().size(), F.size(grps.iterator()));
        for (CacheGroupView row : grps) grpNames.remove(row.cacheGroupName());
        assertTrue(grpNames.toString(), grpNames.isEmpty());
    }
}
Also used : CacheGroupView(org.apache.ignite.spi.systemview.view.CacheGroupView) IgniteEx(org.apache.ignite.internal.IgniteEx) HashSet(java.util.HashSet) Test(org.junit.Test) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)

Aggregations

HashSet (java.util.HashSet)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 CacheGroupView (org.apache.ignite.spi.systemview.view.CacheGroupView)1 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)1 Test (org.junit.Test)1