Search in sources :

Example 1 with MockSecurityServiceBuilder

use of com.palantir.stash.stashbot.mocks.MockSecurityServiceBuilder in project stashbot by palantir.

the class JenkinsManagerTest method setUp.

@Before
public void setUp() throws Throwable {
    MockitoAnnotations.initMocks(this);
    Mockito.when(jenkinsClientManager.getJenkinsServer(Mockito.any(JenkinsServerConfiguration.class), Mockito.any(RepositoryConfiguration.class))).thenReturn(jenkinsServer);
    jtf = new MockJobTemplateFactory(jtm);
    jtf.generateDefaultsForRepo(repo, rc);
    Mockito.when(xmlFormatter.generateJobXml(Mockito.any(JobTemplate.class), Mockito.eq(repo))).thenReturn(XML_STRING);
    Mockito.when(cpm.getJenkinsServerConfiguration(Mockito.anyString())).thenReturn(jsc);
    Mockito.when(cpm.getRepositoryConfigurationForRepository(repo)).thenReturn(rc);
    Mockito.when(jsc.getStashUsername()).thenReturn("stash_username");
    Mockito.when(jsc.getStashPassword()).thenReturn("stash_password");
    Mockito.when(jsc.getPassword()).thenReturn("jenkins_password");
    Mockito.when(repo.getName()).thenReturn("somename");
    Mockito.when(repo.getSlug()).thenReturn("slug");
    Mockito.when(repo.getProject()).thenReturn(proj);
    Mockito.when(proj.getKey()).thenReturn("project_key");
    Mockito.when(um.getRemoteUser()).thenReturn(up);
    Mockito.when(up.getUsername()).thenReturn("someuser");
    Mockito.when(us.getUserByName(Mockito.anyString())).thenReturn(su);
    mssb = new MockSecurityServiceBuilder();
    ss = mssb.getSecurityService();
    jenkinsManager = new JenkinsManager(repositoryService, cpm, jtm, xmlFormatter, jenkinsClientManager, sub, lf, ss, us, um);
}
Also used : MockJobTemplateFactory(com.palantir.stash.stashbot.mocks.MockJobTemplateFactory) MockSecurityServiceBuilder(com.palantir.stash.stashbot.mocks.MockSecurityServiceBuilder) JenkinsServerConfiguration(com.palantir.stash.stashbot.persistence.JenkinsServerConfiguration) RepositoryConfiguration(com.palantir.stash.stashbot.persistence.RepositoryConfiguration) JobTemplate(com.palantir.stash.stashbot.persistence.JobTemplate) Before(org.junit.Before)

Aggregations

MockJobTemplateFactory (com.palantir.stash.stashbot.mocks.MockJobTemplateFactory)1 MockSecurityServiceBuilder (com.palantir.stash.stashbot.mocks.MockSecurityServiceBuilder)1 JenkinsServerConfiguration (com.palantir.stash.stashbot.persistence.JenkinsServerConfiguration)1 JobTemplate (com.palantir.stash.stashbot.persistence.JobTemplate)1 RepositoryConfiguration (com.palantir.stash.stashbot.persistence.RepositoryConfiguration)1 Before (org.junit.Before)1