com.google.appengine.tools.development.testing

## Class LocalBasementServiceTestConfig

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

- All Implemented Interfaces:
    LocalServiceTestConfig

      public class LocalBasementServiceTestConfig
      extends java.lang.Object
      implements LocalServiceTestConfig

  Config for accessing the LocalBasementService in tests. In order to verify that the expected data is being written, you will first need to provide an `OutputStream` for the data to be written to:

      {@code
         private ByteArrayOutputStream protoStream = new ByteArrayOutputStream();
         LocalServiceTestHelper helper;

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalBasementServiceTestConfig()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `LocalBasementServiceTestConfig` | `addGaiaMintAllowedScope(GaiaMintScopeCode.ScopeCode allowedScope)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that the specific `GaiaMintScopeCode.ScopeCode` is allowed.
    `static LocalBasementService` | `getLocalBasementService()`
    `LocalBasementServiceTestConfig` | `setClock(Clock clock)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` to use the specified (@link com.google.common.time.Clock) when determing the current time.
    `LocalBasementServiceTestConfig` | `setGaiaMintAuthDomain(java.lang.String authDomain)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will return the specified auth domain from calls to `GaiaMintService#getUserinfoFromGaiaMint`.
    `LocalBasementServiceTestConfig` | `setGaiaMintEmail(java.lang.String email)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will return the specified email address from calls to `GaiaMintService#getUserinfoFromGaiaMint`.
    `LocalBasementServiceTestConfig` | `setGaiaMintGaiaId(long gaiaId)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will return the specified gaid ID from calls to `GaiaMintService#getUserinfoFromGaiaMint`.
    `LocalBasementServiceTestConfig` | `setGaiaMintIsAdmin(boolean isAdmin)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will return whether the user is an admin from calls to `GaiaMintService#getUserinfoFromGaiaMint`.
    `LocalBasementServiceTestConfig` | `setGaiaMintUserId(java.lang.String userId)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will return the specified user id from calls to `GaiaMintService#getUserinfoFromGaiaMint`.
    `LocalBasementServiceTestConfig` | `setLogToSawmillEnable(boolean b)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` with the specified enable state.
    `LocalBasementServiceTestConfig` | `setLogToSawmillIgnore(boolean b)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` with the specified ignore state.
    `LocalBasementServiceTestConfig` | `setLogToSawmillLogEveryCall(boolean b)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will log every call to `LogToSawmillService#log(byte[])` with `Logger`.
    `LocalBasementServiceTestConfig` | `setLogToSawmillProtoStream(java.io.OutputStream out)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will write a request's final merged proto to the specified `OutputStream`.
    `LocalBasementServiceTestConfig` | `setOneGoogleServerSpec(java.lang.String serverSpec)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` to use the specified server spec for the OneGoogle backend instead of the default (see `LocalBasementService.ONE_GOOGLE_SERVER_SPEC_DEFAULT`).
    `LocalBasementServiceTestConfig` | `setOneGoogleStub(OneGoogleServerProto.OneGoogleService.Stub stub)` Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` to use the the specified `OneGoogleServerProto.OneGoogleService.Stub` to send RPCs to the OneGoogleService server.
    `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

    - #### LocalBasementServiceTestConfig

          public LocalBasementServiceTestConfig()

  - ### Method Detail

    - #### 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`

    - #### getLocalBasementService

          public static LocalBasementService getLocalBasementService()

    - #### setLogToSawmillProtoStream

          public LocalBasementServiceTestConfig setLogToSawmillProtoStream(java.io.OutputStream out)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will write a request's final merged proto to the specified `OutputStream`. If this method is not called or is called with `null`, the final merged proto will not be written. Defaults to `null` and must be called (note: only applies to unit tests, in the Dev App Server defaults to writing to the filesystem). The final merged proto is only written once the request is over. You can indicate this to the unit test by either calling `LocalServiceTestHelper#endRequest()` or `LocalServiceTestHelper#tearDown()`. This method must be called prior to calling `LocalServiceTestHelper#setUp()`.
      Parameters:
        `out` - A non-closed OutputStream.
      Returns:
        itself for call chaining

    - #### setLogToSawmillEnable

          public LocalBasementServiceTestConfig setLogToSawmillEnable(boolean b)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` with the specified enable state. When disabled, the entry points will throw just like the production environment when the app is missing the SAWMILL_APP_EXTENSIONS_ENABLE permission. Defaults to `true`. This method must be called prior to calling `LocalServiceTestHelper#setUp()`.
      Parameters:
        `b` - True to allow the service to log.
      Returns:
        itself for call chaining

    - #### setLogToSawmillIgnore

          public LocalBasementServiceTestConfig setLogToSawmillIgnore(boolean b)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` with the specified ignore state. When ignored, `LogToSawmillService#log(byte[])` will drop all date and the entry points will indicate this in their return value. Defaults to `false`. This method must be called prior to calling `LocalServiceTestHelper#setUp()`.
      Parameters:
        `b` - False to allow the service to log.
      Returns:
        itself for call chaining

    - #### setLogToSawmillLogEveryCall

          public LocalBasementServiceTestConfig setLogToSawmillLogEveryCall(boolean b)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will log every call to `LogToSawmillService#log(byte[])` with `Logger`. Defaults to `false` (note: only applies to unit tests; in the Dev App Server defaults to `true`). This method must be called prior to calling `LocalServiceTestHelper#setUp()`.
      Parameters:
        `b` - True to have the local service log each call.
      Returns:
        itself for call chaining

    - #### setGaiaMintEmail

          public LocalBasementServiceTestConfig setGaiaMintEmail(java.lang.String email)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will return the specified email address from calls to `GaiaMintService#getUserinfoFromGaiaMint`. Defaults to "example@example.com". This method must be called prior to calling `LocalServiceTestHelper.setUp()`.
      Parameters:
        `email` - The email address to return from `GaiaMintService#getUserinfoFromGaiaMint`.
      Returns:
        itself for call chaining

    - #### setGaiaMintUserId

          public LocalBasementServiceTestConfig setGaiaMintUserId(java.lang.String userId)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will return the specified user id from calls to `GaiaMintService#getUserinfoFromGaiaMint`. Defaults to "135705915318242114242". This method must be called prior to calling `LocalServiceTestHelper.setUp()`.
      Parameters:
        `userId` - The user id to return from `GaiaMintService#getUserinfoFromGaiaMint`.
      Returns:
        itself for call chaining

    - #### setGaiaMintAuthDomain

          public LocalBasementServiceTestConfig setGaiaMintAuthDomain(java.lang.String authDomain)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will return the specified auth domain from calls to `GaiaMintService#getUserinfoFromGaiaMint`. Defaults to "gmail.com". This method must be called prior to calling `LocalServiceTestHelper.setUp()`.
      Parameters:
        `authDomain` - The auth domain to return from `GaiaMintService#getUserinfoFromGaiaMint`.
      Returns:
        itself for call chaining

    - #### setGaiaMintIsAdmin

          public LocalBasementServiceTestConfig setGaiaMintIsAdmin(boolean isAdmin)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will return whether the user is an admin from calls to `GaiaMintService#getUserinfoFromGaiaMint`. Defaults to false. This method must be called prior to calling `LocalServiceTestHelper.setUp()`.
      Parameters:
        `isAdmin` - Whether to make the user an admin in calls to `GaiaMintService#getUserinfoFromGaiaMint`.
      Returns:
        itself for call chaining

    - #### setGaiaMintGaiaId

          public LocalBasementServiceTestConfig setGaiaMintGaiaId(long gaiaId)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that it will return the specified gaid ID from calls to `GaiaMintService#getUserinfoFromGaiaMint`. Defaults to 8242114242L. This method must be called prior to calling `LocalServiceTestHelper.setUp()`.
      Parameters:
        `authDomain` - The gaia ID to return from `GaiaMintService#getUserinfoFromGaiaMint`.
      Returns:
        itself for call chaining

    - #### addGaiaMintAllowedScope

          public LocalBasementServiceTestConfig addGaiaMintAllowedScope(GaiaMintScopeCode.ScopeCode allowedScope)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` so that the specific `GaiaMintScopeCode.ScopeCode` is allowed. Calls to `GaiaMintService#getUserinfoFromGaiaMint` with non allowed scopes will fail. If the allowed list of scopes code is empty or it includes `GaiaMintScopeCode.ScopeCode#API_ALL_SCOPES` all scopes will be allowed. This method must be called prior to calling `LocalServiceTestHelper.setUp()`.
      Parameters:
        `allowedScope` - A `GaiaMintScopeCode.ScopeCode` to allow for calls to `GaiaMintService#getUserinfoFromGaiaMint`.
      Returns:
        itself for call chaining

    - #### setOneGoogleServerSpec

          public LocalBasementServiceTestConfig setOneGoogleServerSpec(java.lang.String serverSpec)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` to use the specified server spec for the OneGoogle backend instead of the default (see `LocalBasementService.ONE_GOOGLE_SERVER_SPEC_DEFAULT`). NOTE: most unit tests should not bother with this method and should use `setOneGoogleStub( OneGoogleServerProto.OneGoogleService.Stub)` to install a mock stub.
      Parameters:
        `serverSpec` - the OneGoogle backend server spec to connect to
      Returns:
        itself for call chaining

    - #### setOneGoogleStub

          public LocalBasementServiceTestConfig setOneGoogleStub(OneGoogleServerProto.OneGoogleService.Stub stub)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` to use the the specified `OneGoogleServerProto.OneGoogleService.Stub` to send RPCs to the OneGoogleService server.
      Parameters:
        `stub` - a `OneGoogleServerProto.OneGoogleService.Stub`
      Returns:
        itself for call chaining

    - #### setClock

          public LocalBasementServiceTestConfig setClock(Clock clock)

      Configure the `LocalBasementServiceTestConfig` to create the `LocalBasementService` to use the specified (@link com.google.common.time.Clock) when determing the current time.
      Parameters:
        `clock` - a `com.google.common.time.Clock`
      Returns:
        itself for call chaining