use of net.nemerosa.ontrack.model.security.SecurityService in project ontrack by nemerosa.
the class JenkinsServiceTest method before.
@Before
public void before() {
SecurityService securityService = mock(SecurityService.class);
configurationRepository = mock(ConfigurationRepository.class);
encryptionService = mock(EncryptionService.class);
JenkinsClientFactory jenkinsClientFactory = mock(JenkinsClientFactory.class);
JenkinsClient okJenkinsClient = mock(JenkinsClient.class);
when(jenkinsClientFactory.getClient(any(JenkinsConfiguration.class))).thenReturn(okJenkinsClient);
OntrackConfigProperties ontrackConfigProperties = new OntrackConfigProperties();
jenkinsService = new JenkinsConfigurationServiceImpl(configurationRepository, securityService, encryptionService, mock(EventPostService.class), mock(EventFactory.class), jenkinsClientFactory, ontrackConfigProperties);
}
use of net.nemerosa.ontrack.model.security.SecurityService in project ontrack by nemerosa.
the class JIRAServiceTest method before.
@Before
public void before() {
SecurityService securityService = mock(SecurityService.class);
configurationRepository = mock(ConfigurationRepository.class);
encryptionService = mock(EncryptionService.class);
JIRASession jiraSession = mock(JIRASession.class);
when(jiraSession.getClient()).thenReturn(mock(JIRAClient.class));
JIRASessionFactory jiraSessionFactory = mock(JIRASessionFactory.class);
when(jiraSessionFactory.create(any(JIRAConfiguration.class))).thenReturn(jiraSession);
OntrackConfigProperties ontrackConfigProperties = new OntrackConfigProperties();
jiraService = new JIRAConfigurationServiceImpl(configurationRepository, securityService, encryptionService, mock(EventPostService.class), mock(EventFactory.class), jiraSessionFactory, ontrackConfigProperties);
}
use of net.nemerosa.ontrack.model.security.SecurityService 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));
}
use of net.nemerosa.ontrack.model.security.SecurityService 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));
}
use of net.nemerosa.ontrack.model.security.SecurityService in project ontrack by nemerosa.
the class GitChangeLogResourceDecoratorTest method before.
@Before
public void before() {
SecurityService securityService = mock(SecurityService.class);
gitService = mock(GitService.class);
mapper = new ResourceObjectMapperFactory().resourceObjectMapper(new DefaultResourceContext(new MockURIBuilder(), securityService), new GitChangeLogResourceDecorator(gitService));
}
Aggregations