Package org.voltdb

Class InProcessVoltDBServer

java.lang.Object
org.voltdb.InProcessVoltDBServer

public class InProcessVoltDBServer extends Object
Class used to run a single VoltDB server in-process for debug and test purposes.
  • Constructor Details

    • InProcessVoltDBServer

      public InProcessVoltDBServer()
      Create an instance ready to start.
  • Method Details

    • configPartitionCount

      public InProcessVoltDBServer configPartitionCount(int partitionCount)
      Set the number of partitions the single VoltDB server will use. The default is 8. Must be called before start().
      Parameters:
      partitionCount - The number of partitions desired.
      Returns:
      InProcessVoltDBServer instance for chaining.
    • configPathToLicense

      public InProcessVoltDBServer configPathToLicense(String path)
      When using enterprise or pro edition, specify a path to the license needed.
      Parameters:
      path - Path to license. Must be called before start().
      Returns:
      InProcessVoltDBServer instance for chaining.
    • start

      public InProcessVoltDBServer start()
      Starts the in-process server and blocks until it is ready to accept connections.
      Returns:
      InProcessVoltDBServer instance for chaining.
    • runDDLFromPath

      public InProcessVoltDBServer runDDLFromPath(String path)
      Run DDL from a file on disk. Must be called after start().
      Parameters:
      path - Path to DDL file.
      Returns:
      InProcessVoltDBServer instance for chaining.
    • runDDLFromString

      public InProcessVoltDBServer runDDLFromString(String ddl)
      Run DDL from a given string. Must be called after start().
      Parameters:
      ddl - String containing DDL to run.
      Returns:
      InProcessVoltDBServer instance for chaining.
    • shutdown

      public void shutdown()
      Stop the in-process server and block until it has completely stopped. Obviously must be called after start().
    • getClient

      public org.voltdb.client.Client getClient() throws Exception
      Create and connect a client to the in-process VoltDB server. Note, client will be automatically closed when the in-process server is shut down. Must be called after start().
      Returns:
      Connected client.
      Throws:
      Exception - on failure to connect properly.
    • loadRow

      public void loadRow(String tableName, Object... row) throws Exception
      Helper method for loading a row into a table. Must be called after start() and after runDDLFromPath(String) or runDDLFromString(String).
      Parameters:
      tableName - The case-insensitive name of the target table.
      row - An array of schema-compatible values comprising the row to load.
      Throws:
      Exception - if the server is unable to complete a transaction of if the input doesn't match table schema.