Search in sources :

Example 31 with NULL

use of org.neo4j.io.pagecache.context.CursorContext.NULL in project neo4j by neo4j.

the class SchemaStorageReadAndWriteTest method before.

@BeforeAll
void before() throws Exception {
    testDirectory.prepareDirectory(getClass(), "test");
    var storeFactory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, NullLogProvider.getInstance(), PageCacheTracer.NULL, writable());
    neoStores = storeFactory.openNeoStores(true, StoreType.SCHEMA, StoreType.PROPERTY_KEY_TOKEN, StoreType.LABEL_TOKEN, StoreType.RELATIONSHIP_TYPE_TOKEN);
    AtomicInteger tokenIdCounter = new AtomicInteger();
    TokenCreator tokenCreator = (name, internal) -> tokenIdCounter.incrementAndGet();
    TokenHolders tokens = new TokenHolders(new DelegatingTokenHolder(tokenCreator, TokenHolder.TYPE_PROPERTY_KEY), new DelegatingTokenHolder(tokenCreator, TokenHolder.TYPE_LABEL), new DelegatingTokenHolder(tokenCreator, TokenHolder.TYPE_RELATIONSHIP_TYPE));
    tokens.setInitialTokens(StoreTokens.allTokens(neoStores), NULL);
    tokenIdCounter.set(Math.max(tokenIdCounter.get(), tokens.propertyKeyTokens().size()));
    tokenIdCounter.set(Math.max(tokenIdCounter.get(), tokens.labelTokens().size()));
    tokenIdCounter.set(Math.max(tokenIdCounter.get(), tokens.relationshipTypeTokens().size()));
    storage = new SchemaStorage(neoStores.getSchemaStore(), tokens, () -> KernelVersion.LATEST);
}
Also used : RepeatedTest(org.junit.jupiter.api.RepeatedTest) SchemaRule(org.neo4j.internal.schema.SchemaRule) TokenCreator(org.neo4j.token.TokenCreator) KernelVersion(org.neo4j.kernel.KernelVersion) Config(org.neo4j.configuration.Config) NullLogProvider(org.neo4j.logging.NullLogProvider) DatabaseLayout(org.neo4j.io.layout.DatabaseLayout) AfterAll(org.junit.jupiter.api.AfterAll) TokenHolder(org.neo4j.token.api.TokenHolder) TestInstance(org.junit.jupiter.api.TestInstance) NeoStores(org.neo4j.kernel.impl.store.NeoStores) Inject(org.neo4j.test.extension.Inject) BeforeAll(org.junit.jupiter.api.BeforeAll) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DelegatingTokenHolder(org.neo4j.token.DelegatingTokenHolder) PageCacheTracer(org.neo4j.io.pagecache.tracing.PageCacheTracer) NULL(org.neo4j.io.pagecache.context.CursorContext.NULL) PageCache(org.neo4j.io.pagecache.PageCache) DatabaseReadOnlyChecker.writable(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker.writable) TestDirectory(org.neo4j.test.rule.TestDirectory) EphemeralPageCacheExtension(org.neo4j.test.extension.pagecache.EphemeralPageCacheExtension) RecoveryCleanupWorkCollector.immediate(org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector.immediate) EphemeralNeo4jLayoutExtension(org.neo4j.test.extension.EphemeralNeo4jLayoutExtension) INSTANCE(org.neo4j.memory.EmptyMemoryTracker.INSTANCE) TokenHolders(org.neo4j.token.TokenHolders) EphemeralFileSystemAbstraction(org.neo4j.io.fs.EphemeralFileSystemAbstraction) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreType(org.neo4j.kernel.impl.store.StoreType) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) TokenHolders(org.neo4j.token.TokenHolders) TokenCreator(org.neo4j.token.TokenCreator) DelegatingTokenHolder(org.neo4j.token.DelegatingTokenHolder) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

NULL (org.neo4j.io.pagecache.context.CursorContext.NULL)31 Test (org.junit.jupiter.api.Test)25 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)23 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)22 IOException (java.io.IOException)20 Inject (org.neo4j.test.extension.Inject)20 ArrayList (java.util.ArrayList)19 Assertions.assertFalse (org.junit.jupiter.api.Assertions.assertFalse)19 List (java.util.List)18 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)18 INSTANCE (org.neo4j.memory.EmptyMemoryTracker.INSTANCE)18 PageCache (org.neo4j.io.pagecache.PageCache)17 CursorContext (org.neo4j.io.pagecache.context.CursorContext)17 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)16 Path (java.nio.file.Path)15 DefaultPageCacheTracer (org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer)15 RandomRule (org.neo4j.test.rule.RandomRule)15 BeforeEach (org.junit.jupiter.api.BeforeEach)14 Config (org.neo4j.configuration.Config)14 PageCacheTracer (org.neo4j.io.pagecache.tracing.PageCacheTracer)14