Search in sources :

Example 1 with PropertiesDao

use of org.sonar.db.property.PropertiesDao in project sonarqube by SonarSource.

the class NotificationDaemonTest method hasProjectSubscribersForType.

@Test
public void hasProjectSubscribersForType() {
    setUpMocks();
    PropertiesDao dao = mock(PropertiesDao.class);
    when(dbClient.propertiesDao()).thenReturn(dao);
    // no subscribers
    when(dao.hasProjectNotificationSubscribersForDispatchers("PROJECT_UUID", Arrays.asList("CommentOnIssueAssignedToMe", "CommentOnIssueCreatedByMe"))).thenReturn(false);
    assertThat(service.hasProjectSubscribersForTypes("PROJECT_UUID", Sets.newHashSet("issue-changes"))).isFalse();
    // has subscribers on one dispatcher (among the two)
    when(dao.hasProjectNotificationSubscribersForDispatchers("PROJECT_UUID", Arrays.asList("CommentOnIssueAssignedToMe", "CommentOnIssueCreatedByMe"))).thenReturn(true);
    assertThat(service.hasProjectSubscribersForTypes("PROJECT_UUID", Sets.newHashSet("issue-changes"))).isTrue();
}
Also used : PropertiesDao(org.sonar.db.property.PropertiesDao) Test(org.junit.Test)

Example 2 with PropertiesDao

use of org.sonar.db.property.PropertiesDao in project sonarqube by SonarSource.

the class RenameDeprecatedPropertyKeysTest method should_rename_deprecated_keys.

@Test
public void should_rename_deprecated_keys() {
    PropertiesDao dao = mock(PropertiesDao.class);
    PropertyDefinitions definitions = new PropertyDefinitions(FakeExtension.class);
    RenameDeprecatedPropertyKeys task = new RenameDeprecatedPropertyKeys(dao, definitions);
    task.start();
    verify(dao).renamePropertyKey("old_key", "new_key");
    verifyNoMoreInteractions(dao);
}
Also used : PropertyDefinitions(org.sonar.api.config.PropertyDefinitions) PropertiesDao(org.sonar.db.property.PropertiesDao) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 PropertiesDao (org.sonar.db.property.PropertiesDao)2 PropertyDefinitions (org.sonar.api.config.PropertyDefinitions)1