@Test public void delete_project() { ComponentDto project1 = newProjectDto(); componentDbTester.insertProjectAndSnapshot(project1); ComponentDto project2 = newProjectDto(); componentDbTester.insertProjectAndSnapshot(project2); ComponentDto project3 = newProjectDto(); componentDbTester.insertProjectAndSnapshot(project3); underTest.index(); authorizationIndexerTester.indexProjectPermission(project1.uuid(), emptyList(), emptyList()); authorizationIndexerTester.indexProjectPermission(project2.uuid(), emptyList(), emptyList()); authorizationIndexerTester.indexProjectPermission(project3.uuid(), emptyList(), emptyList()); underTest.deleteProject(project1.uuid()); assertThat(esTester.getIds(INDEX_PROJECT_MEASURES, TYPE_PROJECT_MEASURES)) .containsOnly(project2.uuid(), project3.uuid()); assertThat(esTester.getIds(INDEX_PROJECT_MEASURES, TYPE_AUTHORIZATION)) .containsOnly(project2.uuid(), project3.uuid()); }
@Test public void does_nothing_when_deleting_unknown_project() throws Exception { ComponentDto project = newProjectDto(); componentDbTester.insertProjectAndSnapshot(project); underTest.index(); authorizationIndexerTester.indexProjectPermission(project.uuid(), emptyList(), emptyList()); underTest.deleteProject("UNKNOWN"); assertThat(esTester.getIds(INDEX_PROJECT_MEASURES, TYPE_PROJECT_MEASURES)) .containsOnly(project.uuid()); assertThat(esTester.getIds(INDEX_PROJECT_MEASURES, TYPE_AUTHORIZATION)) .containsOnly(project.uuid()); }