use of net.nemerosa.ontrack.extension.gitlab.client.OntrackGitLabClient in project ontrack by nemerosa.
the class GitLabConfigurationServiceImpl method validate.
@Override
protected ConnectionResult validate(GitLabConfiguration configuration) {
try {
// Gets the client
OntrackGitLabClient client = gitLabClientFactory.create(configuration);
// Gets the list of repositories
client.getRepositories();
// OK
return ConnectionResult.ok();
} catch (Exception ex) {
applicationLogService.log(ApplicationLogEntry.error(ex, NameDescription.nd("gitlab", "GitLab connection issue"), configuration.getUrl()).withDetail("gitlab-config-name", configuration.getName()).withDetail("gitlab-config-url", configuration.getUrl()));
return ConnectionResult.error(ex.getMessage());
}
}
use of net.nemerosa.ontrack.extension.gitlab.client.OntrackGitLabClient in project ontrack by nemerosa.
the class GitLabIssueServiceExtension method getIssue.
@Override
public Issue getIssue(IssueServiceConfiguration issueServiceConfiguration, String issueKey) {
GitLabIssueServiceConfiguration configuration = (GitLabIssueServiceConfiguration) issueServiceConfiguration;
OntrackGitLabClient client = gitLabClientFactory.create(configuration.getConfiguration());
return client.getIssue(configuration.getRepository(), getIssueId(issueKey));
}
use of net.nemerosa.ontrack.extension.gitlab.client.OntrackGitLabClient in project ontrack by nemerosa.
the class GitLabIssueServiceExtensionTest method get_issue_test.
protected Issue get_issue_test(String token, int id) {
OntrackGitLabClient client = mock(OntrackGitLabClient.class);
when(client.getIssue(configuration.getRepository(), id)).thenReturn(issueWrapper);
when(gitHubClientFactory.create(configuration.getConfiguration())).thenReturn(client);
return extension.getIssue(configuration, token);
}
use of net.nemerosa.ontrack.extension.gitlab.client.OntrackGitLabClient in project ontrack by nemerosa.
the class GitLabHealthIndicator method getHealth.
@Override
protected Health getHealth(GitLabConfiguration config) {
try {
// Gets the client
OntrackGitLabClient client = gitLabClientFactory.create(config);
// Gets the list of repositories
client.getRepositories();
// OK
return Health.up().build();
} catch (Exception ex) {
return Health.down(ex).build();
}
}
Aggregations