Search in sources :

Example 1 with GitLabIssueServiceConfiguration

use of net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueServiceConfiguration 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 GitLabIssueServiceConfiguration

use of net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueServiceConfiguration in project ontrack by nemerosa.

the class GitLabIssueServiceExtensionTest method issueServiceIdentifierContainsBothConfigurationAndRepository.

@Test
public void issueServiceIdentifierContainsBothConfigurationAndRepository() {
    when(configurationService.getConfiguration("Test")).thenReturn(new GitLabConfiguration("Test", "https://gitlab.test.com", null, null, false));
    IssueServiceConfiguration configuration = extension.getConfigurationByName("Test:nemerosa/ontrack");
    assertEquals("gitlab", configuration.getServiceId());
    assertEquals("Test:nemerosa/ontrack", configuration.getName());
    assertTrue(configuration instanceof GitLabIssueServiceConfiguration);
    GitLabIssueServiceConfiguration issueServiceConfiguration = (GitLabIssueServiceConfiguration) configuration;
    assertEquals("Test", issueServiceConfiguration.getConfiguration().getName());
    assertEquals("https://gitlab.test.com", issueServiceConfiguration.getConfiguration().getUrl());
    assertEquals("nemerosa/ontrack", issueServiceConfiguration.getRepository());
}
Also used : GitLabConfiguration(net.nemerosa.ontrack.extension.gitlab.model.GitLabConfiguration) GitLabIssueServiceConfiguration(net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueServiceConfiguration) GitLabIssueServiceConfiguration(net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueServiceConfiguration) IssueServiceConfiguration(net.nemerosa.ontrack.extension.issues.model.IssueServiceConfiguration) Test(org.junit.Test)

Example 3 with GitLabIssueServiceConfiguration

use of net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueServiceConfiguration 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));
}
Also used : OntrackGitLabClient(net.nemerosa.ontrack.extension.gitlab.client.OntrackGitLabClient) GitLabIssueServiceConfiguration(net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueServiceConfiguration)

Aggregations

GitLabIssueServiceConfiguration (net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueServiceConfiguration)3 GitLabConfiguration (net.nemerosa.ontrack.extension.gitlab.model.GitLabConfiguration)2 GitExtensionFeature (net.nemerosa.ontrack.extension.git.GitExtensionFeature)1 OntrackGitLabClient (net.nemerosa.ontrack.extension.gitlab.client.OntrackGitLabClient)1 OntrackGitLabClientFactory (net.nemerosa.ontrack.extension.gitlab.client.OntrackGitLabClientFactory)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 IssueServiceConfiguration (net.nemerosa.ontrack.extension.issues.model.IssueServiceConfiguration)1 SCMExtensionFeature (net.nemerosa.ontrack.extension.scm.SCMExtensionFeature)1 GitlabIssue (org.gitlab.api.models.GitlabIssue)1 Before (org.junit.Before)1 Test (org.junit.Test)1