import org.sonar.server.db.migrations.v45.AddMissingRuleParameterDefaultValuesMigration;
import org.sonar.server.db.migrations.v45.DeleteMeasuresOnDeletedProfilesMigration;
import org.sonar.server.db.migrations.v451.DeleteUnescapedActivities;
+import org.sonar.server.db.migrations.v453.AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigration;
import java.util.List;
// 4.5.1
AddMissingCustomRuleParametersMigration.class,
- DeleteUnescapedActivities.class
+ DeleteUnescapedActivities.class,
+
+ // 4.5.3,
+ AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigration.class
);
}
--- /dev/null
+/*
+ * 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.server.db.migrations.v453;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.sonar.api.utils.System2;
+import org.sonar.core.persistence.Database;
+import org.sonar.server.db.migrations.BaseDataChange;
+import org.sonar.server.db.migrations.Select;
+import org.sonar.server.db.migrations.Upsert;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
+
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.List;
+
+import static com.google.common.collect.Lists.newArrayList;
+
+/**
+ * See http://jira.codehaus.org/browse/SONAR-6187
+ *
+ * Add a new Characteristic 'Usability' with 2 sub-characteristics 'Accessibility' and 'Ease of Use'
+ * and add a new sub-characteristic 'Compliance' for all characteristics.
+ *
+ * @since 4.5.3
+ */
+public class AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigration extends BaseDataChange {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigration.class);
+
+ private static final String COMPLIANCE_NAME = "Compliance";
+ private static final String COMPLIANCE_KEY_SUFFIX = "_COMPLIANCE";
+
+ private final System2 system;
+
+ public AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigration(Database db, System2 system) {
+ super(db);
+ this.system = system;
+ }
+
+ @Override
+ public void execute(Context context) throws SQLException {
+ CharacteristicsContext characteristicsContext = new CharacteristicsContext(context, system);
+
+ int usabilityOder = moveCharacteristicsDownToBeAbleToInsertUsability(characteristicsContext);
+ createOrUpdateUsabilityCharacteristicAndItsSubCharacteristic(characteristicsContext, usabilityOder);
+
+ createSubCharacteristic(characteristicsContext, "REUSABILITY" + COMPLIANCE_KEY_SUFFIX, "Reusability " + COMPLIANCE_NAME, "REUSABILITY");
+ createSubCharacteristic(characteristicsContext, "PORTABILITY" + COMPLIANCE_KEY_SUFFIX, "Portability " + COMPLIANCE_NAME, "PORTABILITY");
+ createSubCharacteristic(characteristicsContext, "MAINTAINABILITY" + COMPLIANCE_KEY_SUFFIX, "Maintainability " + COMPLIANCE_NAME, "MAINTAINABILITY");
+ createSubCharacteristic(characteristicsContext, "SECURITY" + COMPLIANCE_KEY_SUFFIX, "Security " + COMPLIANCE_NAME, "SECURITY");
+ createSubCharacteristic(characteristicsContext, "EFFICIENCY" + COMPLIANCE_KEY_SUFFIX, "Efficiency " + COMPLIANCE_NAME, "EFFICIENCY");
+ createSubCharacteristic(characteristicsContext, "CHANGEABILITY" + COMPLIANCE_KEY_SUFFIX, "Changeability " + COMPLIANCE_NAME, "CHANGEABILITY");
+ createSubCharacteristic(characteristicsContext, "RELIABILITY" + COMPLIANCE_KEY_SUFFIX, "Reliability " + COMPLIANCE_NAME, "RELIABILITY");
+ createSubCharacteristic(characteristicsContext, "TESTABILITY" + COMPLIANCE_KEY_SUFFIX, "Testability " + COMPLIANCE_NAME, "TESTABILITY");
+ }
+
+ /**
+ * If the characteristic 'Security' exists, the new characteristic 'Usability' should be inserted just below it,
+ * so every existing characteristics below Security should move down.
+ *
+ * If the characteristic 'Security' does not exists, the new characteristic 'Usability' should be the first one,
+ * so every existing characteristics should move down.
+ *
+ * If the characteristic 'Usability' is already at the right place, nothing will be done.
+ */
+ private int moveCharacteristicsDownToBeAbleToInsertUsability(CharacteristicsContext characteristicsContext) throws SQLException {
+ Characteristic security = characteristicsContext.findCharacteristicByKey("SECURITY");
+ Characteristic usability = characteristicsContext.findCharacteristicByKey("USABILITY");
+
+ int usabilityOder = 1;
+ int indexToStart = 0;
+ if (security != null) {
+ indexToStart = characteristicsContext.characteristics().indexOf(security) + 1;
+ usabilityOder = security.getOrder() + 1;
+ }
+
+ if (usability == null || usability.getOrder() != usabilityOder) {
+ // Move root characteristics one step lower
+ for (int i = indexToStart; i < characteristicsContext.characteristics().size(); i++) {
+ Characteristic characteristic = characteristicsContext.characteristics().get(i);
+ if (characteristic.getParentId() == null) {
+ characteristicsContext.updateCharacteristicOrder(characteristic.getKey(), characteristic.getOrder() + 1);
+ }
+ }
+ }
+ return usabilityOder;
+ }
+
+ private void createOrUpdateUsabilityCharacteristicAndItsSubCharacteristic(CharacteristicsContext characteristicsContext, int newUsabilityOrder)
+ throws SQLException {
+ String usabilityKey = "USABILITY";
+ Characteristic usability = characteristicsContext.findCharacteristicByKey(usabilityKey);
+ if (usability != null) {
+ if (usability.getOrder() != newUsabilityOrder) {
+ usability.setOrder(newUsabilityOrder);
+ characteristicsContext.updateCharacteristicOrder(usability.getKey(), usability.getOrder());
+ }
+ } else {
+ usability = new Characteristic().setKey(usabilityKey).setName("Usability").setOrder(newUsabilityOrder);
+ characteristicsContext.insertCharacteristic(usability);
+ }
+
+ createSubCharacteristic(characteristicsContext, "USABILITY_ACCESSIBILITY", "Accessibility", usabilityKey);
+ createSubCharacteristic(characteristicsContext, "USABILITY_EASE_OF_USE", "Ease of Use", usabilityKey);
+ createSubCharacteristic(characteristicsContext, "USABILITY" + COMPLIANCE_KEY_SUFFIX, "Usability " + COMPLIANCE_NAME, usabilityKey);
+ }
+
+ private void createSubCharacteristic(CharacteristicsContext characteristicsContext,
+ String subCharacteristicKey, String subCharacteristicName, String parentKey) throws SQLException {
+ Characteristic parent = characteristicsContext.findCharacteristicByKey(parentKey);
+ if (parent != null) {
+ Characteristic subCharacteristic = characteristicsContext.findSubCharacteristicByKey(subCharacteristicKey, parent);
+ if (subCharacteristic == null) {
+ characteristicsContext.insertCharacteristic(new Characteristic().setKey(subCharacteristicKey).setName(subCharacteristicName).setParentId(parent.getId()));
+ }
+ }
+ // If the characteristic parent does not exits, the sub-characteristic is not added
+ }
+
+ private static class Characteristic {
+ private Integer id;
+ private String key;
+ private String name;
+ private Integer order;
+ private Integer parentId;
+
+ public Characteristic setId(Integer id) {
+ this.id = id;
+ return this;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public Characteristic setKey(String key) {
+ this.key = key;
+ return this;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public Characteristic setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Characteristic setOrder(@Nullable Integer order) {
+ this.order = order;
+ return this;
+ }
+
+ @CheckForNull
+ public Integer getOrder() {
+ return order;
+ }
+
+ public Characteristic setParentId(@Nullable Integer parentId) {
+ this.parentId = parentId;
+ return this;
+ }
+
+ @CheckForNull
+ public Integer getParentId() {
+ return parentId;
+ }
+ }
+
+ private static class CharacteristicsContext {
+ Context context;
+ private final System2 system;
+ Date now;
+ List<Characteristic> characteristics;
+
+ public CharacteristicsContext(Context context, System2 system) throws SQLException {
+ this.context = context;
+ this.system = system;
+ init();
+ }
+
+ private void init() throws SQLException {
+ now = new Date(system.now());
+ characteristics = selectEnabledCharacteristics();
+ }
+
+ public List<Characteristic> characteristics() {
+ return characteristics;
+ }
+
+ @CheckForNull
+ public Characteristic findCharacteristicByKey(final String key) {
+ Characteristic characteristic = Iterables.find(characteristics, new Predicate<Characteristic>() {
+ @Override
+ public boolean apply(@Nullable Characteristic input) {
+ return input != null && input.key.equals(key);
+ }
+ }, null);
+ if (characteristic != null) {
+ if (characteristic.getParentId() != null) {
+ throw new IllegalStateException(String.format("'%s' must be a characteristic", characteristic.getName()));
+ }
+ }
+ return characteristic;
+ }
+
+ @CheckForNull
+ public Characteristic findSubCharacteristicByKey(final String key, Characteristic parent) {
+ Characteristic characteristic = Iterables.find(characteristics, new Predicate<Characteristic>() {
+ @Override
+ public boolean apply(@Nullable Characteristic input) {
+ return input != null && input.key.equals(key);
+ }
+ }, null);
+ if (characteristic != null) {
+ Integer parentId = characteristic.getParentId();
+ if (parentId == null) {
+ throw new IllegalStateException(String.format("'%s' must be a sub-characteristic", characteristic.getName()));
+ } else if (!characteristic.getParentId().equals(parent.getId())) {
+ throw new IllegalStateException(String.format("'%s' must be defined under '%s'", characteristic.getName(), parent.getName()));
+ }
+ }
+ return characteristic;
+ }
+
+ private List<Characteristic> selectEnabledCharacteristics() throws SQLException {
+ return context.prepareSelect(
+ "SELECT c.id, c.kee, c.name, c.characteristic_order, c.parent_id FROM characteristics c WHERE c.enabled=? ORDER BY c.characteristic_order")
+ .setBoolean(1, true)
+ .list(new CharacteristicReader());
+ }
+
+ private int selectCharacteristicId(String key) throws SQLException {
+ return context.prepareSelect(
+ "SELECT c.id FROM characteristics c WHERE c.kee = ? AND c.enabled=?")
+ .setString(1, key)
+ .setBoolean(2, true)
+ .get(Select.LONG_READER).intValue();
+ }
+
+ public void insertCharacteristic(Characteristic characteristic) throws SQLException {
+ if (characteristic.getParentId() == null) {
+ LOGGER.info("Insert new characteristic '{}'", characteristic.getKey());
+ } else {
+ LOGGER.info("Insert new sub characteristic '{}'", characteristic.getKey());
+ }
+
+ context.prepareUpsert("INSERT INTO characteristics (kee, name, parent_id, characteristic_order, enabled, created_at) VALUES (?, ?, ?, ?, ?, ?)")
+ .setString(1, characteristic.getKey())
+ .setString(2, characteristic.getName())
+ .setInt(3, characteristic.getParentId())
+ .setInt(4, characteristic.getOrder())
+ .setBoolean(5, true)
+ .setDate(6, now)
+ .execute()
+ .commit();
+ characteristic.setId(selectCharacteristicId(characteristic.getKey()));
+
+ characteristics.add(characteristic);
+ }
+
+ public void updateCharacteristicOrder(String key, Integer order) throws SQLException {
+ LOGGER.info("Update characteristic '{}' order to {}", key, order);
+
+ context.prepareUpsert("UPDATE characteristics SET characteristic_order=?, updated_at=? WHERE kee=?")
+ .setInt(1, order)
+ .setDate(2, now)
+ .setString(3, key)
+ .execute()
+ .commit();
+ }
+
+ private static class CharacteristicReader implements Select.RowReader<Characteristic> {
+ @Override
+ public Characteristic read(Select.Row row) throws SQLException {
+ return new Characteristic()
+ .setId(row.getInt(1))
+ .setKey(row.getString(2))
+ .setName(row.getString(3))
+ .setOrder(row.getInt(4))
+ .setParentId(row.getInt(5));
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ */
+
+@ParametersAreNonnullByDefault
+package org.sonar.server.db.migrations.v453;
+
+import javax.annotation.ParametersAreNonnullByDefault;
-<!--
-
- 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.
-
--->
<sqale>
<chc>
<key>REUSABILITY</key>
<key>MODULARITY</key>
<name>Modularity</name>
</chc>
+ <chc>
+ <key>REUSABILITY_COMPLIANCE</key>
+ <name>Reusability Compliance</name>
+ </chc>
<chc>
<key>TRANSPORTABILITY</key>
<name>Transportability</name>
<key>OS_RELATED_PORTABILITY</key>
<name>OS</name>
</chc>
+ <chc>
+ <key>PORTABILITY_COMPLIANCE</key>
+ <name>Portability Compliance</name>
+ </chc>
<chc>
<key>SOFTWARE_RELATED_PORTABILITY</key>
<name>Software</name>
<chc>
<key>MAINTAINABILITY</key>
<name>Maintainability</name>
+ <chc>
+ <key>MAINTAINABILITY_COMPLIANCE</key>
+ <name>Maintainability Compliance</name>
+ </chc>
<chc>
<key>READABILITY</key>
<name>Readability</name>
<key>INPUT_VALIDATION_AND_REPRESENTATION</key>
<name>Input validation and representation</name>
</chc>
+ <chc>
+ <key>SECURITY_COMPLIANCE</key>
+ <name>Security Compliance</name>
+ </chc>
<chc>
<key>SECURITY_FEATURES</key>
<name>Security features</name>
</chc>
</chc>
+ <chc>
+ <key>USABILITY</key>
+ <name>Usability</name>
+ <chc>
+ <key>USABILITY_ACCESSIBILITY</key>
+ <name>Accessibility</name>
+ </chc>
+ <chc>
+ <key>USABILITY_EASE_OF_USE</key>
+ <name>Ease of Use</name>
+ </chc>
+ <chc>
+ <key>USABILITY_COMPLIANCE</key>
+ <name>Usability Compliance</name>
+ </chc>
+ </chc>
<chc>
<key>EFFICIENCY</key>
<name>Efficiency</name>
<key>CPU_EFFICIENCY</key>
<name>Processor use</name>
</chc>
+ <chc>
+ <key>EFFICIENCY_COMPLIANCE</key>
+ <name>Efficiency Compliance</name>
+ </chc>
<chc>
<key>MEMORY_EFFICIENCY</key>
<name>Memory use</name>
<key>ARCHITECTURE_CHANGEABILITY</key>
<name>Architecture</name>
</chc>
+ <chc>
+ <key>CHANGEABILITY_COMPLIANCE</key>
+ <name>Changeability Compliance</name>
+ </chc>
<chc>
<key>DATA_CHANGEABILITY</key>
<name>Data</name>
<key>LOGIC_RELIABILITY</key>
<name>Logic</name>
</chc>
+ <chc>
+ <key>RELIABILITY_COMPLIANCE</key>
+ <name>Reliability Compliance</name>
+ </chc>
<chc>
<key>RESOURCE_RELIABILITY</key>
<name>Resource</name>
<key>INTEGRATION_TESTABILITY</key>
<name>Integration level</name>
</chc>
+ <chc>
+ <key>TESTABILITY_COMPLIANCE</key>
+ <name>Testability Compliance</name>
+ </chc>
<chc>
<key>UNIT_TESTABILITY</key>
<name>Unit level</name>
--- /dev/null
+/*
+ * 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.server.db.migrations.v453;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.api.utils.DateUtils;
+import org.sonar.api.utils.System2;
+import org.sonar.core.persistence.TestDatabase;
+import org.sonar.server.db.migrations.DatabaseMigration;
+
+import static junit.framework.TestCase.fail;
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest {
+
+ @ClassRule
+ public static TestDatabase db = new TestDatabase().schema(AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigrationTest.class, "schema.sql");
+
+ DatabaseMigration migration;
+
+ System2 system = mock(System2.class);
+
+ @Before
+ public void setUp() throws Exception {
+ db.executeUpdateSql("truncate table characteristics");
+
+ when(system.now()).thenReturn(DateUtils.parseDate("2015-02-15").getTime());
+
+ migration = new AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigration(db.database(), system);
+ }
+
+ @Test
+ public void migrate() throws Exception {
+ db.prepareDbUnit(getClass(), "migrate.xml");
+ migration.execute();
+ db.assertDbUnit(getClass(), "migrate-result.xml", "characteristics");
+ }
+
+ @Test
+ public void do_nothing_when_already_migrated() throws Exception {
+ db.prepareDbUnit(getClass(), "do_nothing_when_already_migrated.xml");
+ migration.execute();
+ db.assertDbUnit(getClass(), "do_nothing_when_already_migrated.xml", "characteristics");
+ }
+
+ @Test
+ public void insert_usability_at_the_top_if_security_does_exists() throws Exception {
+ db.prepareDbUnit(getClass(), "insert_usability_at_the_top_if_security_does_exists.xml");
+ migration.execute();
+ db.assertDbUnit(getClass(), "insert_usability_at_the_top_if_security_does_exists-result.xml", "characteristics");
+ }
+
+ @Test
+ public void update_usability_order_if_already_exists() throws Exception {
+ db.prepareDbUnit(getClass(), "update_usability_if_already_exists.xml");
+ migration.execute();
+ db.assertDbUnit(getClass(), "update_usability_if_already_exists-result.xml", "characteristics");
+ }
+
+ @Test
+ public void fail_if_usability_exists_as_sub_characteristic() throws Exception {
+ db.prepareDbUnit(getClass(), "fail_if_usability_exists_as_sub_characteristic.xml");
+
+ try {
+ migration.execute();
+ fail();
+ } catch (Exception e) {
+ assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("'Usability' must be a characteristic");
+ }
+ }
+
+ @Test
+ public void fail_if_compliance_already_exists_as_characteristic() throws Exception {
+ db.prepareDbUnit(getClass(), "fail_if_compliance_already_exists_as_characteristic.xml");
+
+ try {
+ migration.execute();
+ fail();
+ } catch (Exception e) {
+ assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("'Compliance' must be a sub-characteristic");
+ }
+ }
+
+ @Test
+ public void fail_if_compliance_already_exists_under_wrong_characteristic() throws Exception {
+ db.prepareDbUnit(getClass(), "fail_if_compliance_already_exists_under_wrong_characteristic.xml");
+
+ try {
+ migration.execute();
+ fail();
+ } catch (Exception e) {
+ assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("'Reusability Compliance' must be defined under 'Reusability'");
+ }
+ }
+
+}
}
@Test
- public void find_characteristics() throws Exception {
+ public void find_default_characteristics() throws Exception {
DebtModelService debtModelService = serverTester.get(DebtModelService.class);
// Only root characteristics
- assertThat(debtModelService.characteristics()).hasSize(8);
+ assertThat(debtModelService.characteristics()).hasSize(9);
// Characteristics and sub-characteristics
- assertThat(debtModelService.allCharacteristics()).hasSize(39);
+ assertThat(debtModelService.allCharacteristics()).hasSize(51);
}
@Test
--- /dev/null
+<dataset>
+
+ <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+ <characteristics id="2" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="1" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+ <characteristics id="3" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+ <characteristics id="4" kee="PORTABILITY_COMPLIANCE" name="Portability Compliance" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+ <characteristics id="5" kee="MAINTAINABILITY" name="Maintainability" parent_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+ <characteristics id="6" kee="MAINTAINABILITY_COMPLIANCE" name="Maintainability Compliance" parent_id="5" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+ <characteristics id="7" kee="SECURITY" name="Security" parent_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+ <characteristics id="8" kee="SECURITY_COMPLIANCE" name="Security Compliance" parent_id="7" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+ <characteristics id="9" kee="USABILITY" name="Usability" parent_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+ <characteristics id="10" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+ <characteristics id="11" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+ <characteristics id="12" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+ <characteristics id="13" kee="EFFICIENCY" name="Efficiency" parent_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
+ <characteristics id="14" kee="EFFICIENCY_COMPLIANCE" name="Efficiency Compliance" parent_id="13" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+ <characteristics id="15" kee="CHANGEABILITY" name="Changeability" parent_id="[null]" characteristic_order="7" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
+ <characteristics id="16" kee="CHANGEABILITY_COMPLIANCE" name="Changeability Compliance" parent_id="15" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+ <characteristics id="17" kee="RELIABILITY" name="Reliability" parent_id="[null]" characteristic_order="8" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
+ <characteristics id="18" kee="RELIABILITY_COMPLIANCE" name="Reliability Compliance" parent_id="17" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+ <characteristics id="19" kee="TESTABILITY" name="Testability" parent_id="[null]" characteristic_order="9" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-20"/>
+ <characteristics id="20" kee="TESTABILITY_COMPLIANCE" name="Testability Compliance" parent_id="19" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="2" kee="REUSABILITY_COMPLIANCE" name="Compliance" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="3" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="2" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="[null]"/>
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="2" kee="USABILITY" name="Usability" parent_id="1" characteristic_order="[null]" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <!-- Oder has changed : this characteristic is now one step lower -->
+ <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+
+ <!-- Oder has changed : this characteristic is now one step lower -->
+ <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+
+ <!-- New characteristic 'Usability' is on the top (order 1) -->
+ <characteristics id="3" kee="USABILITY" name="Usability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+ <characteristics id="4" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+ <characteristics id="5" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+ <characteristics id="6" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+
+ <!-- New sub characteristic 'Compliance' under Reusability -->
+ <characteristics id="7" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="1" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Portability -->
+ <characteristics id="8" kee="PORTABILITY_COMPLIANCE" name="Portability Compliance" parent_id="2" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="3" kee="MAINTAINABILITY" name="Maintainability" parent_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="4" kee="SECURITY" name="Security" parent_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <!-- Oder has changed : this characteristic is now one step lower -->
+ <characteristics id="5" kee="EFFICIENCY" name="Efficiency" parent_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+
+ <!-- Oder has changed : this characteristic is now one step lower -->
+ <characteristics id="6" kee="CHANGEABILITY" name="Changeability" parent_id="[null]" characteristic_order="7" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+
+ <!-- Oder has changed : this characteristic is now one step lower -->
+ <characteristics id="7" kee="RELIABILITY" name="Reliability" parent_id="[null]" characteristic_order="8" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+
+ <!-- Oder has changed : this characteristic is now one step lower -->
+ <characteristics id="8" kee="TESTABILITY" name="Testability" parent_id="[null]" characteristic_order="9" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+
+ <!-- New characteristic 'Usability' is after Security -->
+ <characteristics id="9" kee="USABILITY" name="Usability" parent_id="[null]" characteristic_order="5" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+ <!-- New sub characteristics under Usability -->
+ <characteristics id="10" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+ <characteristics id="11" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+ <characteristics id="12" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="9" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Reusability -->
+ <characteristics id="13" kee="REUSABILITY_COMPLIANCE" name="Reusability Compliance" parent_id="1" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Portability -->
+ <characteristics id="14" kee="PORTABILITY_COMPLIANCE" name="Portability Compliance" parent_id="2" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Maintainability -->
+ <characteristics id="15" kee="MAINTAINABILITY_COMPLIANCE" name="Maintainability Compliance" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Security -->
+ <characteristics id="16" kee="SECURITY_COMPLIANCE" name="Security Compliance" parent_id="4" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Efficiency -->
+ <characteristics id="17" kee="EFFICIENCY_COMPLIANCE" name="Efficiency Compliance" parent_id="5" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Changeability -->
+ <characteristics id="18" kee="CHANGEABILITY_COMPLIANCE" name="Changeability Compliance" parent_id="6" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Reliability -->
+ <characteristics id="19" kee="RELIABILITY_COMPLIANCE" name="Reliability Compliance" parent_id="7" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Testability -->
+ <characteristics id="20" kee="TESTABILITY_COMPLIANCE" name="Testability Compliance" parent_id="8" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <characteristics id="1" kee="REUSABILITY" name="Reusability" parent_id="[null]" characteristic_order="1" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="2" kee="PORTABILITY" name="Portability" parent_id="[null]" characteristic_order="2" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="3" kee="MAINTAINABILITY" name="Maintainability" parent_id="[null]" characteristic_order="3" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="4" kee="SECURITY" name="Security" parent_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="5" kee="EFFICIENCY" name="Efficiency" parent_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="6" kee="CHANGEABILITY" name="Changeability" parent_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="7" kee="RELIABILITY" name="Reliability" parent_id="[null]" characteristic_order="7" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="8" kee="TESTABILITY" name="Testability" parent_id="[null]" characteristic_order="8" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+</dataset>
--- /dev/null
+CREATE TABLE "CHARACTERISTICS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "KEE" VARCHAR(100),
+ "NAME" VARCHAR(100),
+ "PARENT_ID" INTEGER,
+ "CHARACTERISTIC_ORDER" INTEGER,
+ "ENABLED" BOOLEAN,
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP
+);
--- /dev/null
+<dataset>
+
+ <characteristics id="1" kee="SECURITY" name="Security" parent_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <!-- Oder has changed : this characteristic is now one step lower -->
+ <characteristics id="2" kee="EFFICIENCY" name="Efficiency" parent_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+
+ <!-- Usability is moved after Security -->
+ <characteristics id="3" kee="USABILITY" name="Usability" parent_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="2015-02-15"/>
+
+ <!-- New sub characteristics under Usability -->
+ <characteristics id="4" kee="USABILITY_ACCESSIBILITY" name="Accessibility" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+ <characteristics id="5" kee="USABILITY_EASE_OF_USE" name="Ease of Use" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+ <characteristics id="6" kee="USABILITY_COMPLIANCE" name="Usability Compliance" parent_id="3" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Security -->
+ <characteristics id="7" kee="SECURITY_COMPLIANCE" name="Security Compliance" parent_id="1" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+ <!-- New sub characteristic 'Compliance' under Efficiency -->
+ <characteristics id="8" kee="EFFICIENCY_COMPLIANCE" name="Efficiency Compliance" parent_id="2" characteristic_order="[null]" enabled="[true]" created_at="2015-02-15" updated_at="[null]"/>
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <characteristics id="1" kee="SECURITY" name="Security" parent_id="[null]" characteristic_order="4" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <characteristics id="2" kee="EFFICIENCY" name="Efficiency" parent_id="[null]" characteristic_order="5" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+ <!-- Usability should be move after Security -->
+ <characteristics id="3" kee="USABILITY" name="Usability" parent_id="[null]" characteristic_order="6" enabled="[true]" created_at="2013-11-20" updated_at="2013-11-22"/>
+
+</dataset>
--- /dev/null
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# SonarQube is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# SonarQube 4.5.3
+# SONAR-6187
+#
+class AddCharacteristicUsabilityAndSubCharacteristicsCompliance < ActiveRecord::Migration
+
+ def self.up
+ execute_java_migration 'org.sonar.server.db.migrations.v453.AddCharacteristicUsabilityAndSubCharacteristicsComplianceMigration'
+ end
+
+end
*/
public class DatabaseVersion implements BatchComponent, ServerComponent {
- public static final int LAST_VERSION = 605;
+ public static final int LAST_VERSION = 606;
public static enum Status {
UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('603');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('604');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('605');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('606');
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;
*/
public static final String UNIT_TESTABILITY = "UNIT_TESTABILITY";
+ /**
+ * Related to characteristic ACCESSIBILITY
+ */
+ public static final String USABILITY_ACCESSIBILITY = "USABILITY_ACCESSIBILITY";
+
+ /**
+ * Related to characteristic ACCESSIBILITY
+ */
+ public static final String USABILITY_COMPLIANCE = "USABILITY_COMPLIANCE";
+
+ /**
+ * Related to characteristic ACCESSIBILITY
+ */
+ public static final String USABILITY_EASE_OF_USE = "USABILITY_EASE_OF_USE";
+
+ /**
+ * Related to characteristic REUSABILITY
+ */
+ public static final String REUSABILITY_COMPLIANCE = "REUSABILITY_COMPLIANCE";
+
+ /**
+ * Related to characteristic PORTABILITY
+ */
+ public static final String PORTABILITY_COMPLIANCE = "PORTABILITY_COMPLIANCE";
+
+ /**
+ * Related to characteristic MAINTAINABILITY
+ */
+ public static final String MAINTAINABILITY_COMPLIANCE = "MAINTAINABILITY_COMPLIANCE";
+
+ /**
+ * Related to characteristic SECURITY
+ */
+ public static final String SECURITY_COMPLIANCE = "SECURITY_COMPLIANCE";
+
+ /**
+ * Related to characteristic EFFICIENCY
+ */
+ public static final String EFFICIENCY_COMPLIANCE = "EFFICIENCY_COMPLIANCE";
+
+ /**
+ * Related to characteristic CHANGEABILITY
+ */
+ public static final String CHANGEABILITY_COMPLIANCE = "CHANGEABILITY_COMPLIANCE";
+
+ /**
+ * Related to characteristic RELIABILITY
+ */
+ public static final String RELIABILITY_COMPLIANCE = "RELIABILITY_COMPLIANCE";
+
+ /**
+ * Related to characteristic TESTABILITY
+ */
+ public static final String TESTABILITY_COMPLIANCE = "TESTABILITY_COMPLIANCE";
+
private SubCharacteristics() {
// only constants
}