org.jenkinsci.plugins.pollmailboxtrigger
Class SafeJenkins

java.lang.Object
  extended by org.jenkinsci.plugins.pollmailboxtrigger.SafeJenkins

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.


Method Summary
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

useNativeInstance

public static void useNativeInstance(boolean useNativeInstance)

getJenkinsInstance

public static jenkins.model.Jenkins getJenkinsInstance()

getGlobalNodeProperties

public static hudson.util.DescribableList<hudson.slaves.NodeProperty<?>,hudson.slaves.NodePropertyDescriptor> getGlobalNodeProperties()

getNodeProperties

public static hudson.util.DescribableList<hudson.slaves.NodeProperty<?>,hudson.slaves.NodePropertyDescriptor> getNodeProperties()

setLocalNodeProperties

public static void setLocalNodeProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Creates a EnvironmentVariablesNodeProperty of environment properties, from the given Map.


encrypt

public static java.lang.String encrypt(java.lang.String message)

decrypt

public static java.lang.String decrypt(java.lang.String encryptedMessage)

isNull

public static boolean isNull(java.lang.Object object)

nonNull

public static boolean nonNull(java.lang.Object object)