Commit 475e2f51 authored by Ihrig, Arvid Conrad (ari)'s avatar Ihrig, Arvid Conrad (ari)
Browse files

Integrated Pipeline: ParsingResultsProcessingManager sends events for incoming results

parent 8e4f6d70
......@@ -31,6 +31,13 @@ trait ParsingResultsProcessingManager extends MessageProcessor[FileParsingResult
case signal: FileParsingResult =>
if (!processedCounts.contains(signal.treeTask.treeBasePath))
startFileTree(signal.treeTask)
eventListener.processEvent(myId, ResultWriterEventResult(
treeTask = signal.treeTask,
relativePath = signal.task.relativePath,
parser = signal.task.parserName,
result = signal.result,
error = signal.error
))
processor.processFileParsingResult(signal)
processedCounts(signal.treeTask.treeBasePath) += 1
}
......
......@@ -205,6 +205,16 @@ class ParsingResultsProcessingManagerSpec extends WordSpec with MockitoSugar wit
val results = argument.getAllValues.asScala
exactly(1, results) should have(relativePath("foo"))
}
"notify the EventListener when a parsing result arrives" in {
import ResultWriterEventMatchers._
val f = createFixture()
f.manager.processSignal(anInMemoryResult().withRelativePath("foo"))
val argument: ArgumentCaptor[ResultWriterEvent] = ArgumentCaptor.forClass(classOf[ResultWriterEvent])
verify(f.eventMock, atLeastOnce()).processEvent(any(), argument.capture())
val results = argument.getAllValues.asScala.collect { case x: ResultWriterEventResult => x }
exactly(1, results) should have(relativePath("foo"))
}
}
def readyToAcceptParsingResultsFromAnotherTree(createFixture: () => Fixture): Unit = {
......@@ -212,11 +222,11 @@ class ParsingResultsProcessingManagerSpec extends WordSpec with MockitoSugar wit
import FileParsingResultMatchers._
val f = createFixture()
val fileTree = aFileTreeScanTask().withBasePath("/universe/magic")
f.manager.processSignal(anInMemoryResult().withTreeTask(fileTree))
f.manager.processSignal(anInMemoryResult().withTreeTask(fileTree).withRelativePath("bar"))
val argument: ArgumentCaptor[FileParsingResult] = ArgumentCaptor.forClass(classOf[FileParsingResult])
verify(f.processingMock, atLeastOnce()).processFileParsingResult(argument.capture())
val results = argument.getAllValues.asScala
exactly(1, results) should have(treeTask(fileTree))
exactly(1, results) should have(treeTask(fileTree), relativePath("bar"))
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment