Search in sources :

Example 1 with EmailSettings

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));
}
Also used : Repository(com.atlassian.stash.repository.Repository) EmailSettings(com.palantir.stash.stashbot.config.ConfigurationPersistenceService.EmailSettings) RepositoryConfiguration(com.palantir.stash.stashbot.persistence.RepositoryConfiguration) Test(org.junit.Test)

Example 2 with EmailSettings

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
    }
}
Also used : Repository(com.atlassian.stash.repository.Repository) EmailSettings(com.palantir.stash.stashbot.config.ConfigurationPersistenceService.EmailSettings) Test(org.junit.Test)

Aggregations

Repository (com.atlassian.stash.repository.Repository)2 EmailSettings (com.palantir.stash.stashbot.config.ConfigurationPersistenceService.EmailSettings)2 Test (org.junit.Test)2 RepositoryConfiguration (com.palantir.stash.stashbot.persistence.RepositoryConfiguration)1