diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-02 14:24:33 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-02 14:24:33 +0100 |
commit | efa104638b9cdd7d2821c85b399efb35ca750252 (patch) | |
tree | 8e5aceaea215913c3645a59447deb39c438a7c64 /plugins | |
parent | 2ec8150bf7b1f1808791b211e8cb99b6ea7a974f (diff) | |
download | sonarqube-efa104638b9cdd7d2821c85b399efb35ca750252.tar.gz sonarqube-efa104638b9cdd7d2821c85b399efb35ca750252.zip |
Add unit tests, remove the hibernate model Review and improve ReviewPredicates
Diffstat (limited to 'plugins')
3 files changed, 5 insertions, 5 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualViolationInjector.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualViolationInjector.java index 153a59ffe0b..bd5ddf39192 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualViolationInjector.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualViolationInjector.java @@ -53,8 +53,8 @@ public class ManualViolationInjector implements Decorator { public void decorate(Resource resource, DecoratorContext context) { if (resource.getId() != null) { Collection<ReviewDto> openReviews = reviewDao.selectOpenByResourceId(resource.getId(), - ReviewPredicates.StatusPredicate.create(ReviewDto.STATUS_OPEN), - ReviewPredicates.ManualViolationPredicate.create()); + ReviewPredicates.status(ReviewDto.STATUS_OPEN), + ReviewPredicates.manualViolation()); for (ReviewDto openReview : openReviews) { if (openReview.getRuleId() == null) { LoggerFactory.getLogger(getClass()).warn("No rule is defined on the review with id: " + openReview.getId()); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecorator.java index 738ad8b4cab..a61a523c2c2 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecorator.java @@ -74,7 +74,7 @@ public class ReviewsMeasuresDecorator implements Decorator { // Load open reviews (used for counting and also for tracking new violations without a review) Collection<ReviewDto> openReviews = reviewDao.selectOpenByResourceId(resource.getId(), - ReviewPredicates.StatusPredicate.create(ReviewDto.STATUS_OPEN, ReviewDto.STATUS_REOPENED)); + ReviewPredicates.status(ReviewDto.STATUS_OPEN, ReviewDto.STATUS_REOPENED)); Map<Integer, ReviewDto> openReviewsByViolationPermanentId = Maps.newHashMap(); int countUnassigned = 0; @@ -95,7 +95,7 @@ public class ReviewsMeasuresDecorator implements Decorator { context.saveMeasure(CoreMetrics.UNPLANNED_REVIEWS, (double) (unplanned + sumChildren(resource, context, CoreMetrics.UNPLANNED_REVIEWS))); Collection<ReviewDto> falsePositives = reviewDao.selectOpenByResourceId(resource.getId(), - ReviewPredicates.ResolutionPredicate.create(ReviewDto.RESOLUTION_FALSE_POSITIVE)); + ReviewPredicates.resolution(ReviewDto.RESOLUTION_FALSE_POSITIVE)); context.saveMeasure(CoreMetrics.FALSE_POSITIVE_REVIEWS, (double) (falsePositives.size() + sumChildren(resource, context, CoreMetrics.FALSE_POSITIVE_REVIEWS))); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationSeverityUpdater.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationSeverityUpdater.java index c0bef90b911..575565777d8 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationSeverityUpdater.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationSeverityUpdater.java @@ -78,7 +78,7 @@ public class ViolationSeverityUpdater implements Decorator { } private Collection<ReviewDto> selectReviewsWithManualSeverity(long resourceId) { - return reviewDao.selectOpenByResourceId(resourceId, ReviewPredicates.ManualSeverityPredicate.create()); + return reviewDao.selectOpenByResourceId(resourceId, ReviewPredicates.manualSeverity()); } private Map<Integer, Violation> filterViolationsPerPermanent(List<Violation> violations) { |