aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao
diff options
context:
space:
mode:
authorJanos Gyerik <janos.gyerik@sonarsource.com>2018-08-06 15:05:10 +0200
committerSonarTech <sonartech@sonarsource.com>2018-08-10 20:21:31 +0200
commitd113da5007fe057294baca5d86571cd33b953255 (patch)
tree534e89454ae765a15c0666221d303ed1dda9c0ce /server/sonar-db-dao
parent1a1cf6f989c0957160a71c78b83053a453dfba68 (diff)
downloadsonarqube-d113da5007fe057294baca5d86571cd33b953255.tar.gz
sonarqube-d113da5007fe057294baca5d86571cd33b953255.zip
Drop no longer used ProjectAlmBindingsDao.bindingExists
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingsDao.java7
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingsDaoTest.java34
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java7
3 files changed, 4 insertions, 44 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingsDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingsDao.java
index 45fbecb66e0..61b9bc5d56e 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingsDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingsDao.java
@@ -57,13 +57,6 @@ public class ProjectAlmBindingsDao implements Dao {
}
}
- public boolean bindingExists(DbSession dbSession, ALM alm, String repoId) {
- checkAlm(alm);
- checkRepoId(repoId);
-
- return getMapper(dbSession).bindingCount(alm.getId(), repoId) == 1;
- }
-
public Optional<ProjectAlmBindingDto> selectByProjectUuid(DbSession session, String projectUuid) {
return Optional.ofNullable(getMapper(session).selectByProjectUuid(projectUuid));
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingsDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingsDaoTest.java
index fd279815dc7..f7705701a08 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingsDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingsDaoTest.java
@@ -178,40 +178,6 @@ public class ProjectAlmBindingsDaoTest {
}
@Test
- public void mappingExists_throws_NPE_when_alm_is_null() {
- expectAlmNPE();
-
- underTest.bindingExists(dbSession, null, A_REPO);
- }
-
- @Test
- public void mappingExists_throws_IAE_when_repo_id_is_null() {
- expectRepoIdNullOrEmptyIAE();
-
- underTest.bindingExists(dbSession, GITHUB, null);
- }
-
- @Test
- public void mappingExists_throws_IAE_when_repo_id_is_empty() {
- expectRepoIdNullOrEmptyIAE();
-
- underTest.bindingExists(dbSession, GITHUB, EMPTY_STRING);
- }
-
- @Test
- public void mappingExists_returns_false_when_entry_does_not_exist_in_DB() {
- assertThat(underTest.bindingExists(dbSession, GITHUB, A_REPO)).isFalse();
- }
-
- @Test
- public void mappingExists_returns_true_when_entry_exists() {
- when(uuidFactory.create()).thenReturn("uuid1");
- underTest.insertOrUpdate(dbSession, GITHUB, A_REPO, A_UUID, A_GITHUB_SLUG, A_URL);
-
- assertThat(underTest.bindingExists(dbSession, GITHUB, A_REPO)).isTrue();
- }
-
- @Test
public void select_by_repo_id() {
when(system2.now()).thenReturn(DATE);
when(uuidFactory.create())
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
index 73579845ada..afa7636baf6 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
@@ -628,13 +628,14 @@ public class PurgeDaoTest {
String otherRepoId = repoId + "-foo";
ComponentDto project = dbTester.components().insertPublicProject();
+ ComponentDto otherProject = dbTester.components().insertPublicProject();
dbClient.projectAlmBindingsDao().insertOrUpdate(dbSession, alm, repoId, project.uuid(), null, "foo");
- dbClient.projectAlmBindingsDao().insertOrUpdate(dbSession, alm, otherRepoId, "D2", null, "bar");
+ dbClient.projectAlmBindingsDao().insertOrUpdate(dbSession, alm, otherRepoId, otherProject.uuid(), null, "bar");
underTest.deleteProject(dbSession, project.uuid());
- assertThat(dbClient.projectAlmBindingsDao().bindingExists(dbSession, alm, repoId)).isFalse();
- assertThat(dbClient.projectAlmBindingsDao().bindingExists(dbSession, alm, otherRepoId)).isTrue();
+ assertThat(dbClient.projectAlmBindingsDao().findProjectKey(dbSession, alm, repoId)).isEmpty();
+ assertThat(dbClient.projectAlmBindingsDao().findProjectKey(dbSession, alm, otherRepoId)).isNotEmpty();
}
@Test