]> source.dussan.org Git - sonarqube.git/commitdiff
Merge branch-4.4
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 29 Jul 2014 07:11:12 +0000 (09:11 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 29 Jul 2014 07:11:12 +0000 (09:11 +0200)
1  2 
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest.java
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_nothing.xml
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationTest/migrate_nothing_result.xml

index 5372118b0df45f7368c08f4767bf50618c7b63af,0000000000000000000000000000000000000000..34e2574427ba289dab4fda57597e49e1ad072bfc
mode 100644,000000..100644
--- /dev/null
@@@ -1,80 -1,0 +1,89 @@@
 +/*
 + * 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.v43;
 +
 +import org.junit.Before;
 +import org.junit.ClassRule;
 +import org.junit.Test;
 +import org.junit.runner.RunWith;
 +import org.mockito.Mock;
 +import org.mockito.runners.MockitoJUnitRunner;
 +import org.sonar.core.persistence.TestDatabase;
 +import org.sonar.core.properties.PropertiesDao;
 +import org.sonar.core.properties.PropertyDto;
 +
 +import static org.mockito.Mockito.when;
 +
 +@RunWith(MockitoJUnitRunner.class)
 +public class TechnicalDebtMeasuresMigrationTest {
 +
 +  @ClassRule
 +  public static TestDatabase db = new TestDatabase().schema(TechnicalDebtMeasuresMigrationTest.class, "schema.sql");
 +
 +  @Mock
 +  PropertiesDao propertiesDao;
 +
 +  TechnicalDebtMeasuresMigration migration;
 +
 +  @Before
 +  public void setUp() throws Exception {
 +    when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8"));
 +
 +    migration = new TechnicalDebtMeasuresMigration(db.database(), propertiesDao);
 +  }
 +
++  @Test
++  public void migrate_nothing() throws Exception {
++    db.prepareDbUnit(getClass(), "migrate_nothing.xml");
++
++    migration.execute();
++
++    db.assertDbUnit(getClass(), "migrate_nothing.xml", "project_measures");
++  }
++
 +  @Test
 +  public void migrate_technical_debt_measures() throws Exception {
 +    db.prepareDbUnit(getClass(), "migrate_technical_debt_measures.xml");
 +
 +    migration.execute();
 +
 +    db.assertDbUnit(getClass(), "migrate_technical_debt_measures_result.xml", "project_measures");
 +  }
 +
 +  @Test
 +  public void migrate_added_technical_debt_measures() throws Exception {
 +    db.prepareDbUnit(getClass(), "migrate_new_technical_debt_measures.xml");
 +
 +    migration.execute();
 +
 +    db.assertDbUnit(getClass(), "migrate_new_technical_debt_measures_result.xml", "project_measures");
 +  }
 +
 +  @Test
 +  public void migrate_sqale_measures() throws Exception {
 +    db.prepareDbUnit(getClass(), "migrate_sqale_measures.xml");
 +
 +    migration.execute();
 +
 +    db.assertDbUnit(getClass(), "migrate_sqale_measures_result.xml", "project_measures");
 +  }
 +
 +}
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..d4e3f4a0101190112980a8ecaef88f853bea72e6
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,11 @@@
++<dataset>
++
++  <metrics delete_historical_data="[null]" id="2" name="nclc" VAL_TYPE="INTEGER" DESCRIPTION="[null]"  domain="[null]" short_name=""
++           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
++
++  <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
++                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
++                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
++                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
++
++</dataset>
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..d4e3f4a0101190112980a8ecaef88f853bea72e6
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,11 @@@
++<dataset>
++
++  <metrics delete_historical_data="[null]" id="2" name="nclc" VAL_TYPE="INTEGER" DESCRIPTION="[null]"  domain="[null]" short_name=""
++           enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
++
++  <project_measures id="2" VALUE="1.0" METRIC_ID="2" SNAPSHOT_ID="1000" alert_text="[null]" RULES_CATEGORY_ID="[null]"
++                    RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"
++                    alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" person_id="[null]"
++                    variation_value_1="1.0" variation_value_2="2.0" variation_value_3="3.0" variation_value_4="4.0" variation_value_5="5.0"/>
++
++</dataset>