Search in sources :

Example 1 with TagNameSvnRevisionLink

use of net.nemerosa.ontrack.extension.svn.support.TagNameSvnRevisionLink 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 2 with TagNameSvnRevisionLink

use of net.nemerosa.ontrack.extension.svn.support.TagNameSvnRevisionLink 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)

Aggregations

SCMExtensionFeature (net.nemerosa.ontrack.extension.scm.SCMExtensionFeature)2 SVNExtensionFeature (net.nemerosa.ontrack.extension.svn.SVNExtensionFeature)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 Test (org.junit.Test)2