Package hudson.plugins.collabnet.util
Class Helper
- java.lang.Object
-
- hudson.plugins.collabnet.util.Helper
-
public class Helper extends Object
-
-
Constructor Summary
Constructors Constructor Description Helper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials
getCredentials(Item owner, String credentialsId, String webhookUrl)
static String
getErrorMessage(String messageJson)
static String
getOneTimeToken(URL ctfUrl, String accessToken)
Gets OneTimeToken for given acess tokenstatic String
getSessionId(URL ctfUrl, String oneTimeToken)
Get session id for given OneTimeTokenstatic String
getToken(URL ctfUrl, String ctfUserName, String ctfPassword)
static org.json.simple.JSONObject
getUserData(String url, String sessionId, String username)
static String
getWebhookToken(String webhookUrl, String webhookUsername, String webhookPassword, TaskListener listener)
static void
log(String msg, PrintStream printStream)
Logging helper that prepends the log message prefixstatic void
logMsg(String errMsg, TaskListener listener, Logger logger, Exception e)
static List<com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials>
lookupCredentials(Item owner, String webhookUrl)
static void
markUnstable(Run build, PrintStream consoleLogger, String message, String className)
Marks the build as unstable and logs a message.static javax.ws.rs.core.Response
request(String url, String tfSessionId, String payload, String method, Map<String,String> queryParam)
-
-
-
Method Detail
-
getToken
public static String getToken(URL ctfUrl, String ctfUserName, String ctfPassword) throws IOException
- Throws:
IOException
-
getOneTimeToken
public static String getOneTimeToken(URL ctfUrl, String accessToken) throws IOException
Gets OneTimeToken for given acess token- Parameters:
accessToken
- the access token- Throws:
IOException
-
getSessionId
public static String getSessionId(URL ctfUrl, String oneTimeToken) throws IOException
Get session id for given OneTimeToken- Parameters:
ctfUrl
- the ctf urloneTimeToken
- the one time token- Throws:
IOException
-
getWebhookToken
public static String getWebhookToken(String webhookUrl, String webhookUsername, String webhookPassword, TaskListener listener) throws IOException
- Throws:
IOException
-
logMsg
public static void logMsg(String errMsg, TaskListener listener, Logger logger, Exception e)
-
markUnstable
public static void markUnstable(Run build, PrintStream consoleLogger, String message, String className)
Marks the build as unstable and logs a message.- Parameters:
build
- the build to mark unstableconsoleLogger
- the logger to log tomessage
- the message to log
-
log
public static void log(String msg, PrintStream printStream)
Logging helper that prepends the log message prefix- Parameters:
msg
- log messageprintStream
- print stream
-
getCredentials
public static com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials getCredentials(Item owner, String credentialsId, String webhookUrl)
-
lookupCredentials
public static List<com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials> lookupCredentials(Item owner, String webhookUrl)
-
getUserData
public static org.json.simple.JSONObject getUserData(String url, String sessionId, String username) throws IOException
- Throws:
IOException
-
request
public static javax.ws.rs.core.Response request(String url, String tfSessionId, String payload, String method, Map<String,String> queryParam) throws IOException
- Throws:
IOException
-
-