use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.
the class LoadPeriodsStepTest method feed_period_by_previous_analysis.
@Test
@UseDataProvider("projectAndViewRoots")
public void feed_period_by_previous_analysis(Component root) {
setupRoot(root);
dbTester.prepareDbUnit(getClass(), "shared.xml");
settings.setProperty("sonar.leak.period", "previous_analysis");
underTest.execute();
// return analysis from 2008-11-29
Period period = periodsHolder.getPeriod();
assertThat(period).isNotNull();
assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS);
assertThat(period.getModeParameter()).isNotNull();
assertThat(period.getSnapshotDate()).isEqualTo(1227934800000L);
assertThat(period.getAnalysisUuid()).isEqualTo("u1004");
assertThat(logTester.logs()).hasSize(1);
assertThat(logTester.logs().get(0)).startsWith("Compare to previous analysis (");
}
use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.
the class LoadPeriodsStepTest method feed_one_period.
@Test
@UseDataProvider("projectAndViewRoots")
public void feed_one_period(Component root) {
setupRoot(root);
dbTester.prepareDbUnit(getClass(), "shared.xml");
String textDate = "2008-11-22";
settings.setProperty("sonar.leak.period", textDate);
underTest.execute();
Period period = periodsHolder.getPeriod();
assertThat(period).isNotNull();
assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_DATE);
assertThat(period.getModeParameter()).isEqualTo(textDate);
assertThat(period.getSnapshotDate()).isEqualTo(1227358680000L);
assertThat(period.getAnalysisUuid()).isEqualTo("u1003");
}
use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.
the class LoadPeriodsStepTest method feed_period_by_date.
@Test
@UseDataProvider("projectAndViewRoots")
public void feed_period_by_date(Component root) {
setupRoot(root);
dbTester.prepareDbUnit(getClass(), "shared.xml");
String textDate = "2008-11-22";
settings.setProperty("sonar.leak.period", textDate);
underTest.execute();
// Return analysis from given date 2008-11-22
Period period = periodsHolder.getPeriod();
assertThat(period).isNotNull();
assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_DATE);
assertThat(period.getModeParameter()).isEqualTo(textDate);
assertThat(period.getSnapshotDate()).isEqualTo(1227358680000L);
assertThat(period.getAnalysisUuid()).isEqualTo("u1003");
assertThat(logTester.logs()).hasSize(1);
assertThat(logTester.logs().get(0)).startsWith("Compare to date 2008-11-22 (analysis of ");
}
use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.
the class LoadPeriodsStepTest method feed_period_by_days.
@Test
@UseDataProvider("projectAndViewRoots")
public void feed_period_by_days(Component root) {
setupRoot(root);
dbTester.prepareDbUnit(getClass(), "shared.xml");
settings.setProperty("sonar.leak.period", "10");
underTest.execute();
// return analysis from 2008-11-20
Period period = periodsHolder.getPeriod();
assertThat(period).isNotNull();
assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_DAYS);
assertThat(period.getModeParameter()).isEqualTo("10");
assertThat(period.getSnapshotDate()).isEqualTo(1227157200000L);
assertThat(period.getAnalysisUuid()).isEqualTo("u1002");
assertThat(logTester.logs()).hasSize(1);
assertThat(logTester.logs().get(0)).startsWith("Compare over 10 days (2008-11-20, analysis of ");
}
use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.
the class LoadPeriodsStepTest method search_by_date_return_nearest_later_analysis.
@Test
@UseDataProvider("projectAndViewRoots")
public void search_by_date_return_nearest_later_analysis(Component root) {
setupRoot(root);
dbTester.prepareDbUnit(getClass(), "shared.xml");
String date = "2008-11-24";
settings.setProperty("sonar.leak.period", date);
underTest.execute();
// Analysis form 2008-11-29
Period period = periodsHolder.getPeriod();
assertThat(period).isNotNull();
assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_DATE);
assertThat(period.getModeParameter()).isEqualTo(date);
assertThat(period.getSnapshotDate()).isEqualTo(1227934800000L);
assertThat(period.getAnalysisUuid()).isEqualTo("u1004");
}
Aggregations