@Override protected void clearInternal(final Resource... contexts) throws SailException { if (contexts == null || contexts.length == 0) { _crdf.clear(); } else { Arrays.stream(contexts).parallel().forEach(context -> { try { ((QuadStore) _crdf).removeData(new Value[] { null, null, null, context}); } catch (final Exception exception) { LOGGER.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE, exception); } }); } }
@Override protected void clearInternal(final Resource... contexts) throws SailException { if (contexts == null || contexts.length == 0) { _crdf.clear(); } else { Arrays.stream(contexts).parallel().forEach(context -> { try { ((QuadStore) _crdf).removeData(new Value[] { null, null, null, context}); } catch (final Exception exception) { LOGGER.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE, exception); } }); } }
/** * Tests if the normal indexes are cleared correctly. * * @throws Exception never, otherwise the tests fail. */ @Test public void testClear() throws Exception { _tripleStore.clear(); assertEmptyIterator("clear(): Triple indexes", _tripleStore.query(SELECT_ALL_TRIPLES_PATTERN)); } }
/** * Cleans up the given store. * * @param crdf could be a triple or a quad store. * @throws CumulusStoreException in case the cleanup fails. */ public static void clean(final Store crdf) throws CumulusStoreException { crdf.clear(); assertEquals("Store seems not empty after issuing a delete * command.", 0, numOfRes(crdf.query(crdf instanceof TripleStore ? SELECT_ALL_TRIPLES_PATTERN : SELECT_ALL_QUADS_PATTERN))); }
TRIPLE_STORE.clear(); assertTrue("store should be empty", !TRIPLE_STORE.query(new Value[] { null, null, null }).hasNext());
/** * Shutdown repository and store. * * @throws Exception mmm...hopefully never otherwise tests will fail. */ @AfterClass public static void shutdown() throws Exception { if (_repository != null) { _repository.shutDown(); } if (_sail != null) { _sail.shutDown(); } if (_tripleStore != null) { if (_tripleStore.isOpen()) { _tripleStore.clear(); } _tripleStore.close(); } if (_quadStore != null) { if (_quadStore.isOpen()) { _quadStore.clear(); } _quadStore.close(); } }