aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier García Orduña <javier.garcia@sonarsource.com>2025-02-06 09:27:32 +0100
committersonartech <sonartech@sonarsource.com>2025-02-19 20:03:12 +0000
commit01f820ffb2911d754d1b45ce3dcfdf997db53ce0 (patch)
tree68c1a2048efb27e9330af86512bfaea34c1b4991
parentca06b89d80a886866b84250408c5214f0a775efc (diff)
downloadsonarqube-01f820ffb2911d754d1b45ce3dcfdf997db53ce0.tar.gz
sonarqube-01f820ffb2911d754d1b45ce3dcfdf997db53ce0.zip
SQRP-140 Expose dependency details with new REST APIs
-rw-r--r--server/sonar-db-dao/src/it/java/org/sonar/db/dependency/ProjectDependenciesDaoIT.java183
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java2
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java7
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java6
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesDao.java64
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesMapper.java40
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesQuery.java57
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependencyDto.java32
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/dependency/package-info.java23
-rw-r--r--server/sonar-db-dao/src/testFixtures/java/org/sonar/db/DbTester.java9
-rw-r--r--server/sonar-db-dao/src/testFixtures/java/org/sonar/db/dependency/ProjectDependenciesDbTester.java64
11 files changed, 4 insertions, 483 deletions
diff --git a/server/sonar-db-dao/src/it/java/org/sonar/db/dependency/ProjectDependenciesDaoIT.java b/server/sonar-db-dao/src/it/java/org/sonar/db/dependency/ProjectDependenciesDaoIT.java
deleted file mode 100644
index 2681decb717..00000000000
--- a/server/sonar-db-dao/src/it/java/org/sonar/db/dependency/ProjectDependenciesDaoIT.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2025 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.dependency;
-
-import java.util.List;
-import java.util.Map;
-import java.util.function.Consumer;
-import javax.annotation.Nullable;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-import org.sonar.db.Pagination;
-import org.sonar.db.component.ComponentDto;
-import org.sonar.db.component.ProjectData;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-class ProjectDependenciesDaoIT {
-
- private static final String PROJECT_BRANCH_UUID = "branchUuid";
-
- @RegisterExtension
- private final DbTester db = DbTester.create(System2.INSTANCE);
-
- private final ProjectDependenciesDao projectDependenciesDao = db.getDbClient().projectDependenciesDao();
-
- @Test
- void insert_shouldPersistProjectDependencies() {
- var projectDependencyDto = new ProjectDependencyDto("projectUuid", "version", "includePaths", "packageManager", 1L, 2L);
-
- projectDependenciesDao.insert(db.getSession(), projectDependencyDto);
-
- List<Map<String, Object>> select = db.select(db.getSession(), "select * from project_dependencies");
- assertThat(select).hasSize(1);
- Map<String, Object> stringObjectMap = select.get(0);
- assertThat(stringObjectMap).containsExactlyInAnyOrderEntriesOf(
- Map.of(
- "uuid", projectDependencyDto.uuid(),
- "version", projectDependencyDto.version(),
- "include_paths", projectDependencyDto.includePaths(),
- "package_manager", projectDependencyDto.packageManager(),
- "created_at", projectDependencyDto.createdAt(),
- "updated_at", projectDependencyDto.updatedAt())
- );
- }
-
- @Test
- void deleteByUuid_shoudDeleteProjectDependencies() {
- var projectDependencyDto = new ProjectDependencyDto("projectUuid", "version", "includePaths", "packageManager", 1L, 2L);
- projectDependenciesDao.insert(db.getSession(), projectDependencyDto);
-
- projectDependenciesDao.deleteByUuid(db.getSession(), projectDependencyDto.uuid());
-
- List<Map<String, Object>> select = db.select(db.getSession(), "select * from project_dependencies");
- assertThat(select).isEmpty();
- }
-
- @Test
- void selectByQuery_shouldReturnProjectDependencies_whenQueryByBranchUuid() {
- ProjectData projectData = db.components().insertPublicProject();
- var projectDependencyDto = new ProjectDependencyDto(projectData.getMainBranchComponent().uuid(), "version", "includePaths", "packageManager", 1L, 2L);
- projectDependenciesDao.insert(db.getSession(), projectDependencyDto);
-
- ProjectDependenciesQuery projectDependenciesQuery = new ProjectDependenciesQuery(projectData.mainBranchUuid(), null);
- List<ProjectDependencyDto> results = projectDependenciesDao.selectByQuery(db.getSession(), projectDependenciesQuery, Pagination.all());
-
- assertThat(results).hasSize(1);
- assertThat(results.get(0)).usingRecursiveComparison().isEqualTo(projectDependencyDto);
- }
-
- @Test
- void selectByQuery_shouldReturnPaginatedProjectDependencies() {
- ProjectDependencyDto projectDependencyDto1 = insertProjectDependency("1");
- ProjectDependencyDto projectDependencyDto2 = insertProjectDependency("2");
- ProjectDependencyDto projectDependencyDto3 = insertProjectDependency("3");
- ProjectDependencyDto projectDependencyDto4 = insertProjectDependency("4");
-
- ProjectDependenciesQuery projectDependenciesQuery = new ProjectDependenciesQuery(PROJECT_BRANCH_UUID, null);
- List<ProjectDependencyDto> page1Results = projectDependenciesDao.selectByQuery(db.getSession(), projectDependenciesQuery, Pagination.forPage(1).andSize(2));
- List<ProjectDependencyDto> page2Results = projectDependenciesDao.selectByQuery(db.getSession(), projectDependenciesQuery, Pagination.forPage(2).andSize(2));
-
- assertThat(page1Results).hasSize(2);
- assertThat(page1Results.get(0)).usingRecursiveComparison().isEqualTo(projectDependencyDto1);
- assertThat(page1Results.get(1)).usingRecursiveComparison().isEqualTo(projectDependencyDto2);
- assertThat(page2Results).hasSize(2);
- assertThat(page2Results.get(0)).usingRecursiveComparison().isEqualTo(projectDependencyDto3);
- assertThat(page2Results.get(1)).usingRecursiveComparison().isEqualTo(projectDependencyDto4);
- }
-
- @Test
- void selectByQuery_shouldPartiallyMatchLongName_whenQueriedByText() {
- ProjectDependencyDto projectDepSearched = insertProjectDependency("sEArched");
- insertProjectDependency("notWanted");
- ProjectDependencyDto projectDepSearchAsWell = insertProjectDependency("sEArchedAsWell");
- insertProjectDependency("notwantedeither");
-
- ProjectDependenciesQuery projectDependenciesQuery = new ProjectDependenciesQuery(PROJECT_BRANCH_UUID, "long_nameSearCHed");
- List<ProjectDependencyDto> results = projectDependenciesDao.selectByQuery(db.getSession(), projectDependenciesQuery, Pagination.all());
-
- assertThat(results).hasSize(2);
- assertThat(results.get(0)).usingRecursiveComparison().isEqualTo(projectDepSearched);
- assertThat(results.get(1)).usingRecursiveComparison().isEqualTo(projectDepSearchAsWell);
- }
-
- @Test
- void selectByQuery_shouldExactlyMatchKee_whenQueriedByText() {
- ProjectDependencyDto projectDepSearched = insertProjectDependency("1", dto -> dto.setKey("keySearched"));
- insertProjectDependency("2", dto -> dto.setKey("KEySearCHed"));
- insertProjectDependency("3", dto -> dto.setKey("some_keySearched"));
-
- ProjectDependenciesQuery projectDependenciesQuery = new ProjectDependenciesQuery(PROJECT_BRANCH_UUID, "keySearched");
- List<ProjectDependencyDto> results = projectDependenciesDao.selectByQuery(db.getSession(), projectDependenciesQuery, Pagination.all());
-
- assertThat(results).hasSize(1);
- assertThat(results.get(0)).usingRecursiveComparison().isEqualTo(projectDepSearched);
- }
-
- @Test
- void update_shouldUpdateProjectDependency() {
- ProjectDependencyDto projectDependencyDto = insertProjectDependency();
- ProjectDependencyDto updatedProjectDependency =
- new ProjectDependencyDto(projectDependencyDto.uuid(), "updatedVersion", "updatedIncludePaths", "updatedPackageManager", 2L, 3L);
-
- projectDependenciesDao.update(db.getSession(), updatedProjectDependency);
-
- List<Map<String, Object>> select = db.select(db.getSession(), "select * from project_dependencies");
- assertThat(select).hasSize(1);
- Map<String, Object> stringObjectMap = select.get(0);
- assertThat(stringObjectMap).containsExactlyInAnyOrderEntriesOf(
- Map.of(
- "uuid", updatedProjectDependency.uuid(),
- "version", updatedProjectDependency.version(),
- "include_paths", updatedProjectDependency.includePaths(),
- "package_manager", updatedProjectDependency.packageManager(),
- "created_at", projectDependencyDto.createdAt(),
- "updated_at", updatedProjectDependency.updatedAt())
- );
- }
-
- @Test
- void countByQuery_shouldReturnTheTotalOfDependencies() {
- insertProjectDependency("sEArched");
- insertProjectDependency("notWanted");
- insertProjectDependency("sEArchedAsWell");
- db.projectDependencies().insertProjectDependency("another_branch_uuid", "searched");
-
- ProjectDependenciesQuery projectDependenciesQuery = new ProjectDependenciesQuery(PROJECT_BRANCH_UUID, "long_nameSearCHed");
-
- assertThat(projectDependenciesDao.countByQuery(db.getSession(), projectDependenciesQuery)).isEqualTo(2);
- assertThat(projectDependenciesDao.countByQuery(db.getSession(), new ProjectDependenciesQuery(PROJECT_BRANCH_UUID, null))).isEqualTo(3);
- assertThat(projectDependenciesDao.countByQuery(db.getSession(), new ProjectDependenciesQuery("another_branch_uuid", null))).isEqualTo(1);
- }
-
- private ProjectDependencyDto insertProjectDependency() {
- return db.projectDependencies().insertProjectDependency(PROJECT_BRANCH_UUID);
- }
-
- private ProjectDependencyDto insertProjectDependency(String suffix) {
- return insertProjectDependency(suffix, null);
- }
-
- private ProjectDependencyDto insertProjectDependency(String suffix, @Nullable Consumer<ComponentDto> dtoPopulator) {
- return db.projectDependencies().insertProjectDependency(PROJECT_BRANCH_UUID, suffix, dtoPopulator);
- }
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
index dcff6ee1d0d..5fdc29673fa 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
@@ -38,7 +38,6 @@ import org.sonar.db.component.ComponentDao;
import org.sonar.db.component.ComponentKeyUpdaterDao;
import org.sonar.db.component.ProjectLinkDao;
import org.sonar.db.component.SnapshotDao;
-import org.sonar.db.dependency.ProjectDependenciesDao;
import org.sonar.db.duplication.DuplicationDao;
import org.sonar.db.entity.EntityDao;
import org.sonar.db.es.EsQueueDao;
@@ -162,7 +161,6 @@ public class DaoModule extends Module {
PluginDao.class,
ProjectDao.class,
ProjectBadgeTokenDao.class,
- ProjectDependenciesDao.class,
ProjectExportDao.class,
PortfolioDao.class,
ProjectLinkDao.class,
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
index 279a9fdf83b..4babe31e343 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
@@ -38,7 +38,6 @@ import org.sonar.db.component.ComponentDao;
import org.sonar.db.component.ComponentKeyUpdaterDao;
import org.sonar.db.component.ProjectLinkDao;
import org.sonar.db.component.SnapshotDao;
-import org.sonar.db.dependency.ProjectDependenciesDao;
import org.sonar.db.duplication.DuplicationDao;
import org.sonar.db.entity.EntityDao;
import org.sonar.db.es.EsQueueDao;
@@ -202,7 +201,6 @@ public class DbClient {
private final ProjectExportDao projectExportDao;
private final IssueFixedDao issueFixedDao;
private final TelemetryMetricsSentDao telemetryMetricsSentDao;
- private final ProjectDependenciesDao projectDependenciesDao;
private final ScaDependenciesDao scaDependenciesDao;
public DbClient(Database database, MyBatis myBatis, DBSessions dbSessions, Dao... daos) {
@@ -300,7 +298,6 @@ public class DbClient {
projectExportDao = getDao(map, ProjectExportDao.class);
issueFixedDao = getDao(map, IssueFixedDao.class);
telemetryMetricsSentDao = getDao(map, TelemetryMetricsSentDao.class);
- projectDependenciesDao = getDao(map, ProjectDependenciesDao.class);
scaDependenciesDao = getDao(map, ScaDependenciesDao.class);
}
@@ -666,10 +663,6 @@ public class DbClient {
return projectExportDao;
}
- public ProjectDependenciesDao projectDependenciesDao() {
- return projectDependenciesDao;
- }
-
public ScaDependenciesDao scaDependenciesDao() {
return scaDependenciesDao;
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
index 7f9fac3f962..73e0097b162 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
@@ -63,8 +63,6 @@ import org.sonar.db.component.SnapshotDto;
import org.sonar.db.component.SnapshotMapper;
import org.sonar.db.component.UuidWithBranchUuidDto;
import org.sonar.db.component.ViewsSnapshotDto;
-import org.sonar.db.dependency.ProjectDependenciesMapper;
-import org.sonar.db.dependency.ProjectDependencyDto;
import org.sonar.db.duplication.DuplicationMapper;
import org.sonar.db.duplication.DuplicationUnitDto;
import org.sonar.db.entity.EntityDto;
@@ -154,6 +152,7 @@ import org.sonar.db.rule.RuleMapper;
import org.sonar.db.rule.RuleParamDto;
import org.sonar.db.rule.RuleRepositoryMapper;
import org.sonar.db.sca.ScaDependenciesMapper;
+import org.sonar.db.sca.ScaDependencyDto;
import org.sonar.db.scannercache.ScannerAnalysisCacheMapper;
import org.sonar.db.schemamigration.SchemaMigrationDto;
import org.sonar.db.schemamigration.SchemaMigrationMapper;
@@ -245,7 +244,6 @@ public class MyBatis {
confBuilder.loadAlias("ProjectQgateAssociation", ProjectQgateAssociationDto.class);
confBuilder.loadAlias("Project", ProjectDto.class);
confBuilder.loadAlias("ProjectBadgeToken", ProjectBadgeTokenDto.class);
- confBuilder.loadAlias("ProjectDependency", ProjectDependencyDto.class);
confBuilder.loadAlias("AnalysisPropertyValuePerProject", AnalysisPropertyValuePerProject.class);
confBuilder.loadAlias("ProjectAlmKeyAndProject", ProjectAlmKeyAndProject.class);
confBuilder.loadAlias("PrAndBranchCountByProjectDto", PrBranchAnalyzedLanguageCountByProjectDto.class);
@@ -255,6 +253,7 @@ public class MyBatis {
confBuilder.loadAlias("QualityGate", QualityGateDto.class);
confBuilder.loadAlias("Resource", ResourceDto.class);
confBuilder.loadAlias("RuleParam", RuleParamDto.class);
+ confBuilder.loadAlias("ScaDependency", ScaDependencyDto.class);
confBuilder.loadAlias("SchemaMigration", SchemaMigrationDto.class);
confBuilder.loadAlias("ScrapProperty", ScrapPropertyDto.class);
confBuilder.loadAlias("ScrapAnalysisProperty", ScrapAnalysisPropertyDto.class);
@@ -318,7 +317,6 @@ public class MyBatis {
PluginMapper.class,
PortfolioMapper.class,
ProjectAlmSettingMapper.class,
- ProjectDependenciesMapper.class,
ProjectLinkMapper.class,
ProjectMapper.class,
ProjectBadgeTokenMapper.class,
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesDao.java
deleted file mode 100644
index dd2429d7ba2..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesDao.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2025 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.dependency;
-
-import java.util.List;
-import java.util.Optional;
-import org.sonar.db.Dao;
-import org.sonar.db.DbSession;
-import org.sonar.db.Pagination;
-
-public class ProjectDependenciesDao implements Dao {
-
- private static ProjectDependenciesMapper mapper(DbSession session) {
- return session.getMapper(ProjectDependenciesMapper.class);
- }
-
- public void insert(DbSession session, ProjectDependencyDto projectDependencyDto) {
- mapper(session).insert(projectDependencyDto);
- }
-
- public void deleteByUuid(DbSession session, String uuid) {
- mapper(session).deleteByUuid(uuid);
- }
-
- public Optional<ProjectDependencyDto> selectByUuid(DbSession dbSession, String uuid) {
- return Optional.ofNullable(mapper(dbSession).selectByUuid(uuid));
- }
-
- /**
- * Retrieves all dependencies with a specific branch UUID, no other filtering is done by this method.
- */
- public List<ProjectDependencyDto> selectByBranchUuid(DbSession dbSession, String branchUuid) {
- return mapper(dbSession).selectByBranchUuid(branchUuid);
- }
-
- public List<ProjectDependencyDto> selectByQuery(DbSession session, ProjectDependenciesQuery projectDependenciesQuery, Pagination pagination) {
- return mapper(session).selectByQuery(projectDependenciesQuery, pagination);
- }
-
- public int countByQuery(DbSession session, ProjectDependenciesQuery projectDependenciesQuery) {
- return mapper(session).countByQuery(projectDependenciesQuery);
- }
-
- public void update(DbSession session, ProjectDependencyDto projectDependencyDto) {
- mapper(session).update(projectDependencyDto);
- }
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesMapper.java
deleted file mode 100644
index b0047776c1a..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesMapper.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2025 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.dependency;
-
-import java.util.List;
-import org.apache.ibatis.annotations.Param;
-import org.sonar.db.Pagination;
-
-public interface ProjectDependenciesMapper {
- void insert(ProjectDependencyDto dto);
-
- void deleteByUuid(String uuid);
-
- ProjectDependencyDto selectByUuid(String uuid);
-
- List<ProjectDependencyDto> selectByBranchUuid(String branchUuid);
-
- List<ProjectDependencyDto> selectByQuery(@Param("query") ProjectDependenciesQuery query, @Param("pagination") Pagination pagination);
-
- void update(ProjectDependencyDto dto);
-
- int countByQuery(@Param("query") ProjectDependenciesQuery query);
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesQuery.java b/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesQuery.java
deleted file mode 100644
index b4b2805e1da..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependenciesQuery.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2025 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.dependency;
-
-import java.util.Locale;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static org.sonar.db.DaoUtils.buildLikeValue;
-import static org.sonar.db.WildcardPosition.BEFORE_AND_AFTER;
-
-public final class ProjectDependenciesQuery {
- private final String branchUuid;
- @Nullable
- private final String query;
-
- public ProjectDependenciesQuery(String branchUuid, @Nullable String query) {
- this.branchUuid = branchUuid;
- this.query = query;
- }
-
- /**
- * Used by MyBatis mapper
- */
- @CheckForNull
- public String getLikeQuery() {
- return query == null ? null : buildLikeValue(query, BEFORE_AND_AFTER).toLowerCase(Locale.ENGLISH);
- }
-
- public String branchUuid() {
- return branchUuid;
- }
-
- @Nullable
- public String query() {
- return query;
- }
-
-
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependencyDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependencyDto.java
deleted file mode 100644
index 11eb2f297db..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/ProjectDependencyDto.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2025 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.dependency;
-
-import javax.annotation.Nullable;
-
-public record ProjectDependencyDto(
- String uuid,
- @Nullable String version,
- @Nullable String includePaths,
- @Nullable String packageManager,
- Long createdAt,
- Long updatedAt
- ) {
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/package-info.java b/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/package-info.java
deleted file mode 100644
index 82e1f1e756b..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/dependency/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2025 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.db.dependency;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/DbTester.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/DbTester.java
index 7b0cae590de..8b467a4f90a 100644
--- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/DbTester.java
+++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/DbTester.java
@@ -42,7 +42,6 @@ import org.sonar.db.audit.AuditPersister;
import org.sonar.db.audit.NoOpAuditPersister;
import org.sonar.db.component.ComponentDbTester;
import org.sonar.db.component.ProjectLinkDbTester;
-import org.sonar.db.dependency.ProjectDependenciesDbTester;
import org.sonar.db.event.EventDbTester;
import org.sonar.db.favorite.FavoriteDbTester;
import org.sonar.db.issue.IssueDbTester;
@@ -98,7 +97,6 @@ public class DbTester extends AbstractDbTester<TestDbImpl> implements BeforeEach
private final AlmPatsDbTester almPatsDbtester;
private final AuditDbTester auditDbTester;
private final AnticipatedTransitionDbTester anticipatedTransitionDbTester;
- private final ProjectDependenciesDbTester projectDependenciesDbTester;
private final ScaDependenciesDbTester scaDependenciesDbTester;
private DbTester(UuidFactory uuidFactory, System2 system2, @Nullable String schemaPath, AuditPersister auditPersister, MyBatisConfExtension... confExtensions) {
@@ -132,7 +130,6 @@ public class DbTester extends AbstractDbTester<TestDbImpl> implements BeforeEach
this.almPatsDbtester = new AlmPatsDbTester(this);
this.auditDbTester = new AuditDbTester(this);
this.anticipatedTransitionDbTester = new AnticipatedTransitionDbTester(this);
- this.projectDependenciesDbTester = new ProjectDependenciesDbTester(this);
this.scaDependenciesDbTester = new ScaDependenciesDbTester(this);
}
@@ -281,12 +278,10 @@ public class DbTester extends AbstractDbTester<TestDbImpl> implements BeforeEach
return anticipatedTransitionDbTester;
}
- public ProjectDependenciesDbTester projectDependencies() {
- return projectDependenciesDbTester;
+ public ScaDependenciesDbTester getScaDependenciesDbTester() {
+ return scaDependenciesDbTester;
}
- public ScaDependenciesDbTester getScaDependenciesDbTester() { return scaDependenciesDbTester; }
-
@Override
public void afterEach(ExtensionContext context) throws Exception {
after();
diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/dependency/ProjectDependenciesDbTester.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/dependency/ProjectDependenciesDbTester.java
deleted file mode 100644
index e3c9b8d1430..00000000000
--- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/dependency/ProjectDependenciesDbTester.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2025 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.dependency;
-
-import java.util.function.Consumer;
-import javax.annotation.Nullable;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbTester;
-import org.sonar.db.component.ComponentDto;
-
-import static org.apache.commons.lang3.StringUtils.EMPTY;
-
-public class ProjectDependenciesDbTester {
- private final DbTester db;
- private final DbClient dbClient;
-
- public ProjectDependenciesDbTester(DbTester db) {
- this.db = db;
- this.dbClient = db.getDbClient();
- }
-
- public ProjectDependencyDto insertProjectDependency(String branchUuid) {
- return insertProjectDependency(branchUuid, EMPTY, null);
- }
-
- public ProjectDependencyDto insertProjectDependency(String branchUuid, String suffix) {
- return insertProjectDependency(branchUuid, suffix, null);
- }
-
- public ProjectDependencyDto insertProjectDependency(String branchUuid, String suffix, @Nullable Consumer<ComponentDto> dtoPopulator) {
- ComponentDto componentDto = new ComponentDto().setUuid("uuid" + suffix)
- .setKey("key" + suffix)
- .setUuidPath("uuidPath" + suffix)
- .setName("name" + suffix)
- .setLongName("long_name" + suffix)
- .setBranchUuid(branchUuid);
-
- if (dtoPopulator != null) {
- dtoPopulator.accept(componentDto);
- }
-
- db.components().insertComponent(componentDto);
- var projectDependencyDto = new ProjectDependencyDto(componentDto.uuid(), "version" + suffix, "includePaths" + suffix, "packageManager" + suffix, 1L, 2L);
- dbClient.projectDependenciesDao().insert(db.getSession(), projectDependencyDto);
- return projectDependencyDto;
- }
-}