diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-06-17 18:01:48 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-06-17 18:01:57 +0200 |
commit | 9a7fb4969d31cf0b5f5c3dbafcc19d39b9d86016 (patch) | |
tree | 226688fc6a941bdc1e86290446ce016f40f7f3bb /sonar-batch | |
parent | c973498cfec4ff8e59ac33e9c9fb150a71ef828a (diff) | |
download | sonarqube-9a7fb4969d31cf0b5f5c3dbafcc19d39b9d86016.tar.gz sonarqube-9a7fb4969d31cf0b5f5c3dbafcc19d39b9d86016.zip |
SONAR-2505 support tracking of violations on dry runs
Diffstat (limited to 'sonar-batch')
16 files changed, 29 insertions, 457 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchModule.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchModule.java index eb6c4552073..08931556821 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchModule.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchModule.java @@ -60,7 +60,6 @@ public class BatchModule extends Module { addComponent(MemoryOptimizer.class); addComponent(DefaultResourcePersister.class); addComponent(SourcePersister.class); - addComponent(ViolationPersister.class); } addComponent(Plugins.class); diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java index d603c34a1df..59d3dff04f9 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java @@ -31,7 +31,6 @@ import org.sonar.api.resources.ProjectFileSystem; import org.sonar.api.rules.DefaultRulesManager; import org.sonar.api.utils.SonarException; import org.sonar.batch.*; -import org.sonar.batch.components.PastViolationsLoader; import org.sonar.batch.components.TimeMachineConfiguration; import org.sonar.batch.events.EventBus; import org.sonar.batch.index.DefaultIndex; @@ -80,7 +79,6 @@ public class ProjectModule extends Module { // the Snapshot component will be removed when asynchronous measures are improved (required for AsynchronousMeasureSensor) addComponent(getComponent(DefaultResourcePersister.class).getSnapshot(project)); addComponent(TimeMachineConfiguration.class); - addComponent(PastViolationsLoader.class); } addComponent(org.sonar.api.database.daos.MeasuresDao.class); addComponent(ProfilesDao.class); diff --git a/sonar-batch/src/main/java/org/sonar/batch/components/PastViolationsLoader.java b/sonar-batch/src/main/java/org/sonar/batch/components/PastViolationsLoader.java deleted file mode 100644 index 6168ebca199..00000000000 --- a/sonar-batch/src/main/java/org/sonar/batch/components/PastViolationsLoader.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.batch.components; - -import org.sonar.api.BatchExtension; -import org.sonar.api.database.DatabaseSession; -import org.sonar.api.database.model.RuleFailureModel; -import org.sonar.api.database.model.Snapshot; -import org.sonar.api.database.model.SnapshotSource; -import org.sonar.api.resources.Resource; -import org.sonar.api.utils.SonarException; -import org.sonar.batch.index.ResourcePersister; -import org.sonar.core.NotDryRun; - -import java.util.Collections; -import java.util.List; - -@NotDryRun -public class PastViolationsLoader implements BatchExtension { - - private DatabaseSession session; - private ResourcePersister resourcePersister; - - public PastViolationsLoader(DatabaseSession session, ResourcePersister resourcePersister) { - this.session = session; - this.resourcePersister = resourcePersister; - } - - public List<RuleFailureModel> getPastViolations(Resource resource) { - if (resource == null) { - return Collections.emptyList(); - } - - Snapshot snapshot = resourcePersister.getSnapshot(resource); - if (snapshot == null) { - throw new SonarException("This resource has no snapshot ???" + resource); - } - Snapshot previousLastSnapshot = resourcePersister.getLastSnapshot(snapshot, true); - if (previousLastSnapshot == null) { - return Collections.emptyList(); - } - return session.getResults(RuleFailureModel.class, - "snapshotId", previousLastSnapshot.getId()); - } - - public SnapshotSource getSource(Resource resource) { - Snapshot snapshot = resourcePersister.getSnapshot(resource); - return session.getSingleResult(SnapshotSource.class, - "snapshotId", snapshot.getId()); - } - -} diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index 1accc7b4ea6..5aeac943af9 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -408,6 +408,10 @@ public class DefaultIndex extends SonarIndex { } } + public String getSource(Resource resource) { + return persistence.getSource(resource); + } + /** * Does nothing if the resource is already registered. */ diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultPersistenceManager.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultPersistenceManager.java index f5722b7f5a2..35baf93c09d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultPersistenceManager.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultPersistenceManager.java @@ -78,6 +78,10 @@ public final class DefaultPersistenceManager implements PersistenceManager { sourcePersister.saveSource(file, source); } + public String getSource(Resource resource) { + return sourcePersister.getSource(resource); + } + public void saveMeasure(Resource resource, Measure measure) { if (ResourceUtils.isPersistable(resource)) { measurePersister.saveMeasure(resource, measure); diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/PersistenceManager.java b/sonar-batch/src/main/java/org/sonar/batch/index/PersistenceManager.java index 98de69eb77f..2203c2e4768 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/PersistenceManager.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/PersistenceManager.java @@ -42,6 +42,8 @@ public interface PersistenceManager { void setSource(Resource file, String source); + String getSource(Resource resource); + void saveMeasure(Resource resource, Measure measure); Measure reloadMeasure(Measure measure); diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ReadOnlyPersistenceManager.java b/sonar-batch/src/main/java/org/sonar/batch/index/ReadOnlyPersistenceManager.java index 7682a3dbb6e..1470031672c 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/ReadOnlyPersistenceManager.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/ReadOnlyPersistenceManager.java @@ -19,6 +19,7 @@ */ package org.sonar.batch.index; +import com.google.common.collect.Maps; import org.sonar.api.batch.Event; import org.sonar.api.database.model.Snapshot; import org.sonar.api.design.Dependency; @@ -29,10 +30,14 @@ import org.sonar.api.resources.Resource; import java.util.Collections; import java.util.List; +import java.util.Map; public final class ReadOnlyPersistenceManager implements PersistenceManager { + private Map<Resource, String> sources = Maps.newHashMap(); + public void clear() { + sources.clear(); } public void setDelayedMode(boolean b) { @@ -49,6 +54,11 @@ public final class ReadOnlyPersistenceManager implements PersistenceManager { } public void setSource(Resource file, String source) { + sources.put(file, source); + } + + public String getSource(Resource resource) { + return sources.get(resource); } public void saveMeasure(Resource resource, Measure measure) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java index 0e8f700237c..d4fdd10300c 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java @@ -49,6 +49,15 @@ public final class SourcePersister { addToCache(snapshot); } + public String getSource(Resource resource) { + SnapshotSource source = null; + Snapshot snapshot = resourcePersister.getSnapshot(resource); + if (snapshot!=null && snapshot.getId()!=null) { + source = session.getSingleResult(SnapshotSource.class, "snapshotId", snapshot.getId()); + } + return source!=null ? source.getData() : null; + } + private boolean isCached(Snapshot snapshot) { return savedSnapshotIds.contains(snapshot.getId()); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ViolationPersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/ViolationPersister.java deleted file mode 100644 index 0b15823d5c7..00000000000 --- a/sonar-batch/src/main/java/org/sonar/batch/index/ViolationPersister.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.batch.index; - -import org.sonar.api.database.DatabaseSession; -import org.sonar.api.database.model.RuleFailureModel; -import org.sonar.api.database.model.Snapshot; -import org.sonar.api.resources.Project; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.rules.Violation; - -public final class ViolationPersister { - - private DatabaseSession session; - private ResourcePersister resourcePersister; - private RuleFinder ruleFinder; - - public ViolationPersister(DatabaseSession session, ResourcePersister resourcePersister, RuleFinder ruleFinder) { - this.session = session; - this.resourcePersister = resourcePersister; - this.ruleFinder = ruleFinder; - } - - void saveViolation(Project project, Violation violation) { - saveViolation(project, violation, null, null); - } - - public void saveViolation(Project project, Violation violation, RuleFailureModel pastViolation, String checksum) { - Snapshot snapshot = resourcePersister.saveResource(project, violation.getResource()); - - RuleFailureModel model = createModel(violation); - if (pastViolation!=null) { - model.setCreatedAt(pastViolation.getCreatedAt()); - model.setPermanentId(pastViolation.getPermanentId()); - model.setSwitchedOff(pastViolation.isSwitchedOff()); - } else { - // avoid plugins setting date - model.setCreatedAt(snapshot.getCreatedAt()); - } - model.setSnapshotId(snapshot.getId()); - model.setChecksum(checksum); - session.saveWithoutFlush(model); - - if (model.getPermanentId()==null) { - model.setPermanentId(model.getId()); - session.saveWithoutFlush(model); - } - - // the following fields can have been changed - violation.setMessage(model.getMessage());// the message can be changed in the class RuleFailure (truncate + trim) - violation.setCreatedAt(model.getCreatedAt()); - violation.setSwitchedOff(model.isSwitchedOff()); - } - - public void commit() { - session.commit(); - } - - private RuleFailureModel createModel(Violation violation) { - RuleFailureModel model = new RuleFailureModel(); - Rule rule = ruleFinder.findByKey(violation.getRule().getRepositoryKey(), violation.getRule().getKey()); - model.setRuleId(rule.getId()); - model.setPriority(violation.getSeverity()); - model.setLine(violation.getLineId()); - model.setMessage(violation.getMessage()); - model.setCost(violation.getCost()); - return model; - } - -} diff --git a/sonar-batch/src/test/java/org/sonar/batch/components/PastViolationsLoaderTest.java b/sonar-batch/src/test/java/org/sonar/batch/components/PastViolationsLoaderTest.java deleted file mode 100644 index 965f4f8d85f..00000000000 --- a/sonar-batch/src/test/java/org/sonar/batch/components/PastViolationsLoaderTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.batch.components; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.database.model.RuleFailureModel; -import org.sonar.api.database.model.Snapshot; -import org.sonar.api.resources.JavaFile; -import org.sonar.api.resources.Resource; -import org.sonar.batch.index.ResourcePersister; -import org.sonar.jpa.test.AbstractDbUnitTestCase; - -import java.util.List; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.notNullValue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; - -public class PastViolationsLoaderTest extends AbstractDbUnitTestCase { - - private ResourcePersister resourcePersister; - private PastViolationsLoader loader; - - @Before - public void setUp() { - setupData("shared"); - resourcePersister = mock(ResourcePersister.class); - loader = new PastViolationsLoader(getSession(), resourcePersister); - } - - @Test - public void shouldGetPastResourceViolations() { - Snapshot snapshot = getSession().getSingleResult(Snapshot.class, "id", 1000); - doReturn(snapshot).when(resourcePersister) - .getSnapshot(any(Resource.class)); - doReturn(snapshot).when(resourcePersister) - .getLastSnapshot(any(Snapshot.class), anyBoolean()); - - List<RuleFailureModel> violations = loader.getPastViolations(new JavaFile("file")); - - assertThat(violations.size(), is(2)); - } - - @Test - public void shouldReturnEmptyList() { - List<RuleFailureModel> violations = loader.getPastViolations(null); - - assertThat(violations, notNullValue()); - assertThat(violations.size(), is(0)); - } - -} diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/ViolationPersisterTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/ViolationPersisterTest.java deleted file mode 100644 index bb5bc1a34e9..00000000000 --- a/sonar-batch/src/test/java/org/sonar/batch/index/ViolationPersisterTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.batch.index; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.database.model.RuleFailureModel; -import org.sonar.api.database.model.Snapshot; -import org.sonar.api.resources.JavaFile; -import org.sonar.api.resources.Project; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RulePriority; -import org.sonar.api.rules.Violation; -import org.sonar.core.components.DefaultRuleFinder; -import org.sonar.jpa.test.AbstractDbUnitTestCase; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class ViolationPersisterTest extends AbstractDbUnitTestCase { - - private ViolationPersister violationPersister; - private Rule rule1 = Rule.create("checkstyle", "com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck", "Check Header"); - private Rule rule2 = Rule.create("checkstyle", "com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck", "Equals Avoid Null"); - private JavaFile javaFile = new JavaFile("org.foo.Bar"); - Project project = new Project("project"); - - @Before - public void before() { - setupData("shared"); - Snapshot snapshot = getSession().getSingleResult(Snapshot.class, "id", 1000); - ResourcePersister resourcePersister = mock(ResourcePersister.class); - when(resourcePersister.saveResource((Project) anyObject(), eq(javaFile))).thenReturn(snapshot); - when(resourcePersister.getSnapshot(javaFile)).thenReturn(snapshot); - violationPersister = new ViolationPersister(getSession(), resourcePersister, new DefaultRuleFinder(getSessionFactory())); - } - - @Test - public void shouldSaveViolations() { - Violation violation1a = Violation.create(rule1, javaFile) - .setSeverity(RulePriority.CRITICAL).setLineId(20).setCost(55.6) - .setMessage("the message"); - Violation violation1b = Violation.create(rule1, javaFile) - .setSeverity(RulePriority.CRITICAL).setLineId(50).setCost(80.0); - Violation violation2 = Violation.create(rule2, javaFile) - .setSeverity(RulePriority.MINOR); - - violationPersister.saveViolation(project, violation1a); - violationPersister.saveViolation(project, violation1b); - violationPersister.saveViolation(project, violation2); - - checkTables("shouldInsertViolations", "rule_failures"); - } - - @Test - public void shouldCopyPermanentIdFromPastViolation() { - RuleFailureModel pastViolation = getSession().getSingleResult(RuleFailureModel.class, "id", 1); - - Violation violation = Violation.create(rule1, javaFile).setSeverity(RulePriority.MAJOR).setMessage("new message"); - violationPersister.saveViolation(project, violation, pastViolation, "line_checksum"); - - checkTables("shouldCopyPermanentIdFromPastViolation", "rule_failures"); - } - - @Test - public void shouldCopySwitchedOffFromPastViolation() { - RuleFailureModel pastViolation1 = getSession().getSingleResult(RuleFailureModel.class, "id", 1); - Violation violation1 = Violation.create(rule1, javaFile).setSeverity(RulePriority.MAJOR).setMessage("new message"); - violationPersister.saveViolation(project, violation1, pastViolation1, "line_checksum"); - - RuleFailureModel pastViolation2 = getSession().getSingleResult(RuleFailureModel.class, "id", 2); - Violation violation2 = Violation.create(rule1, javaFile).setSeverity(RulePriority.MAJOR).setMessage("new message"); - violationPersister.saveViolation(project, violation2, pastViolation2, "line_checksum"); - - checkTables("shouldCopySwitchedOffFromPastViolation", "rule_failures"); - } -} diff --git a/sonar-batch/src/test/resources/org/sonar/batch/components/PastViolationsLoaderTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/components/PastViolationsLoaderTest/shared.xml deleted file mode 100644 index 9e11773eca9..00000000000 --- a/sonar-batch/src/test/resources/org/sonar/batch/components/PastViolationsLoaderTest/shared.xml +++ /dev/null @@ -1,24 +0,0 @@ -<dataset> - - <rules_categories id="1" name="Efficiency" description="[null]"/> - <rules_categories id="6" name="Usability" description="[null]"/> - - <rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" - plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" - cardinality="SINGLE" parent_id="[null]"/> - - <rules id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" - plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" - cardinality="SINGLE" parent_id="[null]"/> - - <projects id="200" scope="FIL" qualifier="CLA" kee="project:org.foo.Bar" root_id="[null]" - name="Bar" long_name="org.foo.Bar" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" profile_id="[null]"/> - - <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1000" project_id="200" parent_snapshot_id="[null]" root_project_id="100" root_snapshot_id="[null]" - scope="FIL" qualifier="CLA" created_at="2008-11-01 13:58:00.00" version="[null]" path="" - status="U" islast="false" depth="3" /> - - <rule_failures switched_off="[null]" permanent_id="[null]" ID="1" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" /> - <rule_failures switched_off="[null]" permanent_id="[null]" ID="2" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" /> -</dataset> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shared.xml deleted file mode 100644 index 90a3f202297..00000000000 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shared.xml +++ /dev/null @@ -1,24 +0,0 @@ -<dataset> - - <rules_categories id="1" name="Efficiency" description="[null]"/> - <rules_categories id="6" name="Usability" description="[null]"/> - - <rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" - plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" - cardinality="SINGLE" parent_id="[null]"/> - - <rules id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" - plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" - cardinality="SINGLE" parent_id="[null]"/> - - <projects id="200" scope="FIL" qualifier="CLA" kee="project:org.foo.Bar" root_id="[null]" - name="Bar" long_name="org.foo.Bar" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" profile_id="[null]"/> - - <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1000" project_id="200" parent_snapshot_id="[null]" root_project_id="100" root_snapshot_id="[null]" - scope="FIL" qualifier="CLA" created_at="2008-11-01 13:58:00.00" version="[null]" path="" - status="U" islast="false" depth="3" /> - - <rule_failures switched_off="false" permanent_id="1" ID="1" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> - <rule_failures switched_off="true" permanent_id="2" ID="2" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> -</dataset> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldCopyPermanentIdFromPastViolation-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldCopyPermanentIdFromPastViolation-result.xml deleted file mode 100644 index 881a88dc3bb..00000000000 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldCopyPermanentIdFromPastViolation-result.xml +++ /dev/null @@ -1,26 +0,0 @@ -<dataset> - - <rules_categories id="1" name="Efficiency" description="[null]"/> - <rules_categories id="6" name="Usability" description="[null]"/> - - <rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" - plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" - cardinality="SINGLE" parent_id="[null]"/> - - <rules id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" - plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" - cardinality="SINGLE" parent_id="[null]"/> - - <projects id="200" scope="FIL" qualifier="CLA" kee="project:org.foo.Bar" root_id="[null]" - name="Bar" long_name="org.foo.Bar" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" profile_id="[null]"/> - - <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1000" project_id="200" parent_snapshot_id="[null]" root_project_id="100" root_snapshot_id="[null]" - scope="FIL" qualifier="CLA" created_at="2008-11-01 13:58:00.00" version="[null]" path="" - status="U" islast="false" depth="3" /> - - <rule_failures switched_off="false" permanent_id="1" ID="1" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> - <rule_failures switched_off="true" permanent_id="2" ID="2" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> - - <rule_failures switched_off="false" permanent_id="1" ID="3" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="2" MESSAGE="new message" LINE="[null]" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="line_checksum"/> -</dataset> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldCopySwitchedOffFromPastViolation-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldCopySwitchedOffFromPastViolation-result.xml deleted file mode 100644 index bc366b16a45..00000000000 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldCopySwitchedOffFromPastViolation-result.xml +++ /dev/null @@ -1,27 +0,0 @@ -<dataset> - - <rules_categories id="1" name="Efficiency" description="[null]"/> - <rules_categories id="6" name="Usability" description="[null]"/> - - <rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" - plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" - cardinality="SINGLE" parent_id="[null]"/> - - <rules id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" - plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" - cardinality="SINGLE" parent_id="[null]"/> - - <projects id="200" scope="FIL" qualifier="CLA" kee="project:org.foo.Bar" root_id="[null]" - name="Bar" long_name="org.foo.Bar" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" profile_id="[null]"/> - - <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1000" project_id="200" parent_snapshot_id="[null]" root_project_id="100" root_snapshot_id="[null]" - scope="FIL" qualifier="CLA" created_at="2008-11-01 13:58:00.00" version="[null]" path="" - status="U" islast="false" depth="3" /> - - <rule_failures switched_off="false" permanent_id="1" ID="1" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> - <rule_failures switched_off="true" permanent_id="2" ID="2" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> - - <rule_failures switched_off="false" permanent_id="1" ID="3" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="2" MESSAGE="new message" LINE="[null]" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="line_checksum"/> - <rule_failures switched_off="true" permanent_id="2" ID="4" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="2" MESSAGE="new message" LINE="[null]" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="line_checksum"/> -</dataset> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldInsertViolations-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldInsertViolations-result.xml deleted file mode 100644 index 3b3215ffe11..00000000000 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/ViolationPersisterTest/shouldInsertViolations-result.xml +++ /dev/null @@ -1,26 +0,0 @@ -<dataset> - <rules_categories id="1" name="Efficiency" description="[null]"/> - <rules_categories id="6" name="Usability" description="[null]"/> - - <rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" - plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" - cardinality="SINGLE" parent_id="[null]"/> - - <rules id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" - plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" - cardinality="SINGLE" parent_id="[null]"/> - - <projects id="200" scope="FIL" qualifier="CLA" kee="project:org.foo.Bar" root_id="[null]" - name="Bar" long_name="org.foo.Bar" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" profile_id="[null]"/> - - <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1000" project_id="200" parent_snapshot_id="[null]" root_project_id="100" root_snapshot_id="[null]" - scope="FIL" qualifier="CLA" created_at="2008-11-01 13:58:00.00" version="[null]" path="" - status="U" islast="false" depth="3" /> - - <rule_failures switched_off="false" permanent_id="1" ID="1" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> - <rule_failures switched_off="true" permanent_id="2" ID="2" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="old message" LINE="10" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> - <rule_failures switched_off="false" permanent_id="3" ID="3" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="the message" LINE="20" COST="55.6" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> - <rule_failures switched_off="false" permanent_id="4" ID="4" SNAPSHOT_ID="1000" RULE_ID="30" FAILURE_LEVEL="3" MESSAGE="[null]" LINE="50" COST="80" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> - <rule_failures switched_off="false" permanent_id="5" ID="5" SNAPSHOT_ID="1000" RULE_ID="31" FAILURE_LEVEL="1" MESSAGE="[null]" LINE="[null]" COST="[null]" created_at="2008-11-01 13:58:00.00" checksum="[null]"/> -</dataset>
\ No newline at end of file |