Search in sources :

Example 1 with GitlabIssue

use of org.gitlab.api.models.GitlabIssue in project ontrack by nemerosa.

the class GitLabIssueServiceExtensionTest method init.

@Before
public void init() {
    configurationService = mock(GitLabConfigurationService.class);
    gitHubClientFactory = mock(OntrackGitLabClientFactory.class);
    IssueExportServiceFactory issueExportServiceFactory = mock(IssueExportServiceFactory.class);
    extension = new GitLabIssueServiceExtension(new GitLabExtensionFeature(new GitExtensionFeature(new SCMExtensionFeature())), issueExportServiceFactory, configurationService, gitHubClientFactory);
    engineConfiguration = new GitLabConfiguration("test", "url", "", "", false);
    configuration = new GitLabIssueServiceConfiguration(engineConfiguration, "nemerosa/ontrack");
    issueWrapper = new GitLabIssueWrapper(new GitlabIssue(), "url/xxx", "url/xxx");
}
Also used : GitLabConfiguration(net.nemerosa.ontrack.extension.gitlab.model.GitLabConfiguration) IssueExportServiceFactory(net.nemerosa.ontrack.extension.issues.export.IssueExportServiceFactory) GitLabIssueWrapper(net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueWrapper) GitLabIssueServiceConfiguration(net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueServiceConfiguration) GitLabConfigurationService(net.nemerosa.ontrack.extension.gitlab.service.GitLabConfigurationService) OntrackGitLabClientFactory(net.nemerosa.ontrack.extension.gitlab.client.OntrackGitLabClientFactory) SCMExtensionFeature(net.nemerosa.ontrack.extension.scm.SCMExtensionFeature) GitExtensionFeature(net.nemerosa.ontrack.extension.git.GitExtensionFeature) GitlabIssue(org.gitlab.api.models.GitlabIssue) Before(org.junit.Before)

Example 2 with GitlabIssue

use of org.gitlab.api.models.GitlabIssue in project ontrack by nemerosa.

the class DefaultOntrackGitLabClient method getIssue.

@Override
public GitLabIssueWrapper getIssue(String repository, int id) {
    try {
        // Issue
        String issueUrl = configuration.getUrl() + "/" + repository + GitlabIssue.URL + "/" + id;
        GitlabIssue issue = api.getIssue(repository, id);
        // Milestone URL
        String milestoneUrl = null;
        if (issue.getMilestone() != null) {
            milestoneUrl = configuration.getUrl() + "/" + repository + GitlabMilestone.URL + "/" + issue.getMilestone().getId();
        }
        // OK
        return GitLabIssueWrapper.of(issue, milestoneUrl, issueUrl);
    } catch (IOException e) {
        throw new OntrackGitLabClientException(e);
    }
}
Also used : IOException(java.io.IOException) GitlabIssue(org.gitlab.api.models.GitlabIssue)

Aggregations

GitlabIssue (org.gitlab.api.models.GitlabIssue)2 IOException (java.io.IOException)1 GitExtensionFeature (net.nemerosa.ontrack.extension.git.GitExtensionFeature)1 OntrackGitLabClientFactory (net.nemerosa.ontrack.extension.gitlab.client.OntrackGitLabClientFactory)1 GitLabConfiguration (net.nemerosa.ontrack.extension.gitlab.model.GitLabConfiguration)1 GitLabIssueServiceConfiguration (net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueServiceConfiguration)1 GitLabIssueWrapper (net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueWrapper)1 GitLabConfigurationService (net.nemerosa.ontrack.extension.gitlab.service.GitLabConfigurationService)1 IssueExportServiceFactory (net.nemerosa.ontrack.extension.issues.export.IssueExportServiceFactory)1 SCMExtensionFeature (net.nemerosa.ontrack.extension.scm.SCMExtensionFeature)1 Before (org.junit.Before)1