Class ProcessingUtil
java.lang.Object
org.hansken.plugin.extraction.test.base.ProcessingUtil
Utility functions for use when running an
ExtractionPluginProcessor.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic PathcreateDataStreamPath(Path rootTracePath, String tracePath, String dataType) Create aPathwhich points to the data stream file of the expected trace and type.static PathcreateRunProfilePath(Path rootTracePath) Create aPathwhich points to the output run profile.static byte[]dataStream(nl.minvenj.nfi.flits.api.Trace trace, String dataType) Extract adata streamsof given type from given trace.dataTypes(nl.minvenj.nfi.flits.api.Trace trace) Extract all data types of thedata streamsof given trace.static StringextractFileExtension(Path filePath) Return extension of file at provided path.static StringextractFileName(Path path) Return filename without extension from a given path.static PathgetSearchTracesPath(Path tracePath) Return folder containing search traces given provided path to test trace.static booleanhasDataStreamOfType(nl.minvenj.nfi.flits.api.Trace trace, String dataType) Validate that givenTracecontains a data stream of given type.static booleanisFileWithExtension(Path filePath, String extension) Return true if the extension filename located at path equals the provided extension.static SearchTracesearchTraceFromPath(Path tracePath) Create a search trace given the path to the file representing the search trace.
-
Field Details
-
SEARCH_TRACES_DIR_NAME
- See Also:
-
-
Method Details
-
dataTypes
Extract all data types of thedata streamsof given trace. It does this by filtering for all properties which start with theConstants.DATA_STREAM_NAME_PREFIXmarker.- Parameters:
trace- the trace to extract the data types- Returns:
- all data types of the contained data streams
-
hasDataStreamOfType
Validate that givenTracecontains a data stream of given type.- Parameters:
trace- the trace to testdataType- the type of the data stream to check for- Returns:
trueif the trace contains the requested stream, otherwisefalse
-
dataStream
Extract adata streamsof given type from given trace.- Parameters:
trace- the trace to read the data stream fromdataType- the type of the data to read- Returns:
- the data stream as a byte array
-
createDataStreamPath
Create aPathwhich points to the data stream file of the expected trace and type. ThetracePathis a path which uniquely defines a single (child) trace.- Parameters:
rootTracePath- the path of the root trace JSONtracePath- a uniquely identifying path for current tracedataType- the data type of the stream- Returns:
- a new path for given data stream file
-
createRunProfilePath
Create aPathwhich points to the output run profile.- Parameters:
rootTracePath- the path of the root trace JSON- Returns:
- a new path for given output run profile
-
extractFileName
Return filename without extension from a given path.- Parameters:
path- path to a file- Returns:
- filename without extension
-
getSearchTracesPath
Return folder containing search traces given provided path to test trace.- Parameters:
tracePath- path to the trace being tested- Returns:
- traces returned when querying
-
isFileWithExtension
Return true if the extension filename located at path equals the provided extension.- Parameters:
filePath- path to file to checkextension- extension to match- Returns:
- true if matches
-
extractFileExtension
Return extension of file at provided path.- Parameters:
filePath- path to file- Returns:
- extension of file
-
searchTraceFromPath
Create a search trace given the path to the file representing the search trace.- Parameters:
tracePath- Path to the search trace- Returns:
- New SearchTrace
-