use of net.nemerosa.ontrack.extension.issues.model.IssueServiceConfiguration 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());
}
use of net.nemerosa.ontrack.extension.issues.model.IssueServiceConfiguration in project ontrack by nemerosa.
the class IndexationServiceImpl method indexIssues.
private void indexIssues(SVNRepository repository, SVNLogEntry logEntry) {
// Is the repository associated with any issue service?
ConfiguredIssueService configuredIssueService = repository.getConfiguredIssueService();
if (configuredIssueService != null) {
IssueServiceExtension issueServiceExtension = configuredIssueService.getIssueServiceExtension();
IssueServiceConfiguration issueServiceConfiguration = configuredIssueService.getIssueServiceConfiguration();
// Revision information to scan
long revision = logEntry.getRevision();
String message = logEntry.getMessage();
// Cache for issues
Set<String> revisionIssues = new HashSet<>();
// Gets all issues from the message
Set<String> issues = issueServiceExtension.extractIssueKeysFromMessage(issueServiceConfiguration, message);
// For each issue in the message
issues.stream().filter(issueKey -> !revisionIssues.contains(issueKey)).forEach(issueKey -> {
revisionIssues.add(issueKey);
logger.info(String.format(" Indexing revision %d <-> %s", revision, issueKey));
// Indexes this issue
issueRevisionDao.link(repository.getId(), revision, issueKey);
});
}
}
use of net.nemerosa.ontrack.extension.issues.model.IssueServiceConfiguration 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());
}
use of net.nemerosa.ontrack.extension.issues.model.IssueServiceConfiguration in project ontrack by nemerosa.
the class GitLabIssueServiceExtensionTest method get_configuration_by_name.
@Test
public void get_configuration_by_name() {
when(configurationService.getConfiguration("test")).thenReturn(engineConfiguration);
IssueServiceConfiguration configuration = extension.getConfigurationByName("test:nemerosa/ontrack");
assertNotNull(configuration);
assertEquals("test:nemerosa/ontrack", configuration.getName());
assertEquals("gitlab", configuration.getServiceId());
}
Aggregations