diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-05-19 19:22:32 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-05-20 11:02:53 +0200 |
commit | aac5b47155d3f4de3191951f8c2edb6eb415d385 (patch) | |
tree | 0fc82826729d31ac9c6a605818d60e0fc9c6b6e3 /server | |
parent | b691c1bfbbc7f0d398e46d7377bae26c5ad1725f (diff) | |
download | sonarqube-aac5b47155d3f4de3191951f8c2edb6eb415d385.tar.gz sonarqube-aac5b47155d3f4de3191951f8c2edb6eb415d385.zip |
SONAR-6418 delete table GRAPHS
Diffstat (limited to 'server')
5 files changed, 35 insertions, 50 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java b/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java index 3a4d87a78c0..22e7c803569 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java @@ -39,7 +39,7 @@ import java.sql.SQLException; public class BackendCleanup { private static final String[] INSPECTION_TABLES = { - "action_plans", "authors", "dependencies", "duplications_index", "events", "graphs", "issues", "issue_changes", "manual_measures", + "action_plans", "authors", "dependencies", "duplications_index", "events", "issues", "issue_changes", "manual_measures", "notifications", "project_links", "project_measures", "projects", "resource_index", "semaphores", "snapshots", "file_sources" }; diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index c20b5177782..0f08118e17b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -31,7 +31,6 @@ import org.sonar.api.resources.ResourceTypes; import org.sonar.api.rules.AnnotationRuleParser; import org.sonar.api.rules.XMLRuleParser; import org.sonar.api.server.rule.RulesDefinitionXmlLoader; -import org.sonar.core.component.SnapshotPerspectives; import org.sonar.core.computation.dbcleaner.DefaultPurgeTask; import org.sonar.core.computation.dbcleaner.IndexPurgeListener; import org.sonar.core.computation.dbcleaner.ProjectCleaner; @@ -637,7 +636,6 @@ public class PlatformLevel4 extends PlatformLevel { // graphs and perspective related classes TestablePerspectiveLoader.class, TestPlanPerspectiveLoader.class, - SnapshotPerspectives.class, // Type validation TypeValidations.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java b/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java index b56a58b7f5a..d52a4bfc100 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java @@ -20,25 +20,19 @@ package org.sonar.server.test; +import com.google.common.collect.Maps; import java.util.Map; - import javax.annotation.CheckForNull; - import org.sonar.api.ServerSide; import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.test.MutableTestable; -import org.sonar.api.test.Testable; import org.sonar.api.utils.KeyValueFormat; import org.sonar.api.web.UserRole; -import org.sonar.core.component.SnapshotPerspectives; import org.sonar.core.measure.db.MeasureDto; import org.sonar.core.persistence.DbSession; import org.sonar.core.persistence.MyBatis; import org.sonar.server.measure.persistence.MeasureDao; import org.sonar.server.user.UserSession; -import com.google.common.collect.Maps; - @ServerSide public class CoverageService { @@ -48,13 +42,11 @@ public class CoverageService { private final MyBatis myBatis; private final MeasureDao measureDao; - private final SnapshotPerspectives snapshotPerspectives; private final UserSession userSession; - public CoverageService(MyBatis myBatis, MeasureDao measureDao, SnapshotPerspectives snapshotPerspectives, UserSession userSession) { + public CoverageService(MyBatis myBatis, MeasureDao measureDao, UserSession userSession) { this.myBatis = myBatis; this.measureDao = measureDao; - this.snapshotPerspectives = snapshotPerspectives; this.userSession = userSession; } @@ -95,19 +87,6 @@ public class CoverageService { } } - /** - * Test cases is only return for unit tests - */ - public Map<Integer, Integer> getTestCases(String fileKey, CoverageService.TYPE type) { - if (TYPE.UT.equals(type)) { - Testable testable = snapshotPerspectives.as(MutableTestable.class, fileKey); - if (testable != null) { - return testable.testCasesByLines(); - } - } - return Maps.newHashMap(); - } - @CheckForNull private Map<Integer, Integer> findDataFromComponent(String fileKey, String metricKey) { DbSession session = myBatis.openSession(false); diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/CoverageServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/CoverageServiceTest.java index f018335a00e..5f71cb5ffa5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/test/CoverageServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/test/CoverageServiceTest.java @@ -29,9 +29,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.test.MutableTestable; import org.sonar.api.web.UserRole; -import org.sonar.core.component.SnapshotPerspectives; import org.sonar.core.persistence.DbSession; import org.sonar.core.persistence.MyBatis; import org.sonar.server.measure.persistence.MeasureDao; @@ -57,15 +55,13 @@ public class CoverageServiceTest { DbSession session; @Mock MeasureDao measureDao; - @Mock - SnapshotPerspectives snapshotPerspectives; CoverageService service; @Before public void setUp() { MyBatis myBatis = mock(MyBatis.class); when(myBatis.openSession(false)).thenReturn(session); - service = new CoverageService(myBatis, measureDao, snapshotPerspectives, userSessionRule); + service = new CoverageService(myBatis, measureDao, userSessionRule); } @Test @@ -117,23 +113,4 @@ public class CoverageServiceTest { service.getCoveredConditions(COMPONENT_KEY, CoverageService.TYPE.OVERALL); verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.OVERALL_COVERED_CONDITIONS_BY_LINE_KEY); } - - @Test - public void get_test_cases_by_lines() { - MutableTestable testable = mock(MutableTestable.class); - when(snapshotPerspectives.as(MutableTestable.class, COMPONENT_KEY)).thenReturn(testable); - - service.getTestCases(COMPONENT_KEY, CoverageService.TYPE.UT); - verify(testable).testCasesByLines(); - - assertThat(service.getTestCases(COMPONENT_KEY, CoverageService.TYPE.IT)).isEmpty(); - } - - @Test - public void not_get_test_cases_by_lines_if_no_testable() { - when(snapshotPerspectives.as(MutableTestable.class, COMPONENT_KEY)).thenReturn(null); - - assertThat(service.getTestCases(COMPONENT_KEY, CoverageService.TYPE.UT)).isEqualTo(Collections.emptyMap()); - } - } diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/915_drop_table_graphs.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/915_drop_table_graphs.rb new file mode 100644 index 00000000000..0b5f27341f0 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/915_drop_table_graphs.rb @@ -0,0 +1,31 @@ +# +# 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. +# + +# +# SonarQube 5.1 +# +class DropTableGraphs < ActiveRecord::Migration + + def self.up + remove_index 'graphs', :name => 'graphs_perspectives' + drop_table 'graphs' + end + +end |