|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.appengine.tools.development.testing.LocalServiceTestHelper
public class LocalServiceTestHelper
Helper class for testing against local app engine services.
Construct the helper with one LocalServiceTestConfig
instance for
each service that you wish to access as part of your test. Then call
setUp()
before each test executes and tearDown()
after
each test executes. No specific test-harness is assumed, but here's a
JUnit 3 example that uses task queues and the datastore.
public void MyTest extends TestCase { private final LocalServiceTestHelper helper = new LocalServiceTestHelper( new LocalTaskQueueTestConfig(), new LocalDatastoreServiceTestConfig()); @Override public void setUp() { super.setUp(); helper.setUp(); } @Override public void tearDown() { helper.tearDown(); super.tearDown(); } }
Constructor Summary | |
---|---|
LocalServiceTestHelper(LocalServiceTestConfig... configs)
Constructs a LocalServiceTestHelper with the provided configs. |
Method Summary | |
---|---|
static ApiProxyLocal |
getApiProxyLocal()
Convenience function for getting ahold of the currently registered ApiProxyLocal . |
static LocalRpcService |
getLocalService(java.lang.String serviceName)
Convenience function for getting ahold of a specific local service. |
protected ApiProxy.Environment |
newEnvironment()
Constructs the ApiProxy.Environment that will be installed. |
protected LocalServerEnvironment |
newLocalServerEnvironment()
Constructs the LocalServerEnvironment that will be installed. |
LocalServiceTestHelper |
setClock(Clock clock)
Sets the clock with which all local services will be initialized. |
LocalServiceTestHelper |
setEnvAppId(java.lang.String envAppId)
The value to be returned by ApiProxy.getCurrentEnvironment().getAppId() |
LocalServiceTestHelper |
setEnvAttributes(java.util.Map<java.lang.String,java.lang.Object> envAttributes)
The value to be returned by ApiProxy.getCurrentEnvironment().getAttributes() |
LocalServiceTestHelper |
setEnvAuthDomain(java.lang.String envAuthDomain)
The value to be returned by ApiProxy.getCurrentEnvironment().getAuthDomain() |
LocalServiceTestHelper |
setEnvEmail(java.lang.String envEmail)
The value to be returned by ApiProxy.getCurrentEnvironment().getEmail() |
LocalServiceTestHelper |
setEnvIsAdmin(boolean envIsAdmin)
The value to be returned by ApiProxy.getCurrentEnvironment().isAdmin() |
LocalServiceTestHelper |
setEnvIsLoggedIn(boolean envIsLoggedIn)
The value to be returned by ApiProxy.getCurrentEnvironment().isLoggedIn() |
LocalServiceTestHelper |
setEnvRequestNamespace(java.lang.String envRequestNamespace)
The value to be returned by ApiProxy.getCurrentEnvironment().getRequestNamespace() |
LocalServiceTestHelper |
setEnvVersionId(java.lang.String envVersionId)
The value to be returned by ApiProxy.getCurrentEnvironment().getVersionId() |
void |
setUp()
Set up an environment in which tests that use local services can execute. |
void |
tearDown()
Tear down the environment in which tests that use local services can execute. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocalServiceTestHelper(LocalServiceTestConfig... configs)
configs
- Configs for the local services that need to be
set up and torn down.Method Detail |
---|
public LocalServiceTestHelper setEnvAppId(java.lang.String envAppId)
ApiProxy.getCurrentEnvironment().getAppId()
envAppId
-
this
(for chaining)public LocalServiceTestHelper setEnvVersionId(java.lang.String envVersionId)
ApiProxy.getCurrentEnvironment().getVersionId()
envVersionId
-
this
(for chaining)public LocalServiceTestHelper setEnvEmail(java.lang.String envEmail)
ApiProxy.getCurrentEnvironment().getEmail()
envEmail
-
this
(for chaining)public LocalServiceTestHelper setEnvIsLoggedIn(boolean envIsLoggedIn)
ApiProxy.getCurrentEnvironment().isLoggedIn()
envIsLoggedIn
-
this
(for chaining)public LocalServiceTestHelper setEnvIsAdmin(boolean envIsAdmin)
ApiProxy.getCurrentEnvironment().isAdmin()
envIsAdmin
-
this
(for chaining)public LocalServiceTestHelper setEnvAuthDomain(java.lang.String envAuthDomain)
ApiProxy.getCurrentEnvironment().getAuthDomain()
envAuthDomain
-
this
(for chaining)public LocalServiceTestHelper setEnvRequestNamespace(java.lang.String envRequestNamespace)
ApiProxy.getCurrentEnvironment().getRequestNamespace()
envRequestNamespace
-
this
(for chaining)public LocalServiceTestHelper setEnvAttributes(java.util.Map<java.lang.String,java.lang.Object> envAttributes)
ApiProxy.getCurrentEnvironment().getAttributes()
envAttributes
-
this
(for chaining)public LocalServiceTestHelper setClock(Clock clock)
clock
-
this
(for chaining)public final void setUp()
protected ApiProxy.Environment newEnvironment()
ApiProxy.Environment
that will be installed.
Subclass and override to provide your own implementation.
protected LocalServerEnvironment newLocalServerEnvironment()
LocalServerEnvironment
that will be installed.
Subclass and override to provide your own implementation.
public final void tearDown()
public static ApiProxyLocal getApiProxyLocal()
ApiProxyLocal
.
public static LocalRpcService getLocalService(java.lang.String serviceName)
getLocalService(LocalDatastoreService.PACKAGE)
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |