Search in sources :

Example 1 with VisibleForTesting

use of org.neo4j.util.VisibleForTesting in project neo4j by neo4j.

the class SetInitialPasswordCommand method loadNeo4jConfig.

@VisibleForTesting
Config loadNeo4jConfig() {
    Config cfg = Config.newBuilder().set(GraphDatabaseSettings.neo4j_home, ctx.homeDir().toAbsolutePath()).fromFileNoThrow(ctx.confDir().resolve(Config.DEFAULT_CONFIG_FILE_NAME)).commandExpansion(allowCommandExpansion).build();
    ConfigUtils.disableAllConnectors(cfg);
    return cfg;
}
Also used : Config(org.neo4j.configuration.Config) VisibleForTesting(org.neo4j.util.VisibleForTesting)

Example 2 with VisibleForTesting

use of org.neo4j.util.VisibleForTesting in project neo4j by neo4j.

the class AdminTool method execute.

@SuppressWarnings("InstantiationOfUtilityClass")
@VisibleForTesting
public static int execute(ExecutionContext ctx, String... args) {
    PrintWriter out = new PrintWriter(ctx.out(), true);
    final var cmd = new CommandLine(new AdminTool()).setOut(out).setErr(new PrintWriter(ctx.err(), true)).setUsageHelpWidth(120).setCaseInsensitiveEnumValuesAllowed(true);
    registerCommands(cmd, ctx, Services.loadAll(CommandProvider.class));
    if (args.length == 0) {
        cmd.usage(out);
        return ExitCode.USAGE;
    }
    return cmd.execute(args);
}
Also used : CommandLine(picocli.CommandLine) PrintWriter(java.io.PrintWriter) VisibleForTesting(org.neo4j.util.VisibleForTesting)

Example 3 with VisibleForTesting

use of org.neo4j.util.VisibleForTesting in project neo4j by neo4j.

the class GBPTree method visit.

@VisibleForTesting
public <VISITOR extends GBPTreeVisitor<KEY, VALUE>> VISITOR visit(VISITOR visitor, CursorContext cursorContext) throws IOException {
    try (PageCursor cursor = openRootCursor(PF_SHARED_READ_LOCK, cursorContext)) {
        new GBPTreeStructure<>(bTreeNode, layout, stableGeneration(generation), unstableGeneration(generation)).visitTree(cursor, writer.cursor, visitor, cursorContext);
        freeList.visitFreelist(visitor, cursorContext);
    }
    return visitor;
}
Also used : PageCursor(org.neo4j.io.pagecache.PageCursor) VisibleForTesting(org.neo4j.util.VisibleForTesting)

Example 4 with VisibleForTesting

use of org.neo4j.util.VisibleForTesting in project neo4j by neo4j.

the class GBPTree method unsafe.

@VisibleForTesting
public void unsafe(GBPTreeUnsafe<KEY, VALUE> unsafe, CursorContext cursorContext) throws IOException {
    TreeState state;
    try (PageCursor cursor = pagedFile.io(0, PagedFile.PF_SHARED_WRITE_LOCK, cursorContext)) {
        // todo find better way of getting TreeState?
        Pair<TreeState, TreeState> states = TreeStatePair.readStatePages(cursor, IdSpace.STATE_PAGE_A, IdSpace.STATE_PAGE_B);
        state = TreeStatePair.selectNewestValidState(states);
    }
    unsafe.access(pagedFile, layout, bTreeNode, state);
}
Also used : PageCursor(org.neo4j.io.pagecache.PageCursor) VisibleForTesting(org.neo4j.util.VisibleForTesting)

Example 5 with VisibleForTesting

use of org.neo4j.util.VisibleForTesting in project neo4j by neo4j.

the class ImportCommand method loadNeo4jConfig.

@VisibleForTesting
Config loadNeo4jConfig() {
    Config cfg = Config.newBuilder().set(GraphDatabaseSettings.neo4j_home, ctx.homeDir().toAbsolutePath()).fromFileNoThrow(ctx.confDir().resolve(Config.DEFAULT_CONFIG_FILE_NAME)).fromFileNoThrow(additionalConfig).commandExpansion(allowCommandExpansion).build();
    ConfigUtils.disableAllConnectors(cfg);
    return cfg;
}
Also used : Config(org.neo4j.configuration.Config) IndexConfig(org.neo4j.internal.batchimport.IndexConfig) VisibleForTesting(org.neo4j.util.VisibleForTesting)

Aggregations

VisibleForTesting (org.neo4j.util.VisibleForTesting)11 Config (org.neo4j.configuration.Config)3 PageCursor (org.neo4j.io.pagecache.PageCursor)3 SchemaDescriptor (org.neo4j.internal.schema.SchemaDescriptor)2 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 UncheckedIOException (java.io.UncheckedIOException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 LongStream (java.util.stream.LongStream)1 Stream (java.util.stream.Stream)1 IntObjectProcedure (org.eclipse.collections.api.block.procedure.primitive.IntObjectProcedure)1 IntObjectMap (org.eclipse.collections.api.map.primitive.IntObjectMap)1 KernelException (org.neo4j.exceptions.KernelException)1 IndexConfig (org.neo4j.internal.batchimport.IndexConfig)1 Pair (org.neo4j.internal.helpers.collection.Pair)1 DuplicateSchemaRuleException (org.neo4j.internal.kernel.api.exceptions.schema.DuplicateSchemaRuleException)1 MalformedSchemaRuleException (org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException)1