Class SupportSubscriber

java.lang.Object
com.espertech.esper.runtime.client.scopetest.SupportSubscriber

public class SupportSubscriber extends Object
Subscriber for that retains the events it receives for use in assertions.
  • Constructor Details

    • SupportSubscriber

      public SupportSubscriber()
      Ctor.
  • Method Details

    • update

      public void update(Object[] newData, Object[] oldData)
      Receive events.
      Parameters:
      newData - insert stream
      oldData - remove stream
    • reset

      public void reset()
      Reset subscriber, clearing all associated state.
    • getLastNewData

      public Object[] getLastNewData()
      Returns the last array of events (insert stream) that were received.
      Returns:
      insert stream events or null if either a null value was received or when no events have been received since the last reset
    • getAndResetLastNewData

      public Object[] getAndResetLastNewData()
      Returns the last array of events (insert stream) that were received and resets the subscriber.
      Returns:
      insert stream events or null if either a null value was received or when no events have been received since the last reset
    • assertOneGetNewAndReset

      public Object assertOneGetNewAndReset()
      Asserts that exactly one insert stream event was received and no remove stream events, resets the listener clearing all state and returns the received event.
      Returns:
      single insert-stream event
    • assertOneGetOldAndReset

      public Object assertOneGetOldAndReset()
      Asserts that exactly one remove stream event was received and no insert stream events, resets the listener clearing all state and returns the received event.
      Returns:
      single remove-stream event
    • getLastOldData

      public Object[] getLastOldData()
      Returns the last array of remove-stream events that were received.
      Returns:
      remove stream events or null if either a null value was received or when no events have been received since the last reset
    • getNewDataList

      public List<Object[]> getNewDataList()
      Get a list of all insert-stream event arrays received.
      Returns:
      list of event arrays
    • getOldDataList

      public List<Object[]> getOldDataList()
      Get a list of all remove-stream event arrays received.
      Returns:
      list of event arrays
    • isInvoked

      public boolean isInvoked()
      Returns true if the subscriber was invoked at least once.
      Returns:
      invoked flag
    • getAndClearIsInvoked

      public boolean getAndClearIsInvoked()
      Returns true if the subscriber was invoked at least once and clears the invocation flag.
      Returns:
      invoked flag
    • getNewDataListFlattened

      public Object[] getNewDataListFlattened()
      Returns an event array that represents all insert-stream events received so far.
      Returns:
      event array
    • getOldDataListFlattened

      public Object[] getOldDataListFlattened()
      Returns an event array that represents all remove-stream events received so far.
      Returns:
      event array
    • getDataListsFlattened

      public com.espertech.esper.common.internal.collection.UniformPair<Object[]> getDataListsFlattened()
      Returns a pair of insert and remove stream event arrays considering the all invocations.
      Returns:
      pair of event arrays, the first in the pair is the insert stream data, the second in the pair is the remove stream data