diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2013-12-06 14:37:19 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2013-12-06 14:37:19 +0100 |
commit | 6745f7eb455a4a68ad08cd8323f90248da12d93d (patch) | |
tree | 807790406d96f9c33a6b0f04b2460e19c3a2f508 | |
parent | 8bb3871e4c2d974bb7e8124b8caf1bc6998c9c0c (diff) | |
download | sonarqube-6745f7eb455a4a68ad08cd8323f90248da12d93d.tar.gz sonarqube-6745f7eb455a4a68ad08cd8323f90248da12d93d.zip |
SONAR-4870 Add new "Efficiency > Network use" sub-characteristic
5 files changed, 56 insertions, 4 deletions
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 845d94b5c6f..7f0c9e92b43 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 = 465; + public static final int LAST_VERSION = 466; public static enum Status { UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL 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 ece45fc06e8..0d7310e4347 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 @@ -189,6 +189,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('462'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('463'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('464'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('465'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('466'); 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-server/src/main/resources/com/sonar/sqale/technical-debt-model.xml b/sonar-server/src/main/resources/com/sonar/sqale/technical-debt-model.xml index 286a26eb05f..6d15f00746f 100644 --- a/sonar-server/src/main/resources/com/sonar/sqale/technical-debt-model.xml +++ b/sonar-server/src/main/resources/com/sonar/sqale/technical-debt-model.xml @@ -96,12 +96,16 @@ <key>EFFICIENCY</key> <name>Efficiency</name> <chc> + <key>CPU_EFFICIENCY</key> + <name>Processor use</name> + </chc> + <chc> <key>MEMORY_EFFICIENCY</key> <name>Memory use</name> </chc> <chc> - <key>CPU_EFFICIENCY</key> - <name>Processor use</name> + <key>NETWORK_USE</key> + <name>Network use</name> </chc> </chc> <chc> diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/465_add_perm_template_key_pattern_column.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/465_add_perm_template_key_pattern_column.rb index b2ee196fa43..783901145bb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/465_add_perm_template_key_pattern_column.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/465_add_perm_template_key_pattern_column.rb @@ -27,6 +27,6 @@ class AddPermTemplateKeyPatternColumn < ActiveRecord::Migration def self.up add_column 'permission_templates', :key_pattern, :string, :null => true, :limit => 500 - end + end end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb new file mode 100644 index 00000000000..1a94a672dce --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb @@ -0,0 +1,47 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2013 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# SonarQube is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +# +# SonarQube 4.1 +# SONAR-4870 +# + +class AddNetworkUseSubCharacteristic < ActiveRecord::Migration + + class Characteristic < ActiveRecord::Base + end + + def self.up + Characteristic.reset_column_information + + # On an empty DB, there are no characteristics, they're all gonna be created after (so new characteristics has always to be also added in the technical-debt-model.xml file) + if Characteristic.all.size > 0 + efficiency = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'EFFICIENCY', true]) + network_use = Characteristic.first(:conditions => ['name=? AND enabled=?', 'Network use ', true]) + + # The Efficiency characteristic can have been deleted from the SQALE plugin + # And the Network use can already been created + if efficiency && !network_use + Characteristic.create(:kee => 'NETWORK_USE_EFFICIENCY', :name => 'Network use', :enabled => true, :parent_id => efficiency.id, :root_id => efficiency.id) if efficiency + end + end + end + +end |