Mark Payne created NIFI-5626:
--------------------------------

             Summary: MockProcessSession's getQueueSize() inconsistent with 
StandardProcessSession's
                 Key: NIFI-5626
                 URL: https://issues.apache.org/jira/browse/NIFI-5626
             Project: Apache NiFi
          Issue Type: Bug
            Reporter: Mark Payne


When calling StandardProcessSession.getQueueSize() it returns the size of the 
queues, including any FlowFiles that are held by the Processor. However, 
MockProcessSession does not include the size of FlowFiles held by the 
Processor. As a result, we can have a processor that passes a unit test but 
does not perform the same behavior in production. For example, if a processor 
calls:
{code:java}
FlowFile flowFile = session.get();
if (flowFile != null) {
    // Process FlowFile
}

QueueSize queueSize = session.getQueueSize();
if (queueSize.getObjectCount() == 0) {
    // Perform some logic now that the queue is empty
}{code}
When running a unit test, if a single FlowFiles is enqueued, and then the 
Processor is triggered, in the unit test, QueueSize.getObjectCount() will be 0. 
However, in production, QueueSize.getObjectCount() will be 1, because the 
Processor is still holding the FlowFile.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to