aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/test
diff options
context:
space:
mode:
authorJacek <52388493+jacek-poreda-sonarsource@users.noreply.github.com>2019-07-22 17:14:53 +0200
committerSonarTech <sonartech@sonarsource.com>2019-07-22 20:21:09 +0200
commit44a69c797469630104009f6786d5b519ccf39472 (patch)
tree026a7afb68c214c903c35f5b3156bb5e567e9dc7 /server/sonar-db-dao/src/test
parenta746e93757faef10826e0971c22ab45bc33af759 (diff)
downloadsonarqube-44a69c797469630104009f6786d5b519ccf39472.tar.gz
sonarqube-44a69c797469630104009f6786d5b519ccf39472.zip
SONAR-12259 - remove deprecated request params, response fields from api/projects (#1881)
* remove deprecated params from api/projects/bulk_delete * remove deprecated projectsIds param * update documentation for api/projects/bulk_delete * remove deprecated params from api/projects/bulk_update_key * remove deprecated params: key, projectId, id * update documentation for api/projects/bulk_update_key * remove deprecated params from api/projects/create * remove deprecated param: key * update documentation for api/projects/create * remove deprecated params from api/projects/delete * remove deprecated param: projectId, key * update documentation for api/projects/delete * remove deprecated apis: api/projects/ghosts | index | provisioned * remove deprecated params from api/projects/search * remove deprecated param: projectIds * remove deprecated response fields: id (uuid) * remove all usage of deprecated params: page, pageSize (remove associated tests) * update documentation for api/projects/search * remove deprecated params from api/projects/search_my_projects * remove deprecated response fields: id (uuid) * update documentation for api/projects/search_my_projects * remove deprecated params from api/projects/update_key * remove deprecated params: id, projectId, key, newKey * change "from" param to be mandatory * remove ProjectListTest.java file as endpoint does not exist anymore * bump orchestrator version * remove ComponentDao and ComponentMapper methods associated with deprecated code * use "project" param when calling api/projects/create * update ProjectDumpOperations#renameProjectKey to use api/projects/update_key endpoint * use java api calls instead of URLs * bump orchestrator version to latest released 3.26.0.2111
Diffstat (limited to 'server/sonar-db-dao/src/test')
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java97
1 files changed, 0 insertions, 97 deletions
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
index cbcce2a5294..06cda684a5e 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
@@ -1229,61 +1229,6 @@ public class ComponentDaoTest {
}
@Test
- public void select_ghost_projects() {
- OrganizationDto organization = db.organizations().insert();
-
- // ghosts because has at least one snapshot with status U but none with status P
- ComponentDto ghostProject = db.components().insertPrivateProject(organization);
- db.components().insertSnapshot(ghostProject, dto -> dto.setStatus("U"));
- db.components().insertSnapshot(ghostProject, dto -> dto.setStatus("U"));
- ComponentDto ghostProject2 = db.components().insertPrivateProject(organization);
- db.components().insertSnapshot(ghostProject2, dto -> dto.setStatus("U"));
- ComponentDto disabledGhostProject = db.components().insertPrivateProject(dto -> dto.setEnabled(false));
- db.components().insertSnapshot(disabledGhostProject, dto -> dto.setStatus("U"));
-
- ComponentDto project1 = db.components().insertPrivateProject(organization);
- db.components().insertSnapshot(project1, dto -> dto.setStatus("P"));
- db.components().insertSnapshot(project1, dto -> dto.setStatus("U"));
- ComponentDto module = db.components().insertComponent(newModuleDto(project1));
- ComponentDto dir = db.components().insertComponent(newDirectory(module, "foo"));
- db.components().insertComponent(newFileDto(module, dir, "bar"));
-
- ComponentDto provisionedProject = db.components().insertPrivateProject(organization);
-
- // not a ghost because has at least one snapshot with status P
- ComponentDto project2 = db.components().insertPrivateProject(organization);
- db.components().insertSnapshot(project2, dto -> dto.setStatus("P"));
-
- // not a ghost because it's not a project
- ComponentDto view = db.components().insertView(organization);
- db.components().insertSnapshot(view, dto -> dto.setStatus("U"));
- db.components().insertComponent(newProjectCopy("do", project1, view));
-
- assertThat(underTest.selectGhostProjects(dbSession, organization.getUuid(), null, 0, 10))
- .extracting(ComponentDto::uuid)
- .containsOnly(ghostProject.uuid(), ghostProject2.uuid(), disabledGhostProject.uuid());
- assertThat(underTest.countGhostProjects(dbSession, organization.getUuid(), null)).isEqualTo(3);
- }
-
- @Test
- public void dont_select_branch_ghost_projects() {
- OrganizationDto organization = db.organizations().insert();
-
- // ghosts because has at least one snapshot with status U but none with status P
- ComponentDto ghostProject = db.components().insertPrivateProject(organization);
- db.components().insertSnapshot(ghostProject, dto -> dto.setStatus("U"));
- db.components().insertSnapshot(ghostProject, dto -> dto.setStatus("U"));
- ComponentDto ghostBranchProject = db.components().insertProjectBranch(ghostProject);
-
- db.components().insertSnapshot(ghostBranchProject, dto -> dto.setStatus("U"));
-
- assertThat(underTest.selectGhostProjects(dbSession, organization.getUuid(), null, 0, 10))
- .extracting(ComponentDto::uuid)
- .containsOnly(ghostProject.uuid());
- assertThat(underTest.countGhostProjects(dbSession, organization.getUuid(), null)).isEqualTo(1);
- }
-
- @Test
public void selectByProjectUuid() {
ComponentDto project = db.components().insertPrivateProject();
ComponentDto removedProject = db.components().insertPrivateProject(p -> p.setEnabled(false));
@@ -1946,48 +1891,6 @@ public class ComponentDaoTest {
}
@Test
- public void select_projects_by_name_ignore_branches() {
- OrganizationDto organizationDto = db.organizations().insert();
- ComponentDto project1 = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setName("project1"));
- ComponentDto module1 = db.components().insertComponent(newModuleDto(project1).setName("project1"));
- ComponentDto subModule1 = db.components().insertComponent(newModuleDto(module1).setName("project1"));
-
- db.components().insertComponent(newFileDto(subModule1).setName("project1"));
- db.components().insertProjectBranch(project1, b -> b.setKey("branch1"));
-
- // check that branch is present with same name as main branch
- assertThat(underTest.selectByKeyAndBranch(dbSession, project1.getKey(), "branch1").get().name()).isEqualTo("project1");
-
- // branch is not returned
- assertThat(underTest.selectProjectsByNameQuery(dbSession, null, false)).extracting(ComponentDto::uuid)
- .containsOnly(project1.uuid());
- assertThat(underTest.selectProjectsByNameQuery(dbSession, "project", false)).extracting(ComponentDto::uuid)
- .containsOnly(project1.uuid());
- }
-
- @Test
- public void select_projects_by_name_query() {
- OrganizationDto organizationDto = db.organizations().insert();
- ComponentDto project1 = db.components().insertComponent(newPrivateProjectDto(organizationDto).setName("project1"));
- ComponentDto module1 = db.components().insertComponent(newModuleDto(project1).setName("module1"));
- ComponentDto subModule1 = db.components().insertComponent(newModuleDto(module1).setName("subModule1"));
- db.components().insertComponent(newFileDto(subModule1).setName("file"));
- ComponentDto project2 = db.components().insertComponent(newPrivateProjectDto(organizationDto).setName("project2"));
- ComponentDto project3 = db.components().insertComponent(newPrivateProjectDto(organizationDto).setName("project3"));
-
- assertThat(underTest.selectProjectsByNameQuery(dbSession, null, false)).extracting(ComponentDto::uuid)
- .containsOnly(project1.uuid(), project2.uuid(), project3.uuid());
- assertThat(underTest.selectProjectsByNameQuery(dbSession, null, true)).extracting(ComponentDto::uuid)
- .containsOnly(project1.uuid(), project2.uuid(), project3.uuid(), module1.uuid(), subModule1.uuid());
- assertThat(underTest.selectProjectsByNameQuery(dbSession, "project1", false)).extracting(ComponentDto::uuid).containsOnly(project1.uuid());
- assertThat(underTest.selectProjectsByNameQuery(dbSession, "ct1", false)).extracting(ComponentDto::uuid).containsOnly(project1.uuid());
- assertThat(underTest.selectProjectsByNameQuery(dbSession, "pro", false)).extracting(ComponentDto::uuid).containsOnly(project1.uuid(), project2.uuid(), project3.uuid());
- assertThat(underTest.selectProjectsByNameQuery(dbSession, "jec", false)).extracting(ComponentDto::uuid).containsOnly(project1.uuid(), project2.uuid(), project3.uuid());
- assertThat(underTest.selectProjectsByNameQuery(dbSession, "1", true)).extracting(ComponentDto::uuid).containsOnly(project1.uuid(), module1.uuid(), subModule1.uuid());
- assertThat(underTest.selectProjectsByNameQuery(dbSession, "unknown", true)).extracting(ComponentDto::uuid).isEmpty();
- }
-
- @Test
public void setPrivateForRootComponentUuid_updates_private_column_to_specified_value_for_all_rows_with_specified_projectUuid() {
String uuid1 = "uuid1";
String uuid2 = "uuid2";