Search in sources :

Example 1 with GitHubIssueServiceConfiguration

use of net.nemerosa.ontrack.extension.github.service.GitHubIssueServiceConfiguration in project ontrack by nemerosa.

the class GitHubIssueServiceExtension method getIssue.

@Override
public Issue getIssue(IssueServiceConfiguration issueServiceConfiguration, String issueKey) {
    GitHubIssueServiceConfiguration configuration = (GitHubIssueServiceConfiguration) issueServiceConfiguration;
    OntrackGitHubClient client = gitHubClientFactory.create(configuration.getConfiguration());
    return client.getIssue(configuration.getRepository(), getIssueId(issueKey));
}
Also used : OntrackGitHubClient(net.nemerosa.ontrack.extension.github.client.OntrackGitHubClient) GitHubIssueServiceConfiguration(net.nemerosa.ontrack.extension.github.service.GitHubIssueServiceConfiguration)

Example 2 with GitHubIssueServiceConfiguration

use of net.nemerosa.ontrack.extension.github.service.GitHubIssueServiceConfiguration in project ontrack by nemerosa.

the class GitHubIssueServiceExtensionTest method init.

@Before
public void init() {
    configurationService = mock(GitHubConfigurationService.class);
    OntrackGitHubClientFactory gitHubClientFactory = mock(OntrackGitHubClientFactory.class);
    IssueExportServiceFactory issueExportServiceFactory = mock(IssueExportServiceFactory.class);
    extension = new GitHubIssueServiceExtension(new GitHubExtensionFeature(new GitExtensionFeature(new SCMExtensionFeature())), configurationService, gitHubClientFactory, issueExportServiceFactory);
    GitHubEngineConfiguration engineConfiguration = new GitHubEngineConfiguration("test", "url", "", "", "");
    configuration = new GitHubIssueServiceConfiguration(engineConfiguration, "nemerosa/ontrack");
}
Also used : IssueExportServiceFactory(net.nemerosa.ontrack.extension.issues.export.IssueExportServiceFactory) GitHubConfigurationService(net.nemerosa.ontrack.extension.github.service.GitHubConfigurationService) SCMExtensionFeature(net.nemerosa.ontrack.extension.scm.SCMExtensionFeature) GitHubEngineConfiguration(net.nemerosa.ontrack.extension.github.model.GitHubEngineConfiguration) GitHubIssueServiceConfiguration(net.nemerosa.ontrack.extension.github.service.GitHubIssueServiceConfiguration) GitExtensionFeature(net.nemerosa.ontrack.extension.git.GitExtensionFeature) OntrackGitHubClientFactory(net.nemerosa.ontrack.extension.github.client.OntrackGitHubClientFactory) Before(org.junit.Before)

Example 3 with GitHubIssueServiceConfiguration

use of net.nemerosa.ontrack.extension.github.service.GitHubIssueServiceConfiguration in project ontrack by nemerosa.

the class GitHubIssueServiceExtensionTest method issueServiceIdentifierContainsBothConfigurationAndRepository.

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

Aggregations

GitHubIssueServiceConfiguration (net.nemerosa.ontrack.extension.github.service.GitHubIssueServiceConfiguration)3 GitHubEngineConfiguration (net.nemerosa.ontrack.extension.github.model.GitHubEngineConfiguration)2 GitExtensionFeature (net.nemerosa.ontrack.extension.git.GitExtensionFeature)1 OntrackGitHubClient (net.nemerosa.ontrack.extension.github.client.OntrackGitHubClient)1 OntrackGitHubClientFactory (net.nemerosa.ontrack.extension.github.client.OntrackGitHubClientFactory)1 GitHubConfigurationService (net.nemerosa.ontrack.extension.github.service.GitHubConfigurationService)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 Before (org.junit.Before)1 Test (org.junit.Test)1