Class CustomItemCreationListener

java.lang.Object
org.junit.runner.notification.RunListener
de.hybris.platform.searchservices.support.CustomItemCreationListener
All Implemented Interfaces:
PersistencePool.PersistenceListener

public class CustomItemCreationListener extends org.junit.runner.notification.RunListener implements PersistencePool.PersistenceListener
RunListener assuring each created Item will be removed after finish of test. Similar to TransactionRunListener, but does not depend on used database. Will be disabled automatically for junit thread if transactional support is enabled by using annotation Transactional. Items created inside other threads are still logged and removed at the end of test!
  • Field Details

  • Constructor Details

    • CustomItemCreationListener

      public CustomItemCreationListener()
  • Method Details

    • testRunStarted

      public void testRunStarted(org.junit.runner.Description description) throws Exception
      Overrides:
      testRunStarted in class org.junit.runner.notification.RunListener
      Throws:
      Exception
    • testRunFinished

      public void testRunFinished(org.junit.runner.Result result) throws Exception
      Overrides:
      testRunFinished in class org.junit.runner.notification.RunListener
      Throws:
      Exception
    • testStarted

      public void testStarted(org.junit.runner.Description description) throws Exception
      Overrides:
      testStarted in class org.junit.runner.notification.RunListener
      Throws:
      Exception
    • testFinished

      public void testFinished(org.junit.runner.Description description) throws Exception
      Removes all items registered at the item registry. Will be called automatically at end of each test.
      Overrides:
      testFinished in class org.junit.runner.notification.RunListener
      Throws:
      Exception
    • resolveItemListenerMode

      protected ItemListenerMode resolveItemListenerMode(org.junit.runner.Description description)
    • removeItems

      protected void removeItems(Collection<PK> pks)
    • prepareItem

      protected void prepareItem(Item item) throws ConsistencyCheckException
      Throws:
      ConsistencyCheckException
    • entityCreated

      public void entityCreated(PK pk)
      Specified by:
      entityCreated in interface PersistencePool.PersistenceListener
    • transactionsSupported

      protected boolean transactionsSupported()