Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-lab-base
Commits
9050799d
Commit
9050799d
authored
Jul 25, 2018
by
Ihrig, Arvid Conrad (ari)
Browse files
Integrated Pipeline: renamed FileTree-fields in event classes and test data builders
parent
b2f3749d
Changes
8
Hide whitespace changes
Inline
Side-by-side
integrated-pipeline/src/main/scala/eu/nomad_lab/integrated_pipeline/EventLogger.scala
View file @
9050799d
...
...
@@ -26,28 +26,28 @@ trait EventLogger extends EventListener with Logging {
case
x
:
TreeParserEventStart
=>
logger
.
info
(
baseMarker
,
s
"[TreeParser ${reporter.name}] start processing file tree "
+
s
"'${x.
treeTask
.treeBasePath}' (tree type ${x.
treeTask
.treeType})"
s
"'${x.
fileTree
.treeBasePath}' (tree type ${x.
fileTree
.treeType})"
)
case
x
:
TreeParserEventEnd
=>
logger
.
info
(
baseMarker
,
s
"[TreeParser ${reporter.name}] finished processing file tree "
+
s
"'${x.
treeTask
.treeBasePath}', found ${x.numCandidates} candidate files "
+
s
"(tree type ${x.
treeTask
.treeType})"
s
"'${x.
fileTree
.treeBasePath}', found ${x.numCandidates} candidate files "
+
s
"(tree type ${x.
fileTree
.treeType})"
)
case
x
:
TreeParserEventCandidate
=>
logger
.
debug
(
baseMarker
,
s
"[TreeParser ${reporter.name}] found candidate in file tree "
+
s
"'${x.
treeTask
.treeBasePath}' at '${x.relativePath}' (parser '${x.parser}')"
s
"'${x.
fileTree
.treeBasePath}' at '${x.relativePath}' (parser '${x.parser}')"
)
case
x
:
TreeParserEventScanError
=>
logger
.
warn
(
baseMarker
,
s
"[TreeParser ${reporter.name}] scanning failure in file tree "
+
s
"'${x.
treeTask
.treeBasePath}' at '${x.relativePath}' (${x.error.toString})"
s
"'${x.
fileTree
.treeBasePath}' at '${x.relativePath}' (${x.error.toString})"
)
case
x
:
TreeParserEventTreeFailure
=>
logger
.
error
(
baseMarker
,
s
"[TreeParser ${reporter.name}] encountered failure while processing file tree "
+
s
"'${x.
treeTask
.treeBasePath}', aborting: ${x.error.toString}"
s
"'${x.
fileTree
.treeBasePath}', aborting: ${x.error.toString}"
)
}
super
.
processEvent
(
reporter
,
message
)
...
...
@@ -58,24 +58,24 @@ trait EventLogger extends EventListener with Logging {
case
x
:
CalculationParserEventStart
=>
logger
.
info
(
baseMarker
,
s
"[CalculationParser ${reporter.name}] start parsing file "
+
s
"'${x.relativePath}' in file tree '${x.
treeTask
.treeBasePath}' (parser '${x.parser}')"
s
"'${x.relativePath}' in file tree '${x.
fileTree
.treeBasePath}' (parser '${x.parser}')"
)
case
x
:
CalculationParserEventEnd
=>
x
.
result
match
{
case
ParseResult
.
ParseSuccess
=>
logger
.
info
(
parseSuccessMarker
,
s
"[CalculationParser ${reporter.name}] finished parsing file '${x.relativePath}' in "
+
s
"file tree '${x.
treeTask
.treeBasePath}' (parser '${x.parser}')"
s
"file tree '${x.
fileTree
.treeBasePath}' (parser '${x.parser}')"
)
case
ParseResult
.
ParseSkipped
=>
logger
.
info
(
parseSkippedMarker
,
s
"[CalculationParser ${reporter.name}] skipped parsing file '${x.relativePath}' in "
+
s
"file tree '${x.
treeTask
.treeBasePath}' (parser '${x.parser}')"
s
"file tree '${x.
fileTree
.treeBasePath}' (parser '${x.parser}')"
)
case
ParseResult
.
ParseFailure
=>
logger
.
warn
(
parseFailureMarker
,
s
"[CalculationParser ${reporter.name}] failed parsing file '${x.relativePath}' in "
+
s
"file tree '${x.
treeTask
.treeBasePath}': ${x.error.get} (parser '${x.parser}')"
s
"file tree '${x.
fileTree
.treeBasePath}': ${x.error.get} (parser '${x.parser}')"
)
}
}
...
...
@@ -87,17 +87,17 @@ trait EventLogger extends EventListener with Logging {
case
x
:
ResultWriterEventStart
=>
logger
.
info
(
baseMarker
,
s
"[ResultWriter ${reporter.name}] started writing results for file tree "
+
s
"'${x.
treeTask
.treeBasePath}'"
s
"'${x.
fileTree
.treeBasePath}'"
)
case
x
:
ResultWriterEventResult
=>
logger
.
debug
(
baseMarker
,
s
"[ResultWriter ${reporter.name}] processes parsing results for file '${x.relativePath}' "
+
s
"from file tree '${x.
treeTask
.treeBasePath}'"
s
"from file tree '${x.
fileTree
.treeBasePath}'"
)
case
x
:
ResultWriterEventEnd
=>
logger
.
info
(
baseMarker
,
s
"[ResultWriter ${reporter.name}] finished writing results for file tree "
+
s
"'${x.
treeTask
.treeBasePath}', output location: '${x.outputLocation}' "
+
s
"'${x.
fileTree
.treeBasePath}', output location: '${x.outputLocation}' "
+
s
"(${x.numCalculations} calculations, ${x.numParsingFailures} parsing failures)"
)
}
...
...
integrated-pipeline/src/main/scala/eu/nomad_lab/integrated_pipeline/ParsingResultsProcessingManager.scala
View file @
9050799d
...
...
@@ -34,7 +34,7 @@ trait ParsingResultsProcessingManager extends MessageProcessor[FileParsingResult
if
(!
processedCounts
.
contains
(
signal
.
treeTask
.
treeBasePath
))
startFileTree
(
signal
.
treeTask
)
eventListener
.
processEvent
(
myId
,
ResultWriterEventResult
(
treeTask
=
signal
.
treeTask
,
fileTree
=
signal
.
treeTask
,
relativePath
=
signal
.
task
.
relativePath
,
parser
=
signal
.
task
.
parserName
,
result
=
signal
.
result
,
...
...
@@ -52,7 +52,7 @@ trait ParsingResultsProcessingManager extends MessageProcessor[FileParsingResult
processedCounts
.
remove
(
path
)
val
numFailures
=
failedCounts
.
remove
(
path
).
get
eventListener
.
processEvent
(
myId
,
ResultWriterEventEnd
(
treeTask
=
signal
.
treeTask
,
fileTree
=
signal
.
treeTask
,
numCalculations
=
numCalculations
,
numParsingFailures
=
numFailures
,
outputLocation
=
processor
.
outputLocation
(
signal
.
treeTask
)
...
...
integrated-pipeline/src/main/scala/eu/nomad_lab/integrated_pipeline/messages/ProcessEvents.scala
View file @
9050799d
...
...
@@ -11,49 +11,49 @@ import eu.nomad_lab.parsers.ParseResult.ParseResult
*/
sealed
trait
TreeParserEvent
{
def
treeTask
:
FileTree
def
fileTree
:
FileTree
}
case
class
TreeParserEventStart
(
treeTask
:
FileTree
fileTree
:
FileTree
)
extends
TreeParserEvent
case
class
TreeParserEventCandidate
(
treeTask
:
FileTree
,
fileTree
:
FileTree
,
relativePath
:
Path
,
parser
:
String
)
extends
TreeParserEvent
case
class
TreeParserEventScanError
(
treeTask
:
FileTree
,
fileTree
:
FileTree
,
relativePath
:
Path
,
error
:
Throwable
)
extends
TreeParserEvent
case
class
TreeParserEventTreeFailure
(
treeTask
:
FileTree
,
fileTree
:
FileTree
,
error
:
Throwable
)
extends
TreeParserEvent
case
class
TreeParserEventEnd
(
treeTask
:
FileTree
,
fileTree
:
FileTree
,
numCandidates
:
Long
)
extends
TreeParserEvent
sealed
trait
CalculationParserEvent
{
def
treeTask
:
FileTree
def
fileTree
:
FileTree
def
relativePath
:
Path
def
parser
:
String
}
case
class
CalculationParserEventStart
(
treeTask
:
FileTree
,
fileTree
:
FileTree
,
relativePath
:
Path
,
parser
:
String
)
extends
CalculationParserEvent
case
class
CalculationParserEventEnd
(
treeTask
:
FileTree
,
fileTree
:
FileTree
,
relativePath
:
Path
,
parser
:
String
,
result
:
ParseResult
,
...
...
@@ -61,15 +61,15 @@ case class CalculationParserEventEnd(
)
extends
CalculationParserEvent
sealed
trait
ResultWriterEvent
{
def
treeTask
:
FileTree
def
fileTree
:
FileTree
}
case
class
ResultWriterEventStart
(
treeTask
:
FileTree
fileTree
:
FileTree
)
extends
ResultWriterEvent
case
class
ResultWriterEventResult
(
treeTask
:
FileTree
,
fileTree
:
FileTree
,
relativePath
:
Path
,
parser
:
String
,
result
:
ParseResult
,
...
...
@@ -77,7 +77,7 @@ case class ResultWriterEventResult(
)
extends
ResultWriterEvent
case
class
ResultWriterEventEnd
(
treeTask
:
FileTree
,
fileTree
:
FileTree
,
numCalculations
:
Long
,
numParsingFailures
:
Long
,
outputLocation
:
Path
...
...
integrated-pipeline/src/test/scala/eu/nomad_lab/integrated_pipeline_tests/Builders.scala
View file @
9050799d
...
...
@@ -154,128 +154,128 @@ object EventBuilders {
import
Defaults._
case
class
BuilderTreeParserEventStart
(
private
val
treeTask
:
FileTree
=
BuilderFileTreeScanTask
().
build
()
private
val
fileTree
:
FileTree
=
BuilderFileTreeScanTask
().
build
()
)
{
def
with
TreeTask
(
task
:
FileTree
)
=
copy
(
treeTask
=
t
ask
)
def
withBasePath
(
path
:
Path
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeBasePath
=
path
))
def
with
FileTree
(
tree
:
FileTree
)
=
copy
(
fileTree
=
t
ree
)
def
withBasePath
(
path
:
Path
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeBasePath
=
path
))
def
withBasePath
(
path
:
String
)
:
BuilderTreeParserEventStart
=
withBasePath
(
Paths
.
get
(
path
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeType
=
newType
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeType
=
newType
))
def
build
()
=
TreeParserEventStart
(
treeTask
=
treeTask
fileTree
=
fileTree
)
}
case
class
BuilderTreeParserEventCandidate
(
private
val
treeTask
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
fileTree
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
relativePath
:
Path
=
defaultPath
,
private
val
parser
:
String
=
defaultParser
)
{
def
with
TreeTask
(
task
:
FileTree
)
=
copy
(
treeTask
=
t
ask
)
def
withBasePath
(
path
:
Path
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeBasePath
=
path
))
def
with
FileTree
(
tree
:
FileTree
)
=
copy
(
fileTree
=
t
ree
)
def
withBasePath
(
path
:
Path
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeBasePath
=
path
))
def
withBasePath
(
path
:
String
)
:
BuilderTreeParserEventCandidate
=
withBasePath
(
Paths
.
get
(
path
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeType
=
newType
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeType
=
newType
))
def
withRelativePath
(
path
:
Path
)
=
copy
(
relativePath
=
path
)
def
withRelativePath
(
path
:
String
)
:
BuilderTreeParserEventCandidate
=
withRelativePath
(
Paths
.
get
(
path
))
def
withParser
(
parserName
:
String
)
=
copy
(
parser
=
parserName
)
def
build
()
=
TreeParserEventCandidate
(
treeTask
=
treeTask
,
fileTree
=
fileTree
,
relativePath
=
relativePath
,
parser
=
parser
)
}
case
class
BuilderTreeParserEventScanError
(
private
val
treeTask
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
fileTree
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
relativePath
:
Path
=
defaultPath
,
private
val
error
:
Throwable
=
defaultError
)
{
def
with
TreeTask
(
task
:
FileTree
)
=
copy
(
treeTask
=
t
ask
)
def
withBasePath
(
path
:
Path
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeBasePath
=
path
))
def
with
FileTree
(
tree
:
FileTree
)
=
copy
(
fileTree
=
t
ree
)
def
withBasePath
(
path
:
Path
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeBasePath
=
path
))
def
withBasePath
(
path
:
String
)
:
BuilderTreeParserEventScanError
=
withBasePath
(
Paths
.
get
(
path
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeType
=
newType
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeType
=
newType
))
def
withRelativePath
(
path
:
Path
)
=
copy
(
relativePath
=
path
)
def
withRelativePath
(
path
:
String
)
:
BuilderTreeParserEventScanError
=
withRelativePath
(
Paths
.
get
(
path
))
def
withError
(
newError
:
Throwable
)
=
copy
(
error
=
newError
)
def
build
()
=
TreeParserEventScanError
(
treeTask
=
treeTask
,
fileTree
=
fileTree
,
relativePath
=
relativePath
,
error
=
error
)
}
case
class
BuilderTreeParserEventEnd
(
private
val
treeTask
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
fileTree
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
numCandidates
:
Long
=
-
1
)
{
def
with
TreeTask
(
task
:
FileTree
)
=
copy
(
treeTask
=
t
ask
)
def
withBasePath
(
path
:
Path
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeBasePath
=
path
))
def
with
FileTree
(
tree
:
FileTree
)
=
copy
(
fileTree
=
t
ree
)
def
withBasePath
(
path
:
Path
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeBasePath
=
path
))
def
withBasePath
(
path
:
String
)
:
BuilderTreeParserEventEnd
=
withBasePath
(
Paths
.
get
(
path
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeType
=
newType
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeType
=
newType
))
def
withNumCandidates
(
count
:
Long
)
=
copy
(
numCandidates
=
count
)
def
build
()
=
TreeParserEventEnd
(
treeTask
=
treeTask
,
fileTree
=
fileTree
,
numCandidates
=
numCandidates
)
}
case
class
BuilderTreeParserEventTreeFailure
(
private
val
treeTask
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
fileTree
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
error
:
Throwable
=
defaultError
)
{
def
with
TreeTask
(
task
:
FileTree
)
=
copy
(
treeTask
=
t
ask
)
def
withBasePath
(
path
:
Path
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeBasePath
=
path
))
def
with
FileTree
(
tree
:
FileTree
)
=
copy
(
fileTree
=
t
ree
)
def
withBasePath
(
path
:
Path
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeBasePath
=
path
))
def
withBasePath
(
path
:
String
)
:
BuilderTreeParserEventTreeFailure
=
withBasePath
(
Paths
.
get
(
path
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeType
=
newType
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeType
=
newType
))
def
withError
(
newError
:
Throwable
)
=
copy
(
error
=
newError
)
def
build
()
=
TreeParserEventTreeFailure
(
treeTask
=
treeTask
,
fileTree
=
fileTree
,
error
=
error
)
}
case
class
BuilderCalculationParserEventStart
(
private
val
treeTask
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
fileTree
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
relativePath
:
Path
=
defaultPath
,
private
val
parser
:
String
=
defaultParser
)
{
def
with
TreeTask
(
task
:
FileTree
)
=
copy
(
treeTask
=
t
ask
)
def
withBasePath
(
path
:
Path
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeBasePath
=
path
))
def
with
FileTree
(
tree
:
FileTree
)
=
copy
(
fileTree
=
t
ree
)
def
withBasePath
(
path
:
Path
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeBasePath
=
path
))
def
withBasePath
(
path
:
String
)
:
BuilderCalculationParserEventStart
=
withBasePath
(
Paths
.
get
(
path
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeType
=
newType
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeType
=
newType
))
def
withRelativePath
(
path
:
Path
)
=
copy
(
relativePath
=
path
)
def
withRelativePath
(
path
:
String
)
:
BuilderCalculationParserEventStart
=
withRelativePath
(
Paths
.
get
(
path
))
def
withParser
(
parserName
:
String
)
=
copy
(
parser
=
parserName
)
def
build
()
=
CalculationParserEventStart
(
treeTask
=
treeTask
,
fileTree
=
fileTree
,
relativePath
=
relativePath
,
parser
=
parser
)
}
case
class
BuilderCalculationParserEventEnd
(
private
val
treeTask
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
fileTree
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
relativePath
:
Path
=
defaultPath
,
private
val
parser
:
String
=
defaultParser
,
private
val
result
:
ParseResult
=
defaultParseResult
,
private
val
error
:
Option
[
String
]
=
None
)
{
def
with
TreeTask
(
task
:
FileTree
)
=
copy
(
treeTask
=
t
ask
)
def
withBasePath
(
path
:
Path
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeBasePath
=
path
))
def
with
FileTree
(
tree
:
FileTree
)
=
copy
(
fileTree
=
t
ree
)
def
withBasePath
(
path
:
Path
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeBasePath
=
path
))
def
withBasePath
(
path
:
String
)
:
BuilderCalculationParserEventEnd
=
withBasePath
(
Paths
.
get
(
path
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeType
=
newType
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeType
=
newType
))
def
withRelativePath
(
path
:
Path
)
=
copy
(
relativePath
=
path
)
def
withRelativePath
(
path
:
String
)
:
BuilderCalculationParserEventEnd
=
withRelativePath
(
Paths
.
get
(
path
))
def
withParser
(
parserName
:
String
)
=
copy
(
parser
=
parserName
)
...
...
@@ -283,7 +283,7 @@ object EventBuilders {
def
withErrorMessage
(
newError
:
Option
[
String
])
=
copy
(
error
=
newError
)
def
build
()
=
CalculationParserEventEnd
(
treeTask
=
treeTask
,
fileTree
=
fileTree
,
relativePath
=
relativePath
,
parser
=
parser
,
result
=
result
,
...
...
@@ -292,31 +292,31 @@ object EventBuilders {
}
case
class
BuilderResultWriterEventStart
(
private
val
treeTask
:
FileTree
=
BuilderFileTreeScanTask
().
build
()
private
val
fileTree
:
FileTree
=
BuilderFileTreeScanTask
().
build
()
)
{
def
with
TreeTask
(
task
:
FileTree
)
=
copy
(
treeTask
=
t
ask
)
def
withBasePath
(
path
:
Path
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeBasePath
=
path
))
def
with
FileTree
(
tree
:
FileTree
)
=
copy
(
fileTree
=
t
ree
)
def
withBasePath
(
path
:
Path
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeBasePath
=
path
))
def
withBasePath
(
path
:
String
)
:
BuilderResultWriterEventStart
=
withBasePath
(
Paths
.
get
(
path
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeType
=
newType
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeType
=
newType
))
def
build
()
=
ResultWriterEventStart
(
treeTask
=
treeTask
fileTree
=
fileTree
)
}
case
class
BuilderResultWriterEventResult
(
private
val
treeTask
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
fileTree
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
relativePath
:
Path
=
defaultPath
,
private
val
parser
:
String
=
defaultParser
,
private
val
result
:
ParseResult
=
defaultParseResult
,
private
val
error
:
Option
[
String
]
=
None
)
{
def
with
TreeTask
(
task
:
FileTree
)
=
copy
(
treeTask
=
t
ask
)
def
withBasePath
(
path
:
Path
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeBasePath
=
path
))
def
with
FileTree
(
tree
:
FileTree
)
=
copy
(
fileTree
=
t
ree
)
def
withBasePath
(
path
:
Path
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeBasePath
=
path
))
def
withBasePath
(
path
:
String
)
:
BuilderResultWriterEventResult
=
withBasePath
(
Paths
.
get
(
path
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeType
=
newType
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeType
=
newType
))
def
withRelativePath
(
path
:
Path
)
=
copy
(
relativePath
=
path
)
def
withRelativePath
(
path
:
String
)
:
BuilderResultWriterEventResult
=
withRelativePath
(
Paths
.
get
(
path
))
def
withParser
(
parserName
:
String
)
=
copy
(
parser
=
parserName
)
...
...
@@ -324,7 +324,7 @@ object EventBuilders {
def
withErrorMessage
(
newError
:
Option
[
String
])
=
copy
(
error
=
newError
)
def
build
()
=
ResultWriterEventResult
(
treeTask
=
treeTask
,
fileTree
=
fileTree
,
relativePath
=
relativePath
,
parser
=
parser
,
result
=
result
,
...
...
@@ -333,23 +333,23 @@ object EventBuilders {
}
case
class
BuilderResultWriterEventEnd
(
private
val
treeTask
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
fileTree
:
FileTree
=
BuilderFileTreeScanTask
().
build
(),
private
val
numCalculations
:
Long
=
-
1
,
private
val
numParsingFailures
:
Long
=
-
1
,
private
val
outputLocation
:
Path
=
defaultPath
)
{
def
with
TreeTask
(
task
:
FileTree
)
=
copy
(
treeTask
=
t
ask
)
def
withBasePath
(
path
:
Path
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeBasePath
=
path
))
def
with
FileTree
(
tree
:
FileTree
)
=
copy
(
fileTree
=
t
ree
)
def
withBasePath
(
path
:
Path
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeBasePath
=
path
))
def
withBasePath
(
path
:
String
)
:
BuilderResultWriterEventEnd
=
withBasePath
(
Paths
.
get
(
path
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
treeTask
=
treeTask
.
copy
(
treeType
=
newType
))
def
withTreeType
(
newType
:
TreeType
)
=
copy
(
fileTree
=
fileTree
.
copy
(
treeType
=
newType
))
def
withNumCalculations
(
count
:
Long
)
=
copy
(
numCalculations
=
count
)
def
withNumParsingFailures
(
count
:
Long
)
=
copy
(
numParsingFailures
=
count
)
def
withOutputPath
(
path
:
Path
)
=
copy
(
outputLocation
=
path
)
def
withOutputPath
(
path
:
String
)
:
BuilderResultWriterEventEnd
=
withOutputPath
(
Paths
.
get
(
path
))
def
build
()
=
ResultWriterEventEnd
(
treeTask
=
treeTask
,
fileTree
=
fileTree
,
numCalculations
=
numCalculations
,
numParsingFailures
=
numParsingFailures
,
outputLocation
=
outputLocation
...
...
integrated-pipeline/src/test/scala/eu/nomad_lab/integrated_pipeline_tests/TreeScannerSpec.scala
View file @
9050799d
...
...
@@ -53,7 +53,7 @@ class TreeScannerSpec extends WordSpec with TestDataBuilders with MockitoSugar
def
taskReceivedWillCreateScanError
()
:
Fixture
=
{
val
data
:
Iterator
[
Either
[
TreeParserEventScanError
,
FileParsingTask
]]
=
Iterator
.
single
(
Left
(
aTreeParserEventScanError
().
withTree
Task
(
sampleTreeTask
).
withRelativePath
(
"nullPointer"
).
Left
(
aTreeParserEventScanError
().
with
File
Tree
(
sampleTreeTask
).
withRelativePath
(
"nullPointer"
).
withError
(
new
UnsupportedOperationException
(
"failing test case"
))
build
())
)
val
f
=
new
Fixture
(
data
)
...
...
integrated-pipeline/src/test/scala/eu/nomad_lab/integrated_pipeline_tests/matchers/MatcherCalculationParserEvent.scala
View file @
9050799d
...
...
@@ -12,7 +12,7 @@ trait MatcherCalculationParserEvent {
MatcherHelpers
.
propertyMatcher
(
propertyName
=
"tree base path"
,
expected
=
expectedValue
,
test
=
(
x
:
CalculationParserEvent
)
=>
x
.
treeTask
.
treeBasePath
test
=
(
x
:
CalculationParserEvent
)
=>
x
.
fileTree
.
treeBasePath
)
def
basePath
(
expectedValue
:
String
)
:
HavePropertyMatcher
[
CalculationParserEvent
,
Path
]
=
...
...
integrated-pipeline/src/test/scala/eu/nomad_lab/integrated_pipeline_tests/matchers/MatcherResultWriterEvent.scala
View file @
9050799d
...
...
@@ -12,7 +12,7 @@ trait MatcherResultWriterEvent {
MatcherHelpers
.
propertyMatcher
(
propertyName
=
"tree base path"
,
expected
=
expectedValue
,
test
=
(
x
:
ResultWriterEvent
)
=>
x
.
treeTask
.
treeBasePath
test
=
(
x
:
ResultWriterEvent
)
=>
x
.
fileTree
.
treeBasePath
)
def
basePath
(
expectedValue
:
String
)
:
HavePropertyMatcher
[
ResultWriterEvent
,
Path
]
=
...
...
integrated-pipeline/src/test/scala/eu/nomad_lab/integrated_pipeline_tests/matchers/MatcherTreeParserEvent.scala
View file @
9050799d
...
...
@@ -11,7 +11,7 @@ trait MatcherTreeParserEvent {
MatcherHelpers
.
propertyMatcher
(
propertyName
=
"tree base path"
,
expected
=
expectedValue
,
test
=
(
x
:
TreeParserEvent
)
=>
x
.
treeTask
.
treeBasePath
test
=
(
x
:
TreeParserEvent
)
=>
x
.
fileTree
.
treeBasePath
)
def
basePath
(
expectedValue
:
String
)
:
HavePropertyMatcher
[
TreeParserEvent
,
Path
]
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment