public class LocalBasementServiceTestConfig extends java.lang.Object implements LocalServiceTestConfig
OutputStream
for the
data to be written to:
{@code private ByteArrayOutputStream protoStream = new ByteArrayOutputStream(); LocalServiceTestHelper helper;
Constructor and Description |
---|
LocalBasementServiceTestConfig() |
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.
|
public void setUp()
LocalServiceTestConfig
setUp
in interface LocalServiceTestConfig
public void tearDown()
LocalServiceTestConfig
tearDown
in interface LocalServiceTestConfig
public static LocalBasementService getLocalBasementService()
public LocalBasementServiceTestConfig setLogToSawmillProtoStream(java.io.OutputStream out)
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()
.out
- A non-closed OutputStream.public LocalBasementServiceTestConfig setLogToSawmillEnable(boolean b)
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()
.b
- True to allow the service to log.public LocalBasementServiceTestConfig setLogToSawmillIgnore(boolean b)
LocalBasementServiceTestConfig
to create the LocalBasementService
with the specified ignore state. When ignored, LogToSawmillService#log(byte[])
will
drop all date and the the entry points will indicate this in their
return value. Defaults to false
.
This method must be called prior to calling LocalServiceTestHelper#setUp()
.b
- False to allow the service to log.public LocalBasementServiceTestConfig setLogToSawmillLogEveryCall(boolean b)
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()
.b
- True to have the local service log each call.public LocalBasementServiceTestConfig setGaiaMintEmail(java.lang.String email)
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()
.email
- The email address to return from GaiaMintService#getUserinfoFromGaiaMint
.public LocalBasementServiceTestConfig setGaiaMintUserId(java.lang.String userId)
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()
.userId
- The user id to return from GaiaMintService#getUserinfoFromGaiaMint
.public LocalBasementServiceTestConfig setGaiaMintAuthDomain(java.lang.String authDomain)
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()
.authDomain
- The auth domain to return from GaiaMintService#getUserinfoFromGaiaMint
.public LocalBasementServiceTestConfig setGaiaMintIsAdmin(boolean isAdmin)
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()
.isAdmin
- Whether to make the user an admin in calls to GaiaMintService#getUserinfoFromGaiaMint
.public LocalBasementServiceTestConfig setGaiaMintGaiaId(long gaiaId)
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()
.authDomain
- The gaia ID to return from GaiaMintService#getUserinfoFromGaiaMint
.public LocalBasementServiceTestConfig addGaiaMintAllowedScope(GaiaMintScopeCode.ScopeCode allowedScope)
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()
.allowedScope
- A GaiaMintScopeCode.ScopeCode
to allow for calls to GaiaMintService#getUserinfoFromGaiaMint
.public LocalBasementServiceTestConfig setOneGoogleServerSpec(java.lang.String serverSpec)
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.serverSpec
- the OneGoogle backend server spec to connect topublic LocalBasementServiceTestConfig setOneGoogleStub(OneGoogleServerProto.OneGoogleService.Stub stub)
LocalBasementServiceTestConfig
to create the LocalBasementService
to use the the specified OneGoogleServerProto.OneGoogleService.Stub
to send RPCs to the OneGoogleService server.stub
- a OneGoogleServerProto.OneGoogleService.Stub
public LocalBasementServiceTestConfig setClock(Clock clock)
LocalBasementServiceTestConfig
to create the LocalBasementService
to use the specified (@link com.google.common.time.Clock) when determing
the current time.clock
- a com.google.common.time.Clock