Class ItemCreationListener
- java.lang.Object
-
- org.junit.runner.notification.RunListener
-
- de.hybris.platform.testframework.runlistener.ItemCreationListener
-
- All Implemented Interfaces:
PersistencePool.PersistenceListener
public class ItemCreationListener extends org.junit.runner.notification.RunListener implements PersistencePool.PersistenceListener
RunListenerassuring each created Item will be removed after finish of test. Similar toTransactionRunListener, but does not depend on used database. Will be disabled automatically for junit thread if transactional support is enabled by using annotationTransactional. Items created inside other threads are still logged and removed at the end of test!
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringITEM_CREATION_LIFECYCLE_LISTENER
-
Constructor Summary
Constructors Constructor Description ItemCreationListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidentityCreated(PK pk)protected voidprepareItem(Item item)protected voidremoveItems(java.util.Collection<PK> pks)voidtestFinished(org.junit.runner.Description description)Removes all items registered at the item registry.voidtestStarted(org.junit.runner.Description description)protected booleantransactionsSupported()
-
-
-
Field Detail
-
ITEM_CREATION_LIFECYCLE_LISTENER
public static final java.lang.String ITEM_CREATION_LIFECYCLE_LISTENER
- See Also:
- Constant Field Values
-
-
Method Detail
-
testStarted
public void testStarted(org.junit.runner.Description description) throws java.lang.Exception- Overrides:
testStartedin classorg.junit.runner.notification.RunListener- Throws:
java.lang.Exception
-
testFinished
public void testFinished(org.junit.runner.Description description) throws java.lang.ExceptionRemoves all items registered at the item registry. Will be called automatically at end of each test.- Overrides:
testFinishedin classorg.junit.runner.notification.RunListener- Throws:
java.lang.Exception
-
removeItems
protected void removeItems(java.util.Collection<PK> pks)
-
prepareItem
protected void prepareItem(Item item) throws ConsistencyCheckException
- Throws:
ConsistencyCheckException
-
entityCreated
public void entityCreated(PK pk)
- Specified by:
entityCreatedin interfacePersistencePool.PersistenceListener
-
transactionsSupported
protected boolean transactionsSupported()
-
-