diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-10-01 14:11:16 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-10-02 15:27:04 +0200 |
commit | c7e2e99344f9ac49cd664a85193a260bdc37599e (patch) | |
tree | f3b3fdc652ed4f2c4ffee9e3048598d24cbe9214 /sonar-core | |
parent | 7b8464adf1bc41765efe1f582e7fef3ee7d9af48 (diff) | |
download | sonarqube-c7e2e99344f9ac49cd664a85193a260bdc37599e.tar.gz sonarqube-c7e2e99344f9ac49cd664a85193a260bdc37599e.zip |
SONAR-5603 Get issues from E/S in Unresolved Issues per Assignee widget
Conflicts:
server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexMediumTest.java
Diffstat (limited to 'sonar-core')
7 files changed, 3 insertions, 206 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueStatsColumn.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueStatsColumn.java deleted file mode 100644 index 50a85b40ab3..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueStatsColumn.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.core.issue.db; - -import com.google.common.collect.ImmutableList; - -import java.util.List; - -public class IssueStatsColumn { - - private IssueStatsColumn() { - // utility - } - - public static final String ASSIGNEE = "ASSIGNEE"; - - public static final List<String> ALL = ImmutableList.of(ASSIGNEE); - -} diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueStatsDao.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueStatsDao.java deleted file mode 100644 index 81db0758bf7..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueStatsDao.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.core.issue.db; - -import org.apache.ibatis.session.SqlSession; -import org.sonar.api.ServerComponent; -import org.sonar.core.persistence.MyBatis; -import org.sonar.server.issue.IssueQuery; - -import javax.annotation.Nullable; - -import java.util.List; - -/** - * @since 3.6 - */ -public class IssueStatsDao implements ServerComponent { - - private final MyBatis mybatis; - - public IssueStatsDao(MyBatis mybatis) { - this.mybatis = mybatis; - } - - public List<Object> selectIssuesColumn(IssueQuery query, String column, @Nullable Integer userId) { - SqlSession session = mybatis.openSession(false); - try { - IssueStatsMapper mapper = session.getMapper(IssueStatsMapper.class); - return mapper.selectIssuesColumn(query, column, query.componentRoots(), userId, query.requiredRole()); - } finally { - MyBatis.closeQuietly(session); - } - } -} diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueStatsMapper.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueStatsMapper.java deleted file mode 100644 index 14bdfc99604..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueStatsMapper.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.core.issue.db; - -import org.apache.ibatis.annotations.Param; -import org.sonar.server.issue.IssueQuery; - -import javax.annotation.Nullable; - -import java.util.Collection; -import java.util.List; - -public interface IssueStatsMapper { - - List<Object> selectIssuesColumn(@Param("query") IssueQuery query, @Param("column") String column, @Param("componentRootKeys") Collection<String> componentRootKeys, - @Nullable @Param("userId") Integer userId, @Param("role") String role); - -} diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DaoUtils.java b/sonar-core/src/main/java/org/sonar/core/persistence/DaoUtils.java index 5ac15ee88e6..c097fd6e167 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DaoUtils.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DaoUtils.java @@ -24,13 +24,7 @@ import org.sonar.core.dashboard.ActiveDashboardDao; import org.sonar.core.dashboard.DashboardDao; import org.sonar.core.duplication.DuplicationDao; import org.sonar.core.graph.jdbc.GraphDao; -import org.sonar.core.issue.db.ActionPlanDao; -import org.sonar.core.issue.db.ActionPlanStatsDao; -import org.sonar.core.issue.db.IssueChangeDao; -import org.sonar.core.issue.db.IssueDao; -import org.sonar.core.issue.db.IssueFilterDao; -import org.sonar.core.issue.db.IssueFilterFavouriteDao; -import org.sonar.core.issue.db.IssueStatsDao; +import org.sonar.core.issue.db.*; import org.sonar.core.notification.db.NotificationQueueDao; import org.sonar.core.permission.PermissionDao; import org.sonar.core.permission.PermissionTemplateDao; @@ -46,11 +40,7 @@ import org.sonar.core.source.db.SnapshotDataDao; import org.sonar.core.source.db.SnapshotSourceDao; import org.sonar.core.technicaldebt.db.CharacteristicDao; import org.sonar.core.template.LoadedTemplateDao; -import org.sonar.core.user.AuthorDao; -import org.sonar.core.user.AuthorizationDao; -import org.sonar.core.user.GroupMembershipDao; -import org.sonar.core.user.RoleDao; -import org.sonar.core.user.UserDao; +import org.sonar.core.user.*; import java.util.List; @@ -74,7 +64,6 @@ public final class DaoUtils { GraphDao.class, GroupMembershipDao.class, IssueDao.class, - IssueStatsDao.class, IssueChangeDao.class, IssueFilterDao.class, IssueFilterFavouriteDao.class, diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java index 051892c4cc9..86a1bb4861f 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java @@ -169,7 +169,7 @@ public class MyBatis implements BatchComponent, ServerComponent { loadMapper(conf, "org.sonar.core.permission.PermissionMapper"); Class<?>[] mappers = {ActivityMapper.class, ActiveDashboardMapper.class, AuthorMapper.class, DashboardMapper.class, DependencyMapper.class, DuplicationMapper.class, GraphDtoMapper.class, - IssueMapper.class, IssueAuthorizationMapper.class, IssueStatsMapper.class, IssueChangeMapper.class, IssueFilterMapper.class, IssueFilterFavouriteMapper.class, + IssueMapper.class, IssueAuthorizationMapper.class, IssueChangeMapper.class, IssueFilterMapper.class, IssueFilterFavouriteMapper.class, LoadedTemplateMapper.class, MeasureFilterMapper.class, Migration44Mapper.class, PermissionTemplateMapper.class, PropertiesMapper.class, PurgeMapper.class, ResourceKeyUpdaterMapper.class, ResourceIndexerMapper.class, ResourceSnapshotMapper.class, RoleMapper.class, RuleMapper.class, SchemaMigrationMapper.class, SemaphoreMapper.class, UserMapper.class, GroupMapper.class, WidgetMapper.class, WidgetPropertyMapper.class, diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueStatsMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueStatsMapper.xml deleted file mode 100644 index a721832a98a..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueStatsMapper.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mappei.dtd"> - -<mapper namespace="org.sonar.core.issue.db.IssueStatsMapper"> - - <select id="selectIssuesColumn" parameterType="map" resultType="Object"> - SELECT - <if test="'ASSIGNEE'.equals(column)"> - i.assignee - </if> - FROM issues i - <include refid="org.sonar.core.issue.db.IssueMapper.selectQueryConditions"/> - </select> - -</mapper> diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStatsDaoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStatsDaoTest.java deleted file mode 100644 index 304185d13e1..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStatsDaoTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.core.issue.db; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.core.persistence.AbstractDaoTestCase; -import org.sonar.server.issue.IssueQuery; - -import java.util.List; - -import static org.fest.assertions.Assertions.assertThat; - -public class IssueStatsDaoTest extends AbstractDaoTestCase { - - IssueStatsDao dao; - - @Before - public void createDao() { - dao = new IssueStatsDao(getMyBatis()); - } - - @Test - public void should_select_assignees(){ - setupData("should_select_assignees"); - - IssueQuery query = IssueQuery.builder().requiredRole("user").build(); - List<Object> results = dao.selectIssuesColumn(query, IssueStatsColumn.ASSIGNEE, null); - assertThat(results).hasSize(3); - // 2 perceval, and one null - assertThat(results).containsOnly("perceval", null); - } -} |