From 4e72c1f993a66a2598c97d9dcbed7916c05fe527 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 14 Mar 2014 13:19:55 +0100 Subject: [PATCH] SONAR-5143 remove sonar.inclusions and sonar.test.inclusions from UI --- .../plugins/core/ExclusionProperties.java | 10 +- .../java/org/sonar/batch/ProjectTreeTest.java | 116 ------------------ .../org/sonar/core/persistence/rows-h2.sql | 1 + .../499_delete_inclusions_properties.rb | 35 ++++++ 4 files changed, 42 insertions(+), 120 deletions(-) delete mode 100644 sonar-batch/src/test/java/org/sonar/batch/ProjectTreeTest.java create mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/499_delete_inclusions_properties.rb diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/ExclusionProperties.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/ExclusionProperties.java index b169a572965..00d7e7c0611 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/ExclusionProperties.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/ExclusionProperties.java @@ -34,22 +34,24 @@ class ExclusionProperties { static List definitions() { return ImmutableList.of( + + // Do not display inclusions in UI + // https://jira.codehaus.org/browse/SONAR-5143 PropertyDefinition.builder(CoreProperties.PROJECT_INCLUSIONS_PROPERTY) .name("Source File Inclusions") .multiValues(true) .category(CoreProperties.CATEGORY_EXCLUSIONS) .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS) - .onQualifiers(Qualifiers.PROJECT) - .index(3) + .hidden() .build(), PropertyDefinition.builder(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY) .name("Test File Inclusions") .multiValues(true) .category(CoreProperties.CATEGORY_EXCLUSIONS) .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS) - .onQualifiers(Qualifiers.PROJECT) - .index(5) + .hidden() .build(), + PropertyDefinition.builder(CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY) .name("Global Source File Exclusions") .multiValues(true) diff --git a/sonar-batch/src/test/java/org/sonar/batch/ProjectTreeTest.java b/sonar-batch/src/test/java/org/sonar/batch/ProjectTreeTest.java deleted file mode 100644 index d99289eec9a..00000000000 --- a/sonar-batch/src/test/java/org/sonar/batch/ProjectTreeTest.java +++ /dev/null @@ -1,116 +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.batch; - -import org.junit.Ignore; -import org.sonar.jpa.test.AbstractDbUnitTestCase; - -@Ignore -public class ProjectTreeTest extends AbstractDbUnitTestCase { - - // @Test - // public void keyIncludesBranch() throws IOException, XmlPullParserException, URISyntaxException { - // MavenProject pom = loadProject("/org/sonar/batch/ProjectTreeTest/keyIncludesBranch/pom.xml", true); - // - // ProjectTree tree = new ProjectTree(newConfigurator(), Arrays.asList(pom)); - // tree.start(); - // - // assertThat(tree.getRootProject().getKey(), is("org.test:project:BRANCH-1.X")); - // assertThat(tree.getRootProject().getName(), is("Project BRANCH-1.X")); - // } - // - // @Test - // public void doNotSkipAnyModules() { - // Project foo = newProjectWithArtifactId("root"); - // Project bar = newProjectWithArtifactId("sub1"); - // Project baz = newProjectWithArtifactId("sub2"); - // - // ProjectTree tree = new ProjectTree(Arrays.asList(foo, bar, baz)); - // tree.applyExclusions(); - // - // assertThat(tree.getProjects().size(), is(3)); - // } - // - // @Test - // public void skipModule() throws IOException { - // Project root = newProjectWithArtifactId("root"); - // root.getConfiguration().setProperty("sonar.skippedModules", "sub1"); - // Project sub1 = newProjectWithArtifactId("sub1"); - // Project sub2 = newProjectWithArtifactId("sub2"); - // - // ProjectTree tree = new ProjectTree(Arrays.asList(root, sub1, sub2)); - // tree.applyExclusions(); - // - // assertThat(tree.getProjects().size(), is(2)); - // assertThat(tree.getProjects(), hasItem(root)); - // assertThat(tree.getProjects(), hasItem(sub2)); - // } - // - // @Test - // public void skipModules() { - // Project root = newProjectWithArtifactId("root"); - // root.getConfiguration().setProperty("sonar.skippedModules", "sub1,sub2"); - // Project sub1 = newProjectWithArtifactId("sub1"); - // Project sub2 = newProjectWithArtifactId("sub2"); - // - // ProjectTree tree = new ProjectTree(Arrays.asList(root, sub1, sub2)); - // tree.applyExclusions(); - // - // assertThat(tree.getProjects().size(), is(1)); - // assertThat(tree.getProjects(), hasItem(root)); - // } - // - // @Test - // public void includeModules() { - // Project root = newProjectWithArtifactId("root"); - // root.getConfiguration().setProperty("sonar.includedModules", "sub1,sub2"); - // Project sub1 = newProjectWithArtifactId("sub1"); - // Project sub2 = newProjectWithArtifactId("sub2"); - // - // ProjectTree tree = new ProjectTree(Arrays.asList(root, sub1, sub2)); - // tree.applyExclusions(); - // - // assertThat(tree.getProjects().size(), is(2)); - // assertThat(tree.getProjects(), hasItem(sub1)); - // assertThat(tree.getProjects(), hasItem(sub2)); - // } - // - // @Test - // public void skippedModulesTakePrecedenceOverIncludedModules() { - // Project root = newProjectWithArtifactId("root"); - // root.getConfiguration().setProperty("sonar.includedModules", "sub1,sub2"); - // root.getConfiguration().setProperty("sonar.skippedModules", "sub1"); - // Project sub1 = newProjectWithArtifactId("sub1"); - // Project sub2 = newProjectWithArtifactId("sub2"); - // - // ProjectTree tree = new ProjectTree(Arrays.asList(root, sub1, sub2)); - // tree.applyExclusions(); - // - // assertThat(tree.getProjects().size(), is(1)); - // assertThat(tree.getProjects(), hasItem(sub2)); - // } - - // private Project newProjectWithArtifactId(String artifactId) { - // MavenProject pom = new MavenProject(); - // pom.setArtifactId(artifactId); - // return new Project("org.example:" + artifactId).setPom(pom).setConfiguration(new PropertiesConfiguration()); - // } - -} diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql index 18024e5406e..27f5e700736 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql @@ -208,6 +208,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('495'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('496'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('497'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('498'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('499'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('510'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('511'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('513'); diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/499_delete_inclusions_properties.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/499_delete_inclusions_properties.rb new file mode 100644 index 00000000000..ab25317901d --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/499_delete_inclusions_properties.rb @@ -0,0 +1,35 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2013 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 4.2 +# SONAR-5143 +# +class DeleteInclusionsProperties < ActiveRecord::Migration + + class Property < ActiveRecord::Base + end + + def self.up + Property.delete_all("prop_key = 'sonar.inclusions'") + Property.delete_all("prop_key = 'sonar.test.inclusions'") + end + +end -- 2.39.5