Package org.javalite.activeweb
Class DBControllerSpec
java.lang.Object
org.javalite.activeweb.SpecHelper
org.javalite.activeweb.RequestSpecHelper
org.javalite.activeweb.ControllerSpec
org.javalite.activeweb.DBControllerSpec
- All Implemented Interfaces:
JSpecSupport
Super class for controllers requiring a DB connection to the test DB.
Connection is opened before a test, closed after a test and a transaction is rolled back.
- Author:
- Igor Polevoy
-
Nested Class Summary
Nested classes/interfaces inherited from class org.javalite.activeweb.SpecHelper
SpecHelper.DynamicBuilder, SpecHelper.ModuleBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
void
close()
static void
void
open()
boolean
rollback()
Current state of 'rollback' flag.void
setRollback(boolean rollback)
Set to true in order to rollback a transaction at the end of the test (default is true).Methods inherited from class org.javalite.activeweb.ControllerSpec
atStart, getControllerClassName, getControllerPath, request
Methods inherited from class org.javalite.activeweb.RequestSpecHelper
assigns, atStart00, bytesContent, contentType, cookie, cookieValue, count, getCookies, header, headerNames, headers, layout, redirected, redirectValue, responseContent, responseJSONList, responseJSONMap, statusCode, template, text, val, val, valBoolean, valDouble, valFloat, valInteger, valLong, vals, valString
Methods inherited from class org.javalite.activeweb.SpecHelper
afterEnd, createInjector, flash, flash, flashExists, injector, registerTag, session, session, session, sessionBoolean, sessionDouble, sessionFloat, sessionHas, sessionInteger, sessionLong, sessionObject, sessionString, setInjector, setTemplateLocation
-
Constructor Details
-
DBControllerSpec
public DBControllerSpec()
-
-
Method Details
-
rollback
public boolean rollback()Current state of 'rollback' flag.- Returns:
- Current state of 'rollback' flag.
-
setRollback
public void setRollback(boolean rollback)Set to true in order to rollback a transaction at the end of the test (default is true). This method will set theautocommit = !rollback
on all connections found on this thread.WARNING: if you set this value to false inside your test, the framework will not clean any remaining data you insert into your test database. Basically, this is a "manual mode" where you are responsible for cleaning after yourself.
- Parameters:
rollback
- true to rollback transactions at the end of the test, false to not rollback.
-
initDBConfig
@BeforeAll public static void initDBConfig() -
open
@BeforeEach public final void open() -
close
@AfterEach public final void close() -
clearConnectionConfigs
@AfterAll public static void clearConnectionConfigs()
-