Search in sources :

Example 1 with GitLabConfiguration

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

the class GitLabConfigurationTest method cloneTest.

@Test
public void cloneTest() {
    GitLabConfiguration cloned = configurationFixture().clone("newConfig", s -> StringUtils.replace(s, "nemerosa", "other"));
    assertEquals("newConfig", cloned.getName());
    assertEquals("https://gitlab.other.net", cloned.getUrl());
    assertEquals("test", cloned.getUser());
    assertEquals("1234567890abcdef", cloned.getPassword());
    assertFalse(cloned.isIgnoreSslCertificate());
}
Also used : GitLabConfiguration(net.nemerosa.ontrack.extension.gitlab.model.GitLabConfiguration) Test(org.junit.Test)

Example 2 with GitLabConfiguration

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

the class GitLabConfigurationTest method obfuscate.

@Test
public void obfuscate() {
    GitLabConfiguration obfuscate = configurationFixture().obfuscate();
    assertEquals("", obfuscate.getPassword());
}
Also used : GitLabConfiguration(net.nemerosa.ontrack.extension.gitlab.model.GitLabConfiguration) Test(org.junit.Test)

Example 3 with GitLabConfiguration

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

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

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

the class GitLabProjectConfigurationPropertyType method fromStorage.

@Override
public GitLabProjectConfigurationProperty fromStorage(JsonNode node) {
    String configurationName = node.path("configuration").asText();
    // Looks the configuration up
    GitLabConfiguration configuration = configurationService.getConfiguration(configurationName);
    // OK
    return new GitLabProjectConfigurationProperty(configuration, node.path("issueServiceConfigurationIdentifier").asText(), node.path("repository").asText(), node.path("indexationInterval").asInt());
}
Also used : GitLabConfiguration(net.nemerosa.ontrack.extension.gitlab.model.GitLabConfiguration)

Aggregations

GitLabConfiguration (net.nemerosa.ontrack.extension.gitlab.model.GitLabConfiguration)6 Test (org.junit.Test)4 GitLabIssueServiceConfiguration (net.nemerosa.ontrack.extension.gitlab.model.GitLabIssueServiceConfiguration)2 GitExtensionFeature (net.nemerosa.ontrack.extension.git.GitExtensionFeature)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