Java Code Examples for org.apache.ignite.Ignite#cacheNames()

The following examples show how to use org.apache.ignite.Ignite#cacheNames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GridCacheConfigurationValidationSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception If fails.
 */
@Test
public void testCacheNames() throws Exception {
    try {
        startGridsMultiThreaded(2);

        Collection<String> names = grid(0).cacheNames();

        assertEquals(3, names.size());

        for (String name : names)
            assertTrue(name.equals(CACHE_NAME_WITH_SPECIAL_CHARACTERS_PARTITIONED)
                    || name.equals(CACHE_NAME_WITH_SPECIAL_CHARACTERS_REPLICATED)
                    || DEFAULT_CACHE_NAME.equals(name));

        Ignite client = startClientGrid(2);

        names = client.cacheNames();

        assertEquals(3, names.size());
    }
    finally {
        stopAllGrids();
    }
}
 
Example 2
Source File: WalModeChangeCommonAbstractSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Execute certain logic for all nodes.
 *
 * @param task Task.
 * @throws Exception If failed.
 */
protected void forAllNodes(IgniteInClosureX<Ignite> task) throws Exception {
    for (Ignite node : Ignition.allGrids()) {
        try {
            info("");
            info(">>> Executing test on node: " + node.name());

            task.applyx(node);
        }
        finally {
            for (Ignite node0 : Ignition.allGrids()) {
                Collection<String> cacheNames = node0.cacheNames();

                for (String cacheName : cacheNames)
                    destroyCache(node0, cacheName);
            }
        }
    }
}
 
Example 3
Source File: IgniteSpringDataCrudSelfExpressionTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Tests SpEL expression.
 */
@Test
public void testCacheCount() {
    Ignite ignite = ctx.getBean("igniteInstance", Ignite.class);

    Collection<String> cacheNames = ignite.cacheNames();

    assertFalse("The SpEL \"#{cacheNames.personCacheName}\" isn't processed!",
        cacheNames.contains("#{cacheNames.personCacheName}"));

    assertTrue("Cache \"PersonCache\" isn't found!",
        cacheNames.contains("PersonCache"));
}
 
Example 4
Source File: IgniteSpringDataCrudSelfExpressionTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** */
@Test
public void testCacheCountTWO() {
    Ignite ignite = ctx.getBean("igniteInstanceTWO", Ignite.class);

    Collection<String> cacheNames = ignite.cacheNames();

    assertFalse("The SpEL \"#{cacheNames.personCacheName}\" isn't processed!",
        cacheNames.contains("#{cacheNames.personCacheName}"));

    assertTrue("Cache \"PersonCache\" isn't found!",
        cacheNames.contains("PersonCache"));
}
 
Example 5
Source File: IgniteSpringDataCrudSelfExpressionTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Tests SpEL expression.
 */
@Test
public void testCacheCount() {
    Ignite ignite = ctx.getBean("igniteInstance", Ignite.class);

    Collection<String> cacheNames = ignite.cacheNames();

    assertFalse("The SpEL \"#{cacheNames.personCacheName}\" isn't processed!",
        cacheNames.contains("#{cacheNames.personCacheName}"));

    assertTrue("Cache \"PersonCache\" isn't found!",
        cacheNames.contains("PersonCache"));
}
 
Example 6
Source File: IgniteSpringDataCrudSelfExpressionTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** */
@Test
public void testCacheCountTWO() {
    Ignite ignite = ctx.getBean("igniteInstanceTWO", Ignite.class);

    Collection<String> cacheNames = ignite.cacheNames();

    assertFalse("The SpEL \"#{cacheNames.personCacheName}\" isn't processed!",
        cacheNames.contains("#{cacheNames.personCacheName}"));

    assertTrue("Cache \"PersonCache\" isn't found!",
        cacheNames.contains("PersonCache"));
}