Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add StatusInformation to the connector monitor #427

Open
NassimBtk opened this issue Sep 24, 2024 · 0 comments
Open

Add StatusInformation to the connector monitor #427

NassimBtk opened this issue Sep 24, 2024 · 0 comments
Assignees

Comments

@NassimBtk
Copy link
Member

Specification

Enhance the AbstractStrategy.validateConnectorDetectionCriteria method to collect a new StatusInformation parameter. This parameter will aggregate and append messages from CriterionTestResult instances found in the ConnectorTestResult.

	/**
	 * Builds the status information for the connector
	 * @param hostname   Hostname of the resource being monitored
	 * @param testResult Test result of the connector
	 * @return String representing the status information
	 */
	protected String buildStatusInformation(final String hostname, final ConnectorTestResult testResult) {
		final StringBuilder value = new StringBuilder();

		final String builtTestResult = testResult
			.getCriterionTestResults()
			.stream()
			.map(criterionResult -> {
				final String result = criterionResult.getResult();
				final String message = criterionResult.getMessage();
				return String.format(
					"Received Result: %s. %s",
					result != null ? result : "N/A",
					message != null ? message : "N/A"
				);
			})
			.collect(Collectors.joining("\n"));
		value
			.append(builtTestResult)
			.append("\nConclusion: ")
			.append("Test on ")
			.append(hostname)
			.append(" ")
			.append(testResult.isSuccess() ? "SUCCEEDED" : "FAILED");

		return value.toString();
	}

Add the StatusInformation value in the legacyTextParameters of the Monitor typed as connector.

MedMaalej added a commit that referenced this issue Sep 27, 2024
* Update validateConnectorDetectionCriteria to put StatusInformation in the legacyTextParameters monitor attribute map of the connector monitor
* Add unit tests assertions in DiscoveryStrategyTest, SimpleStrategyTest and CollectStrategyTest
MedMaalej added a commit that referenced this issue Sep 27, 2024
* Update validateConnectorDetectionCriteria
* Update unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants