Class Util
java.lang.Object
com.axis.jenkins.plugins.eiffel.eiffelbroadcaster.Util
Constants and helper functions.
- Author:
- Isac Holm <isac.holm@axis.com>
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Fetches the full name task name if available.Splits the input string into lines, removes leading and trailing whitespace, and returns non-empty lines in a list.static URI
Returns the URI of aRun
, or one of its subresources.static com.fasterxml.jackson.databind.JsonNode
mustPublishEvent
(EiffelEvent event, EventSigner signer) Publishes anEiffelEvent
and raises an exception if an error occurs.static com.fasterxml.jackson.databind.JsonNode
publishEvent
(EiffelEvent event, EventSigner signer) Publishes anEiffelEvent
and logs a message if there's an error.translateStatus
(String status) Translate Jenkins job status into corresponding eiffel status.
-
Method Details
-
getFullName
Fetches the full name task name if available.- Parameters:
t
- Queue.task- Returns:
- full name if available, else the short name
-
getRunUri
Returns the URI of aRun
, or one of its subresources.- Parameters:
r
- the Run to return the URI forpathSuffix
- additional path components to append- Returns:
- the URI asked for, or null if a URI couldn't be resolved
-
mustPublishEvent
@CheckForNull public static com.fasterxml.jackson.databind.JsonNode mustPublishEvent(@NonNull EiffelEvent event, @CheckForNull EventSigner signer) throws EventValidationFailedException, InvalidCertificateConfigurationException, InvalidKeyException, JsonCanonicalizationException, com.fasterxml.jackson.core.JsonProcessingException, KeyStoreException, NoSuchAlgorithmException, SchemaUnavailableException, SignatureException, UnsupportedAlgorithmException, UnrecoverableKeyException Publishes anEiffelEvent
and raises an exception if an error occurs.- Parameters:
event
- the Eiffel event to publishsigner
- theEventSigner
that should be called to get the event signed (if signing has been enabled), ornull
if signing should be disabled- Returns:
- the published event or null if event publishing is disabled
- Throws:
EventValidationFailedException
- if the validation of the event against the JSON schema failsInvalidCertificateConfigurationException
- if the keystore in the certificate credential was entirely empty or its first item didn't contain a certificate with a private keyInvalidKeyException
- if the given private key was invalidJsonCanonicalizationException
- if there was an error serializing the event to canonical JSON formcom.fasterxml.jackson.core.JsonProcessingException
- if there's an error during JSON serializationKeyStoreException
- if theKeyStore
hasn't been initialized (shouldn't happen and indicates a bug)NoSuchAlgorithmException
- if the algorithm needed to decrypt the key isn't availableSchemaUnavailableException
- if there's no schema available for the supplied eventSignatureException
- if there's a general problem in the signing processUnsupportedAlgorithmException
- if the credential's signature algorithm isn't supported by this implementation of the Eiffel protocol or the available cryptography providerUnrecoverableKeyException
-
publishEvent
@CheckForNull public static com.fasterxml.jackson.databind.JsonNode publishEvent(@NonNull EiffelEvent event, @CheckForNull EventSigner signer) Publishes anEiffelEvent
and logs a message if there's an error.- Parameters:
event
- the Eiffel event to publishsigner
- theEventSigner
that should be called to get the event signed (if signing has been enabled), ornull
if signing should be disabled- Returns:
- the published event or null if there was an error or event publishing is disabled
-
getLinesInString
Splits the input string into lines, removes leading and trailing whitespace, and returns non-empty lines in a list.- Parameters:
s
- the line to split
-
translateStatus
Translate Jenkins job status into corresponding eiffel status.- Parameters:
status
- jenkins job status to translate.- Returns:
- translated status.
-