public final class SafeJenkins
extends java.lang.Object
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.
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
decrypt(java.lang.String encryptedMessage) |
static java.lang.String |
encrypt(java.lang.String message) |
static hudson.util.DescribableList<hudson.slaves.NodeProperty<?>,hudson.slaves.NodePropertyDescriptor> |
getGlobalNodeProperties() |
static jenkins.model.Jenkins |
getJenkinsInstance() |
static hudson.util.DescribableList<hudson.slaves.NodeProperty<?>,hudson.slaves.NodePropertyDescriptor> |
getNodeProperties() |
static boolean |
isNull(java.lang.Object object) |
static boolean |
nonNull(java.lang.Object object) |
static void |
setLocalNodeProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Creates a
EnvironmentVariablesNodeProperty of environment properties, from the given Map . |
static void |
useNativeInstance(boolean useNativeInstance) |
public static void useNativeInstance(boolean useNativeInstance)
public static jenkins.model.Jenkins getJenkinsInstance()
public static hudson.util.DescribableList<hudson.slaves.NodeProperty<?>,hudson.slaves.NodePropertyDescriptor> getGlobalNodeProperties()
public static hudson.util.DescribableList<hudson.slaves.NodeProperty<?>,hudson.slaves.NodePropertyDescriptor> getNodeProperties()
public static void setLocalNodeProperties(java.util.Map<java.lang.String,java.lang.String> properties)
EnvironmentVariablesNodeProperty
of environment properties, from the given Map
.public static java.lang.String encrypt(java.lang.String message)
public static java.lang.String decrypt(java.lang.String encryptedMessage)
public static boolean isNull(java.lang.Object object)
public static boolean nonNull(java.lang.Object object)