Search in sources :

Example 1 with NO_MONITOR

use of org.neo4j.internal.counts.GBPTreeCountsStore.NO_MONITOR in project neo4j by neo4j.

the class GBPTreeGenericCountsStoreTest method shouldNotStartWithoutFileIfReadOnly.

@Test
void shouldNotStartWithoutFileIfReadOnly() {
    final Path file = directory.file("non-existing");
    final IllegalStateException e = assertThrows(IllegalStateException.class, () -> new GBPTreeCountsStore(pageCache, file, fs, immediate(), CountsBuilder.EMPTY, readOnly(), PageCacheTracer.NULL, NO_MONITOR, DEFAULT_DATABASE_NAME, randomMaxCacheSize()));
    assertTrue(Exceptions.contains(e, t -> t instanceof ReadOnlyDbException));
    assertTrue(Exceptions.contains(e, t -> t instanceof TreeFileNotFoundException));
    assertTrue(Exceptions.contains(e, t -> t instanceof IllegalStateException));
}
Also used : Path(java.nio.file.Path) BeforeEach(org.junit.jupiter.api.BeforeEach) NoSuchFileException(java.nio.file.NoSuchFileException) DatabaseReadOnlyChecker.readOnly(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker.readOnly) RandomExtension(org.neo4j.test.extension.RandomExtension) CursorContext(org.neo4j.io.pagecache.context.CursorContext) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Random(java.util.Random) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) ANY_LABEL(org.neo4j.token.api.TokenConstants.ANY_LABEL) ByteBuffer(java.nio.ByteBuffer) NO_MONITOR(org.neo4j.internal.counts.GBPTreeCountsStore.NO_MONITOR) DEFAULT_DATABASE_NAME(org.neo4j.configuration.GraphDatabaseSettings.DEFAULT_DATABASE_NAME) Future(java.util.concurrent.Future) StoreChannel(org.neo4j.io.fs.StoreChannel) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) RandomRule(org.neo4j.test.rule.RandomRule) Map(java.util.Map) Mockito.doAnswer(org.mockito.Mockito.doAnswer) PageCacheTracer(org.neo4j.io.pagecache.tracing.PageCacheTracer) NULL(org.neo4j.io.pagecache.context.CursorContext.NULL) Path(java.nio.file.Path) Exceptions(org.neo4j.internal.helpers.Exceptions) PageCache(org.neo4j.io.pagecache.PageCache) EMPTY_REBUILD(org.neo4j.internal.counts.GBPTreeGenericCountsStore.EMPTY_REBUILD) ArrayQueueOutOfOrderSequence(org.neo4j.util.concurrent.ArrayQueueOutOfOrderSequence) OtherThreadExecutor.command(org.neo4j.test.OtherThreadExecutor.command) DatabaseReadOnlyChecker.writable(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker.writable) StandardOpenOption(java.nio.file.StandardOpenOption) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) TestDirectory(org.neo4j.test.rule.TestDirectory) String.format(java.lang.String.format) Test(org.junit.jupiter.api.Test) INSTANCE(org.neo4j.memory.EmptyMemoryTracker.INSTANCE) GBPTreeCountsStore.nodeKey(org.neo4j.internal.counts.GBPTreeCountsStore.nodeKey) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Rebuilder(org.neo4j.internal.counts.GBPTreeGenericCountsStore.Rebuilder) EMPTY_LONG_ARRAY(org.apache.commons.lang3.ArrayUtils.EMPTY_LONG_ARRAY) Race.throwing(org.neo4j.test.Race.throwing) MutableBoolean(org.apache.commons.lang3.mutable.MutableBoolean) DatabaseReadOnlyChecker(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker) Assertions.assertDoesNotThrow(org.junit.jupiter.api.Assertions.assertDoesNotThrow) Mockito.mock(org.mockito.Mockito.mock) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) OutOfOrderSequence(org.neo4j.util.concurrent.OutOfOrderSequence) TreeFileNotFoundException(org.neo4j.index.internal.gbptree.TreeFileNotFoundException) HashMap(java.util.HashMap) MINUTES(java.util.concurrent.TimeUnit.MINUTES) BASE_TX_ID(org.neo4j.storageengine.api.TransactionIdStore.BASE_TX_ID) AtomicReference(java.util.concurrent.atomic.AtomicReference) ConcurrentMap(java.util.concurrent.ConcurrentMap) ReadOnlyDbException(org.neo4j.kernel.api.exceptions.ReadOnlyDbException) Inject(org.neo4j.test.extension.Inject) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) GBPTreeCountsStore.relationshipKey(org.neo4j.internal.counts.GBPTreeCountsStore.relationshipKey) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) OtherThreadExecutor(org.neo4j.test.OtherThreadExecutor) MemoryTracker(org.neo4j.memory.MemoryTracker) PageCacheExtension(org.neo4j.test.extension.pagecache.PageCacheExtension) IOException(java.io.IOException) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) AtomicLong(java.util.concurrent.atomic.AtomicLong) RecoveryCleanupWorkCollector.immediate(org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector.immediate) AfterEach(org.junit.jupiter.api.AfterEach) ANY_RELATIONSHIP_TYPE(org.neo4j.token.api.TokenConstants.ANY_RELATIONSHIP_TYPE) Race(org.neo4j.test.Race) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) ReadOnlyDbException(org.neo4j.kernel.api.exceptions.ReadOnlyDbException) TreeFileNotFoundException(org.neo4j.index.internal.gbptree.TreeFileNotFoundException) Test(org.junit.jupiter.api.Test)

Aggregations

IOException (java.io.IOException)1 String.format (java.lang.String.format)1 ByteBuffer (java.nio.ByteBuffer)1 NoSuchFileException (java.nio.file.NoSuchFileException)1 Path (java.nio.file.Path)1 StandardOpenOption (java.nio.file.StandardOpenOption)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Random (java.util.Random)1 Set (java.util.Set)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 Future (java.util.concurrent.Future)1 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)1 TimeUnit (java.util.concurrent.TimeUnit)1 MINUTES (java.util.concurrent.TimeUnit.MINUTES)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 EMPTY_LONG_ARRAY (org.apache.commons.lang3.ArrayUtils.EMPTY_LONG_ARRAY)1 MutableBoolean (org.apache.commons.lang3.mutable.MutableBoolean)1