com.google.appengine.tools.development.testing
Class LocalBasementServiceTestConfig

java.lang.Object
  extended by 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 out = new ByteArrayOutputStream();
   LocalServiceTestHelper helper;


Constructor Summary
LocalBasementServiceTestConfig()
           
 
Method Summary
static LocalBasementService getLocalBasementService()
           
 LocalBasementServiceTestConfig setEnable(boolean b)
          Configure the LocalBasementServiceTestConfig to create the LocalBasementService with the specified enable state.
 LocalBasementServiceTestConfig setIgnore(boolean b)
          Configure the LocalBasementServiceTestConfig to create the LocalBasementService with the specified ignore state.
 LocalBasementServiceTestConfig setLogEveryCall(boolean b)
          Configure the LocalBasementServiceTestConfig to create the LocalBasementService so that it will log every call to LogToSawmillService#log(byte[]) with Logger.
 LocalBasementServiceTestConfig setProtoStream(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.
 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()

setProtoStream

public LocalBasementServiceTestConfig setProtoStream(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 easy call chaining.

setEnable

public LocalBasementServiceTestConfig setEnable(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 easy call chaining.

setIgnore

public LocalBasementServiceTestConfig setIgnore(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 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 easy call chaining.

setLogEveryCall

public LocalBasementServiceTestConfig setLogEveryCall(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 easy call chaining.