Search in sources :

Example 1 with SCMExtensionFeature

use of net.nemerosa.ontrack.extension.scm.SCMExtensionFeature 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 SCMExtensionFeature

use of net.nemerosa.ontrack.extension.scm.SCMExtensionFeature in project ontrack by nemerosa.

the class SVNBranchConfigurationPropertyTypeTest method not_editable_when_project_not_configured.

@Test
public void not_editable_when_project_not_configured() {
    Project project = Project.of(new NameDescription("P", "Project")).withId(ID.of(1));
    Branch branch = Branch.of(project, new NameDescription("B", "Branch")).withId(ID.of(1));
    PropertyService propertiesService = mock(PropertyService.class);
    when(propertiesService.hasProperty(project, SVNProjectConfigurationPropertyType.class)).thenReturn(false);
    SecurityService securityService = mock(SecurityService.class);
    when(securityService.isProjectFunctionGranted(1, ProjectConfig.class)).thenReturn(true);
    BuildSvnRevisionLinkService buildSvnRevisionLinkService = mock(BuildSvnRevisionLinkService.class);
    TagNameSvnRevisionLink tagNameSvnRevisionLink = new TagNameSvnRevisionLink(mock(SVNService.class), mock(StructureService.class));
    SVNBranchConfigurationPropertyType propertyType = new SVNBranchConfigurationPropertyType(new SVNExtensionFeature(new SCMExtensionFeature()), propertiesService, buildSvnRevisionLinkService, tagNameSvnRevisionLink);
    assertFalse(propertyType.canEdit(branch, securityService));
}
Also used : SVNExtensionFeature(net.nemerosa.ontrack.extension.svn.SVNExtensionFeature) TagNameSvnRevisionLink(net.nemerosa.ontrack.extension.svn.support.TagNameSvnRevisionLink) SecurityService(net.nemerosa.ontrack.model.security.SecurityService) SCMExtensionFeature(net.nemerosa.ontrack.extension.scm.SCMExtensionFeature) BuildSvnRevisionLinkService(net.nemerosa.ontrack.extension.svn.model.BuildSvnRevisionLinkService) SVNService(net.nemerosa.ontrack.extension.svn.service.SVNService) Test(org.junit.Test)

Example 3 with SCMExtensionFeature

use of net.nemerosa.ontrack.extension.scm.SCMExtensionFeature in project ontrack by nemerosa.

the class SVNBranchConfigurationPropertyTypeTest method editable_when_project_configured.

@Test
public void editable_when_project_configured() {
    Project project = Project.of(new NameDescription("P", "Project")).withId(ID.of(1));
    Branch branch = Branch.of(project, new NameDescription("B", "Branch")).withId(ID.of(1));
    PropertyService propertiesService = mock(PropertyService.class);
    when(propertiesService.hasProperty(project, SVNProjectConfigurationPropertyType.class)).thenReturn(true);
    SecurityService securityService = mock(SecurityService.class);
    when(securityService.isProjectFunctionGranted(1, ProjectConfig.class)).thenReturn(true);
    BuildSvnRevisionLinkService buildSvnRevisionLinkService = mock(BuildSvnRevisionLinkService.class);
    TagNameSvnRevisionLink tagNameSvnRevisionLink = new TagNameSvnRevisionLink(mock(SVNService.class), mock(StructureService.class));
    SVNBranchConfigurationPropertyType propertyType = new SVNBranchConfigurationPropertyType(new SVNExtensionFeature(new SCMExtensionFeature()), propertiesService, buildSvnRevisionLinkService, tagNameSvnRevisionLink);
    assertTrue(propertyType.canEdit(branch, securityService));
}
Also used : SVNExtensionFeature(net.nemerosa.ontrack.extension.svn.SVNExtensionFeature) TagNameSvnRevisionLink(net.nemerosa.ontrack.extension.svn.support.TagNameSvnRevisionLink) SecurityService(net.nemerosa.ontrack.model.security.SecurityService) SCMExtensionFeature(net.nemerosa.ontrack.extension.scm.SCMExtensionFeature) BuildSvnRevisionLinkService(net.nemerosa.ontrack.extension.svn.model.BuildSvnRevisionLinkService) SVNService(net.nemerosa.ontrack.extension.svn.service.SVNService) Test(org.junit.Test)

Example 4 with SCMExtensionFeature

use of net.nemerosa.ontrack.extension.scm.SCMExtensionFeature in project ontrack by nemerosa.

the class SVNRevisionChangeLogIssueValidatorTest method fromStorage.

@Test
public void fromStorage() {
    PropertyService propertyService = mock(PropertyService.class);
    SVNIssueRevisionDao issueRevisionDao = mock(SVNIssueRevisionDao.class);
    SVNRevisionChangeLogIssueValidator validator = new SVNRevisionChangeLogIssueValidator(new SVNExtensionFeature(new SCMExtensionFeature()), propertyService, issueRevisionDao);
    assertEquals(new SVNRevisionChangeLogIssueValidatorConfig(Arrays.asList("Closed", "Resolved")), validator.fromStorage(JsonUtils.object().with("closedStatuses", JsonUtils.stringArray("Closed", "Resolved")).end()));
}
Also used : SVNExtensionFeature(net.nemerosa.ontrack.extension.svn.SVNExtensionFeature) SVNIssueRevisionDao(net.nemerosa.ontrack.extension.svn.db.SVNIssueRevisionDao) PropertyService(net.nemerosa.ontrack.model.structure.PropertyService) SCMExtensionFeature(net.nemerosa.ontrack.extension.scm.SCMExtensionFeature) Test(org.junit.Test)

Example 5 with SCMExtensionFeature

use of net.nemerosa.ontrack.extension.scm.SCMExtensionFeature 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)

Aggregations

SCMExtensionFeature (net.nemerosa.ontrack.extension.scm.SCMExtensionFeature)5 SVNExtensionFeature (net.nemerosa.ontrack.extension.svn.SVNExtensionFeature)3 Test (org.junit.Test)3 GitExtensionFeature (net.nemerosa.ontrack.extension.git.GitExtensionFeature)2 IssueExportServiceFactory (net.nemerosa.ontrack.extension.issues.export.IssueExportServiceFactory)2 BuildSvnRevisionLinkService (net.nemerosa.ontrack.extension.svn.model.BuildSvnRevisionLinkService)2 SVNService (net.nemerosa.ontrack.extension.svn.service.SVNService)2 TagNameSvnRevisionLink (net.nemerosa.ontrack.extension.svn.support.TagNameSvnRevisionLink)2 SecurityService (net.nemerosa.ontrack.model.security.SecurityService)2 Before (org.junit.Before)2 OntrackGitHubClientFactory (net.nemerosa.ontrack.extension.github.client.OntrackGitHubClientFactory)1 GitHubEngineConfiguration (net.nemerosa.ontrack.extension.github.model.GitHubEngineConfiguration)1 GitHubConfigurationService (net.nemerosa.ontrack.extension.github.service.GitHubConfigurationService)1 GitHubIssueServiceConfiguration (net.nemerosa.ontrack.extension.github.service.GitHubIssueServiceConfiguration)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 SVNIssueRevisionDao (net.nemerosa.ontrack.extension.svn.db.SVNIssueRevisionDao)1