diff options
Diffstat (limited to 'sonar-core')
50 files changed, 574 insertions, 383 deletions
diff --git a/sonar-core/pom.xml b/sonar-core/pom.xml index 331c28cede2..bad0f4f5503 100644 --- a/sonar-core/pom.xml +++ b/sonar-core/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.codehaus.sonar</groupId> <artifactId>sonar</artifactId> - <version>4.4-SNAPSHOT</version> + <version>4.5-SNAPSHOT</version> </parent> <artifactId>sonar-core</artifactId> @@ -170,7 +170,7 @@ <scope>test</scope> </dependency> <dependency> - <groupId>postgresql</groupId> + <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <scope>test</scope> </dependency> diff --git a/sonar-core/src/main/java/org/sonar/core/component/ComponentKeys.java b/sonar-core/src/main/java/org/sonar/core/component/ComponentKeys.java index ed2e5abdd7f..67d2f112b3c 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/ComponentKeys.java +++ b/sonar-core/src/main/java/org/sonar/core/component/ComponentKeys.java @@ -20,7 +20,7 @@ package org.sonar.core.component; import org.apache.commons.lang.StringUtils; -import org.sonar.api.batch.fs.InputFile; +import org.sonar.api.batch.fs.InputPath; import org.sonar.api.database.model.ResourceModel; import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; @@ -64,12 +64,12 @@ public final class ComponentKeys { return key; } - public static String createEffectiveKey(String projectKey, InputFile inputFile) { + public static String createEffectiveKey(String projectKey, InputPath inputPath) { // not a project nor a library return new StringBuilder(ResourceModel.KEY_SIZE) .append(projectKey) .append(':') - .append(inputFile.relativePath()) + .append(inputPath.relativePath()) .toString(); } diff --git a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java index 82bb38e79b6..d98fddab931 100644 --- a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java +++ b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java @@ -22,7 +22,6 @@ package org.sonar.core.config; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.sonar.api.CoreProperties; -import org.sonar.api.PropertyType; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; @@ -39,18 +38,9 @@ public class CorePropertyDefinitions { defs.addAll(IssueExclusionProperties.all()); defs.addAll(ExclusionProperties.all()); defs.addAll(SecurityProperties.all()); + defs.addAll(DebtProperties.all()); defs.addAll(ImmutableList.of( - - // DEBT - PropertyDefinition.builder(CoreProperties.HOURS_IN_DAY) - .name("Number of working hours in a day") - .type(PropertyType.INTEGER) - .defaultValue("8") - .category(CoreProperties.CATEGORY_TECHNICAL_DEBT) - .deprecatedKey("sqale.hoursInDay") - .build(), - // BATCH PropertyDefinition.builder(CoreProperties.CORE_VIOLATION_LOCALE_PROPERTY) @@ -111,7 +101,7 @@ public class CorePropertyDefinitions { .category(CoreProperties.CATEGORY_GENERAL) .subCategory(CoreProperties.SUBCATEGORY_DIFFERENTIAL_VIEWS) .build() - )); + )); return defs; } } diff --git a/sonar-core/src/main/java/org/sonar/core/config/DebtProperties.java b/sonar-core/src/main/java/org/sonar/core/config/DebtProperties.java new file mode 100644 index 00000000000..035cfcb01e7 --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/config/DebtProperties.java @@ -0,0 +1,104 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.sonar.core.config; + +import com.google.common.collect.ImmutableList; +import org.sonar.api.CoreProperties; +import org.sonar.api.PropertyType; +import org.sonar.api.config.PropertyDefinition; +import org.sonar.api.config.PropertyFieldDefinition; +import org.sonar.api.measures.CoreMetrics; + +import java.util.List; + +class DebtProperties { + + private DebtProperties() { + // only static stuff + } + + static List<PropertyDefinition> all() { + return ImmutableList.of( + PropertyDefinition.builder(CoreProperties.HOURS_IN_DAY) + .name("Number of working hours in a day") + .type(PropertyType.INTEGER) + .defaultValue("8") + .category(CoreProperties.CATEGORY_TECHNICAL_DEBT) + .deprecatedKey("sqale.hoursInDay") + .build(), + + PropertyDefinition.builder(CoreProperties.SIZE_METRIC) + .defaultValue("" + CoreMetrics.NCLOC_KEY) + .name("Size metric") + .description("Metric used to estimate artifact's development cost.") + .type(PropertyType.METRIC) + .options("key:^(ncloc|complexity)$") + .category(CoreProperties.CATEGORY_TECHNICAL_DEBT) + .deprecatedKey("sizeMetric") + .build(), + + PropertyDefinition.builder(CoreProperties.DEVELOPMENT_COST) + .defaultValue("" + CoreProperties.DEVELOPMENT_COST_DEF_VALUE) + .name("Development cost") + .description("Cost to develop one unit of code. If the unit is a line of code (LOC), and the cost to develop 1 LOC has been estimated at 30 minutes, " + + "then the value of this property would be 30.") + .category(CoreProperties.CATEGORY_TECHNICAL_DEBT) + .deprecatedKey("workUnitsBySizePoint") + .build(), + + PropertyDefinition.builder(CoreProperties.RATING_GRID) + .defaultValue("" + CoreProperties.RATING_GRID_DEF_VALUES) + .name("Rating grid") + .description("SQALE ratings range from A (very good) to E (very bad). They compare the technical debt on a project to the time that has already gone into writing it. " + + "The default values for A through D are 0.1,0.2,0.5,1. Anything over 1 is an E. " + + "Assuming the size metric is lines of code (LOC), and the work unit is 30 (minutes to produce 1 LOC), " + + "a project with a technical debt of 24,000 minutes for 2,500 LOC will have a ratio of 24000/(30 * 2,500) = 0.32. That yields a SQALE rating of C.") + .category(CoreProperties.CATEGORY_TECHNICAL_DEBT) + .deprecatedKey("ratingGrid") + .build(), + + PropertyDefinition.builder(CoreProperties.LANGUAGE_SPECIFIC_PARAMETERS) + .name("Language specific parameters") + .description("The parameters specified here for a given language will override the general parameters defined in this section.") + .category(CoreProperties.CATEGORY_TECHNICAL_DEBT) + .deprecatedKey("languageSpecificParameters") + .fields( + PropertyFieldDefinition.build(CoreProperties.LANGUAGE_SPECIFIC_PARAMETERS_LANGUAGE_KEY) + .name("Language Key") + .description("Ex: java, cs, cpp...") + .type(PropertyType.STRING) + .build(), + PropertyFieldDefinition.build(CoreProperties.LANGUAGE_SPECIFIC_PARAMETERS_MAN_DAYS_KEY) + .name("Development cost") + .description("If left blank, the generic value defined in this section will be used.") + .type(PropertyType.FLOAT) + .build(), + PropertyFieldDefinition.build(CoreProperties.LANGUAGE_SPECIFIC_PARAMETERS_SIZE_METRIC_KEY) + .name("Size metric") + .description("If left blank, the generic value defined in this section will be used.") + .type(PropertyType.METRIC) + .options("key:^(ncloc|complexity)$") + .build() + ) + .build() + ); + } +} diff --git a/sonar-core/src/main/java/org/sonar/core/measure/db/MetricDto.java b/sonar-core/src/main/java/org/sonar/core/measure/db/MetricDto.java new file mode 100644 index 00000000000..4f9d7cf5255 --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/measure/db/MetricDto.java @@ -0,0 +1,173 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.sonar.core.measure.db; + +import org.sonar.core.persistence.Dto; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class MetricDto extends Dto<String> { + + private int id; + + private String name; + + private String valueType; + + private String description; + + private int direction; + + private boolean qualitative; + + private boolean userManaged; + + private Double worstValue; + + private Double bestValue; + + private Boolean optimizedBestValue; + + private boolean enabled; + + private MetricDto() { + // Nothing here + } + + public int getId() { + return id; + } + + public MetricDto setId(int id) { + this.id = id; + return this; + } + + public String getName() { + return name; + } + + public MetricDto setName(String name) { + this.name = name; + return this; + } + + public String getValueType() { + return valueType; + } + + public MetricDto setValueType(String valueType) { + this.valueType = valueType; + return this; + } + + /** + * @return null for manual metrics + */ + @CheckForNull + public String getDescription() { + return description; + } + + public MetricDto setDescription(@Nullable String description) { + this.description = description; + return this; + } + + public int getDirection() { + return direction; + } + + public MetricDto setDirection(int direction) { + this.direction = direction; + return this; + } + + public boolean isQualitative() { + return qualitative; + } + + public MetricDto setQualitative(boolean qualitative) { + this.qualitative = qualitative; + return this; + } + + public boolean isUserManaged() { + return userManaged; + } + + public MetricDto setUserManaged(boolean userManaged) { + this.userManaged = userManaged; + return this; + } + + @CheckForNull + public Double getWorstValue() { + return worstValue; + } + + public MetricDto setWorstValue(@Nullable Double worstValue) { + this.worstValue = worstValue; + return this; + } + + @CheckForNull + public Double getBestValue() { + return bestValue; + } + + public MetricDto setBestValue(@Nullable Double bestValue) { + this.bestValue = bestValue; + return this; + } + + /** + * @return null for manual metrics + */ + @CheckForNull + public Boolean isOptimizedBestValue() { + return optimizedBestValue; + } + + public MetricDto setOptimizedBestValue(@Nullable Boolean optimizedBestValue) { + this.optimizedBestValue = optimizedBestValue; + return this; + } + + public boolean isEnabled() { + return enabled; + } + + public MetricDto setEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + @Override + public String getKey() { + return name; + } + + public static MetricDto createFor(String key) { + return new MetricDto().setName(key); + } +} diff --git a/sonar-core/src/main/java/org/sonar/core/measure/db/MetricMapper.java b/sonar-core/src/main/java/org/sonar/core/measure/db/MetricMapper.java new file mode 100644 index 00000000000..7282a917e50 --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/measure/db/MetricMapper.java @@ -0,0 +1,33 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.sonar.core.measure.db; + +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface MetricMapper { + + MetricDto selectByKey(@Param("key") String key); + + List<MetricDto> selectAllEnabled(); + +} diff --git a/sonar-core/src/main/java/org/sonar/core/metric/CacheMetricFinder.java b/sonar-core/src/main/java/org/sonar/core/metric/CacheMetricFinder.java deleted file mode 100644 index cd8a1d2a8f9..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/metric/CacheMetricFinder.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.core.metric; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import org.sonar.api.measures.Metric; -import org.sonar.jpa.session.DatabaseSessionFactory; - -import java.util.Collection; -import java.util.List; -import java.util.Map; - -public final class CacheMetricFinder extends DefaultMetricFinder { - - private Map<String, Metric> metricsByKey = Maps.newLinkedHashMap(); - private Map<Integer, Metric> metricsById = Maps.newLinkedHashMap(); - - public CacheMetricFinder(DatabaseSessionFactory sessionFactory) { - super(sessionFactory); - } - - public void start() { - Collection<Metric> metrics = doFindAll(); - for (Metric metric : metrics) { - metricsByKey.put(metric.getKey(), metric); - metricsById.put(metric.getId(), metric); - } - } - - @Override - public Metric findById(int metricId) { - return metricsById.get(metricId); - } - - @Override - public Metric findByKey(String key) { - return metricsByKey.get(key); - } - - @Override - public Collection<Metric> findAll(List<String> metricKeys) { - List<Metric> result = Lists.newLinkedList(); - for (String metricKey : metricKeys) { - Metric metric = findByKey(metricKey); - if (metric != null) { - result.add(metric); - } - } - return result; - } - - @Override - public Collection<Metric> findAll() { - return metricsByKey.values(); - } -} diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java index 2eeaa8c21dd..ee7e376fa52 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java @@ -33,7 +33,7 @@ import java.util.List; */ public class DatabaseVersion implements BatchComponent, ServerComponent { - public static final int LAST_VERSION = 556; + public static final int LAST_VERSION = 583; public static enum Status { UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL @@ -48,9 +48,8 @@ public class DatabaseVersion implements BatchComponent, ServerComponent { "action_plans", "active_dashboards", "active_rules", - "active_rule_changes", "active_rule_parameters", - "active_rule_param_changes", + "activities", "authors", "characteristics", "dashboards", @@ -92,9 +91,8 @@ public class DatabaseVersion implements BatchComponent, ServerComponent { "users", "user_roles", "widgets", - "widget_properties", - "activities" - ); + "widget_properties" + ); private MyBatis mybatis; diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java b/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java index b37563754e9..caa1f9453ef 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java @@ -25,7 +25,6 @@ import org.apache.commons.dbcp.BasicDataSourceFactory; import org.apache.commons.dbutils.DbUtils; import org.apache.commons.lang.StringUtils; import org.hibernate.cfg.Environment; -import org.picocontainer.Startable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.config.Settings; @@ -221,6 +220,6 @@ public class DefaultDatabase implements Database { @Override public String toString() { - return "Database[" + (properties != null ? properties.getProperty(SONAR_JDBC_URL) : "?")+ "]"; + return "Database[" + (properties != null ? properties.getProperty(SONAR_JDBC_URL) : "?") + "]"; } } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java index fa58e882c90..e8a97e02518 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java @@ -24,11 +24,7 @@ import com.google.common.io.Closeables; import org.apache.ibatis.builder.xml.XMLMapperBuilder; import org.apache.ibatis.logging.LogFactory; import org.apache.ibatis.mapping.Environment; -import org.apache.ibatis.session.Configuration; -import org.apache.ibatis.session.ExecutorType; -import org.apache.ibatis.session.SqlSession; -import org.apache.ibatis.session.SqlSessionFactory; -import org.apache.ibatis.session.SqlSessionFactoryBuilder; +import org.apache.ibatis.session.*; import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory; import org.apache.ibatis.type.JdbcType; import org.slf4j.LoggerFactory; @@ -41,14 +37,7 @@ import org.sonar.core.cluster.WorkQueue; import org.sonar.core.component.ComponentDto; import org.sonar.core.component.db.ComponentMapper; import org.sonar.core.config.Logback; -import org.sonar.core.dashboard.ActiveDashboardDto; -import org.sonar.core.dashboard.ActiveDashboardMapper; -import org.sonar.core.dashboard.DashboardDto; -import org.sonar.core.dashboard.DashboardMapper; -import org.sonar.core.dashboard.WidgetDto; -import org.sonar.core.dashboard.WidgetMapper; -import org.sonar.core.dashboard.WidgetPropertyDto; -import org.sonar.core.dashboard.WidgetPropertyMapper; +import org.sonar.core.dashboard.*; import org.sonar.core.dependency.DependencyDto; import org.sonar.core.dependency.DependencyMapper; import org.sonar.core.dependency.ResourceSnapshotDto; @@ -57,53 +46,19 @@ import org.sonar.core.duplication.DuplicationMapper; import org.sonar.core.duplication.DuplicationUnitDto; import org.sonar.core.graph.jdbc.GraphDto; import org.sonar.core.graph.jdbc.GraphDtoMapper; -import org.sonar.core.issue.db.ActionPlanDto; -import org.sonar.core.issue.db.ActionPlanMapper; -import org.sonar.core.issue.db.ActionPlanStatsDto; -import org.sonar.core.issue.db.ActionPlanStatsMapper; -import org.sonar.core.issue.db.IssueChangeDto; -import org.sonar.core.issue.db.IssueChangeMapper; -import org.sonar.core.issue.db.IssueDto; -import org.sonar.core.issue.db.IssueFilterDto; -import org.sonar.core.issue.db.IssueFilterFavouriteDto; -import org.sonar.core.issue.db.IssueFilterFavouriteMapper; -import org.sonar.core.issue.db.IssueFilterMapper; -import org.sonar.core.issue.db.IssueMapper; -import org.sonar.core.issue.db.IssueStatsMapper; -import org.sonar.core.measure.db.MeasureDto; -import org.sonar.core.measure.db.MeasureFilterDto; -import org.sonar.core.measure.db.MeasureFilterMapper; -import org.sonar.core.measure.db.MeasureMapper; +import org.sonar.core.issue.db.*; +import org.sonar.core.measure.db.*; import org.sonar.core.notification.db.NotificationQueueDto; import org.sonar.core.notification.db.NotificationQueueMapper; -import org.sonar.core.permission.GroupWithPermissionDto; -import org.sonar.core.permission.PermissionTemplateDto; -import org.sonar.core.permission.PermissionTemplateGroupDto; -import org.sonar.core.permission.PermissionTemplateMapper; -import org.sonar.core.permission.PermissionTemplateUserDto; -import org.sonar.core.permission.UserWithPermissionDto; +import org.sonar.core.permission.*; import org.sonar.core.persistence.migration.v44.Migration44Mapper; import org.sonar.core.properties.PropertiesMapper; import org.sonar.core.properties.PropertyDto; import org.sonar.core.purge.PurgeMapper; import org.sonar.core.purge.PurgeableSnapshotDto; -import org.sonar.core.qualitygate.db.ProjectQgateAssociationDto; -import org.sonar.core.qualitygate.db.ProjectQgateAssociationMapper; -import org.sonar.core.qualitygate.db.QualityGateConditionDto; -import org.sonar.core.qualitygate.db.QualityGateConditionMapper; -import org.sonar.core.qualitygate.db.QualityGateDto; -import org.sonar.core.qualitygate.db.QualityGateMapper; -import org.sonar.core.qualityprofile.db.ActiveRuleDto; -import org.sonar.core.qualityprofile.db.ActiveRuleMapper; -import org.sonar.core.qualityprofile.db.ActiveRuleParamDto; -import org.sonar.core.qualityprofile.db.QualityProfileDto; -import org.sonar.core.qualityprofile.db.QualityProfileMapper; -import org.sonar.core.resource.ResourceDto; -import org.sonar.core.resource.ResourceIndexDto; -import org.sonar.core.resource.ResourceIndexerMapper; -import org.sonar.core.resource.ResourceKeyUpdaterMapper; -import org.sonar.core.resource.ResourceMapper; -import org.sonar.core.resource.SnapshotDto; +import org.sonar.core.qualitygate.db.*; +import org.sonar.core.qualityprofile.db.*; +import org.sonar.core.resource.*; import org.sonar.core.rule.RuleDto; import org.sonar.core.rule.RuleMapper; import org.sonar.core.rule.RuleParamDto; @@ -115,16 +70,7 @@ import org.sonar.core.technicaldebt.db.CharacteristicMapper; import org.sonar.core.technicaldebt.db.RequirementMigrationDto; import org.sonar.core.template.LoadedTemplateDto; import org.sonar.core.template.LoadedTemplateMapper; -import org.sonar.core.user.AuthorDto; -import org.sonar.core.user.AuthorMapper; -import org.sonar.core.user.GroupDto; -import org.sonar.core.user.GroupMembershipDto; -import org.sonar.core.user.GroupMembershipMapper; -import org.sonar.core.user.GroupRoleDto; -import org.sonar.core.user.RoleMapper; -import org.sonar.core.user.UserDto; -import org.sonar.core.user.UserMapper; -import org.sonar.core.user.UserRoleDto; +import org.sonar.core.user.*; import java.io.InputStream; @@ -134,7 +80,7 @@ public class MyBatis implements BatchComponent, ServerComponent { private final Logback logback; private SqlSessionFactory sessionFactory; - //TODO this queue should directly be an IndexQueue. Pending move of persistence to sonar-server + // TODO this queue should directly be an IndexQueue. Pending move of persistence to sonar-server private WorkQueue queue; public MyBatis(Database database, Logback logback, WorkQueue queue) { @@ -187,6 +133,7 @@ public class MyBatis implements BatchComponent, ServerComponent { loadAlias(conf, "WidgetProperty", WidgetPropertyDto.class); loadAlias(conf, "MeasureModel", MeasureModel.class); loadAlias(conf, "Measure", MeasureDto.class); + loadAlias(conf, "Metric", MetricDto.class); loadAlias(conf, "Issue", IssueDto.class); loadAlias(conf, "IssueChange", IssueChangeDto.class); loadAlias(conf, "IssueFilter", IssueFilterDto.class); @@ -221,7 +168,7 @@ public class MyBatis implements BatchComponent, ServerComponent { org.sonar.api.database.model.MeasureMapper.class, SnapshotDataMapper.class, SnapshotSourceMapper.class, ActionPlanMapper.class, ActionPlanStatsMapper.class, NotificationQueueMapper.class, CharacteristicMapper.class, GroupMembershipMapper.class, QualityProfileMapper.class, ActiveRuleMapper.class, - MeasureMapper.class, QualityGateMapper.class, QualityGateConditionMapper.class, ComponentMapper.class, ProjectQgateAssociationMapper.class + MeasureMapper.class, MetricMapper.class, QualityGateMapper.class, QualityGateConditionMapper.class, ComponentMapper.class, ProjectQgateAssociationMapper.class }; loadMappers(conf, mappers); configureLogback(mappers); diff --git a/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java b/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java index be7e5ed7028..756ed70d824 100644 --- a/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java +++ b/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java @@ -24,8 +24,8 @@ import com.google.common.base.Strings; import org.apache.commons.lang.StringUtils; import org.apache.ibatis.session.SqlSession; import org.sonar.api.BatchComponent; -import org.sonar.core.persistence.DaoComponent; import org.sonar.api.ServerComponent; +import org.sonar.core.persistence.DaoComponent; import org.sonar.core.persistence.DbSession; import org.sonar.core.persistence.MyBatis; @@ -74,14 +74,17 @@ public class PropertiesDao implements BatchComponent, ServerComponent, DaoCompon public List<PropertyDto> selectGlobalProperties() { SqlSession session = mybatis.openSession(false); - PropertiesMapper mapper = session.getMapper(PropertiesMapper.class); try { - return mapper.selectGlobalProperties(); + return selectGlobalProperties(session); } finally { MyBatis.closeQuietly(session); } } + public List<PropertyDto> selectGlobalProperties(SqlSession session) { + return session.getMapper(PropertiesMapper.class).selectGlobalProperties(); + } + public PropertyDto selectGlobalProperty(String propertyKey) { SqlSession session = mybatis.openSession(false); PropertiesMapper mapper = session.getMapper(PropertiesMapper.class); diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java index fed0a1078da..b908bb4e6bb 100644 --- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java +++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java @@ -87,7 +87,7 @@ public class ActiveRuleDto extends Dto<ActiveRuleKey> { return this; } - public Integer getRulId() { + public Integer getRuleId() { return ruleId; } diff --git a/sonar-core/src/main/java/org/sonar/core/rule/CacheRuleFinder.java b/sonar-core/src/main/java/org/sonar/core/rule/CacheRuleFinder.java index 76a59f8ea80..96aab429ea5 100644 --- a/sonar-core/src/main/java/org/sonar/core/rule/CacheRuleFinder.java +++ b/sonar-core/src/main/java/org/sonar/core/rule/CacheRuleFinder.java @@ -23,6 +23,7 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.Maps; import org.apache.commons.lang.StringUtils; +import org.hibernate.Hibernate; import org.sonar.api.database.DatabaseSession; import org.sonar.api.rule.RuleKey; import org.sonar.api.rules.Rule; @@ -32,10 +33,15 @@ import org.sonar.jpa.session.DatabaseSessionFactory; import javax.annotation.CheckForNull; import javax.persistence.Query; + import java.util.Collection; import java.util.HashMap; import java.util.Map; +/** + * @deprecated since 4.5 + */ +@Deprecated public final class CacheRuleFinder implements RuleFinder { private BiMap<Integer, Rule> rulesById = HashBiMap.create(); @@ -72,6 +78,7 @@ public final class CacheRuleFinder implements RuleFinder { rulesByKey.put(repositoryKey, repository); for (Rule rule : findAll(RuleQuery.create().withRepositoryKey(repositoryKey))) { + hibernateHack(rule); repository.put(rule.getKey(), rule); rulesById.put(rule.getId(), rule); } @@ -79,6 +86,10 @@ public final class CacheRuleFinder implements RuleFinder { return repository; } + private void hibernateHack(Rule rule) { + Hibernate.initialize(rule.getParams()); + } + protected final Rule doFindById(int ruleId) { DatabaseSession session = sessionFactory.getSession(); return session.getSingleResult( @@ -89,7 +100,6 @@ public final class CacheRuleFinder implements RuleFinder { null); } - @Override @CheckForNull public Rule findByKey(RuleKey key) { diff --git a/sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java b/sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java index 5b065f8d699..c7a3fa9de4d 100644 --- a/sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java +++ b/sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java @@ -30,20 +30,22 @@ import org.sonar.core.persistence.Dto; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import java.util.Arrays; -import java.util.Date; -import java.util.HashSet; -import java.util.Set; -import java.util.TreeSet; + +import java.util.*; public final class RuleDto extends Dto<RuleKey> { public static final Integer DISABLED_CHARACTERISTIC_ID = -1; + public enum Format { + HTML, MARKDOWN + } + private Integer id; private String repositoryKey; private String ruleKey; private String description; + private Format descriptionFormat; private RuleStatus status; private String name; private String configKey; @@ -113,6 +115,15 @@ public final class RuleDto extends Dto<RuleKey> { return this; } + public Format getDescriptionFormat() { + return descriptionFormat; + } + + public RuleDto setDescriptionFormat(Format descriptionFormat) { + this.descriptionFormat = descriptionFormat; + return this; + } + public RuleStatus getStatus() { return status; } diff --git a/sonar-core/src/main/resources/org/sonar/core/activity/db/ActivityMapper.xml b/sonar-core/src/main/resources/org/sonar/core/activity/db/ActivityMapper.xml index 06246058171..0c516fa3f89 100644 --- a/sonar-core/src/main/resources/org/sonar/core/activity/db/ActivityMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/activity/db/ActivityMapper.xml @@ -3,13 +3,13 @@ <mapper namespace="org.sonar.core.activity.db.ActivityMapper"> - <insert id="insert" parameterType="Activity" useGeneratedKeys="false" lang="raw"> + <insert id="insert" parameterType="Activity" useGeneratedKeys="false" > insert into activities (created_at, log_key, log_type, log_action, user_login, data_field, log_message) values (#{createdAt}, #{key}, #{type}, #{action}, #{author}, #{data}, #{message}) </insert> - <select id="selectAll" parameterType="map" resultType="Activity" lang="raw"> + <select id="selectAll" parameterType="map" resultType="Activity" > SELECT created_at as "createdAt", log_type as "type", diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml index 013ee97161e..16b9f3cdd74 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml @@ -3,12 +3,12 @@ <mapper namespace="org.sonar.core.dashboard.ActiveDashboardMapper"> - <insert id="insert" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="true" keyProperty ="id" lang="raw"> + <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="selectMaxOrderIndexForNullUser" resultType="Integer" lang="raw"> + <select id="selectMaxOrderIndexForNullUser" resultType="Integer" > SELECT MAX(order_index) FROM active_dashboards WHERE user_id IS NULL diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml index e9f4803c394..9c3b1864e02 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml @@ -3,12 +3,12 @@ <mapper namespace="org.sonar.core.dashboard.DashboardMapper"> - <select id="selectGlobalDashboard" parameterType="string" resultType="Dashboard" lang="raw"> + <select id="selectGlobalDashboard" parameterType="string" resultType="Dashboard" > select id, user_id as "userId", name, description, column_layout as "columnLayout", shared, is_global, created_at as "createdAt", updated_at as "updatedAt" from dashboards WHERE name=#{id} and user_id is null </select> - <insert id="insert" parameterType="Dashboard" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="Dashboard" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO dashboards (user_id, name, description, column_layout, shared, is_global, created_at, updated_at) VALUES (#{userId}, #{name}, #{description}, #{columnLayout}, #{shared}, #{global}, #{createdAt}, #{updatedAt}) diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml index 71bc01cf451..fd37b23df5f 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml @@ -3,7 +3,7 @@ <mapper namespace="org.sonar.core.dashboard.WidgetMapper"> - <insert id="insert" parameterType="Widget" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="Widget" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO widgets (dashboard_id, widget_key, name, description, column_index, row_index, configured, created_at, updated_at, resource_id) VALUES (#{dashboardId}, #{key}, #{name}, #{description}, #{columnIndex}, #{rowIndex}, #{configured}, #{createdAt}, #{updatedAt}, #{resourceId}) diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml index 5ab44a79e62..b9ad3a48dee 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml @@ -3,7 +3,7 @@ <mapper namespace="org.sonar.core.dashboard.WidgetPropertyMapper"> - <insert id="insert" parameterType="WidgetProperty" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="WidgetProperty" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO widget_properties (widget_id, kee, text_value) VALUES (#{widgetId}, #{key}, #{value}) </insert> diff --git a/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml index 1ea976a0ea5..dc93ec177f2 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml @@ -3,7 +3,7 @@ <mapper namespace="org.sonar.core.dependency.DependencyMapper"> - <select id="selectAll" resultType="dependency" lang="raw"> + <select id="selectAll" resultType="dependency" > SELECT id, from_snapshot_id as fromSnapshotId, to_snapshot_id as toSnapshotId, dep_usage as "usage" FROM dependencies </select> diff --git a/sonar-core/src/main/resources/org/sonar/core/dependency/ResourceSnapshotMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dependency/ResourceSnapshotMapper.xml index 5377b4f9d20..b84277f4962 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dependency/ResourceSnapshotMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dependency/ResourceSnapshotMapper.xml @@ -3,7 +3,7 @@ <mapper namespace="org.sonar.core.dependency.ResourceSnapshotMapper"> - <select id="selectAll" resultType="ResourceSnapshot" lang="raw"> + <select id="selectAll" resultType="ResourceSnapshot" > SELECT id, project_id as projectId, version FROM snapshots </select> diff --git a/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml b/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml index a2810919e0b..530c1182ebf 100644 --- a/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml @@ -17,7 +17,7 @@ </if> </select> - <insert id="batchInsert" parameterType="DuplicationUnit" useGeneratedKeys="false" lang="raw"> + <insert id="batchInsert" parameterType="DuplicationUnit" useGeneratedKeys="false" > INSERT INTO duplications_index (snapshot_id, project_snapshot_id, hash, index_in_file, start_line, end_line) VALUES (#{snapshotId}, #{projectSnapshotId}, #{hash}, #{indexInFile}, #{startLine}, #{endLine}) </insert> diff --git a/sonar-core/src/main/resources/org/sonar/core/graph/jdbc/GraphDtoMapper.xml b/sonar-core/src/main/resources/org/sonar/core/graph/jdbc/GraphDtoMapper.xml index d77105ac702..704090274f5 100644 --- a/sonar-core/src/main/resources/org/sonar/core/graph/jdbc/GraphDtoMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/graph/jdbc/GraphDtoMapper.xml @@ -3,13 +3,13 @@ <mapper namespace="org.sonar.core.graph.jdbc.GraphDtoMapper"> - <select id="selectBySnapshot" parameterType="map" resultType="Graph" lang="raw"> + <select id="selectBySnapshot" parameterType="map" resultType="Graph" > SELECT id, resource_id as resourceId, snapshot_id as snapshotId, format, version, perspective, root_vertex_id as rootVertexId, data FROM graphs WHERE snapshot_id = #{sid} AND perspective = #{perspective} </select> - <select id="selectByComponent" parameterType="map" resultType="Graph" lang="raw"> + <select id="selectByComponent" parameterType="map" resultType="Graph" > SELECT g.id, g.resource_id as resourceId, g.snapshot_id as snapshotId, g.format, g.version, g.perspective, g.root_vertex_id as rootVertexId, g.data FROM graphs g, snapshots s WHERE g.perspective = #{perspective} AND g.snapshot_id=s.id AND s.islast=${_true} and s.project_id=( @@ -17,7 +17,7 @@ ) </select> - <insert id="insert" parameterType="Graph" useGeneratedKeys="false" lang="raw"> + <insert id="insert" parameterType="Graph" useGeneratedKeys="false" > insert into graphs (resource_id, snapshot_id, format, version, perspective, root_vertex_id, data, created_at, updated_at) values ( diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/ActionPlanMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/ActionPlanMapper.xml index a41db485e48..1d770735304 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/ActionPlanMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/ActionPlanMapper.xml @@ -18,7 +18,7 @@ p.kee as projectKey </sql> - <insert id="insert" parameterType="ActionPlanIssue" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="ActionPlanIssue" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO action_plans (kee, name, description, user_login, project_id, status, deadline, created_at, updated_at) VALUES (#{kee}, #{name}, #{description}, #{userLogin}, #{projectId}, #{status}, #{deadLine}, #{createdAt}, #{updatedAt}) </insert> diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueChangeMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueChangeMapper.xml index 6cda9b308e5..a38c34e88ae 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueChangeMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueChangeMapper.xml @@ -16,16 +16,16 @@ c.issue_change_creation_date as issueChangeCreationDate </sql> - <insert id="insert" parameterType="IssueChange" useGeneratedKeys="false" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="IssueChange" useGeneratedKeys="false" keyProperty="id" > INSERT INTO issue_changes (kee, issue_key, user_login, change_type, change_data, created_at, updated_at, issue_change_creation_date) VALUES (#{kee}, #{issueKey}, #{userLogin}, #{changeType}, #{changeData}, #{createdAt}, #{updatedAt}, #{issueChangeCreationDate}) </insert> - <delete id="delete" parameterType="string" lang="raw"> + <delete id="delete" parameterType="string" > delete from issue_changes where kee=#{id} </delete> - <update id="update" parameterType="map" lang="raw"> + <update id="update" parameterType="map" > update issue_changes set change_data=#{changeData}, updated_at=#{updatedAt} where kee=#{kee} </update> diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterFavouriteMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterFavouriteMapper.xml index dc774b63048..8f6ca9fef93 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterFavouriteMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterFavouriteMapper.xml @@ -28,11 +28,11 @@ VALUES (#{userLogin}, #{issueFilterId}, current_timestamp) </insert> - <delete id="delete" parameterType="long" lang="raw"> + <delete id="delete" parameterType="long" > delete from issue_filter_favourites where id=#{id} </delete> - <delete id="deleteByFilterId" parameterType="long" lang="raw"> + <delete id="deleteByFilterId" parameterType="long" > delete from issue_filter_favourites where issue_filter_id=#{issueFilterId} </delete> diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml index 2f2cf4980b2..078620f535b 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml @@ -40,12 +40,12 @@ where filters.shared=${_true} </select> - <insert id="insert" parameterType="IssueFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="IssueFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO issue_filters (name, user_login, shared, description, data, created_at, updated_at) VALUES (#{name}, #{userLogin}, #{shared}, #{description}, #{data}, #{createdAt}, #{updatedAt}) </insert> - <update id="update" parameterType="IssueFilter" lang="raw"> + <update id="update" parameterType="IssueFilter" > update issue_filters set name=#{name}, shared=#{shared}, @@ -56,7 +56,7 @@ where id=#{id} </update> - <delete id="delete" parameterType="long" lang="raw"> + <delete id="delete" parameterType="long" > delete from issue_filters where id=#{id} </delete> diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml index 2c4ef44b041..2e26a8c6799 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml @@ -60,7 +60,7 @@ </if> </sql> - <insert id="insert" parameterType="Issue" useGeneratedKeys="false" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="Issue" useGeneratedKeys="false" keyProperty="id" > INSERT INTO issues (kee, component_id, root_component_id, rule_id, action_plan_key, severity, manual_severity, message, line, effort_to_fix, technical_debt, status, resolution, checksum, reporter, assignee, author_login, issue_attributes, issue_creation_date, issue_update_date, @@ -74,7 +74,7 @@ <!-- IMPORTANT - invariant columns can't be updated. See IssueDto#toDtoForUpdate() --> - <update id="update" parameterType="Issue" lang="raw"> + <update id="update" parameterType="Issue" > update issues set action_plan_key=#{actionPlanKey}, severity=#{severity}, @@ -101,7 +101,7 @@ <!-- IMPORTANT - invariant columns can't be updated. See IssueDto#toDtoForUpdate() --> - <update id="updateIfBeforeSelectedDate" parameterType="Issue" lang="raw"> + <update id="updateIfBeforeSelectedDate" parameterType="Issue" > update issues set action_plan_key=#{actionPlanKey}, severity=#{severity}, @@ -135,7 +135,7 @@ where i.kee=#{kee} </select> - <select id="selectNonClosedIssuesByModule" parameterType="int" resultType="Issue" lang="raw"> + <select id="selectNonClosedIssuesByModule" parameterType="int" resultType="Issue" > select i.id, i.kee as kee, diff --git a/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureFilterMapper.xml b/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureFilterMapper.xml index 6a762f01ffd..0ed22491088 100644 --- a/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureFilterMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureFilterMapper.xml @@ -3,12 +3,12 @@ <mapper namespace="org.sonar.core.measure.db.MeasureFilterMapper"> - <select id="findSystemFilterByName" parameterType="string" resultType="MeasureFilter" lang="raw"> + <select id="findSystemFilterByName" parameterType="string" resultType="MeasureFilter" > select id, name, user_id as "userId", shared, description, data, created_at as "createdAt", updated_at as "updatedAt" from measure_filters WHERE user_id is null and name=#{id} </select> - <insert id="insert" parameterType="MeasureFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="MeasureFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO measure_filters (name, user_id, shared, description, data, created_at, updated_at) VALUES (#{name}, #{userId}, #{shared}, #{description}, #{data}, #{createdAt}, #{updatedAt}) </insert> diff --git a/sonar-core/src/main/resources/org/sonar/core/measure/db/MetricMapper.xml b/sonar-core/src/main/resources/org/sonar/core/measure/db/MetricMapper.xml new file mode 100644 index 00000000000..8feed30cc25 --- /dev/null +++ b/sonar-core/src/main/resources/org/sonar/core/measure/db/MetricMapper.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ 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. + --> + +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + +<mapper namespace="org.sonar.core.measure.db.MetricMapper"> + + <sql id="metricColumns"> + m.id, + m.name, + m.val_type as valueType, + m.description, + m.direction, + m.qualitative, + m.user_managed as userManaged, + m.worst_value as worstValue, + m.best_value as bestValue, + m.optimized_best_value as optimizedBestValue, + m.enabled + </sql> + + <select id="selectByKey" parameterType="map" resultType="Metric"> + SELECT + <include refid="metricColumns"/> + FROM metrics m + <where> + AND m.name=#{key} + </where> + </select> + + <select id="selectAllEnabled" parameterType="map" resultType="Metric"> + SELECT + <include refid="metricColumns"/> + FROM metrics m + <where> + AND m.enabled=${_true} + </where> + </select> + +</mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/notification/db/NotificationQueueMapper.xml b/sonar-core/src/main/resources/org/sonar/core/notification/db/NotificationQueueMapper.xml index ce373be4106..d1dbc9b0875 100644 --- a/sonar-core/src/main/resources/org/sonar/core/notification/db/NotificationQueueMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/notification/db/NotificationQueueMapper.xml @@ -4,20 +4,20 @@ <mapper namespace="org.sonar.core.notification.db.NotificationQueueMapper"> - <insert id="insert" parameterType="NotificationQueue" useGeneratedKeys="false" lang="raw"> + <insert id="insert" parameterType="NotificationQueue" useGeneratedKeys="false" > INSERT INTO notifications (data) VALUES (#{data}) </insert> - <delete id="delete" parameterType="long" lang="raw"> + <delete id="delete" parameterType="long" > delete from notifications where id=#{id} </delete> - <select id="count" resultType="long" lang="raw"> + <select id="count" resultType="long" > select count(*) from notifications </select> - <select id="findOldest" parameterType="int" resultType="NotificationQueue" lang="raw"> + <select id="findOldest" parameterType="int" resultType="NotificationQueue" > select id, data from notifications order by id asc @@ -25,14 +25,14 @@ </select> <!-- SQL Server --> - <select id="findOldest" parameterType="int" resultType="NotificationQueue" databaseId="mssql" lang="raw"> + <select id="findOldest" parameterType="int" resultType="NotificationQueue" databaseId="mssql" > select top (#{count}) id, data from notifications order by id asc </select> <!-- Oracle --> - <select id="findOldest" parameterType="int" resultType="NotificationQueue" databaseId="oracle" lang="raw"> + <select id="findOldest" parameterType="int" resultType="NotificationQueue" databaseId="oracle" > select * from (select id, data from notifications diff --git a/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml b/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml index 70c9ffb08e0..7791fb0aa89 100644 --- a/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml @@ -3,45 +3,45 @@ <mapper namespace="org.sonar.core.permission.PermissionTemplateMapper"> - <insert id="insert" parameterType="PermissionTemplate" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="PermissionTemplate" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO permission_templates (name, kee, description, key_pattern, created_at, updated_at) VALUES (#{name}, #{kee}, #{description}, #{keyPattern}, #{createdAt}, #{updatedAt}) </insert> - <update id="update" parameterType="PermissionTemplate" lang="raw"> + <update id="update" parameterType="PermissionTemplate" > UPDATE permission_templates SET name = #{name}, description = #{description}, key_pattern = #{keyPattern}, updated_at = #{updatedAt} WHERE id = #{id} </update> - <delete id="delete" parameterType="long" lang="raw"> + <delete id="delete" parameterType="long" > DELETE FROM permission_templates WHERE id = #{templateId} </delete> - <delete id="deleteUsersPermissions" parameterType="long" lang="raw"> + <delete id="deleteUsersPermissions" parameterType="long" > DELETE FROM perm_templates_users WHERE template_id = #{templateId} </delete> - <delete id="deleteGroupsPermissions" parameterType="long" lang="raw"> + <delete id="deleteGroupsPermissions" parameterType="long" > DELETE FROM perm_templates_groups WHERE template_id = #{templateId} </delete> - <insert id="insertUserPermission" parameterType="PermissionTemplateUser" lang="raw"> + <insert id="insertUserPermission" parameterType="PermissionTemplateUser" > INSERT INTO perm_templates_users (template_id, user_id, permission_reference, created_at, updated_at) VALUES (#{templateId}, #{userId}, #{permission}, #{createdAt}, #{updatedAt}) </insert> - <delete id="deleteUserPermission" parameterType="PermissionTemplateUser" lang="raw"> + <delete id="deleteUserPermission" parameterType="PermissionTemplateUser" > DELETE FROM perm_templates_users WHERE template_id = #{templateId} AND user_id = #{userId} AND permission_reference = #{permission} </delete> - <insert id="insertGroupPermission" parameterType="PermissionTemplateGroup" lang="raw"> + <insert id="insertGroupPermission" parameterType="PermissionTemplateGroup" > INSERT INTO perm_templates_groups (template_id, group_id, permission_reference, created_at, updated_at) VALUES (#{templateId}, #{groupId}, #{permission}, #{createdAt}, #{updatedAt}) </insert> @@ -108,18 +108,18 @@ ORDER BY groups.name </select> - <select id="selectByKey" parameterType="String" resultType="PermissionTemplate" lang="raw"> + <select id="selectByKey" parameterType="String" resultType="PermissionTemplate" > SELECT id, name, kee, description, key_pattern AS keyPattern, created_at AS createdAt, updated_at AS updatedAt FROM permission_templates WHERE kee = #{kee} </select> - <select id="selectAllPermissionTemplates" resultType="PermissionTemplate" lang="raw"> + <select id="selectAllPermissionTemplates" resultType="PermissionTemplate" > SELECT id, name, kee, description, key_pattern AS keyPattern, created_at AS createdAt, updated_at AS updatedAt FROM permission_templates </select> - <select id="selectTemplateUsersPermissions" parameterType="String" resultMap="fullPermissionsTemplateResult" lang="raw"> + <select id="selectTemplateUsersPermissions" parameterType="String" resultMap="fullPermissionsTemplateResult" > SELECT pt.id AS template_id, pt.name AS template_name, pt.description AS template_description, @@ -137,7 +137,7 @@ WHERE pt.kee = #{templateKey} </select> - <select id="selectTemplateGroupsPermissions" parameterType="String" resultMap="fullPermissionsTemplateResult" lang="raw"> + <select id="selectTemplateGroupsPermissions" parameterType="String" resultMap="fullPermissionsTemplateResult" > SELECT pt.id AS template_id, pt.name AS template_name, pt.description AS template_description, diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/SchemaMigrationMapper.xml b/sonar-core/src/main/resources/org/sonar/core/persistence/SchemaMigrationMapper.xml index be1da205bec..2df5fc4b400 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/SchemaMigrationMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/SchemaMigrationMapper.xml @@ -3,7 +3,7 @@ <mapper namespace="org.sonar.core.persistence.SchemaMigrationMapper"> - <select id="selectVersions" resultType="int" lang="raw"> + <select id="selectVersions" resultType="int" > select * from schema_migrations </select> diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml b/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml index f4efc01f985..bdd0d86a85d 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml @@ -3,16 +3,16 @@ <mapper namespace="org.sonar.core.persistence.SemaphoreMapper"> - <insert id="initialize" parameterType="map" useGeneratedKeys="false" lang="raw"> + <insert id="initialize" parameterType="map" useGeneratedKeys="false" > INSERT INTO semaphores (name, checksum, created_at, updated_at, locked_at) VALUES (#{name}, #{checksum}, current_timestamp, current_timestamp, #{lockedAt}) </insert> - <select id="now" resultType="Date" lang="raw"> + <select id="now" resultType="Date" > select current_timestamp </select> - <select id="now" databaseId="oracle" resultType="Date" lang="raw"> + <select id="now" databaseId="oracle" resultType="Date" > select current_timestamp from dual </select> @@ -25,16 +25,16 @@ </if> </update> - <delete id="release" parameterType="String" lang="raw"> + <delete id="release" parameterType="String" > delete from semaphores where name=#{id} </delete> - <select id="selectSemaphore" parameterType="String" resultType="Semaphore" lang="raw"> + <select id="selectSemaphore" parameterType="String" resultType="Semaphore" > select s.id, s.name as name, s.locked_at as lockedAt, s.created_at as createdAt, s.updated_at as updatedAt from semaphores s where s.name=#{name} </select> - <update id="update" parameterType="String" lang="raw"> + <update id="update" parameterType="String" > update semaphores set updated_at = current_timestamp where name=#{name} 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 cfc4e72849d..9634897e73f 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 @@ -249,6 +249,10 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('553'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('554'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('555'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('556'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('580'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('581'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('582'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('583'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index a740173f02b..d3c9a53a3e4 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -78,14 +78,6 @@ CREATE TABLE "GROUPS" ( "UPDATED_AT" TIMESTAMP ); -CREATE TABLE "ACTIVE_RULE_PARAM_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "ACTIVE_RULE_CHANGE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "OLD_VALUE" VARCHAR(4000), - "NEW_VALUE" VARCHAR(4000) -); - CREATE TABLE "SNAPSHOTS" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "CREATED_AT" TIMESTAMP, @@ -135,6 +127,7 @@ CREATE TABLE "RULES" ( "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, "PLUGIN_NAME" VARCHAR(255) NOT NULL, "DESCRIPTION" VARCHAR(16777215), + "DESCRIPTION_FORMAT" VARCHAR(20), "PRIORITY" INTEGER, "IS_TEMPLATE" BOOLEAN DEFAULT FALSE, "TEMPLATE_ID" INTEGER, @@ -226,18 +219,6 @@ CREATE TABLE "DUPLICATIONS_INDEX" ( "END_LINE" INTEGER NOT NULL ); -CREATE TABLE "ACTIVE_RULE_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "USERNAME" VARCHAR(255), - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_VERSION" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "CHANGE_DATE" TIMESTAMP NOT NULL, - "ENABLED" BOOLEAN, - "OLD_SEVERITY" INTEGER, - "NEW_SEVERITY" INTEGER -); - CREATE TABLE "PROJECT_MEASURES" ( "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "VALUE" DOUBLE, @@ -601,12 +582,8 @@ CREATE INDEX "DEPS_PRJ_SID" ON "DEPENDENCIES" ("PROJECT_SNAPSHOT_ID"); CREATE INDEX "MEASURES_SID_METRIC" ON "PROJECT_MEASURES" ("SNAPSHOT_ID", "METRIC_ID"); -CREATE INDEX "ACTIVE_RULE_CHANGES_PID" ON "ACTIVE_RULE_CHANGES" ("PROFILE_ID"); - CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS" ("NAME"); -CREATE INDEX "ACTIVE_RULE_PARAM_CHANGES_CID" ON "ACTIVE_RULE_PARAM_CHANGES" ("ACTIVE_RULE_CHANGE_ID"); - CREATE INDEX "EVENTS_SNAPSHOT_ID" ON "EVENTS" ("SNAPSHOT_ID"); CREATE INDEX "EVENTS_RESOURCE_ID" ON "EVENTS" ("RESOURCE_ID"); diff --git a/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml b/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml index 8e1f1645409..250b49a361b 100644 --- a/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml @@ -27,13 +27,13 @@ ) </select> - <select id="selectGlobalProperties" resultType="Property" lang="raw"> + <select id="selectGlobalProperties" resultType="Property" > select p.id as id, p.prop_key as "key", p.text_value as value, p.resource_id as resourceId, p.user_id as userId from properties p where p.resource_id is null and p.user_id is null </select> - <select id="selectProjectProperties" parameterType="String" resultType="Property" lang="raw"> + <select id="selectProjectProperties" parameterType="String" resultType="Property" > select p.id as id, p.prop_key as "key", p.text_value as value, p.resource_id as resourceId, p.user_id as userId from properties p, projects r where p.resource_id=r.id and p.user_id is null and r.kee=#{id} @@ -80,20 +80,20 @@ </where> </select> - <update id="update" parameterType="Property" lang="raw"> + <update id="update" parameterType="Property" > update properties set text_value = #{value} where id = #{id} </update> - <insert id="insert" parameterType="Property" useGeneratedKeys="false" lang="raw"> + <insert id="insert" parameterType="Property" useGeneratedKeys="false" > INSERT INTO properties (prop_key, resource_id, user_id, text_value) VALUES (#{key}, #{resourceId}, #{userId}, #{value}) </insert> - <delete id="deleteProjectProperty" parameterType="map" lang="raw"> + <delete id="deleteProjectProperty" parameterType="map" > delete from properties where prop_key=#{key} and resource_id=#{rId} and user_id is null </delete> - <delete id="deleteProjectProperties" parameterType="map" lang="raw"> + <delete id="deleteProjectProperties" parameterType="map" > DELETE FROM properties WHERE prop_key=#{key} @@ -102,23 +102,23 @@ AND user_id IS NULL </delete> - <delete id="deleteGlobalProperty" parameterType="string" lang="raw"> + <delete id="deleteGlobalProperty" parameterType="string" > delete from properties where prop_key=#{id} and resource_id is null and user_id is null </delete> - <delete id="deleteGlobalProperties" lang="raw"> + <delete id="deleteGlobalProperties" > delete from properties where resource_id is null and user_id is null </delete> - <delete id="deleteAllProperties" parameterType="string" lang="raw"> + <delete id="deleteAllProperties" parameterType="string" > delete from properties where prop_key=#{id} </delete> - <update id="renamePropertyKey" parameterType="map" lang="raw"> + <update id="renamePropertyKey" parameterType="map" > update properties set prop_key=#{newKey} where prop_key=#{oldKey} </update> - <update id="updateProperties" parameterType="map" lang="raw"> + <update id="updateProperties" parameterType="map" > update properties set text_value=#{newValue} where text_value LIKE #{oldValue} and prop_key=#{key} </update> diff --git a/sonar-core/src/main/resources/org/sonar/core/qualitygate/db/QualityGateConditionMapper.xml b/sonar-core/src/main/resources/org/sonar/core/qualitygate/db/QualityGateConditionMapper.xml index 600d7ac593e..d4170d89d0f 100644 --- a/sonar-core/src/main/resources/org/sonar/core/qualitygate/db/QualityGateConditionMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/qualitygate/db/QualityGateConditionMapper.xml @@ -3,7 +3,7 @@ <mapper namespace="org.sonar.core.qualitygate.db.QualityGateConditionMapper"> - <insert id="insert" parameterType="QualityGateCondition" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="QualityGateCondition" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > insert into quality_gate_conditions (qgate_id, metric_id, operator, value_error, value_warning, period, created_at, updated_at) values (#{qualityGateId}, #{metricId}, #{operator}, #{errorThreshold}, #{warningThreshold}, #{period}, #{createdAt}, #{updatedAt}) </insert> @@ -22,11 +22,11 @@ select <include refid="conditionColumns"/> from quality_gate_conditions where id=#{id} </select> - <update id="delete" parameterType="long" lang="raw"> + <update id="delete" parameterType="long" > delete from quality_gate_conditions where id=#{id} </update> - <update id="update" parameterType="QualityGateCondition" lang="raw"> + <update id="update" parameterType="QualityGateCondition" > update quality_gate_conditions set metric_id=#{metricId}, operator=#{operator}, @@ -37,7 +37,7 @@ where id=#{id} </update> - <delete id="deleteConditionsWithInvalidMetrics" lang="raw"> + <delete id="deleteConditionsWithInvalidMetrics" > delete from quality_gate_conditions where metric_id not in (select id from metrics where enabled=${_true}) </delete> diff --git a/sonar-core/src/main/resources/org/sonar/core/qualitygate/db/QualityGateMapper.xml b/sonar-core/src/main/resources/org/sonar/core/qualitygate/db/QualityGateMapper.xml index 84644a0a6e0..f54a4a8414b 100644 --- a/sonar-core/src/main/resources/org/sonar/core/qualitygate/db/QualityGateMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/qualitygate/db/QualityGateMapper.xml @@ -3,7 +3,7 @@ <mapper namespace="org.sonar.core.qualitygate.db.QualityGateMapper"> - <insert id="insert" parameterType="QualityGate" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="QualityGate" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > insert into quality_gates (name, created_at, updated_at) values (#{name}, #{createdAt}, #{updatedAt}) </insert> @@ -27,11 +27,11 @@ where id=#{id} </select> - <update id="delete" parameterType="long" lang="raw"> + <update id="delete" parameterType="long" > delete from quality_gates where id=#{id} </update> - <update id="update" parameterType="QualityGate" lang="raw"> + <update id="update" parameterType="QualityGate" > update quality_gates set name=#{name}, updated_at=#{updatedAt} diff --git a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml index 2f31335b5fd..63c868f2097 100644 --- a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml @@ -66,7 +66,7 @@ WHERE id=#{id} </update> - <update id="delete" parameterType="int" lang="raw"> + <update id="delete" parameterType="int" > DELETE FROM active_rules WHERE id=#{id} </update> diff --git a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml index e6ad1eaf7c8..84c2ae5e101 100644 --- a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml @@ -14,12 +14,12 @@ p.rules_updated_at as rulesUpdatedAt </sql> - <insert id="insert" parameterType="QualityProfile" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="QualityProfile" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO rules_profiles (kee, parent_kee, name, language, created_at, updated_at, rules_updated_at) VALUES (#{kee}, #{parentKee}, #{name}, #{language}, #{createdAt}, #{updatedAt}, #{rulesUpdatedAt,}) </insert> - <update id="update" parameterType="QualityProfile" lang="raw"> + <update id="update" parameterType="QualityProfile" > UPDATE rules_profiles SET name=#{name}, language=#{language}, @@ -29,7 +29,7 @@ WHERE id=#{id} </update> - <update id="delete" parameterType="int" lang="raw"> + <update id="delete" parameterType="int" > DELETE FROM rules_profiles WHERE id=#{id} </update> diff --git a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml index 9dc93cb8295..f32095b71da 100644 --- a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml @@ -156,7 +156,7 @@ </where> </select> - <select id="selectRootProjectByComponentId" parameterType="long" resultMap="resourceResultMap" lang="raw"> + <select id="selectRootProjectByComponentId" parameterType="long" resultMap="resourceResultMap" > select rootProject.* from snapshots s inner join projects rootProject on rootProject.id=s.root_project_id @@ -235,7 +235,7 @@ </where> </select> - <select id="selectProvisionedProject" parameterType="string" resultMap="resourceResultMap" lang="raw"> + <select id="selectProvisionedProject" parameterType="string" resultMap="resourceResultMap" > select p.* from projects p left join snapshots s on s.project_id=p.id where s.id is null @@ -289,7 +289,7 @@ </where> </sql> - <insert id="insert" parameterType="Resource" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="Resource" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > insert into projects (name, long_name, description, scope, qualifier, kee, deprecated_kee, path, language, root_id, copy_resource_id, person_id, enabled, created_at) values ( @@ -299,7 +299,7 @@ ) </insert> - <update id="update" parameterType="Resource" lang="raw"> + <update id="update" parameterType="Resource" > update projects set name=#{name}, long_name=#{longName}, description=#{description}, scope=#{scope}, qualifier=#{qualifier}, kee=#{key}, deprecated_kee=#{deprecatedKey}, path=#{path}, language=#{language}, root_id=#{rootId}, copy_resource_id=#{copyResourceId}, diff --git a/sonar-core/src/main/resources/org/sonar/core/rule/RuleMapper.xml b/sonar-core/src/main/resources/org/sonar/core/rule/RuleMapper.xml index 7fba3960e6e..6255c904b7d 100644 --- a/sonar-core/src/main/resources/org/sonar/core/rule/RuleMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/rule/RuleMapper.xml @@ -8,6 +8,7 @@ r.plugin_rule_key as "ruleKey", r.plugin_name as "repositoryKey", r.description, + r.description_format as "descriptionFormat", r.status, r.name, r.plugin_config_key as "configKey", @@ -70,6 +71,7 @@ plugin_rule_key=#{ruleKey}, plugin_name=#{repositoryKey}, description=#{description}, + description_format=#{descriptionFormat}, status=#{status}, name=#{name}, plugin_config_key=#{configKey}, @@ -97,7 +99,7 @@ </update> <sql id="insertColumns"> - (plugin_rule_key, plugin_name, description, status, name, plugin_config_key, priority, is_template, language, template_id, + (plugin_rule_key, plugin_name, description, description_format, status, name, plugin_config_key, priority, is_template, language, template_id, characteristic_id, default_characteristic_id, remediation_function, default_remediation_function, remediation_coeff, default_remediation_coeff, remediation_offset, default_remediation_offset, effort_to_fix_description, tags, system_tags, note_data, note_user_login, note_created_at, note_updated_at, @@ -106,7 +108,7 @@ <insert id="insert" parameterType="Rule" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> insert into rules <include refid="insertColumns"/> - values (#{ruleKey}, #{repositoryKey}, #{description}, #{status}, #{name}, #{configKey}, + values (#{ruleKey}, #{repositoryKey}, #{description}, #{descriptionFormat}, #{status}, #{name}, #{configKey}, #{severity}, #{isTemplate}, #{language}, #{templateId}, #{subCharacteristicId}, #{defaultSubCharacteristicId}, #{remediationFunction}, #{defaultRemediationFunction}, #{remediationCoefficient}, #{defaultRemediationCoefficient}, #{remediationOffset}, #{defaultRemediationOffset}, @@ -116,7 +118,7 @@ <insert id="batchInsert" parameterType="Rule" useGeneratedKeys="false"> insert into rules <include refid="insertColumns"/> - values (#{ruleKey}, #{repositoryKey}, #{description}, #{status}, #{name}, #{configKey}, + values (#{ruleKey}, #{repositoryKey}, #{description}, #{descriptionFormat}, #{status}, #{name}, #{configKey}, #{severity}, #{isTemplate}, #{language}, #{templateId}, #{subCharacteristicId}, #{defaultSubCharacteristicId}, #{remediationFunction}, #{defaultRemediationFunction}, #{remediationCoefficient}, #{defaultRemediationCoefficient}, #{remediationOffset}, #{defaultRemediationOffset}, @@ -124,7 +126,7 @@ #{noteUpdatedAt}, #{createdAt}, #{updatedAt}) </insert> - <delete id="deleteParams" parameterType="Integer" lang="raw"> + <delete id="deleteParams" parameterType="Integer" > delete from active_rule_parameters where rules_parameter_id=#{id} </delete> @@ -159,16 +161,16 @@ WHERE p.rule_id=#{ruleId} AND p.name=#{key} </select> - <delete id="deleteParameter" parameterType="Integer" lang="raw"> + <delete id="deleteParameter" parameterType="Integer" > delete from rules_parameters where id=#{id} </delete> - <insert id="insertParameter" parameterType="RuleParam" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insertParameter" parameterType="RuleParam" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO rules_parameters (rule_id, name, param_type, default_value, description) VALUES (#{ruleId}, #{name}, #{type}, #{defaultValue}, #{description}) </insert> - <update id="updateParameter" parameterType="RuleParam" lang="raw"> + <update id="updateParameter" parameterType="RuleParam" > UPDATE rules_parameters SET param_type=#{type}, default_value=#{defaultValue}, @@ -176,7 +178,7 @@ WHERE id=#{id} </update> - <select id="selectKeysOfRulesUpdatedSince" resultType="map" lang="raw"> + <select id="selectKeysOfRulesUpdatedSince" resultType="map" > SELECT r.plugin_name as "repoField", r.plugin_rule_key as "ruleField" FROM rules r WHERE r.updated_at IS NULL or r.updated_at >= #{id} diff --git a/sonar-core/src/main/resources/org/sonar/core/technicaldebt/db/CharacteristicMapper.xml b/sonar-core/src/main/resources/org/sonar/core/technicaldebt/db/CharacteristicMapper.xml index 152832e0366..713a095a03d 100644 --- a/sonar-core/src/main/resources/org/sonar/core/technicaldebt/db/CharacteristicMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/technicaldebt/db/CharacteristicMapper.xml @@ -95,7 +95,7 @@ VALUES (#{kee}, #{name}, #{parentId}, #{characteristicOrder}, #{enabled}, #{createdAt}, #{updatedAt}) </insert> - <update id="update" parameterType="Characteristic" lang="raw"> + <update id="update" parameterType="Characteristic" > update characteristics set name=#{name}, parent_id=#{parentId}, @@ -105,7 +105,7 @@ where id=#{id} </update> - <select id="selectDeprecatedRequirements" resultType="RequirementMigration" lang="raw"> + <select id="selectDeprecatedRequirements" resultType="RequirementMigration" > select id as "id", parent_id as "parentId", root_id as "rootId", @@ -120,7 +120,7 @@ where rule_id IS NOT NULL </select> - <delete id="deleteRequirementsFromCharacteristicsTable" lang="raw"> + <delete id="deleteRequirementsFromCharacteristicsTable" > DELETE FROM characteristics WHERE rule_id IS NOT NULL </delete> </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml b/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml index 1a347fa53dd..f4d03658b08 100644 --- a/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml @@ -3,17 +3,17 @@ <mapper namespace="org.sonar.core.user.AuthorMapper"> - <select id="selectByLogin" parameterType="string" resultType="Author" lang="raw"> + <select id="selectByLogin" parameterType="string" resultType="Author" > SELECT id, person_id AS personId, login, created_at AS createdAt, updated_at AS updatedAt FROM authors WHERE login=#{id} </select> - <select id="countDeveloperLogins" parameterType="long" resultType="int" lang="raw"> + <select id="countDeveloperLogins" parameterType="long" resultType="int" > SELECT count(id) FROM authors WHERE person_id=#{id} </select> - <insert id="insert" parameterType="Author" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insert" parameterType="Author" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO authors (person_id, login, created_at, updated_at) VALUES (#{personId}, #{login}, #{createdAt}, #{updatedAt}) diff --git a/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml b/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml index 8d81b2ccc52..ad7a4b02f21 100644 --- a/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml @@ -46,12 +46,12 @@ </where> </select> - <insert id="insertGroupRole" parameterType="GroupRole" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insertGroupRole" parameterType="GroupRole" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO group_roles (group_id, resource_id, role) VALUES (#{groupId}, #{resourceId}, #{role}) </insert> - <insert id="insertUserRole" parameterType="UserRole" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw"> + <insert id="insertUserRole" parameterType="UserRole" keyColumn="id" useGeneratedKeys="true" keyProperty="id" > INSERT INTO user_roles (user_id, resource_id, role) VALUES (#{userId}, #{resourceId}, #{role}) </insert> diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 698c89fe519..8d538ffb626 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -1204,11 +1204,6 @@ widget.hotspot_most_violated_rules.property.numberOfLines.name=Number of lines widget.hotspot_most_violated_rules.property.defaultSeverity.name=Default severity widget.hotspot_most_violated_rules.property.defaultSeverity.desc=If selected, severity used to initialize the dropdown list of widget -widget.hotspot_most_violated_resources.name=Most Violated Components -widget.hotspot_most_violated_resources.description=Shows the components that have the most issues. -widget.hotspot_most_violated_resources.no_resource=No result -widget.hotspot_most_violated_resources.property.numberOfLines.name=Number of lines - widget.my_reviews.name=My Unresolved Issues widget.my_reviews.description=Shows unresolved issues assigned to the current user. widget.my_reviews.property.numberOfLines.name=Number of lines @@ -1243,11 +1238,14 @@ widget.issue_filter.unknown_filter_warning=This widget is configured to display widget.treemap-widget.name=Treemap of Components widget.treemap-widget.description=Displays a treemap of all direct components of the selected resource. widget.treemap-widget.property.sizeMetric.name=Size Metric -widget.treemap-widget.property.sizeMetric.description=Metric used for square size +widget.treemap-widget.property.sizeMetric.desc=Metric used for square size widget.treemap-widget.property.colorMetric.name=Color Metric -widget.treemap-widget.property.colorMetric.description=Metric used for square color +widget.treemap-widget.property.colorMetric.desc=Metric used for square color widget.treemap-widget.property.heightInPercents.name=Height -widget.treemap-widget.property.heightInPercents.description=Height in percents of width +widget.treemap-widget.property.heightInPercents.desc=Height in percents of width +widget.treemap-widget.property.chartTitle.name=Chart Title +widget.treemap-widget.property.maxItems.name=Max Components +widget.treemap-widget.property.maxItems.desc=Maximum number of components to show widget.welcome.name=Welcome widget.welcome.description=Welcome message used to provide links to the most valuable resources like documentation and support @@ -1271,10 +1269,14 @@ widget.measure_filter_treemap.name=Measure Filter as Treemap widget.measure_filter_treemap.description=Displays the result of pre-configured measure filter as a Treemap. widget.measure_filter_treemap.property.filter.name=Filter widget.measure_filter_treemap.property.sizeMetric.name=Size Metric +widget.measure_filter_treemap.property.sizeMetric.desc=Metric used for square size widget.measure_filter_treemap.property.colorMetric.name=Color Metric +widget.measure_filter_treemap.property.colorMetric.desc=Metric used for square color widget.measure_filter_treemap.property.heightInPercents.name=Height -widget.measure_filter_treemap.property.heightInPercents.description=Height in percents of width -widget.measure_filter_treemap.property.displayFilterDescription.name=Display Filter Description +widget.measure_filter_treemap.property.heightInPercents.desc=Height in percents of width +widget.measure_filter_treemap.property.chartTitle.name=Chart Title +widget.measure_filter_treemap.property.maxItems.name=Max Components +widget.measure_filter_treemap.property.maxItems.desc=Maximum number of components to show widget.technical_debt_pyramid.name=Technical Debt Pyramid widget.technical_debt_pyramid.description=Displays the technical debt by characteristics. Characteristics located at the bottom should be addressed before those on top. @@ -1282,6 +1284,9 @@ widget.technical_debt_pyramid.technical_debt=Technical Debt widget.technical_debt_pyramid.total=Total widget.technical_debt_pyramid.no_info_available=No information available. +widget.debt_overview.name=Technical Debt Synopsis +widget.debt_overview.description=Display the SQALE rating and the technical debt ratio. + # Below are labels used in widget edition pages widget.image.name=Image widget.image.description=Shows an image with a link @@ -1707,6 +1712,7 @@ coding_rules.change_severity_in=Change Severity In coding_rules.change_details=Change Details of Quality Profile coding_rules.create=Create coding_rules.create_custom_rule=Create Custom Rule +coding_rules.create_manual_rule=Create Manual Rule coding_rules.custom_rule=Custom Rule coding_rules.custom_rule.title=This rule has been created through customization of a rule template coding_rules.custom_rules=Custom Rules @@ -1745,11 +1751,14 @@ coding_rules._rules=rules coding_rules.select_tag=Select Tag coding_rules.show_template=Show Template coding_rules.update_custom_rule=Update Custom Rule +coding_rules.update_manual_rule=Update Manual Rule coding_rules.filters.activation=Activation coding_rules.filters.activation.active=Active coding_rules.filters.activation.inactive=Inactive coding_rules.filters.activation.help=Activation criterion is available when a quality profile is selected +coding_rules.filters.active_severity=Active Severity +coding_rules.filters.active_severity.inactive=Active severity criterion is available when a quality profile is selected coding_rules.filters.availableSince=Available Since coding_rules.filters.characteristic=Characteristic coding_rules.filters.description=Description @@ -1778,6 +1787,13 @@ coding_rules.sort.creation_date=Creation Date coding_rules.sort.name=Name coding_rules.sort.relevance=Relevance +coding_rules.remediation_function=Remediation function +coding_rules.remediation_function.LINEAR=Linear +coding_rules.remediation_function.LINEAR_OFFSET=Linear with offset +coding_rules.remediation_function.CONSTANT_ISSUE=Constant/issue +coding_rules.remediation_function.coeff=Coeff +coding_rules.remediation_function.offset=Offset + #------------------------------------------------------------------------------ # # EMAIL CONFIGURATION @@ -1948,8 +1964,7 @@ provisioning.no_analysis=No analysis has been performed since creation. The only # TREEMAP # #------------------------------------------------------------------------------ -treemap.click_help=Left click to zoom in. Right click to zoom out. -treemap.bootom_level_reached=Zooming in is not possible as you have reached the bottom level +treemap.open_dashboard=Open Dashboard #------------------------------------------------------------------------------ @@ -2338,13 +2353,6 @@ metric.portability.description=Portability metric.maintainability.name=Maintainability metric.maintainability.description=Maintainability -metric.weighted_violations.name=Weighted issues -metric.weighted_violations.description=Weighted issues - -metric.violations_density.name=Rules compliance -metric.violations_density.description=Rules compliance -metric.violations_density.abbreviation=RCI - metric.violations.name=Issues metric.violations.description=Issues @@ -2506,9 +2514,16 @@ metric.confirmed_issues.description=Confirmed issues metric.sqale_index.name=Technical Debt metric.sqale_index.description=Total effort (in days) to fix all the issues on the component and therefore to comply to all the requirements. + metric.new_technical_debt.name=Technical Debt on new code metric.new_technical_debt.description=Technical Debt on new code +metric.sqale_rating.name=SQALE Rating +metric.sqale_rating.description=Density of technical debt computed by dividing the technical debt by the estimated effort to develop from scratch an application. + +metric.sqale_debt_ratio.name=Technical Debt Ratio +metric.sqale_debt_ratio.description=Ratio of the technical debt compared to what it would cost to develop the whole source code from scratch. + #------------------------------------------------------------------------------ # @@ -2629,7 +2644,7 @@ component_viewer.measure_section.size=Size component_viewer.measure_section.complexity=Complexity component_viewer.measure_section.structure=Structure component_viewer.measure_section.documentation=Documentation -component_viewer.measure_section.resolutions=Resolutions +component_viewer.measure_section.filters=Filters component_viewer.measure_section.severities=Severities component_viewer.measure_section.rules=Rules component_viewer.measure_section.issues=Issues @@ -2638,11 +2653,13 @@ component_viewer.measure_section.unit_tests=Unit Tests component_viewer.measure_section.tests=Tests component_viewer.measure_section.test_names=Test Names component_viewer.measure_section.integration_tests=Integration Tests +component_viewer.measure_section.overall=Overall component_viewer.issues.current_issue=Current Issue component_viewer.issues.unresolved_issues=Unresolved Issues component_viewer.issues.fixed_issues=Fixed Issues component_viewer.issues.false_positive_issues=False Positive Issues +component_viewer.issues.open_issues=Open/Reopened Issues component_viewer.header.debt=Debt component_viewer.header.toggle_issues=Toggle issues @@ -2656,6 +2673,10 @@ component_viewer.transition.coverage=Covered By component_viewer.transition.covers=Covers component_viewer.transition.duplication=Duplicated By +component_viewer.tests.sort_by=Sort by +component_viewer.tests.duration=Duration +component_viewer.tests.test_name=Test Name + component_viewer.x_lines_are_covered={0} lines are covered component_viewer.details=Details component_viewer.add_manual_issue=Add Manual Issue diff --git a/sonar-core/src/test/java/org/sonar/core/metric/CacheMetricFinderTest.java b/sonar-core/src/test/java/org/sonar/core/metric/CacheMetricFinderTest.java deleted file mode 100644 index 515c8e71835..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/metric/CacheMetricFinderTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.core.metric; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.core.metric.CacheMetricFinder; -import org.sonar.jpa.test.AbstractDbUnitTestCase; - -import java.util.Arrays; - -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNull.nullValue; -import static org.junit.Assert.assertThat; - - -public class CacheMetricFinderTest extends AbstractDbUnitTestCase { - - private CacheMetricFinder finder; - - @Before - public void initFinder() { - setupData("shared"); - finder = new CacheMetricFinder(getSessionFactory()); - finder.start(); - } - - @Test - public void shouldFindAll() { - assertThat(finder.findAll().size(), is(2)); - } - - @Test - public void shouldFindByKeys() { - assertThat(finder.findAll(Arrays.<String>asList("ncloc", "foo", "coverage")).size(), is(2)); - } - - @Test - public void shouldFindById() { - assertThat(finder.findById(1).getKey(), is("ncloc")); - assertThat(finder.findById(3), nullValue()); - } - - @Test - public void shouldFindByKey() { - assertThat(finder.findByKey("ncloc").getKey(), is("ncloc")); - assertThat(finder.findByKey("disabled"), nullValue()); - } -} diff --git a/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java b/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java index 7c1dfa37c8b..0c5d788048e 100644 --- a/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java @@ -47,6 +47,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { assertThat(ruleDto.getId()).isEqualTo(1); assertThat(ruleDto.getName()).isEqualTo("Avoid Null"); assertThat(ruleDto.getDescription()).isEqualTo("Should avoid NULL"); + assertThat(ruleDto.getDescriptionFormat()).isEqualTo(RuleDto.Format.HTML); assertThat(ruleDto.getStatus()).isEqualTo(RuleStatus.READY); assertThat(ruleDto.getRepositoryKey()).isEqualTo("checkstyle"); assertThat(ruleDto.getNoteData()).isEqualTo("Rule note with accents \u00e9\u00e8\u00e0"); diff --git a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_enables_and_non_manual.xml b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_enables_and_non_manual.xml index 38d6cc5ce02..fe85e591078 100644 --- a/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_enables_and_non_manual.xml +++ b/sonar-core/src/test/resources/org/sonar/core/rule/RuleDaoTest/select_enables_and_non_manual.xml @@ -1,7 +1,7 @@ <dataset> <rules tags="[null]" system_tags="[null]" id="1" plugin_rule_key="AvoidNull" plugin_name="checkstyle" name="Avoid Null" description="Should avoid NULL" status="READY" - note_data="Rule note with accents éèà" note_user_login="polop.palap" note_created_at="2013-12-25" + note_data="Rule note with accents éèà" note_user_login="polop.palap" note_created_at="2013-12-25" description_format="HTML" characteristic_id="100" default_characteristic_id="101" remediation_function="LINEAR" default_remediation_function="LINEAR_OFFSET" remediation_coeff="1h" default_remediation_coeff="5d" @@ -9,7 +9,7 @@ effort_to_fix_description="squid.S115.effortToFix"/> <rules tags="[null]" system_tags="[null]" id="2" plugin_rule_key="AvoidNull" plugin_name="squid" name="Avoid Null" description="Should avoid NULL" status="REMOVED" - note_data="[null]" note_user_login="[null]" note_created_at="[null]" + note_data="[null]" note_user_login="[null]" note_created_at="[null]" description_format="HTML" characteristic_id="[null]" default_characteristic_id="[null]" remediation_function="[null]" default_remediation_function="[null]" remediation_coeff="[null]" default_remediation_coeff="[null]" @@ -17,7 +17,7 @@ effort_to_fix_description="[null]"/> <rules tags="[null]" system_tags="[null]" id="3" plugin_rule_key="AvoidNull" plugin_name="manual" name="Manual Rule" description="Should not appear" status="READY" - note_data="[null]" note_user_login="[null]" note_created_at="[null]" + note_data="[null]" note_user_login="[null]" note_created_at="[null]" description_format="HTML" characteristic_id="[null]" default_characteristic_id="[null]" remediation_function="[null]" default_remediation_function="[null]" remediation_coeff="[null]" default_remediation_coeff="[null]" |