Record Class ConnectionTestResult
java.lang.Object
java.lang.Record
com.xebialabs.xlrelease.osgi.api.configuration.ConnectionTestResult
- Record Components:
successful- whether the test succeededmessage- shown to the release author on success or failure; must never contain secretsexception- present for failures that carry a cause
public record ConnectionTestResult(boolean successful, String message, Optional<Exception> exception)
extends Record
The outcome of one
ConnectionTestExtension.test(com.xebialabs.deployit.plugin.api.udm.ConfigurationItem) call. message is rendered to the
release author who clicked Test Connection, on both success and failure - never put a
configuration value (a URL with embedded credentials, a token from an HTTP error body, ...) in
it, exactly as TaskExecutionContext.log(java.lang.String) already
warns for task execution logs.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSafe fallback for failures that do not provide an explicit public message. -
Constructor Summary
ConstructorsConstructorDescriptionConnectionTestResult(boolean successful, Exception e) UsesDEFAULT_FAILURE_MESSAGEas the result message.ConnectionTestResult(boolean successful, String message) Success or failure with a message but no attached exception.ConnectionTestResult(boolean successful, String message, Exception exception) Result carrying both a message and an exception.ConnectionTestResult(boolean successful, String message, Optional<Exception> exception) Creates an instance of aConnectionTestResultrecord class.Failure carrying the given exception and theDEFAULT_FAILURE_MESSAGE.ConnectionTestResult(String message) Successful result with the given message. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theexceptionrecord component.final inthashCode()Returns a hash code value for this object.message()Returns the value of themessagerecord component.booleanReturns the value of thesuccessfulrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_FAILURE_MESSAGE
Safe fallback for failures that do not provide an explicit public message.Attached exception details are for server-side diagnostics only and are not used to build client-facing messages.
- See Also:
-
-
Constructor Details
-
ConnectionTestResult
Success or failure with a message but no attached exception.- Parameters:
successful- whether the test succeededmessage- shown to the release author; must never contain secrets
-
ConnectionTestResult
Result carrying both a message and an exception.- Parameters:
successful- whether the test succeededmessage- shown to the release authorexception- the cause
-
ConnectionTestResult
UsesDEFAULT_FAILURE_MESSAGEas the result message. The exception remains attached for server-side diagnostics and does not contribute to the client-facing message.- Parameters:
successful- whether the test succeedede- the exception to attach
-
ConnectionTestResult
Failure carrying the given exception and theDEFAULT_FAILURE_MESSAGE. The exception remains available for server-side diagnostics only.- Parameters:
e- the exception to attach
-
ConnectionTestResult
Successful result with the given message.- Parameters:
message- shown to the release author
-
ConnectionTestResult
Creates an instance of aConnectionTestResultrecord class.- Parameters:
successful- the value for thesuccessfulrecord componentmessage- the value for themessagerecord componentexception- the value for theexceptionrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
successful
public boolean successful()Returns the value of thesuccessfulrecord component.- Returns:
- the value of the
successfulrecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-
exception
Returns the value of theexceptionrecord component.- Returns:
- the value of the
exceptionrecord component
-