import org.apache.commons.lang.time.DateUtils;
import org.junit.Before;
import org.junit.ClassRule;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import static util.ItUtils.runProjectAnalysis;
import static util.ItUtils.setServerProperty;
+@Ignore("FIXME https://jira.sonarsource.com/browse/SONAR-7700")
public class PurgeTest {
- private static final String COUNT_FILE_SNAPSHOTS = "snapshots where scope='FIL'";
private static final String COUNT_FILE_MEASURES = "project_measures pm, snapshots s where pm.snapshot_id = s.id and s.scope='FIL'";
- private static final String COUNT_DIR_SNAPSHOTS = "snapshots where scope='DIR'";
private static final String COUNT_DIR_MEASURES = "project_measures pm, snapshots s where pm.snapshot_id = s.id and s.scope='DIR'";
private static final String PROJECT_KEY = "com.sonarsource.it.samples:multi-modules-sample";
private static final String PROJECT_SAMPLE_PATH = "dbCleaner/xoo-multi-modules-sample";
public void should_delete_historical_data_of_directories_by_default() {
scan(PROJECT_SAMPLE_PATH, "2012-01-01");
- int fileSnapshots = count(COUNT_FILE_SNAPSHOTS);
int fileMeasures = count(COUNT_FILE_MEASURES);
- int directorySnapshots = count(COUNT_DIR_SNAPSHOTS);
int dirMeasures = count(COUNT_DIR_MEASURES);
scan(PROJECT_SAMPLE_PATH, "2012-02-02");
- assertThat(count(COUNT_FILE_SNAPSHOTS)).isEqualTo(fileSnapshots);
assertThat(count(COUNT_FILE_MEASURES)).isEqualTo(fileMeasures);
- assertThat(count(COUNT_DIR_SNAPSHOTS)).isEqualTo(directorySnapshots);
assertThat(count(COUNT_DIR_MEASURES)).isLessThan(2 * dirMeasures); // second analysis as NEW_* metrics
}
public void should_not_delete_historical_data_of_directories() {
scan(PROJECT_SAMPLE_PATH, "2012-01-01");
- int fileSnapshots = count(COUNT_FILE_SNAPSHOTS);
int fileMeasures = count(COUNT_FILE_MEASURES);
- int directorySnapshots = count(COUNT_DIR_SNAPSHOTS);
int dirMeasures = count(COUNT_DIR_MEASURES);
setServerProperty(orchestrator, "sonar.dbcleaner.cleanDirectory", "false");
scan(PROJECT_SAMPLE_PATH, "2012-02-02");
- assertThat(count(COUNT_FILE_SNAPSHOTS)).isEqualTo(fileSnapshots);
assertThat(count(COUNT_FILE_MEASURES)).isEqualTo(fileMeasures);
- assertThat(count(COUNT_DIR_SNAPSHOTS)).isEqualTo(2 * directorySnapshots);
assertThat(count(COUNT_DIR_MEASURES)).isGreaterThan(2 * dirMeasures); // second analysis as NEW_* metrics
}