Ejemplo n.º 1
0
  @Override
  public List<FlowFile> get(final FlowFileFilter filter) {
    final List<FlowFile> flowFiles = new ArrayList<>();
    final List<MockFlowFile> unselected = new ArrayList<>();

    while (true) {
      final MockFlowFile flowFile = processorQueue.poll();
      if (flowFile == null) {
        break;
      }

      final FlowFileFilter.FlowFileFilterResult filterResult = filter.filter(flowFile);
      if (filterResult.isAccept()) {
        flowFiles.add(flowFile);

        beingProcessed.add(flowFile.getId());
        currentVersions.put(flowFile.getId(), flowFile);
        originalVersions.put(flowFile.getId(), flowFile);
      } else {
        unselected.add(flowFile);
      }

      if (!filterResult.isContinue()) {
        break;
      }
    }

    processorQueue.addAll(unselected);
    return flowFiles;
  }
Ejemplo n.º 2
0
 @Override
 public MockFlowFile get() {
   final MockFlowFile flowFile = processorQueue.poll();
   if (flowFile != null) {
     beingProcessed.add(flowFile.getId());
     currentVersions.put(flowFile.getId(), flowFile);
     originalVersions.put(flowFile.getId(), flowFile);
   }
   return flowFile;
 }