/** * @param cache Cache. */ private void checkCache(GridCacheAdapter cache) { assertNotNull(cache); assertFalse(cache.context().userCache()); assertTrue(cache.context().systemTx()); assertEquals(SYSTEM_POOL, cache.context().ioPolicy()); } }
/** * @param ignite Ignite. * @param dataCacheName Data cache name. * @param metaCacheName Meta cache name. */ private void checkIgfsCaches(final Ignite ignite, final String dataCacheName, final String metaCacheName) { GridTestUtils.assertThrows(log(), new Callable<Object>() { @Override public Object call() throws Exception { ignite.cache(dataCacheName); return null; } }, IllegalStateException.class, null); GridTestUtils.assertThrows(log(), new Callable<Object>() { @Override public Object call() throws Exception { ignite.cache(metaCacheName); return null; } }, IllegalStateException.class, null); checkCache(((IgniteKernal)ignite).internalCache(dataCacheName)); checkCache(((IgniteKernal)ignite).internalCache(metaCacheName)); }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); stopAllGrids(); }
/** * @throws Exception If failed. */ @Test public void testCacheStart() throws Exception { Ignite g0 = G.start(config(true, 0)); String dataCacheName = ((IgniteEx)g0).igfsx("igfs").configuration().getDataCacheConfiguration().getName(); String metaCacheName = ((IgniteEx)g0).igfsx("igfs").configuration().getMetaCacheConfiguration().getName(); checkIgfsCaches(g0, dataCacheName, metaCacheName); Ignite g1 = G.start(config(false, 1)); checkIgfsCaches(g1, dataCacheName, metaCacheName); IgniteFileSystem igfs = g0.fileSystem("igfs"); igfs.mkdirs(new IgfsPath("/test")); try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(igfs.create( new IgfsPath("/test/test.file"), true)))) { for (int i = 0; i < 1000; i++) bw.write("test-" + i); } }