/** @throws Exception If failed. */ public void testSystemCache() throws Exception { CollectionConfiguration colCfg = collectionConfiguration(); IgniteQueue queue = grid(0).queue("Queue1", 0, colCfg); final CacheConfiguration ccfg = getQueueCache(queue); GridTestUtils.assertThrows( log, new Callable<Object>() { @Override public Object call() throws Exception { grid(0).cache(ccfg.getName()); return null; } }, IllegalStateException.class, "Failed to get cache because it is a system cache"); assertNotNull(((IgniteKernal) grid(0)).internalCache(ccfg.getName())); }
/** * @param ignite Ignite instance. * @param ccfg Cache configuration. * @return Data transfer object for cache store configuration properties. */ public static VisorCacheStoreConfiguration from(Ignite ignite, CacheConfiguration ccfg) { VisorCacheStoreConfiguration cfg = new VisorCacheStoreConfiguration(); GridCacheAdapter<Object, Object> c = ((IgniteKernal) ignite).internalCache(ccfg.getName()); CacheStore store = c != null && c.context().started() ? c.context().store().configuredStore() : null; cfg.jdbcStore = store instanceof CacheAbstractJdbcStore; cfg.store = compactClass(store); cfg.storeFactory = compactClass(ccfg.getCacheStoreFactory()); cfg.readThrough = ccfg.isReadThrough(); cfg.writeThrough = ccfg.isWriteThrough(); cfg.writeBehindEnabled = ccfg.isWriteBehindEnabled(); cfg.batchSz = ccfg.getWriteBehindBatchSize(); cfg.flushFreq = ccfg.getWriteBehindFlushFrequency(); cfg.flushSz = ccfg.getWriteBehindFlushSize(); cfg.flushThreadCnt = ccfg.getWriteBehindFlushThreadCount(); return cfg; }