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);
}
Aggregations