Class Neo4jExtensionBuilder

java.lang.Object
org.neo4j.harness.junit.extension.Neo4jExtensionBuilder

public class Neo4jExtensionBuilder extends Object
Neo4jExtension extension builder.
  • Method Details

    • withFolder

      public Neo4jExtensionBuilder withFolder(Path workingDirectory)
      Configure the Neo4j to use provided directory
      Parameters:
      workingDirectory - new working directory
      Returns:
      this configurator instance
    • withConfig

      public <T> Neo4jExtensionBuilder withConfig(Setting<T> key, T value)
      Configure the Neo4j instance. Configuration here can be both configuration aimed at the server as well as the database tuning options. Please refer to the Neo4j Manual for details on available configuration options.
      Type Parameters:
      T - the setting type
      Parameters:
      key - the config key
      value - the config value
      Returns:
      this configurator instance
    • withUnmanagedExtension

      public Neo4jExtensionBuilder withUnmanagedExtension(String mountPath, Class<?> extension)
      Shortcut for configuring the server to use an unmanaged extension. Please refer to the Neo4j Manual on how to write unmanaged extensions.
      Parameters:
      mountPath - the http path, relative to the server base URI, that this extension should be mounted at.
      extension - the unmanaged extension class.
      Returns:
      this configurator instance
    • withUnmanagedExtension

      public Neo4jExtensionBuilder withUnmanagedExtension(String mountPath, String packageName)
      Shortcut for configuring the server to find and mount all unmanaged extensions in the given package.
      Parameters:
      mountPath - the http path, relative to the server base URI, that this extension should be mounted at.
      packageName - a java package with extension classes.
      Returns:
      this configurator instance
      See Also:
    • withDisabledServer

      public Neo4jExtensionBuilder withDisabledServer()
      Disable web server on configured Neo4j instance. For cases where web server is not required to test specific functionality it can be fully disabled using this tuning option.
      Returns:
      this configurator instance.
    • withFixture

      public Neo4jExtensionBuilder withFixture(Path cypherFileOrDirectory)
      Data fixtures to inject upon server build. This can be either a file with a plain-text cypher query (for example, myFixture.cyp), or a directory containing such files with the suffix ".cyp".
      Parameters:
      cypherFileOrDirectory - file with cypher statement, or directory containing ".cyp"-suffixed files.
      Returns:
      this configurator instance
    • withFixture

      public Neo4jExtensionBuilder withFixture(String fixtureStatement)
      Data fixture to inject upon server build. This should be a valid Cypher statement.
      Parameters:
      fixtureStatement - a cypher statement
      Returns:
      this configurator instance
    • withFixture

      public Neo4jExtensionBuilder withFixture(Function<GraphDatabaseService,Void> fixtureFunction)
      Data fixture to inject upon server build. This should be a user implemented fixture function operating on a GraphDatabaseService instance
      Parameters:
      fixtureFunction - a fixture function
      Returns:
      this configurator instance
    • copyFrom

      public Neo4jExtensionBuilder copyFrom(Path sourceDirectory)
      Pre-populate the server with databases copied from the specified source directory. The source directory needs to have sub-folders `databases/neo4j` in which the source store files are located.
      Parameters:
      sourceDirectory - the directory to copy from
      Returns:
      this configurator instance
    • withProcedure

      public Neo4jExtensionBuilder withProcedure(Class<?> procedureClass)
      Configure the server to load the specified procedure definition class. The class should contain one or more methods annotated with Procedure, these will become available to call through cypher.
      Parameters:
      procedureClass - a class containing one or more procedure definitions
      Returns:
      this configurator instance
    • withFunction

      public Neo4jExtensionBuilder withFunction(Class<?> functionClass)
      Configure the server to load the specified function definition class. The class should contain one or more methods annotated with UserFunction, these will become available to call through cypher.
      Parameters:
      functionClass - a class containing one or more function definitions
      Returns:
      this configurator instance
    • withAggregationFunction

      public Neo4jExtensionBuilder withAggregationFunction(Class<?> functionClass)
      Configure the server to load the specified aggregation function definition class. The class should contain one or more methods annotated with UserAggregationFunction, these will become available to call through cypher.
      Parameters:
      functionClass - a class containing one or more function definitions
      Returns:
      this configurator instance
    • build

      public Neo4jExtension build()