Search in sources :

Example 1 with CommandOutputHandlerFactory

use of com.palantir.stash.stashbot.outputhandler.CommandOutputHandlerFactory in project stashbot by palantir.

the class TriggerJenkinsBuildHookTest method setUp.

@Before
public void setUp() throws SQLException {
    MockitoAnnotations.initMocks(this);
    Mockito.when(repo.getId()).thenReturn(REPO_ID);
    Mockito.when(cpm.getRepositoryConfigurationForRepository(repo)).thenReturn(rc);
    Mockito.when(cpm.getJenkinsServerConfiguration(Mockito.anyString())).thenReturn(jsc);
    Mockito.when(cpm.getJobTypeStatusMapping(rc, JobType.VERIFY_COMMIT)).thenReturn(true);
    Mockito.when(cpm.getJobTypeStatusMapping(rc, JobType.PUBLISH)).thenReturn(true);
    Mockito.when(rc.getCiEnabled()).thenReturn(true);
    Mockito.when(rc.getVerifyBranchRegex()).thenReturn(".*master.*");
    Mockito.when(rc.getPublishBranchRegex()).thenReturn(".*release.*");
    Mockito.when(jsc.getMaxVerifyChain()).thenReturn(MVC);
    Mockito.when(change.getFromHash()).thenReturn(FROM_HEAD);
    Mockito.when(change.getToHash()).thenReturn(HEAD);
    Mockito.when(change.getRefId()).thenReturn(HEAD_BR);
    Mockito.when(change.getType()).thenReturn(RefChangeType.UPDATE);
    changes = new ArrayList<RefChange>();
    changes.add(change);
    // MGC stuff
    mgc = new MockGitCommandBuilderFactory();
    mgc.getChangesets().add(HEAD);
    mgc.getBranchMap().put(HEAD, ImmutableList.of("  otherbranch"));
    gcbf = mgc.getGitCommandBuilderFactory();
    cohf = new CommandOutputHandlerFactory();
    tjbh = new TriggerJenkinsBuildHook(cpm, jenkinsManager, gcbf, cohf, lf);
}
Also used : RefChange(com.atlassian.stash.repository.RefChange) CommandOutputHandlerFactory(com.palantir.stash.stashbot.outputhandler.CommandOutputHandlerFactory) MockGitCommandBuilderFactory(com.palantir.stash.stashbot.mocks.MockGitCommandBuilderFactory) Before(org.junit.Before)

Aggregations

RefChange (com.atlassian.stash.repository.RefChange)1 MockGitCommandBuilderFactory (com.palantir.stash.stashbot.mocks.MockGitCommandBuilderFactory)1 CommandOutputHandlerFactory (com.palantir.stash.stashbot.outputhandler.CommandOutputHandlerFactory)1 Before (org.junit.Before)1