test_class.file: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/api/reader/BufferReaderTest.java
test_class.identifier: BufferReaderTest
test_case.body: @Test
  	public void testIterativeGetNextBufferOrEvent() throws IOException, InterruptedException {
  
  		final TestSingleInputGate inputGate = new TestSingleInputGate(1)
  				.readBuffer().readBuffer().readEvent()
  				.readBuffer().readBuffer().readEvent()
  				.readBuffer().readEndOfSuperstepEvent()
  				.readBuffer().readBuffer().readEvent()
  				.readBuffer().readBuffer().readEvent()
  				.readBuffer().readEndOfPartitionEvent();
  
  		final BufferReader reader = new BufferReader(inputGate.getInputGate());
  
  		// Set reader iterative
  		reader.setIterativeReader();
  
  		// Task event listener to be notified...
  		final EventListener<TaskEvent> listener = mock(EventListener.class);
  		// Task event listener to be notified...
  		reader.registerTaskEventListener(listener, TestTaskEvent.class);
  
  		int numReadBuffers = 0;
  		int numEndOfSuperstepEvents = 0;
  
  		while (true) {
  			Buffer buffer = reader.getNextBuffer();
  
  			if (buffer != null) {
  				numReadBuffers++;
  			}
  			else if (reader.hasReachedEndOfSuperstep()) {
  				reader.startNextSuperstep();
  
  				numEndOfSuperstepEvents++;
  			}
  			else if (reader.isFinished()) {
  				break;
  			}
  		}
  
  		assertEquals(10, numReadBuffers);
  		assertEquals(1, numEndOfSuperstepEvents);
  
  		verify(listener, times(4)).onEvent(any(TaskEvent.class));
  	}
test_case.class_method_signature: BufferReaderTest.testIterativeGetNextBufferOrEvent()
test_case.full_signature: @Test public void testIterativeGetNextBufferOrEvent()
test_case.identifier: testIterativeGetNextBufferOrEvent
test_case.invocations: readEndOfPartitionEvent readBuffer readEvent readBuffer readBuffer readEvent readBuffer readBuffer readEndOfSuperstepEvent readBuffer readEvent readBuffer readBuffer readEvent readBuffer readBuffer getInputGate setIterativeReader mock registerTaskEventListener getNextBuffer hasReachedEndOfSuperstep startNextSuperstep isFinished assertEquals assertEquals onEvent verify times any
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testIterativeGetNextBufferOrEvent()
focal_class.file: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/reader/BufferReader.java
focal_class.identifier: BufferReader
focal_class.class_method_signature: BufferReader.BufferReader(InputGate gate)
focal_class.full_signature: public  BufferReader(InputGate gate)
focal_class.identifier: BufferReader
focal_class.modifiers: public
focal_class.parameters: (InputGate gate)
focal_class.signature:  BufferReader(InputGate gate)
focal_class.class_method_signature: BufferReader.getNextBuffer()
focal_class.full_signature: public Buffer getNextBuffer()
focal_class.identifier: getNextBuffer
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Buffer
focal_class.signature: Buffer getNextBuffer()
focal_class.class_method_signature: BufferReader.setReporter(AccumulatorRegistry.Reporter reporter)
focal_class.full_signature: @Override public void setReporter(AccumulatorRegistry.Reporter reporter)
focal_class.identifier: setReporter
focal_class.modifiers: @Override public
focal_class.parameters: (AccumulatorRegistry.Reporter reporter)
focal_class.return: void
focal_class.signature: void setReporter(AccumulatorRegistry.Reporter reporter)
focal_class.superclass: extends AbstractReader
focal_method.body: public Buffer getNextBuffer() throws IOException, InterruptedException {
  		while (true) {
  			final BufferOrEvent bufferOrEvent = inputGate.getNextBufferOrEvent();
  
  			if (bufferOrEvent.isBuffer()) {
  				return bufferOrEvent.getBuffer();
  			}
  			else {
  				if (handleEvent(bufferOrEvent.getEvent())) {
  					return null;
  				}
  			}
  		}
  	}
focal_method.class_method_signature: BufferReader.getNextBuffer()
focal_method.full_signature: public Buffer getNextBuffer()
focal_method.identifier: getNextBuffer
focal_method.invocations: getNextBufferOrEvent isBuffer getBuffer handleEvent getEvent
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: Buffer
focal_method.signature: Buffer getNextBuffer()