]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8354 Remove dao related to dashboards
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 7 Nov 2016 14:54:16 +0000 (15:54 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 9 Nov 2016 15:47:34 +0000 (16:47 +0100)
41 files changed:
server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
sonar-db/src/main/java/org/sonar/db/DaoModule.java
sonar-db/src/main/java/org/sonar/db/DbClient.java
sonar-db/src/main/java/org/sonar/db/MyBatis.java
sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDao.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDto.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardMapper.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDto.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/DashboardMapper.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDao.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDto.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/WidgetMapper.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDao.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDto.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyMapper.java [deleted file]
sonar-db/src/main/java/org/sonar/db/dashboard/package-info.java [deleted file]
sonar-db/src/main/java/org/sonar/db/user/UserDao.java
sonar-db/src/main/java/org/sonar/db/user/UserMapper.java
sonar-db/src/main/resources/org/sonar/db/dashboard/ActiveDashboardMapper.xml [deleted file]
sonar-db/src/main/resources/org/sonar/db/dashboard/DashboardMapper.xml [deleted file]
sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetMapper.xml [deleted file]
sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetPropertyMapper.xml [deleted file]
sonar-db/src/main/resources/org/sonar/db/user/UserMapper.xml
sonar-db/src/test/java/org/sonar/db/DaoModuleTest.java
sonar-db/src/test/java/org/sonar/db/dashboard/ActiveDashboardDaoTest.java [deleted file]
sonar-db/src/test/java/org/sonar/db/dashboard/DashboardDaoTest.java [deleted file]
sonar-db/src/test/java/org/sonar/db/dashboard/WidgetDaoTest.java [deleted file]
sonar-db/src/test/java/org/sonar/db/user/UserDaoTest.java
sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/empty.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldGetMaxOrderIndexForNullUser.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldInsert-result.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldInsert.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldInsertWithNoUser-result.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldSelectDashboardsForAnonymous.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldSelectDashboardsForUser.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldInsert-result.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldInsert.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldInsertWithNullableColumns-result.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldSelectGlobalDashboard.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/dashboard/WidgetDaoTest/before.xml [deleted file]

index 97bab6ac4bbb8498990e6d054a9230be36fb5ba8..e92a53e339551e91bc8ee9c7922c479e29d5a62d 100644 (file)
@@ -106,7 +106,7 @@ public class ComputeEngineContainerImplTest {
     assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize(
       COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION
         + 24 // level 1
-        + 52 // content of DaoModule
+        + 48 // content of DaoModule
         + 2 // content of EsSearchModule
         + 62 // content of CorePropertyDefinitions
         + 1 // content of CePropertyDefinitions
index 7a11ad95208f4473316e493381b441305e1b2a1b..17fb1ec62683d5b6c609616da0f4e0cf3e61b9bf 100644 (file)
@@ -32,10 +32,6 @@ import org.sonar.db.component.ComponentLinkDao;
 import org.sonar.db.component.ResourceDao;
 import org.sonar.db.component.ResourceIndexDao;
 import org.sonar.db.component.SnapshotDao;
-import org.sonar.db.dashboard.ActiveDashboardDao;
-import org.sonar.db.dashboard.DashboardDao;
-import org.sonar.db.dashboard.WidgetDao;
-import org.sonar.db.dashboard.WidgetPropertyDao;
 import org.sonar.db.duplication.DuplicationDao;
 import org.sonar.db.event.EventDao;
 import org.sonar.db.issue.IssueChangeDao;
@@ -77,7 +73,6 @@ import org.sonar.db.user.UserTokenDao;
 
 public class DaoModule extends Module {
   private static final List<Class<? extends Dao>> classes = ImmutableList.<Class<? extends Dao>>builder().add(
-    ActiveDashboardDao.class,
     AuthorDao.class,
     AuthorizationDao.class,
     CeActivityDao.class,
@@ -86,7 +81,6 @@ public class DaoModule extends Module {
     ComponentDao.class,
     ComponentLinkDao.class,
     CustomMeasureDao.class,
-    DashboardDao.class,
     DuplicationDao.class,
     EventDao.class,
     FileSourceDao.class,
@@ -126,9 +120,7 @@ public class DaoModule extends Module {
     UserDao.class,
     UserGroupDao.class,
     UserPermissionDao.class,
-    UserTokenDao.class,
-    WidgetDao.class,
-    WidgetPropertyDao.class).build();
+    UserTokenDao.class).build();
 
   @Override
   protected void configureModule() {
index 16eaa687271b4440083a258e287ef69c6e06567f..a4aebb92ea1b7a2e6bed86a564bd015e0fc2910c 100644 (file)
@@ -32,10 +32,6 @@ import org.sonar.db.component.ComponentLinkDao;
 import org.sonar.db.component.ResourceDao;
 import org.sonar.db.component.ResourceIndexDao;
 import org.sonar.db.component.SnapshotDao;
-import org.sonar.db.dashboard.ActiveDashboardDao;
-import org.sonar.db.dashboard.DashboardDao;
-import org.sonar.db.dashboard.WidgetDao;
-import org.sonar.db.dashboard.WidgetPropertyDao;
 import org.sonar.db.duplication.DuplicationDao;
 import org.sonar.db.event.EventDao;
 import org.sonar.db.issue.IssueChangeDao;
@@ -108,10 +104,6 @@ public class DbClient {
   private final CeQueueDao ceQueueDao;
   private final CeTaskInputDao ceTaskInputDao;
   private final CeScannerContextDao ceScannerContextDao;
-  private final DashboardDao dashboardDao;
-  private final ActiveDashboardDao activeDashboardDao;
-  private final WidgetDao widgetDao;
-  private final WidgetPropertyDao widgetPropertyDao;
   private final FileSourceDao fileSourceDao;
   private final AuthorDao authorDao;
   private final ResourceIndexDao componentIndexDao;
@@ -169,10 +161,6 @@ public class DbClient {
     ceQueueDao = getDao(map, CeQueueDao.class);
     ceTaskInputDao = getDao(map, CeTaskInputDao.class);
     ceScannerContextDao = getDao(map, CeScannerContextDao.class);
-    dashboardDao = getDao(map, DashboardDao.class);
-    activeDashboardDao = getDao(map, ActiveDashboardDao.class);
-    widgetDao = getDao(map, WidgetDao.class);
-    widgetPropertyDao = getDao(map, WidgetPropertyDao.class);
     fileSourceDao = getDao(map, FileSourceDao.class);
     authorDao = getDao(map, AuthorDao.class);
     componentIndexDao = getDao(map, ResourceIndexDao.class);
@@ -322,22 +310,6 @@ public class DbClient {
     return ceScannerContextDao;
   }
 
-  public DashboardDao dashboardDao() {
-    return dashboardDao;
-  }
-
-  public ActiveDashboardDao activeDashboardDao() {
-    return activeDashboardDao;
-  }
-
-  public WidgetDao widgetDao() {
-    return widgetDao;
-  }
-
-  public WidgetPropertyDao widgetPropertyDao() {
-    return widgetPropertyDao;
-  }
-
   public FileSourceDao fileSourceDao() {
     return fileSourceDao;
   }
index cd885f5c3c1758fd29a10cc476e2953f3b609d0b..ba299882ddac74244a372d7a78984d7d29f4207c 100644 (file)
@@ -48,14 +48,6 @@ import org.sonar.db.component.SnapshotDto;
 import org.sonar.db.component.SnapshotMapper;
 import org.sonar.db.component.UuidWithProjectUuidDto;
 import org.sonar.db.component.ViewsSnapshotDto;
-import org.sonar.db.dashboard.ActiveDashboardDto;
-import org.sonar.db.dashboard.ActiveDashboardMapper;
-import org.sonar.db.dashboard.DashboardDto;
-import org.sonar.db.dashboard.DashboardMapper;
-import org.sonar.db.dashboard.WidgetDto;
-import org.sonar.db.dashboard.WidgetMapper;
-import org.sonar.db.dashboard.WidgetPropertyDto;
-import org.sonar.db.dashboard.WidgetPropertyMapper;
 import org.sonar.db.debt.RequirementMigrationDto;
 import org.sonar.db.duplication.DuplicationMapper;
 import org.sonar.db.duplication.DuplicationUnitDto;
@@ -166,7 +158,6 @@ public class MyBatis {
     MyBatisConfBuilder confBuilder = new MyBatisConfBuilder(database);
 
     // DTO aliases, keep them sorted alphabetically
-    confBuilder.loadAlias("ActiveDashboard", ActiveDashboardDto.class);
     confBuilder.loadAlias("ActiveRule", ActiveRuleDto.class);
     confBuilder.loadAlias("ActiveRuleParam", ActiveRuleParamDto.class);
     confBuilder.loadAlias("Author", AuthorDto.class);
@@ -174,7 +165,6 @@ public class MyBatis {
     confBuilder.loadAlias("ComponentLink", ComponentLinkDto.class);
     confBuilder.loadAlias("ComponentWithSnapshot", ComponentDtoWithSnapshotId.class);
     confBuilder.loadAlias("CustomMeasure", CustomMeasureDto.class);
-    confBuilder.loadAlias("Dashboard", DashboardDto.class);
     confBuilder.loadAlias("DuplicationUnit", DuplicationUnitDto.class);
     confBuilder.loadAlias("Event", EventDto.class);
     confBuilder.loadAlias("FilePathWithHash", FilePathWithHashDto.class);
@@ -217,15 +207,12 @@ public class MyBatis {
     confBuilder.loadAlias("User", UserDto.class);
     confBuilder.loadAlias("UuidWithProjectUuid", UuidWithProjectUuidDto.class);
     confBuilder.loadAlias("ViewsSnapshot", ViewsSnapshotDto.class);
-    confBuilder.loadAlias("WidgetProperty", WidgetPropertyDto.class);
-    confBuilder.loadAlias("Widget", WidgetDto.class);
 
     // ResourceMapper has to be loaded before IssueMapper because this last one used it
     confBuilder.loadMapper(ResourceMapper.class);
 
     // keep them sorted alphabetically
     Class<?>[] mappers = {
-      ActiveDashboardMapper.class,
       ActiveRuleMapper.class,
       AuthorMapper.class,
       AuthorizationMapper.class,
@@ -237,7 +224,6 @@ public class MyBatis {
       ComponentLinkMapper.class,
       ComponentMapper.class,
       CustomMeasureMapper.class,
-      DashboardMapper.class,
       DuplicationMapper.class,
       EventMapper.class,
       FileSourceMapper.class,
@@ -278,9 +264,7 @@ public class MyBatis {
       UserGroupMapper.class,
       UserMapper.class,
       UserPermissionMapper.class,
-      UserTokenMapper.class,
-      WidgetMapper.class,
-      WidgetPropertyMapper.class
+      UserTokenMapper.class
     };
     confBuilder.loadMappers(mappers);
 
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDao.java b/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDao.java
deleted file mode 100644 (file)
index ab72f8f..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.ibatis.session.SqlSession;
-import org.sonar.db.Dao;
-import org.sonar.db.DbSession;
-import org.sonar.db.MyBatis;
-
-public class ActiveDashboardDao implements Dao {
-
-  private MyBatis mybatis;
-
-  public ActiveDashboardDao(MyBatis mybatis) {
-    this.mybatis = mybatis;
-  }
-
-  public void insert(DbSession session, ActiveDashboardDto activeDashboardDto) {
-    mapper(session).insert(activeDashboardDto);
-    session.commit();
-  }
-
-  public void insert(ActiveDashboardDto activeDashboardDto) {
-    DbSession session = mybatis.openSession(false);
-    try {
-      insert(session, activeDashboardDto);
-      session.commit();
-    } finally {
-      MyBatis.closeQuietly(session);
-    }
-  }
-
-  @CheckForNull
-  public ActiveDashboardDto selectById(DbSession session, long id){
-    return mapper(session).selectById(id);
-  }
-
-  public int selectMaxOrderIndexForNullUser() {
-    SqlSession session = mybatis.openSession(false);
-    try {
-      Integer max = mapper(session).selectMaxOrderIndexForNullUser();
-      return max != null ? max.intValue() : 0;
-    } finally {
-      session.close();
-    }
-
-  }
-
-  public List<DashboardDto> selectGlobalDashboardsForUserLogin(@Nullable String login) {
-    SqlSession session = mybatis.openSession(false);
-    try {
-      return mapper(session).selectGlobalDashboardsForUserLogin(login);
-    } finally {
-      session.close();
-    }
-  }
-
-  public List<DashboardDto> selectProjectDashboardsForUserLogin(@Nullable String login) {
-    SqlSession session = mybatis.openSession(false);
-    try {
-      return selectProjectDashboardsForUserLogin(session, login);
-    } finally {
-      session.close();
-    }
-  }
-
-  public List<DashboardDto> selectProjectDashboardsForUserLogin(SqlSession session, @Nullable String login) {
-    return mapper(session).selectProjectDashboardsForUserLogin(login);
-  }
-
-  private static ActiveDashboardMapper mapper(SqlSession session) {
-    return session.getMapper(ActiveDashboardMapper.class);
-  }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDto.java b/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDto.java
deleted file mode 100644 (file)
index 6db7d48..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import java.util.Objects;
-
-public final class ActiveDashboardDto {
-  private Long id;
-  private Long dashboardId;
-  private Long userId;
-  private Integer orderIndex;
-
-  /**
-   * @return the id
-   */
-  public Long getId() {
-    return id;
-  }
-
-  /**
-   * @param id the id to set
-   */
-  public ActiveDashboardDto setId(Long id) {
-    this.id = id;
-    return this;
-  }
-
-  /**
-   * @return the dashboardId
-   */
-  public Long getDashboardId() {
-    return dashboardId;
-  }
-
-  /**
-   * @param dashboardId the dashboardId to set
-   */
-  public ActiveDashboardDto setDashboardId(Long dashboardId) {
-    this.dashboardId = dashboardId;
-    return this;
-  }
-
-  /**
-   * @return the userId
-   */
-  public Long getUserId() {
-    return userId;
-  }
-
-  /**
-   * @param userId the userId to set
-   */
-  public ActiveDashboardDto setUserId(Long userId) {
-    this.userId = userId;
-    return this;
-  }
-
-  /**
-   * @return the orderIndex
-   */
-  public Integer getOrderIndex() {
-    return orderIndex;
-  }
-
-  /**
-   * @param orderIndex the orderIndex to set
-   */
-  public ActiveDashboardDto setOrderIndex(Integer orderIndex) {
-    this.orderIndex = orderIndex;
-    return this;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    ActiveDashboardDto that = (ActiveDashboardDto) o;
-    return !(id != null ? !id.equals(that.id) : that.id != null);
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hashCode(id);
-  }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardMapper.java b/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardMapper.java
deleted file mode 100644 (file)
index d0f3d83..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.ibatis.annotations.Param;
-
-public interface ActiveDashboardMapper {
-
-  void insert(ActiveDashboardDto activeDashboardDto);
-
-  ActiveDashboardDto selectById(long id);
-
-  @CheckForNull
-  Integer selectMaxOrderIndexForNullUser();
-
-  List<DashboardDto> selectGlobalDashboardsForUserLogin(@Nullable @Param("login") String login);
-
-  List<DashboardDto> selectProjectDashboardsForUserLogin(@Nullable @Param("login") String login);
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java b/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDao.java
deleted file mode 100644 (file)
index 8e2a90f..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.ibatis.session.SqlSession;
-import org.sonar.db.Dao;
-import org.sonar.db.DbSession;
-import org.sonar.db.MyBatis;
-
-public class DashboardDao implements Dao {
-
-  private MyBatis mybatis;
-
-  public DashboardDao(MyBatis mybatis) {
-    this.mybatis = mybatis;
-  }
-
-  public DashboardDto selectGlobalDashboard(String name) {
-    SqlSession session = mybatis.openSession(false);
-    try {
-      DashboardMapper mapper = session.getMapper(DashboardMapper.class);
-      return mapper.selectGlobalDashboard(name);
-    } finally {
-      MyBatis.closeQuietly(session);
-    }
-  }
-
-  public void insert(DbSession session, DashboardDto dashboardDto) {
-    DashboardMapper dashboardMapper = session.getMapper(DashboardMapper.class);
-    WidgetMapper widgetMapper = session.getMapper(WidgetMapper.class);
-    WidgetPropertyMapper widgetPropertyMapper = session.getMapper(WidgetPropertyMapper.class);
-    dashboardMapper.insert(dashboardDto);
-    for (WidgetDto widgetDto : dashboardDto.getWidgets()) {
-      widgetDto.setDashboardId(dashboardDto.getId());
-      widgetMapper.insert(widgetDto);
-      for (WidgetPropertyDto widgetPropertyDto : widgetDto.getWidgetProperties()) {
-        widgetPropertyDto.setWidgetId(widgetDto.getId());
-        widgetPropertyMapper.insert(widgetPropertyDto);
-      }
-    }
-  }
-
-  public void insert(DashboardDto dashboardDto) {
-    DbSession session = mybatis.openSession(false);
-    try {
-      insert(session, dashboardDto);
-      session.commit();
-    } finally {
-      MyBatis.closeQuietly(session);
-    }
-  }
-
-  @CheckForNull
-  public DashboardDto selectById(DbSession session, long id) {
-    return mapper(session).selectById(id);
-  }
-
-  /**
-   * Get dashboard if allowed : shared or owned by logged-in user
-   * @param userId id of logged-in user, null if anonymous
-   */
-  @CheckForNull
-  public DashboardDto selectAllowedByKey(DbSession session, Long key, @Nullable Long userId) {
-    return mapper(session).selectAllowedById(key, userId != null ? userId : -1L);
-  }
-
-  private static DashboardMapper mapper(DbSession session) {
-    return session.getMapper(DashboardMapper.class);
-  }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDto.java b/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardDto.java
deleted file mode 100644 (file)
index a70ad3f..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import com.google.common.collect.Lists;
-import java.util.Collection;
-import java.util.List;
-import org.sonar.db.Dto;
-
-public final class DashboardDto extends Dto<Long> {
-
-  private Long id;
-  private Long userId;
-  private String name;
-  private String description;
-  private String columnLayout;
-  private boolean shared;
-  private List<WidgetDto> widgetDtos = Lists.newArrayList();
-
-  public Long getId() {
-    return id;
-  }
-
-  @Override
-  public Long getKey() {
-    return id;
-  }
-
-  public DashboardDto setId(Long id) {
-    this.id = id;
-    return this;
-  }
-
-  public Long getUserId() {
-    return userId;
-  }
-
-  public DashboardDto setUserId(Long userId) {
-    this.userId = userId;
-    return this;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public DashboardDto setName(String name) {
-    this.name = name;
-    return this;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public DashboardDto setDescription(String description) {
-    this.description = description;
-    return this;
-  }
-
-  public String getColumnLayout() {
-    return columnLayout;
-  }
-
-  public DashboardDto setColumnLayout(String columnLayout) {
-    this.columnLayout = columnLayout;
-    return this;
-  }
-
-  public boolean getShared() {
-    return shared;
-  }
-
-  public DashboardDto setShared(boolean shared) {
-    this.shared = shared;
-    return this;
-  }
-
-  public Collection<WidgetDto> getWidgets() {
-    return widgetDtos;
-  }
-
-  public DashboardDto addWidget(WidgetDto widgetDto) {
-    widgetDtos.add(widgetDto);
-    return this;
-  }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardMapper.java b/sonar-db/src/main/java/org/sonar/db/dashboard/DashboardMapper.java
deleted file mode 100644 (file)
index 720ceb5..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import javax.annotation.CheckForNull;
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Options;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-
-public interface DashboardMapper {
-
-  String COLUMNS = "id, user_id as \"userId\", name, description, column_layout as \"columnLayout\", " +
-    "shared, created_at as \"createdAt\", updated_at as \"updatedAt\"";
-
-  @CheckForNull
-  @Select("select " + COLUMNS + " from dashboards where id=#{id}")
-  DashboardDto selectById(long id);
-
-  @CheckForNull
-  @Select("select " + COLUMNS + " from dashboards where id=#{id} and (shared=${_true} or user_id=${userId})")
-  DashboardDto selectAllowedById(@Param("id") long id, @Param("userId") long userId);
-
-  @CheckForNull
-  @Select("select " + COLUMNS + " from dashboards WHERE name=#{id} and user_id is null")
-  DashboardDto selectGlobalDashboard(String name);
-
-  @Insert("INSERT INTO dashboards (user_id, name, description, column_layout, shared, created_at, updated_at) " +
-    "VALUES (#{userId}, #{name}, #{description}, #{columnLayout}, #{shared}, #{createdAt}, #{updatedAt})")
-  @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
-  void insert(DashboardDto dashboardDto);
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDao.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDao.java
deleted file mode 100644 (file)
index 0b39fcc..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import java.util.Collection;
-import org.sonar.db.Dao;
-import org.sonar.db.DbSession;
-import org.sonar.db.MyBatis;
-
-public class WidgetDao implements Dao {
-
-  private MyBatis myBatis;
-
-  public WidgetDao(MyBatis myBatis) {
-    this.myBatis = myBatis;
-  }
-
-  public WidgetDto selectByKey(Long widgetId) {
-    DbSession session = myBatis.openSession(false);
-    try {
-      return selectByKey(session, widgetId);
-    } finally {
-      MyBatis.closeQuietly(session);
-    }
-  }
-
-  public WidgetDto selectByKey(DbSession session, Long widgetId) {
-    return mapper(session).selectById(widgetId);
-  }
-
-  public WidgetDto update(WidgetDto item) {
-    DbSession session = myBatis.openSession(false);
-    try {
-      return update(session, item);
-    } finally {
-      MyBatis.closeQuietly(session);
-    }
-  }
-
-  public WidgetDto update(DbSession session, WidgetDto item) {
-    mapper(session).update(item);
-    return item;
-  }
-
-  public Collection<WidgetDto> findByDashboard(DbSession session, long dashboardKey) {
-    return mapper(session).selectByDashboard(dashboardKey);
-  }
-
-  public Collection<WidgetDto> findAll(DbSession session) {
-    return mapper(session).selectAll();
-  }
-
-  private static WidgetMapper mapper(DbSession session) {
-    return session.getMapper(WidgetMapper.class);
-  }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDto.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetDto.java
deleted file mode 100644 (file)
index d44d5dc..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import com.google.common.collect.Lists;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
-public class WidgetDto {
-  private Long id;
-  private Long dashboardId;
-  private String widgetKey;
-  private String name;
-  private String description;
-  private Integer columnIndex;
-  private Integer rowIndex;
-  private boolean configured;
-  private Integer resourceId;
-  private Date createdAt;
-  private Date updatedAt;
-  private List<WidgetPropertyDto> widgetPropertyDtos = Lists.newArrayList();
-
-  /**
-   * @return the id
-   */
-  public Long getId() {
-    return id;
-  }
-
-  /**
-   * @param id the id to set
-   */
-  public WidgetDto setId(Long id) {
-    this.id = id;
-    return this;
-  }
-
-  /**
-   * @return the dashboardId
-   */
-  public Long getDashboardId() {
-    return dashboardId;
-  }
-
-  /**
-   * @param dashboardId the dashboardId to set
-   */
-  public WidgetDto setDashboardId(Long dashboardId) {
-    this.dashboardId = dashboardId;
-    return this;
-  }
-
-  public String getWidgetKey() {
-    return widgetKey;
-  }
-
-  public WidgetDto setWidgetKey(String s) {
-    this.widgetKey = s;
-    return this;
-  }
-
-  /**
-   * @return the name
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * @param name the name to set
-   */
-  public WidgetDto setName(String name) {
-    this.name = name;
-    return this;
-  }
-
-  /**
-   * @return the description
-   */
-  public String getDescription() {
-    return description;
-  }
-
-  /**
-   * @param description the description to set
-   */
-  public WidgetDto setDescription(String description) {
-    this.description = description;
-    return this;
-  }
-
-  /**
-   * @return the columnIndex
-   */
-  public Integer getColumnIndex() {
-    return columnIndex;
-  }
-
-  /**
-   * @param columnIndex the columnIndex to set
-   */
-  public WidgetDto setColumnIndex(Integer columnIndex) {
-    this.columnIndex = columnIndex;
-    return this;
-  }
-
-  /**
-   * @return the rowIndex
-   */
-  public Integer getRowIndex() {
-    return rowIndex;
-  }
-
-  /**
-   * @param rowIndex the rowIndex to set
-   */
-  public WidgetDto setRowIndex(Integer rowIndex) {
-    this.rowIndex = rowIndex;
-    return this;
-  }
-
-  /**
-   * @return the configured
-   */
-  public boolean getConfigured() {
-    return configured;
-  }
-
-  /**
-   * @param configured the configured to set
-   */
-  public WidgetDto setConfigured(boolean configured) {
-    this.configured = configured;
-    return this;
-  }
-
-  /**
-   * @return the widgetProperties
-   */
-  public Collection<WidgetPropertyDto> getWidgetProperties() {
-    return widgetPropertyDtos;
-  }
-
-  /**
-   * @param widgetPropertyDto the widgetProperty to set
-   */
-  public WidgetDto addWidgetProperty(WidgetPropertyDto widgetPropertyDto) {
-    widgetPropertyDtos.add(widgetPropertyDto);
-    return this;
-  }
-
-  /**
-   * @return the resourceId
-   * @since 3.1
-   */
-  public Integer getResourceId() {
-    return resourceId;
-  }
-
-  /**
-   * @param resourceId the resourceId to set
-   * @since 3.1
-   */
-  public WidgetDto setResourceId(Integer resourceId) {
-    this.resourceId = resourceId;
-    return this;
-  }
-
-  public WidgetDto setCreatedAt(Date datetime) {
-    this.createdAt = datetime;
-    return this;
-  }
-
-  public WidgetDto setUpdatedAt(Date datetime) {
-    this.updatedAt = datetime;
-    return this;
-  }
-
-  public final Date getCreatedAt() {
-    return this.createdAt;
-  }
-
-  public final Date getUpdatedAt() {
-    return this.updatedAt;
-  }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetMapper.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetMapper.java
deleted file mode 100644 (file)
index a169f5d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import java.util.Collection;
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Options;
-import org.apache.ibatis.annotations.Update;
-
-public interface WidgetMapper {
-
-  @Insert("insert into widgets (dashboard_id, widget_key, name, description, column_index, " +
-    " row_index, configured, created_at, updated_at, resource_id)" +
-    " values (#{dashboardId,jdbcType=INTEGER}, #{widgetKey,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, " +
-    " #{description,jdbcType=VARCHAR}, #{columnIndex,jdbcType=INTEGER}, " +
-    " #{rowIndex,jdbcType=INTEGER}, #{configured,jdbcType=BOOLEAN}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{resourceId,jdbcType=INTEGER})")
-  @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
-  void insert(WidgetDto widgetDto);
-
-  WidgetDto selectById(long widgetId);
-
-  Collection<WidgetDto> selectByDashboard(long dashboardKey);
-
-  Collection<WidgetDto> selectAll();
-
-  @Update("UPDATE widgets SET " +
-    "dashboard_id=#{dashboardId,jdbcType=INTEGER}, " +
-    "widget_key=#{widgetKey,jdbcType=VARCHAR}, " +
-    "name=#{name,jdbcType=VARCHAR}, " +
-    "description=#{description,jdbcType=VARCHAR}, " +
-    "column_index=#{columnIndex,jdbcType=INTEGER}, " +
-    "row_index=#{rowIndex,jdbcType=INTEGER}, " +
-    "configured=#{configured,jdbcType=BOOLEAN}, " +
-    "created_at=#{createdAt,jdbcType=TIMESTAMP}, " +
-    "updated_at=#{updatedAt,jdbcType=TIMESTAMP}, " +
-    "resource_id=#{resourceId,jdbcType=INTEGER} " +
-    "WHERE id=#{id}")
-  @Options(useGeneratedKeys = false)
-  void update(WidgetDto item);
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDao.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDao.java
deleted file mode 100644 (file)
index 7f1a66c..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.sonar.db.Dao;
-import org.sonar.db.DbSession;
-import org.sonar.db.MyBatis;
-
-import static org.sonar.db.DatabaseUtils.executeLargeInputs;
-
-public class WidgetPropertyDao implements Dao {
-
-  private final MyBatis myBatis;
-
-  public WidgetPropertyDao(MyBatis myBatis) {
-    this.myBatis = myBatis;
-  }
-
-  public WidgetPropertyDto insert(WidgetPropertyDto item) {
-    DbSession session = myBatis.openSession(false);
-    try {
-      return insert(session, item);
-    } finally {
-      MyBatis.closeQuietly(session);
-    }
-  }
-
-  public WidgetPropertyDto insert(DbSession session, WidgetPropertyDto item) {
-    mapper(session).insert(item);
-    return item;
-  }
-
-  public void insert(DbSession session, Collection<WidgetPropertyDto> items) {
-    for (WidgetPropertyDto item : items) {
-      insert(session, item);
-    }
-  }
-
-  public WidgetPropertyDto selectByKey(Long propertyId) {
-    DbSession session = myBatis.openSession(false);
-    try {
-      return selectByKey(session, propertyId);
-    } finally {
-      MyBatis.closeQuietly(session);
-    }
-  }
-
-  public WidgetPropertyDto selectByKey(DbSession session, Long propertyId) {
-    return mapper(session).selectById(propertyId);
-  }
-
-  public Collection<WidgetPropertyDto> selectByDashboard(DbSession session, long dashboardKey) {
-    return mapper(session).selectByDashboard(dashboardKey);
-  }
-
-  public void deleteByWidgetIds(DbSession session, List<Long> widgetIdsWithPropertiesToDelete) {
-    executeLargeInputs(
-      widgetIdsWithPropertiesToDelete,
-      input -> {
-        mapper(session).deleteByWidgetIds(input);
-        return Collections.emptyList();
-      });
-  }
-
-  private static WidgetPropertyMapper mapper(DbSession session) {
-    return session.getMapper(WidgetPropertyMapper.class);
-  }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDto.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDto.java
deleted file mode 100644 (file)
index 55f975a..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ListMultimap;
-import java.util.Collection;
-
-public class WidgetPropertyDto {
-  private Long id;
-  private Long widgetId;
-  private String propertyKey;
-  private String textValue;
-
-  public Long getId() {
-    return id;
-  }
-
-  public WidgetPropertyDto setId(Long id) {
-    this.id = id;
-    return this;
-  }
-
-  public Long getWidgetId() {
-    return widgetId;
-  }
-
-  public WidgetPropertyDto setWidgetId(Long widgetId) {
-    this.widgetId = widgetId;
-    return this;
-  }
-
-  public String getPropertyKey() {
-    return propertyKey;
-  }
-
-  public WidgetPropertyDto setPropertyKey(String s) {
-    this.propertyKey = s;
-    return this;
-  }
-
-  public String getTextValue() {
-    return textValue;
-  }
-
-  public WidgetPropertyDto setTextValue(String s) {
-    this.textValue = s;
-    return this;
-  }
-
-  public static ListMultimap<Long, WidgetPropertyDto> groupByWidgetId(Collection<WidgetPropertyDto> properties) {
-    ListMultimap<Long, WidgetPropertyDto> group = ArrayListMultimap.create();
-    for (WidgetPropertyDto property : properties) {
-      group.put(property.getWidgetId(), property);
-    }
-    return group;
-  }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyMapper.java b/sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyMapper.java
deleted file mode 100644 (file)
index 8c962ec..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import java.util.Collection;
-import java.util.List;
-import javax.annotation.CheckForNull;
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Options;
-import org.apache.ibatis.annotations.Select;
-
-public interface WidgetPropertyMapper {
-
-  String COLUMNS = "wp.id, wp.widget_id as \"widgetId\", wp.kee as \"propertyKey\", wp.text_value as \"textValue\"";
-
-  @Insert("insert into widget_properties (widget_id, kee, text_value) values (#{widgetId}, #{propertyKey}, #{textValue})")
-  @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
-  void insert(WidgetPropertyDto dto);
-
-  @CheckForNull
-  @Select("select " + COLUMNS + " from widget_properties wp where wp.id=#{id}")
-  WidgetPropertyDto selectById(long propertyId);
-
-  @Select("select " + COLUMNS + " from widget_properties wp " +
-    "inner join widgets w on w.id=wp.widget_id where w.dashboard_id=#{id}")
-  Collection<WidgetPropertyDto> selectByDashboard(long dashboardKey);
-
-  void deleteByWidgetIds(List<Long> widgetIds);
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/package-info.java b/sonar-db/src/main/java/org/sonar/db/dashboard/package-info.java
deleted file mode 100644 (file)
index 10b4706..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
index b75b14d7ce9d2341ac89f511d5db7797cf60547f..74bd4355b9fcb078f91f2a3b7cb19769dd801f19 100644 (file)
@@ -157,8 +157,6 @@ public class UserDao implements Dao {
     }
 
     mapper.removeUserFromGroups(dto.getId());
-    mapper.deleteUserActiveDashboards(dto.getId());
-    mapper.deleteUnsharedUserDashboards(dto.getId());
     mapper.deleteUnsharedUserIssueFilters(dto.getLogin());
     mapper.deleteUserIssueFilterFavourites(dto.getLogin());
     mapper.deleteUnsharedUserMeasureFilters(dto.getId());
index 9088a71b6181d0e9ecf7411078599b10e71e47e4..8795c1e4c7ee1a425942b8c4d4682ba8ccd0b122 100644 (file)
@@ -66,10 +66,6 @@ public interface UserMapper {
 
   void removeUserFromGroups(long userId);
 
-  void deleteUserActiveDashboards(long userId);
-
-  void deleteUnsharedUserDashboards(long userId);
-
   void deleteUnsharedUserIssueFilters(String login);
 
   void deleteUserIssueFilterFavourites(String login);
diff --git a/sonar-db/src/main/resources/org/sonar/db/dashboard/ActiveDashboardMapper.xml b/sonar-db/src/main/resources/org/sonar/db/dashboard/ActiveDashboardMapper.xml
deleted file mode 100644 (file)
index 9349e3c..0000000
+++ /dev/null
@@ -1,73 +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-mapper.dtd">
-
-<mapper namespace="org.sonar.db.dashboard.ActiveDashboardMapper">
-
-  <sql id="activeDashboardColumns">
-    ad.id,
-    ad.user_id as "userId",
-    ad.dashboard_id as "dashboardId",
-    ad.order_index as "orderIndex"
-  </sql>
-
-  <insert id="insert" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
-    INSERT INTO active_dashboards (dashboard_id, user_id, order_index)
-    VALUES (#{dashboardId}, #{userId}, #{orderIndex})
-  </insert>
-
-  <select id="selectById" resultType="ActiveDashboard">
-    SELECT <include refid="activeDashboardColumns"/>
-    FROM active_dashboards ad
-    WHERE ad.id=#{id}
-  </select>
-
-  <select id="selectMaxOrderIndexForNullUser" resultType="Integer">
-    SELECT MAX(order_index)
-    FROM active_dashboards
-    WHERE user_id IS NULL
-  </select>
-
-  <sql id="dashboardColumns">
-    d.id, d.user_id as "userId", d.name, d.description, d.column_layout as "columnLayout",
-    d.shared, d.created_at as "createdAt", d.updated_at as "updatedAt"
-  </sql>
-
-  <select id="selectGlobalDashboardsForUserLogin" parameterType="String" resultType="Dashboard">
-    SELECT
-    <include refid="dashboardColumns"/>
-    FROM dashboards d
-    INNER JOIN active_dashboards ad on d.id=ad.dashboard_id
-    LEFT OUTER JOIN users u on u.id=ad.user_id
-    <where>
-      <choose>
-        <when test="login == null">
-          AND u.login IS NULL
-        </when>
-        <otherwise>
-          AND u.login=#{login}
-        </otherwise>
-      </choose>
-    </where>
-    ORDER BY order_index ASC
-  </select>
-
-  <select id="selectProjectDashboardsForUserLogin" parameterType="String" resultType="Dashboard">
-    SELECT
-    <include refid="dashboardColumns"/>
-    FROM dashboards d
-    INNER JOIN active_dashboards ad on d.id=ad.dashboard_id
-    LEFT OUTER JOIN users u on u.id=ad.user_id
-    <where>
-      <choose>
-        <when test="login == null">
-          AND u.login IS NULL
-        </when>
-        <otherwise>
-          AND u.login=#{login}
-        </otherwise>
-      </choose>
-    </where>
-    ORDER BY order_index ASC
-  </select>
-
-</mapper>
diff --git a/sonar-db/src/main/resources/org/sonar/db/dashboard/DashboardMapper.xml b/sonar-db/src/main/resources/org/sonar/db/dashboard/DashboardMapper.xml
deleted file mode 100644 (file)
index ce27a44..0000000
+++ /dev/null
@@ -1,6 +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-mapper.dtd">
-
-<mapper namespace="org.sonar.db.dashboard.DashboardMapper">
-
-</mapper>
diff --git a/sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetMapper.xml b/sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetMapper.xml
deleted file mode 100644 (file)
index a631f84..0000000
+++ /dev/null
@@ -1,38 +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-mapper.dtd">
-
-<mapper namespace="org.sonar.db.dashboard.WidgetMapper">
-
-  <sql id="selectColumns">
-    w.id as "id",
-    w.dashboard_id as "dashboardId",
-    w.widget_key as "widgetKey",
-    w.name as "name",
-    w.description as "description",
-    w.column_index as "columnIndex",
-    w.row_index as "rowIndex",
-    w.configured as "configured",
-    w.created_at as "createdAt",
-    w.updated_at as "updatedAt",
-    w.resource_id as "resourceId"
-  </sql>
-
-  <select id="selectById" parameterType="Long" resultType="Widget">
-    select
-    <include refid="selectColumns"/>
-    from widgets w where w.id=#{id}
-  </select>
-
-  <select id="selectByDashboard" parameterType="Long" resultType="Widget">
-    select
-    <include refid="selectColumns"/>
-    from widgets w where w.dashboard_id=#{id}
-  </select>
-
-  <select id="selectAll" resultType="Widget">
-    select
-    <include refid="selectColumns"/>
-    from widgets w
-  </select>
-
-</mapper>
diff --git a/sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetPropertyMapper.xml b/sonar-db/src/main/resources/org/sonar/db/dashboard/WidgetPropertyMapper.xml
deleted file mode 100644 (file)
index a2bf802..0000000
+++ /dev/null
@@ -1,12 +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-mapper.dtd">
-
-<mapper namespace="org.sonar.db.dashboard.WidgetPropertyMapper">
-
-  <delete id="deleteByWidgetIds" parameterType="map">
-    DELETE FROM widget_properties
-    WHERE widget_id IN
-    <foreach collection="list" open="(" close=")" item="wid" separator=",">#{wid}</foreach>
-  </delete>
-
-</mapper>
index cde781fd0abe8a4ab271e2169646f0938f22eb0b..7087a0a4b2f782ac42bff51f75d8fa6d5e2fbfad 100644 (file)
     DELETE FROM properties WHERE user_id=#{id}
   </delete>
 
-  <delete id="deleteUnsharedUserDashboards" parameterType="long">
-    DELETE FROM dashboards WHERE user_id=#{id} and shared &lt;&gt; ${_true}
-  </delete>
-
-  <delete id="deleteUserActiveDashboards" parameterType="long">
-    DELETE FROM active_dashboards WHERE user_id=#{id}
-  </delete>
-
   <delete id="deleteUnsharedUserMeasureFilters" parameterType="long">
     DELETE FROM measure_filters WHERE user_id=#{id} and shared &lt;&gt; ${_true}
   </delete>
index a87ffc547e03d0c6667db4c47b68edd2043edd18..f653c76bfcef058460a4ba1cc4391ddb756c569d 100644 (file)
@@ -29,6 +29,6 @@ public class DaoModuleTest {
   public void verify_count_of_added_components() {
     ComponentContainer container = new ComponentContainer();
     new DaoModule().configure(container);
-    assertThat(container.size()).isEqualTo(2 + 52);
+    assertThat(container.size()).isEqualTo(2 + 48);
   }
 }
diff --git a/sonar-db/src/test/java/org/sonar/db/dashboard/ActiveDashboardDaoTest.java b/sonar-db/src/test/java/org/sonar/db/dashboard/ActiveDashboardDaoTest.java
deleted file mode 100644 (file)
index 36e8e2f..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbSession;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-
-public class ActiveDashboardDaoTest {
-
-  @Rule
-  public DbTester dbTester = DbTester.create(System2.INSTANCE);
-
-  DbSession session = dbTester.getSession();
-
-  ActiveDashboardDao underTest = dbTester.getDbClient().activeDashboardDao();
-
-  @Test
-  public void shouldInsert() {
-    dbTester.prepareDbUnit(getClass(), "shouldInsert.xml");
-
-    ActiveDashboardDto dashboard = new ActiveDashboardDto();
-    dashboard.setDashboardId(2L);
-    dashboard.setUserId(3L);
-    dashboard.setOrderIndex(4);
-    underTest.insert(dashboard);
-
-    dbTester.assertDbUnit(getClass(), "shouldInsert-result.xml", "active_dashboards");
-  }
-
-  @Test
-  public void shouldInsertWithNoUser() {
-    dbTester.prepareDbUnit(getClass(), "shouldInsert.xml");
-
-    ActiveDashboardDto dashboard = new ActiveDashboardDto();
-    dashboard.setDashboardId(2L);
-    dashboard.setOrderIndex(4);
-    underTest.insert(dashboard);
-
-    dbTester.assertDbUnit(getClass(), "shouldInsertWithNoUser-result.xml", "active_dashboards");
-  }
-
-  @Test
-  public void shouldGetMaxOrderIndexForNullUser() {
-    dbTester.prepareDbUnit(getClass(), "shouldGetMaxOrderIndexForNullUser.xml");
-
-    int index = underTest.selectMaxOrderIndexForNullUser();
-
-    assertThat(index).isEqualTo(15);
-  }
-
-  @Test
-  public void shouldGetZeroMaxOrderIndex() {
-    dbTester.prepareDbUnit(getClass(), "empty.xml");
-
-    int index = underTest.selectMaxOrderIndexForNullUser();
-
-    assertThat(index).isZero();
-  }
-
-  @Test
-  public void should_get_dashboards_for_anonymous() {
-    dbTester.prepareDbUnit(getClass(), "shouldSelectDashboardsForAnonymous.xml");
-
-    assertThat(underTest.selectGlobalDashboardsForUserLogin(null)).hasSize(2).extracting("id").containsExactly(2L, 1L);
-  }
-
-  @Test
-  public void should_get_dashboards_for_user() {
-    dbTester.prepareDbUnit(getClass(), "shouldSelectDashboardsForUser.xml");
-
-    assertThat(underTest.selectGlobalDashboardsForUserLogin("obiwan")).hasSize(2).extracting("id").containsExactly(2L, 1L);
-  }
-
-  @Test
-  public void select_by_id() throws Exception {
-    ActiveDashboardDto dto = new ActiveDashboardDto()
-      .setDashboardId(10L)
-      .setOrderIndex(2)
-      .setUserId(5L);
-    underTest.insert(session, dto);
-    session.commit();
-
-    ActiveDashboardDto dtoReloaded = underTest.selectById(session, dto.getId());
-    assertThat(dtoReloaded).isNotNull();
-    assertThat(dtoReloaded.getDashboardId()).isEqualTo(10L);
-    assertThat(dtoReloaded.getUserId()).isEqualTo(5L);
-    assertThat(dtoReloaded.getOrderIndex()).isEqualTo(2);
-
-    assertThat(underTest.selectById(session, 123L)).isNull();
-  }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/dashboard/DashboardDaoTest.java b/sonar-db/src/test/java/org/sonar/db/dashboard/DashboardDaoTest.java
deleted file mode 100644 (file)
index 95a8cd0..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import java.util.Date;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-
-
-public class DashboardDaoTest {
-
-  @Rule
-  public DbTester dbTester = DbTester.create(System2.INSTANCE);
-
-  DashboardDao underTest = dbTester.getDbClient().dashboardDao();
-
-  @Test
-  public void shouldSelectGlobalDashboard() {
-    dbTester.prepareDbUnit(getClass(), "shouldSelectGlobalDashboard.xml");
-    DashboardDto dashboard = underTest.selectGlobalDashboard("SQALE");
-    assertThat(dashboard.getId(), is(2L));
-    assertThat(dashboard.getUserId(), nullValue());
-
-    assertNull(underTest.selectGlobalDashboard("unknown"));
-  }
-
-  @Test
-  public void shouldInsert() {
-    dbTester.prepareDbUnit(getClass(), "shouldInsert.xml");
-    Date aDate = new Date();
-
-    DashboardDto dashboardDto = new DashboardDto();
-    dashboardDto.setUserId(6L);
-    dashboardDto.setName("My Dashboard");
-    dashboardDto.setDescription("This is a dashboard");
-    dashboardDto.setColumnLayout("100%");
-    dashboardDto.setShared(true);
-    dashboardDto.setCreatedAt(aDate);
-    dashboardDto.setUpdatedAt(aDate);
-
-    WidgetDto widgetDto = new WidgetDto();
-    widgetDto.setWidgetKey("code_coverage");
-    widgetDto.setName("Code coverage");
-    widgetDto.setDescription("Widget for code coverage");
-    widgetDto.setColumnIndex(13);
-    widgetDto.setRowIndex(14);
-    widgetDto.setConfigured(true);
-    widgetDto.setCreatedAt(aDate);
-    widgetDto.setUpdatedAt(aDate);
-    dashboardDto.addWidget(widgetDto);
-
-    WidgetPropertyDto property = new WidgetPropertyDto();
-    property.setPropertyKey("displayITs");
-    property.setTextValue("true");
-    widgetDto.addWidgetProperty(property);
-
-    underTest.insert(dashboardDto);
-
-    dbTester.assertDbUnit(getClass(), "shouldInsert-result.xml", new String[] {"created_at", "updated_at"}, "dashboards", "widgets", "widget_properties");
-  }
-
-  @Test
-  public void shouldInsertWithNullableColumns() {
-    dbTester.prepareDbUnit(getClass(), "shouldInsert.xml");
-
-    DashboardDto dashboardDto = new DashboardDto();
-    dashboardDto.setUserId(null);
-    dashboardDto.setName(null);
-    dashboardDto.setDescription(null);
-    dashboardDto.setColumnLayout(null);
-    dashboardDto.setShared(true);
-    dashboardDto.setCreatedAt(null);
-    dashboardDto.setUpdatedAt(null);
-
-    WidgetDto widgetDto = new WidgetDto();
-    widgetDto.setWidgetKey("code_coverage");
-    widgetDto.setName(null);
-    widgetDto.setDescription(null);
-    widgetDto.setColumnIndex(null);
-    widgetDto.setRowIndex(null);
-    widgetDto.setConfigured(true);
-    widgetDto.setCreatedAt(null);
-    widgetDto.setUpdatedAt(null);
-    dashboardDto.addWidget(widgetDto);
-
-    WidgetPropertyDto property = new WidgetPropertyDto();
-    property.setPropertyKey(null);
-    property.setTextValue(null);
-    widgetDto.addWidgetProperty(property);
-
-    underTest.insert(dashboardDto);
-
-    dbTester.assertDbUnit(getClass(), "shouldInsertWithNullableColumns-result.xml", "dashboards", "widgets", "widget_properties");
-  }
-
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/dashboard/WidgetDaoTest.java b/sonar-db/src/test/java/org/sonar/db/dashboard/WidgetDaoTest.java
deleted file mode 100644 (file)
index 813e327..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.dashboard;
-
-import java.util.Collection;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbSession;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class WidgetDaoTest {
-
-  @Rule
-  public DbTester db = DbTester.create(System2.INSTANCE);
-  DbSession dbSession = db.getSession();
-
-  WidgetDao underTest = db.getDbClient().widgetDao();
-
-  @Test
-  public void should_select_all() {
-    db.prepareDbUnit(this.getClass(), "before.xml");
-
-    Collection<WidgetDto> widgets = underTest.findAll(db.getSession());
-    assertThat(widgets).hasSize(5);
-    for (WidgetDto widget : widgets) {
-      assertThat(widget.getId()).isNotNull();
-      assertThat(widget.getName()).isNotNull();
-      assertThat(widget.getDescription()).isNotNull();
-    }
-  }
-
-  @Test
-  public void select_by_dashboard_key() {
-    db.prepareDbUnit(this.getClass(), "before.xml");
-
-    Collection<WidgetDto> result = underTest.findByDashboard(dbSession, 1L);
-
-    assertThat(result).hasSize(5);
-  }
-
-  @Test
-  public void select_by_key() {
-    db.prepareDbUnit(this.getClass(), "before.xml");
-
-    WidgetDto result = underTest.selectByKey(dbSession, 1L);
-
-    assertThat(result).isNotNull();
-  }
-}
index dc1114eef2f19841863c727358977a3f03fcf826..39a771d08e26a170ca1b02cf8685d9de3d4233bd 100644 (file)
@@ -33,14 +33,11 @@ import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
 import org.sonar.db.DbTester;
 import org.sonar.db.RowNotFoundException;
-import org.sonar.db.dashboard.ActiveDashboardDto;
-import org.sonar.db.dashboard.DashboardDto;
 import org.sonar.db.issue.IssueFilterDto;
 import org.sonar.db.issue.IssueFilterFavouriteDto;
 import org.sonar.db.measure.MeasureFilterDto;
 import org.sonar.db.measure.MeasureFilterFavouriteDto;
 import org.sonar.db.organization.OrganizationDto;
-import org.sonar.db.permission.UserPermissionDto;
 import org.sonar.db.property.PropertyDto;
 import org.sonar.db.property.PropertyQuery;
 
@@ -400,8 +397,6 @@ public class UserDaoTest {
   @Test
   public void deactivate_user() throws Exception {
     UserDto user = newActiveUser();
-    DashboardDto dashboard = insertDashboard(user, false);
-    ActiveDashboardDto activeDashboard = insertActiveDashboard(dashboard, user);
     IssueFilterDto issueFilter = insertIssueFilter(user, false);
     IssueFilterFavouriteDto issueFilterFavourite = insertIssueFilterFavourite(issueFilter, user);
     MeasureFilterDto measureFilter = insertMeasureFilter(user, false);
@@ -430,8 +425,6 @@ public class UserDaoTest {
 
     assertThat(underTest.selectUserById(session, otherUser.getId())).isNotNull();
 
-    assertThat(dbClient.dashboardDao().selectById(session, dashboard.getId())).isNull();
-    assertThat(dbClient.activeDashboardDao().selectById(session, activeDashboard.getId())).isNull();
     assertThat(dbClient.issueFilterDao().selectById(session, issueFilter.getId())).isNull();
     assertThat(dbClient.issueFilterFavouriteDao().selectById(session, issueFilterFavourite.getId())).isNull();
     assertThat(dbClient.measureFilterDao().selectById(session, measureFilter.getId())).isNull();
@@ -441,22 +434,6 @@ public class UserDaoTest {
     assertThat(dbClient.groupMembershipDao().countGroups(session, builder().login(user.getLogin()).membership(IN).build(), user.getId())).isZero();
   }
 
-  @Test
-  public void deactivate_user_does_not_remove_shared_dashboard() throws Exception {
-    UserDto user = newActiveUser();
-    DashboardDto notSharedDashboard = insertDashboard(user, false);
-    DashboardDto sharedDashboard = insertDashboard(user, true);
-    session.commit();
-
-    boolean deactivated = underTest.deactivateUserByLogin(session, user.getLogin());
-    assertThat(deactivated).isTrue();
-
-    assertThat(dbClient.dashboardDao().selectById(session, notSharedDashboard.getId())).isNull();
-    DashboardDto sharedDashboardReloaded = dbClient.dashboardDao().selectById(session, sharedDashboard.getId());
-    assertThat(sharedDashboardReloaded).isNotNull();
-    assertThat(sharedDashboardReloaded.getUserId()).isEqualTo(user.getId());
-  }
-
   @Test
   public void deactivate_user_does_not_remove_shared_issue_filter() throws Exception {
     UserDto user = newActiveUser();
@@ -788,18 +765,6 @@ public class UserDaoTest {
     return dto;
   }
 
-  private DashboardDto insertDashboard(UserDto user, boolean shared) {
-    DashboardDto dto = new DashboardDto().setUserId(user.getId()).setShared(shared);
-    dbClient.dashboardDao().insert(session, dto);
-    return dto;
-  }
-
-  private ActiveDashboardDto insertActiveDashboard(DashboardDto dashboard, UserDto user) {
-    ActiveDashboardDto dto = new ActiveDashboardDto().setDashboardId(dashboard.getId()).setUserId(user.getId());
-    dbClient.activeDashboardDao().insert(session, dto);
-    return dto;
-  }
-
   private IssueFilterDto insertIssueFilter(UserDto user, boolean shared) {
     IssueFilterDto dto = new IssueFilterDto().setUserLogin(user.getLogin()).setName(randomAlphanumeric(100)).setShared(shared);
     dbClient.issueFilterDao().insert(session, dto);
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/empty.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/empty.xml
deleted file mode 100644 (file)
index 871dedc..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<dataset>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldGetMaxOrderIndexForNullUser.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldGetMaxOrderIndexForNullUser.xml
deleted file mode 100644 (file)
index 1a3d923..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<dataset>
-
-  <active_dashboards
-    id="1"
-    dashboard_id="1"
-    user_id="[null]"
-    order_index="1"/>
-
-  <active_dashboards
-    id="2"
-    dashboard_id="2"
-    user_id="[null]"
-    order_index="15"/>
-
-  <active_dashboards
-    id="3"
-    dashboard_id="3"
-    user_id="3"
-    order_index="25"/>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldInsert-result.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldInsert-result.xml
deleted file mode 100644 (file)
index 75fb167..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<dataset>
-
-  <active_dashboards
-    id="1"
-    dashboard_id="2"
-    user_id="3"
-    order_index="4"/>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldInsert.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldInsert.xml
deleted file mode 100644 (file)
index 871dedc..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<dataset>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldInsertWithNoUser-result.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldInsertWithNoUser-result.xml
deleted file mode 100644 (file)
index a247a4f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<dataset>
-
-  <active_dashboards
-    id="1"
-    dashboard_id="2"
-    user_id="[null]"
-    order_index="4"/>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldSelectDashboardsForAnonymous.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldSelectDashboardsForAnonymous.xml
deleted file mode 100644 (file)
index ef64957..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<dataset>
-
-  <users id="42"
-         login="obiwan"
-         name="Obiwan"
-         email="obiwan@keno.bi"
-         created_at="1418215735482"
-         updated_at="1418215735482"
-         active="[true]"
-         is_root="[false]"/>
-
-  <dashboards
-      id="1"
-      user_id="1"
-      name="My Dashboard"
-      description="Dashboard shared by admin"
-      column_layout="100%"
-      shared="[true]"
-  />
-  <dashboards
-      id="2"
-      user_id="[null]"
-      name="Default Dashboard"
-      description="Dashboard provided by system"
-      column_layout="100%"
-      shared="[true]"
-  />
-  <dashboards
-      id="4"
-      user_id="[null]"
-      name="User Dashboard"
-      description="Won't appear, not anonymous"
-      column_layout="100%"
-      shared="[true]"
-  />
-
-  <!-- Dashboard with ID 1 appears after ID 2 -->
-  <active_dashboards
-      id="1"
-      dashboard_id="1"
-      user_id="[null]"
-      order_index="2"/>
-  <!-- Dashboard with ID 2 appears before ID 1 -->
-  <active_dashboards
-      id="2"
-      dashboard_id="2"
-      user_id="[null]"
-      order_index="1"/>
-  <!-- Dashboard with ID 4 does not appear (not anonymous) -->
-  <active_dashboards
-      id="4"
-      dashboard_id="4"
-      user_id="42"
-      order_index="1"/>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldSelectDashboardsForUser.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/ActiveDashboardDaoTest/shouldSelectDashboardsForUser.xml
deleted file mode 100644 (file)
index 5b57ddf..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<dataset>
-
-  <users id="24"
-         login="anakin"
-         name="Anakin"
-         email="anakin@skywalk.er"
-         created_at="1418215735482"
-         updated_at="1418215735482"
-         active="[true]"
-         is_root="[false]"/>
-  <users id="42"
-         login="obiwan"
-         name="Obiwan"
-         email="obiwan@keno.bi"
-         created_at="1418215735482"
-         updated_at="1418215735482"
-         active="[true]"
-         is_root="[false]"/>
-
-  <dashboards
-      id="1"
-      user_id="1"
-      name="My Dashboard"
-      description="Dashboard shared by admin"
-      column_layout="100%"
-      shared="[true]"
-  />
-  <dashboards
-      id="2"
-      user_id="[null]"
-      name="Default Dashboard"
-      description="Dashboard provided by system"
-      column_layout="100%"
-      shared="[true]"
-  />
-  <dashboards
-      id="4"
-      user_id="[null]"
-      name="Anonymous Dashboard"
-      description="Won't appear, anonymous"
-      column_layout="100%"
-      shared="[true]"
-  />
-  <dashboards
-      id="5"
-      user_id="[null]"
-      name="Another User Dashboard"
-      description="Won't appear, different user"
-      column_layout="100%"
-      shared="[true]"
-  />
-
-  <!-- Dashboard with ID 1 appears after ID 2 -->
-  <active_dashboards
-      id="1"
-      dashboard_id="1"
-      user_id="42"
-      order_index="2"/>
-  <!-- Dashboard with ID 2 appears before ID 1 -->
-  <active_dashboards
-      id="2"
-      dashboard_id="2"
-      user_id="42"
-      order_index="1"/>
-  <!-- Dashboard with ID 4 does not appear (anonymous) -->
-  <active_dashboards
-      id="4"
-      dashboard_id="4"
-      user_id="[null]"
-      order_index="1"/>
-  <!-- Dashboard with ID 5 does not appear (another user) -->
-  <active_dashboards
-      id="5"
-      dashboard_id="5"
-      user_id="24"
-      order_index="1"/>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldInsert-result.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldInsert-result.xml
deleted file mode 100644 (file)
index 30969fc..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<dataset>
-
-  <dashboards
-    id="1"
-    user_id="6"
-    name="My Dashboard"
-    description="This is a dashboard"
-    column_layout="100%"
-    shared="[true]"
-    />
-
-  <widgets
-    id="1"
-    dashboard_id="1"
-    widget_key="code_coverage"
-    name="Code coverage"
-    description="Widget for code coverage"
-    column_index="13"
-    row_index="14"
-    configured="[true]"
-    resource_id="[null]"
-    />
-
-  <widget_properties
-    id="1"
-    widget_id="1"
-    kee="displayITs"
-    text_value="true"
-    />
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldInsert.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldInsert.xml
deleted file mode 100644 (file)
index 871dedc..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<dataset>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldInsertWithNullableColumns-result.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldInsertWithNullableColumns-result.xml
deleted file mode 100644 (file)
index 67181df..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<dataset>
-
-  <dashboards
-    id="1"
-    user_id="[null]"
-    name="[null]"
-    description="[null]"
-    column_layout="[null]"
-    shared="[true]"
-    created_at="[null]"
-    updated_at="[null]"
-    />
-
-  <widgets
-    id="1"
-    dashboard_id="1"
-    widget_key="code_coverage"
-    name="[null]"
-    description="[null]"
-    column_index="[null]"
-    row_index="[null]"
-    configured="[true]"
-    created_at="[null]"
-    updated_at="[null]"
-    resource_id="[null]"
-    />
-
-  <widget_properties
-    id="1"
-    widget_id="1"
-    kee="[null]"
-    text_value="[null]"
-    />
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldSelectGlobalDashboard.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/DashboardDaoTest/shouldSelectGlobalDashboard.xml
deleted file mode 100644 (file)
index 110e760..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<dataset>
-
-  <dashboards
-    id="1"
-    user_id="6"
-    name="SQALE"
-    description="User SQALE dashboard"
-    column_layout="100%"
-    shared="[true]"
-    />
-
-  <dashboards
-    id="2"
-    user_id="[null]"
-    name="SQALE"
-    description="Global SQALE dashboard"
-    column_layout="100%"
-    shared="[true]"
-    />
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/dashboard/WidgetDaoTest/before.xml b/sonar-db/src/test/resources/org/sonar/db/dashboard/WidgetDaoTest/before.xml
deleted file mode 100644 (file)
index a942341..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<dataset>
-
-  <widgets id="1" dashboard_id="1" widget_key="polop" name="Polop" description="Palap"
-     column_index="1" row_index="1" configured="[true]" created_at="[null]" updated_at="[null]" resource_id="[null]"/>
-
-  <widgets id="2" dashboard_id="1" widget_key="false_positive_reviews" name="Polop" description="Palap"
-     column_index="1" row_index="2" configured="[true]" created_at="[null]" updated_at="[null]" resource_id="[null]"/>
-
-  <widgets id="3" dashboard_id="1" widget_key="my_reviews" name="Polop" description="Palap"
-     column_index="1" row_index="3" configured="[true]" created_at="[null]" updated_at="[null]" resource_id="[null]"/>
-
-  <widgets id="4" dashboard_id="1" widget_key="reviews_per_developer" name="Polop" description="Palap"
-     column_index="1" row_index="4" configured="[true]" created_at="[null]" updated_at="[null]" resource_id="[null]"/>
-
-  <widgets id="5" dashboard_id="1" widget_key="unresolved_issues_statuses" name="Polop" description="Palap"
-     column_index="1" row_index="5" configured="[true]" created_at="[null]" updated_at="[null]" resource_id="[null]"/>
-
-</dataset>