com.google.appengine.tools.development.testing

## Class LocalDatastoreServiceTestConfig

- java.lang.Object
- - com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig

- All Implemented Interfaces:
    LocalServiceTestConfig

      public final class LocalDatastoreServiceTestConfig
      extends java.lang.Object
      implements LocalServiceTestConfig

  Config for accessing the local datastore service in tests. Default behavior is to configure the local datastore to only store data in-memory, to not write anything to disk, and for all jobs to apply on the first attempt. `tearDown()` wipes out all in-memory state so that the datastore is empty at the end of every test.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalDatastoreServiceTestConfig()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Class<? extends HighRepJobPolicy>` | `getAlternateHighRepJobPolicyClass()`
    `AutoIdAllocationPolicy` | `getAutoIdAllocationPolicy()`
    `java.lang.String` | `getBackingStoreLocation()`
    `java.lang.Long` | `getDefaultHighRepJobPolicyRandomSeed()`
    `java.lang.Float` | `getDefaultHighRepJobPolicyUnappliedJobPercentage()`
    `static LocalDatastoreV3Service` | `getLocalDatastoreService()`
    `java.lang.Integer` | `getMaxQueryLifetimeMs()`
    `java.lang.Integer` | `getMaxTxnLifetimeMs()`
    `java.lang.Integer` | `getStoreDelayMs()`
    `boolean` | `isNoIndexAutoGen()`
    `boolean` | `isNoStorage()`
    `LocalDatastoreServiceTestConfig` | `setAlternateHighRepJobPolicyClass(java.lang.Class<? extends HighRepJobPolicy> alternateHighRepJobPolicyClass)` An alternate `HighRepJobPolicy` implementation.
    `LocalDatastoreServiceTestConfig` | `setApplyAllHighRepJobPolicy()` Make the datastore a high-replication datastore, but with all jobs applying immediately (simplifies tests that use eventually-consistent queries).
    `LocalDatastoreServiceTestConfig` | `setAutoIdAllocationPolicy(AutoIdAllocationPolicy autoIdAllocationPolicy)` Dictate how Put() assigns auto IDs.
    `LocalDatastoreServiceTestConfig` | `setBackingStoreLocation(java.lang.String backingStoreLocation)` Where to read/store the datastore from/to.
    `LocalDatastoreServiceTestConfig` | `setDefaultHighRepJobPolicyRandomSeed(long defaultHighRepJobPolicyRandomSeed)` A seed for a `Random` used by `DefaultHighRepJobPolicy` to determine whether or not a job application attempt fails.
    `LocalDatastoreServiceTestConfig` | `setDefaultHighRepJobPolicyUnappliedJobPercentage(float defaultHighRepJobPolicyUnappliedJobPercentage)` The percentage of job application attempts that will fail.
    `LocalDatastoreServiceTestConfig` | `setMaxQueryLifetimeMs(int maxQueryLifetimeMs)` Sets how long a query can stay "live" before we expire it.
    `LocalDatastoreServiceTestConfig` | `setMaxTxnLifetimeMs(int maxTxnLifetimeMs)` Sets how long a txn can stay "live" before we expire it.
    `LocalDatastoreServiceTestConfig` | `setNoIndexAutoGen(boolean noIndexAutoGen)` True to prevent the datastore from writing the auto-generated index file.
    `LocalDatastoreServiceTestConfig` | `setNoStorage(boolean noStorage)` True to put the datastore into "memory-only" mode.
    `LocalDatastoreServiceTestConfig` | `setStoreDelayMs(int storeDelayMs)` Sets how long to wait before updating the persistent store.
    `void` | `setUp()` Set up the local service.
    `void` | `tearDown()` Tear down the local service.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LocalDatastoreServiceTestConfig

          public LocalDatastoreServiceTestConfig()

  - ### Method Detail

    - #### isNoStorage

          public boolean isNoStorage()

    - #### setNoStorage

          public LocalDatastoreServiceTestConfig setNoStorage(boolean noStorage)

      True to put the datastore into "memory-only" mode.
      Parameters:
        `noStorage` -
      Returns:
        `this` (for chaining)

    - #### getAutoIdAllocationPolicy

          public AutoIdAllocationPolicy getAutoIdAllocationPolicy()

    - #### setAutoIdAllocationPolicy

          public LocalDatastoreServiceTestConfig setAutoIdAllocationPolicy(AutoIdAllocationPolicy autoIdAllocationPolicy)

      Dictate how Put() assigns auto IDs.
      Parameters:
        `autoIdAllocationPolicy` -
      Returns:
        `this` (for chaining)

    - #### getMaxQueryLifetimeMs

          public java.lang.Integer getMaxQueryLifetimeMs()

    - #### setMaxQueryLifetimeMs

          public LocalDatastoreServiceTestConfig setMaxQueryLifetimeMs(int maxQueryLifetimeMs)

      Sets how long a query can stay "live" before we expire it.
      Parameters:
        `maxQueryLifetimeMs` -
      Returns:
        `this` (for chaining)

    - #### getMaxTxnLifetimeMs

          public java.lang.Integer getMaxTxnLifetimeMs()

    - #### setMaxTxnLifetimeMs

          public LocalDatastoreServiceTestConfig setMaxTxnLifetimeMs(int maxTxnLifetimeMs)

      Sets how long a txn can stay "live" before we expire it.
      Parameters:
        `maxTxnLifetimeMs` -
      Returns:
        `this` (for chaining)

    - #### getStoreDelayMs

          public java.lang.Integer getStoreDelayMs()

    - #### setStoreDelayMs

          public LocalDatastoreServiceTestConfig setStoreDelayMs(int storeDelayMs)

      Sets how long to wait before updating the persistent store. Only useful if `isNoStorage()` returns `false`.
      Parameters:
        `storeDelayMs` -
      Returns:
        `this` (for chaining)

    - #### getBackingStoreLocation

          public java.lang.String getBackingStoreLocation()

    - #### setBackingStoreLocation

          public LocalDatastoreServiceTestConfig setBackingStoreLocation(java.lang.String backingStoreLocation)

      Where to read/store the datastore from/to.
      Parameters:
        `backingStoreLocation` -
      Returns:
        `this` (for chaining)

    - #### isNoIndexAutoGen

          public boolean isNoIndexAutoGen()

    - #### setNoIndexAutoGen

          public LocalDatastoreServiceTestConfig setNoIndexAutoGen(boolean noIndexAutoGen)

      True to prevent the datastore from writing the auto-generated index file.
      Parameters:
        `noIndexAutoGen` -
      Returns:
        `this` (for chaining)

    - #### getDefaultHighRepJobPolicyRandomSeed

          public java.lang.Long getDefaultHighRepJobPolicyRandomSeed()

    - #### setDefaultHighRepJobPolicyRandomSeed

          public LocalDatastoreServiceTestConfig setDefaultHighRepJobPolicyRandomSeed(long defaultHighRepJobPolicyRandomSeed)

      A seed for a `Random` used by `DefaultHighRepJobPolicy` to determine whether or not a job application attempt fails. This method cannot be used in combination with `setAlternateHighRepJobPolicyClass(Class)`.
      Parameters:
        `defaultHighRepJobPolicyRandomSeed` - The random seed.
      Returns:
        `this` (for chaining)
      Throws:
        `java.lang.IllegalArgumentException` - If `setAlternateHighRepJobPolicyClass(Class)` has been called.

    - #### getDefaultHighRepJobPolicyUnappliedJobPercentage

          public java.lang.Float getDefaultHighRepJobPolicyUnappliedJobPercentage()

    - #### setDefaultHighRepJobPolicyUnappliedJobPercentage

          public LocalDatastoreServiceTestConfig setDefaultHighRepJobPolicyUnappliedJobPercentage(float defaultHighRepJobPolicyUnappliedJobPercentage)

      The percentage of job application attempts that will fail. Must be >= 0 and <= 100. This validation is performed during the initialization of `LocalDatastoreService`, not in the setter, so it will not fail fast. In addition, any portion of the value beyond two decimal places will be truncated. This method cannot be used in combination with `setAlternateHighRepJobPolicyClass(Class)`.
      Parameters:
        `defaultHighRepJobPolicyUnappliedJobPercentage` - The percentage of job application attempts that should fail.
      Returns:
        `this` (for chaining)
      Throws:
        `java.lang.IllegalArgumentException` - If `setAlternateHighRepJobPolicyClass(Class)` has been called.

    - #### getAlternateHighRepJobPolicyClass

          public java.lang.Class<? extends HighRepJobPolicy> getAlternateHighRepJobPolicyClass()

    - #### setAlternateHighRepJobPolicyClass

          public LocalDatastoreServiceTestConfig setAlternateHighRepJobPolicyClass(java.lang.Class<? extends HighRepJobPolicy> alternateHighRepJobPolicyClass)

      An alternate `HighRepJobPolicy` implementation. The class must have a no-arg constructor, but this validation is performed during the iniitialization of `LocalDatastoreService`, not in the setter, so it will not fail fast. This method cannot be used in combination with `setDefaultHighRepJobPolicyRandomSeed(long)` or `setDefaultHighRepJobPolicyUnappliedJobPercentage(float)`.
      Parameters:
        `alternateHighRepJobPolicyClass` - The `HighRepJobPolicy` implementation.
      Returns:
        `this` (for chaining)
      Throws:
        `java.lang.IllegalArgumentException` - If `setDefaultHighRepJobPolicyRandomSeed(long)` or `setDefaultHighRepJobPolicyUnappliedJobPercentage(float)` has been called.

    - #### setApplyAllHighRepJobPolicy

          public LocalDatastoreServiceTestConfig setApplyAllHighRepJobPolicy()

      Make the datastore a high-replication datastore, but with all jobs applying immediately (simplifies tests that use eventually-consistent queries).

    - #### setUp

          public void setUp()

      Description copied from interface: `LocalServiceTestConfig`
      Set up the local service.
      Specified by:
        `setUp` in interface `LocalServiceTestConfig`

    - #### tearDown

          public void tearDown()

      Description copied from interface: `LocalServiceTestConfig`
      Tear down the local service.
      Specified by:
        `tearDown` in interface `LocalServiceTestConfig`

    - #### getLocalDatastoreService

          public static LocalDatastoreV3Service getLocalDatastoreService()