Class SafeJenkins
java.lang.Object
org.jenkinsci.plugins.pollmailboxtrigger.SafeJenkins
This class provides a way for us to invoke the Jenkins.getInstance() method, during testing, without it throwing NoSuchMethod errors. Currently this method throws the following error: 'java.lang.NoSuchMethodError: hudson.util.XStream2.getConverterRegistry()Lcom/thoughtworks/xstream/converters/ConverterRegistry;'.
Unfortunately this method is invoked in many places, often nested within other static methods. This makes mocking very difficult/impossible. So, I've fashioned the following class to address these issues.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic Stringstatic DescribableList<NodeProperty<?>, NodePropertyDescriptor> static Jenkinsstatic DescribableList<NodeProperty<?>, NodePropertyDescriptor> static booleanstatic booleanstatic voidsetLocalNodeProperties(Map<String, String> properties) Creates aEnvironmentVariablesNodePropertyof environment properties, from the givenMap.static voiduseNativeInstance(boolean useNativeInstance)
-
Method Details
-
useNativeInstance
public static void useNativeInstance(boolean useNativeInstance) -
getJenkinsInstance
-
getGlobalNodeProperties
-
getNodeProperties
-
setLocalNodeProperties
Creates aEnvironmentVariablesNodePropertyof environment properties, from the givenMap. -
encrypt
-
decrypt
-
isNull
-
nonNull
-