Search in sources :

Example 1 with TestProjectIndexers

use of org.sonar.server.es.TestProjectIndexers in project sonarqube by SonarSource.

the class DeleteActionTest method project_deletion_also_ensure_that_webhooks_on_this_project_if_they_exists_are_deleted.

@Test
public void project_deletion_also_ensure_that_webhooks_on_this_project_if_they_exists_are_deleted() {
    ProjectDto project = componentDbTester.insertPrivateProjectDto();
    webhookDbTester.insertWebhook(project);
    webhookDbTester.insertWebhook(project);
    webhookDbTester.insertWebhook(project);
    webhookDbTester.insertWebhook(project);
    userSessionRule.logIn().addProjectPermission(ADMIN, project);
    DeleteAction underTest = new DeleteAction(new ComponentCleanerService(dbClient, mockResourceTypes, new TestProjectIndexers()), from(db), dbClient, userSessionRule, projectLifeCycleListeners);
    new WsActionTester(underTest).newRequest().setParam(PARAM_PROJECT, project.getKey()).execute();
    List<WebhookDto> webhookDtos = dbClient.webhookDao().selectByProject(dbSession, project);
    assertThat(webhookDtos).isEmpty();
}
Also used : ProjectDto(org.sonar.db.project.ProjectDto) WebhookDto(org.sonar.db.webhook.WebhookDto) ComponentCleanerService(org.sonar.server.component.ComponentCleanerService) TestProjectIndexers(org.sonar.server.es.TestProjectIndexers) WsActionTester(org.sonar.server.ws.WsActionTester) Test(org.junit.Test)

Example 2 with TestProjectIndexers

use of org.sonar.server.es.TestProjectIndexers in project sonarqube by SonarSource.

the class DeleteActionTest method project_deletion_also_ensure_that_homepage_on_this_project_if_it_exists_is_cleared.

@Test
public void project_deletion_also_ensure_that_homepage_on_this_project_if_it_exists_is_cleared() {
    ComponentDto project = componentDbTester.insertPrivateProject();
    UserDto insert = dbClient.userDao().insert(dbSession, newUserDto().setHomepageType("PROJECT").setHomepageParameter(project.uuid()));
    dbSession.commit();
    userSessionRule.logIn().addProjectPermission(ADMIN, project);
    DeleteAction underTest = new DeleteAction(new ComponentCleanerService(dbClient, mockResourceTypes, new TestProjectIndexers()), from(db), dbClient, userSessionRule, projectLifeCycleListeners);
    new WsActionTester(underTest).newRequest().setParam(PARAM_PROJECT, project.getDbKey()).execute();
    UserDto userReloaded = dbClient.userDao().selectByUuid(dbSession, insert.getUuid());
    assertThat(userReloaded.getHomepageType()).isNull();
    assertThat(userReloaded.getHomepageParameter()).isNull();
}
Also used : UserDto(org.sonar.db.user.UserDto) UserTesting.newUserDto(org.sonar.db.user.UserTesting.newUserDto) ComponentDto(org.sonar.db.component.ComponentDto) ComponentCleanerService(org.sonar.server.component.ComponentCleanerService) TestProjectIndexers(org.sonar.server.es.TestProjectIndexers) WsActionTester(org.sonar.server.ws.WsActionTester) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ComponentCleanerService (org.sonar.server.component.ComponentCleanerService)2 TestProjectIndexers (org.sonar.server.es.TestProjectIndexers)2 WsActionTester (org.sonar.server.ws.WsActionTester)2 ComponentDto (org.sonar.db.component.ComponentDto)1 ProjectDto (org.sonar.db.project.ProjectDto)1 UserDto (org.sonar.db.user.UserDto)1 UserTesting.newUserDto (org.sonar.db.user.UserTesting.newUserDto)1 WebhookDto (org.sonar.db.webhook.WebhookDto)1