aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-05-10 13:52:14 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-05-12 12:37:19 +0200
commit4367c635b9e660bec4e30929143d6b1bfd32f2de (patch)
tree122b9e9146c6213e91cf1c2065463b03eb18f6ac /server
parentaf0fb06721dcc88c53622f0380f1016aa0bd17c8 (diff)
downloadsonarqube-4367c635b9e660bec4e30929143d6b1bfd32f2de.tar.gz
sonarqube-4367c635b9e660bec4e30929143d6b1bfd32f2de.zip
OrganizationDao#selectByUuids does not fail with single unknown uuid
Diffstat (limited to 'server')
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDao.java4
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/organization/OrganizationDaoTest.java9
2 files changed, 9 insertions, 4 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDao.java
index 4ddc575bd86..1a43599dd1a 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDao.java
@@ -19,7 +19,6 @@
*/
package org.sonar.db.organization;
-import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@@ -69,9 +68,6 @@ public class OrganizationDao implements Dao {
}
public List<OrganizationDto> selectByUuids(DbSession dbSession, Set<String> organizationUuids) {
- if (organizationUuids.size() == 1) {
- return Collections.singletonList(getMapper(dbSession).selectByUuid(organizationUuids.iterator().next()));
- }
return executeLargeInputs(organizationUuids, getMapper(dbSession)::selectByUuids);
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/organization/OrganizationDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/organization/OrganizationDaoTest.java
index 7e37027d520..9912aede16c 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/organization/OrganizationDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/organization/OrganizationDaoTest.java
@@ -284,6 +284,15 @@ public class OrganizationDaoTest {
}
@Test
+ public void selectByUuids_returns_empty_when_no_single_uuid_exist() {
+ insertOrganization(ORGANIZATION_DTO_1);
+ insertOrganization(ORGANIZATION_DTO_2);
+
+ assertThat(underTest.selectByUuids(dbSession, of("foo uuid")))
+ .isEmpty();
+ }
+
+ @Test
public void selectByUuids_ignores_non_existing_uuids() {
insertOrganization(ORGANIZATION_DTO_1);
insertOrganization(ORGANIZATION_DTO_2);