Class PolyspaceHelpersUtils
java.lang.Object
com.mathworks.polyspace.jenkins.utils.PolyspaceHelpersUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Small utility class to hold a results runId and projectId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
appendLineInFile
(Path file, String line) Appendline
with a new line infile
static String
getAccessResultProjectId
(Path output) static String
getAccessResultRunId
(Path output) static String
getAccessResultUrl
(Path output, String accessURL) static long
getCountFindings
(Path report) static Path
getReportOwner
(Path report, String owner) Build the report-owner filename: Owner is empty: "report
" unmodified Report without extension: "report
_owner
" Report with extension: "report
_owner
.ext"static Path
getReportOwnerList
(Path report) Build the report-owner-list filename:report
.owners.liststatic String
getReportStatus
(Path report, long max) static Boolean
isOwnerInFile
(Path ownerList, String owner) static void
reportFilter
(Path originalReport, Path filteredReport, String owner, String[] filters) FilteroriginalReport
againstfilters
intofilteredReport
associated withowner
static int
reportGetColId
(String line, String token) Get the column ID oftoken
inline
Note that tokens inline
are separated by tabs
-
Constructor Details
-
PolyspaceHelpersUtils
public PolyspaceHelpersUtils()
-
-
Method Details
-
isOwnerInFile
- Parameters:
ownerList
- - The owner list fileowner
- - An owner- Returns:
true
ifowner
is inownerList
-false
otherwise- Throws:
IOException
- Error while accessingownerList
-
appendLineInFile
Appendline
with a new line infile
- Parameters:
file
- - Path to a fileline
- - Line string to add- Throws:
IOException
- Error while accessingfile
-
getReportOwner
Build the report-owner filename:- Owner is empty: "
report
" unmodified - Report without extension: "
report
_owner
" - Report with extension: "
report
_owner
.ext"
- Parameters:
report
- - Path to the reportowner
- - An owner- Returns:
- The report-owner filename
- Owner is empty: "
-
getReportOwnerList
Build the report-owner-list filename:report
.owners.list- Parameters:
report
- - Path to the report- Returns:
- The report-owner-list filename
-
reportGetColId
Get the column ID oftoken
inline
Note that tokens inline
are separated by tabs- Parameters:
line
- - Line string containing the report column namestoken
- - Searched token- Returns:
- The column ID
-
reportFilter
public static void reportFilter(Path originalReport, Path filteredReport, String owner, String[] filters) throws IOException FilteroriginalReport
againstfilters
intofilteredReport
associated withowner
- Parameters:
originalReport
- - Path to original reportfilteredReport
- - Path to the new filtered report - it may already exist to allow to append multiple filtered reportsowner
- - The owner for the filtered report - must be a username matching an email as it will also be used to send the email notificationfilters
- - An array of strings containing one or more "key" "value" pairs- Throws:
IOException
- Error while accessingoriginalReport
orfilteredReport
-
getCountFindings
- Parameters:
report
- - Path to the report- Returns:
- - Number of findings in
report
: number of lines - 1 (title line) - Throws:
IOException
- Error while accessingreport
-
getReportStatus
- Parameters:
report
- - Path to the reportmax
- - Thereshold for status- Returns:
- - Job status string: SUCCESS if num findings smaller than
max
, UNSTABLE otherwise - Throws:
IOException
- Error while accessingreport
-
getAccessResultRunId
- Parameters:
output
- - Path to the report- Returns:
- Result runId
- Throws:
IOException
- Error while accessingoutput
-
getAccessResultProjectId
- Parameters:
output
- - Path to the report- Returns:
- Result projectId
- Throws:
IOException
- Error while accessingoutput
-
getAccessResultUrl
- Parameters:
output
- - Path to the reportaccessURL
- - Root Access server URL- Returns:
- Results URL
- Throws:
IOException
- Error while accessingoutput
-