public final class PluginUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static org.xmlunit.diff.Diff |
computeXmlDiff(hudson.XmlFile xmlFile1,
hudson.XmlFile xmlFile2)
Compare two xml files, ignore whitespace.
|
static String |
fileToString(File file)
Get a file's content as String.
|
static hudson.XmlFile |
getBuildXml(File buildRootDir)
Get the build xml file contained in the buildRootDir.
|
static PipelineItemHistoryDao |
getHistoryDao()
Get the history dao which is used to manage the config history storage.
|
static String |
getJenkinsfilePath(org.jenkinsci.plugins.workflow.job.WorkflowJob workflowJob)
Get the path to a workflowJob's current jenkinsfile.
|
static String |
getJenkinsfilePathFromFlowDefinition(org.jenkinsci.plugins.workflow.flow.FlowDefinition flowDefinition)
Get the path to a flowDefinition's current jenkinsfile.
|
static File |
getJenkinsRootDir()
Get the current Jenkins root directory.
|
static File |
getLibDir(File buildRootDir)
Get the library directory for a given root directory (normally a build dir).
|
static String |
getMissingRequiredPlugins()
Get the missing required plugins as String.
|
static int |
getOriginalNumberFromBuildXml(File buildXmlFile)
Get the original number for builds which are replays from other builds.
|
static org.jenkinsci.plugins.workflow.job.WorkflowJob |
getWorkflowJob(String fullName)
get the workflowJob associated with the given fullName.
|
static Date |
parsedDate(String timeStamp)
Returns a
Date. |
static boolean |
requiredPluginsInstalled()
Test if the required plugins are installed.
|
static boolean |
scriptInXmlFileIsEqual(hudson.XmlFile xmlFile1,
hudson.XmlFile xmlFile2)
Test if the scripts contained in the two files are equal.
|
public static PipelineItemHistoryDao getHistoryDao()
public static File getLibDir(File buildRootDir)
buildRootDir - the build root directory.public static hudson.XmlFile getBuildXml(File buildRootDir)
buildRootDir - the directory containing the build xml filepublic static int getOriginalNumberFromBuildXml(File buildXmlFile) throws ParserConfigurationException, IOException, SAXException
buildXmlFile - the build xml fileParserConfigurationException - if something goes wrong creating a document parser.IOException - if something IO related goes wrong int the parsing
process.SAXException - if something goes wrong parsing the xml file.public static String fileToString(File file) throws IOException
file - the file to readIOException - if the file could not be read.public static org.jenkinsci.plugins.workflow.job.WorkflowJob getWorkflowJob(String fullName)
fullName - the job's fullNamepublic static String getJenkinsfilePath(org.jenkinsci.plugins.workflow.job.WorkflowJob workflowJob)
workflowJob - the workflowJob.public static String getJenkinsfilePathFromFlowDefinition(org.jenkinsci.plugins.workflow.flow.FlowDefinition flowDefinition)
flowDefinition - the FlowDefinition.public static File getJenkinsRootDir()
public static boolean requiredPluginsInstalled()
public static String getMissingRequiredPlugins()
public static boolean scriptInXmlFileIsEqual(hudson.XmlFile xmlFile1,
hudson.XmlFile xmlFile2)
throws ParserConfigurationException,
IOException,
SAXException
xmlFile1 - file1xmlFile2 - file2ParserConfigurationException - if creating a parser failsIOException - if one of the two files is corrupt.SAXException - if parsing one xml file failspublic static Date parsedDate(String timeStamp)
Date.timeStamp - date as string.public static org.xmlunit.diff.Diff computeXmlDiff(hudson.XmlFile xmlFile1,
hudson.XmlFile xmlFile2)
xmlFile1 - the first filexmlFile2 - the second fileCopyright © 2016–2020. All rights reserved.