use of com.palantir.stash.stashbot.config.ConfigurationPersistenceService.EmailSettings in project stashbot by palantir.
the class ConfigurationTest method storesRepoData.
@Test
public void storesRepoData() throws Exception {
Repository repo = Mockito.mock(Repository.class);
Mockito.when(repo.getId()).thenReturn(1);
Mockito.when(repo.getName()).thenReturn("repoName");
int size = ao.count(RepositoryConfiguration.class);
cpm.setRepositoryConfigurationForRepository(repo, true, "verifyBranchRegex", "verifyBuildCommand", false, "N/A", "publishBranchRegex", "publishBuildCommand", false, "N/A", "prebuildCommand", "default", true, false, "N/A", false, "N/A", size, new EmailSettings(true, "a@a.a", true, true, true), false, false);
RepositoryConfiguration rc = cpm.getRepositoryConfigurationForRepository(repo);
Assert.assertEquals("publishBranchRegex", rc.getPublishBranchRegex());
Assert.assertEquals("publishBuildCommand", rc.getPublishBuildCommand());
Assert.assertEquals("verifyBranchRegex", rc.getVerifyBranchRegex());
Assert.assertEquals("verifyBuildCommand", rc.getVerifyBuildCommand());
Assert.assertEquals("prebuildCommand", rc.getPrebuildCommand());
Assert.assertEquals("default", rc.getJenkinsServerName());
Assert.assertTrue(rc.getCiEnabled());
Assert.assertTrue(rc.getEmailNotificationsEnabled());
Assert.assertFalse(rc.getPreserveJenkinsJobConfig());
Assert.assertEquals(size + 1, ao.count(RepositoryConfiguration.class));
}
use of com.palantir.stash.stashbot.config.ConfigurationPersistenceService.EmailSettings in project stashbot by palantir.
the class ConfigurationTest method failsWithBadData.
@Test
public void failsWithBadData() throws Exception {
Repository repo = Mockito.mock(Repository.class);
Mockito.when(repo.getId()).thenReturn(1);
Mockito.when(repo.getName()).thenReturn("repoName");
try {
cpm.setRepositoryConfigurationForRepository(repo, true, "verifyBranchRegex", "verifyBuildCommand", false, "N/A", "publishBranchRegex", "publishBuildCommand", false, "N/A", "prebuildCommand", "BADNAME", true, false, "N/A", false, "N/A", null, new EmailSettings(), false, false);
Assert.fail("Should have thrown exception");
} catch (Exception e) {
// success
}
}
Aggregations