diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-05-23 14:59:34 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-05-23 17:46:59 +0200 |
commit | f1187355aa041dc5dd183574bf43a52ca535db5f (patch) | |
tree | 216884f51336af7941227496ecd0606b9f9e26e7 /sonar-core/src | |
parent | 6a0ee5725ed9fd514f177d9c07ade38cf1cf8272 (diff) | |
download | sonarqube-f1187355aa041dc5dd183574bf43a52ca535db5f.tar.gz sonarqube-f1187355aa041dc5dd183574bf43a52ca535db5f.zip |
SONAR-3755 remove code related to reviews and violations
Diffstat (limited to 'sonar-core/src')
45 files changed, 15 insertions, 1560 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DaoUtils.java b/sonar-core/src/main/java/org/sonar/core/persistence/DaoUtils.java index 054c5d045a9..e6ec895fb13 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DaoUtils.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DaoUtils.java @@ -34,8 +34,6 @@ import org.sonar.core.purge.PurgeDao; import org.sonar.core.resource.ResourceDao; import org.sonar.core.resource.ResourceIndexerDao; import org.sonar.core.resource.ResourceKeyUpdaterDao; -import org.sonar.core.review.ReviewCommentDao; -import org.sonar.core.review.ReviewDao; import org.sonar.core.rule.RuleDao; import org.sonar.core.source.jdbc.SnapshotDataDao; import org.sonar.core.template.LoadedTemplateDao; @@ -70,8 +68,6 @@ public final class DaoUtils { ResourceIndexerDao.class, ResourceDao.class, ResourceKeyUpdaterDao.class, - ReviewCommentDao.class, - ReviewDao.class, RuleDao.class, SemaphoreDao.class, SnapshotDataDao.class, diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java index b2ed5c6be76..4d684fc9e74 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java @@ -42,7 +42,6 @@ public final class DatabaseUtils { */ static final String[] TABLE_NAMES = { "action_plans", - "action_plans_reviews", "active_dashboards", "active_rules", "active_rule_changes", @@ -76,12 +75,9 @@ public final class DatabaseUtils { "properties", "quality_models", "resource_index", - "reviews", - "review_comments", "rules", "rules_parameters", "rules_profiles", - "rule_failures", "semaphores", "schema_migrations", "snapshots", diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java b/sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java index 95e13a6c9ae..23bd385d1b8 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java @@ -25,11 +25,9 @@ import org.sonar.api.ServerComponent; import org.sonar.api.issue.Issue; import org.sonar.api.platform.ServerFileSystem; import org.sonar.api.utils.SonarException; -import org.sonar.core.review.ReviewDto; import javax.annotation.Nullable; import javax.sql.DataSource; - import java.io.File; import java.io.IOException; import java.sql.SQLException; @@ -82,9 +80,7 @@ public class DryRunDatabaseFactory implements ServerComponent { String snapshotCondition = "islast=" + database.getDialect().getTrueSqlValue() + " and (project_id=" + projectId + " or root_project_id=" + projectId + ")"; template .copyTable(source, dest, "projects", "(id=" + projectId + " or root_id=" + projectId + ")") - .copyTable(source, dest, "reviews", "project_id=" + projectId, "status<>'" + ReviewDto.STATUS_CLOSED + "'") - .copyTable(source, dest, "rule_failures", "snapshot_id in (select id from snapshots where " + snapshotCondition + ")") - .copyTable(source, dest, "issues", "resource_id in (" + projectsConditionForIssues + ")", "status<>'"+ Issue.STATUS_CLOSED + "'") + .copyTable(source, dest, "issues", "resource_id in (" + projectsConditionForIssues + ")", "status<>'" + Issue.STATUS_CLOSED + "'") .copyTable(source, dest, "snapshots", snapshotCondition); } } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java index e5dfb458eb2..368462b040d 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java @@ -52,10 +52,6 @@ import org.sonar.core.properties.PropertyDto; import org.sonar.core.purge.PurgeMapper; import org.sonar.core.purge.PurgeableSnapshotDto; import org.sonar.core.resource.*; -import org.sonar.core.review.ReviewCommentDto; -import org.sonar.core.review.ReviewCommentMapper; -import org.sonar.core.review.ReviewDto; -import org.sonar.core.review.ReviewMapper; import org.sonar.core.rule.RuleDto; import org.sonar.core.rule.RuleMapper; import org.sonar.core.source.jdbc.SnapshotDataDto; @@ -107,8 +103,6 @@ public class MyBatis implements BatchComponent, ServerComponent { loadAlias(conf, "Resource", ResourceDto.class); loadAlias(conf, "ResourceIndex", ResourceIndexDto.class); loadAlias(conf, "ResourceSnapshot", ResourceSnapshotDto.class); - loadAlias(conf, "Review", ReviewDto.class); - loadAlias(conf, "ReviewComment", ReviewCommentDto.class); loadAlias(conf, "Rule", RuleDto.class); loadAlias(conf, "Snapshot", SnapshotDto.class); loadAlias(conf, "Semaphore", SemaphoreDto.class); @@ -128,7 +122,7 @@ public class MyBatis implements BatchComponent, ServerComponent { Class<?>[] mappers = {ActiveDashboardMapper.class, AuthorMapper.class, DashboardMapper.class, DependencyMapper.class, DuplicationMapper.class, GraphDtoMapper.class, IssueMapper.class, IssueChangeMapper.class, LoadedTemplateMapper.class, MeasureFilterMapper.class, PropertiesMapper.class, PurgeMapper.class, ResourceKeyUpdaterMapper.class, ResourceIndexerMapper.class, ResourceMapper.class, - ResourceSnapshotMapper.class, ReviewCommentMapper.class, ReviewMapper.class, RoleMapper.class, RuleMapper.class, SchemaMigrationMapper.class, + ResourceSnapshotMapper.class, RoleMapper.class, RuleMapper.class, SchemaMigrationMapper.class, SemaphoreMapper.class, UserMapper.class, WidgetMapper.class, WidgetPropertyMapper.class, MeasureMapper.class, SnapshotDataMapper.class, SnapshotSourceMapper.class, ActionPlanMapper.class, ActionPlanStatsMapper.class }; @@ -188,15 +182,15 @@ public class MyBatis implements BatchComponent, ServerComponent { } private void loadMapper(Configuration configuration, String mapperName) { - InputStream input = null; - try { - input = getClass().getResourceAsStream("/" + mapperName.replace('.', '/') + ".xml"); - new XMLMapperBuilder(input, configuration, mapperName, configuration.getSqlFragments()).parse(); - configuration.addLoadedResource(mapperName); - } finally { - Closeables.closeQuietly(input); - } + InputStream input = null; + try { + input = getClass().getResourceAsStream("/" + mapperName.replace('.', '/') + ".xml"); + new XMLMapperBuilder(input, configuration, mapperName, configuration.getSqlFragments()).parse(); + configuration.addLoadedResource(mapperName); + } finally { + Closeables.closeQuietly(input); } + } private void loadAlias(Configuration conf, String alias, Class dtoClass) { conf.getTypeAliasRegistry().registerAlias(alias, dtoClass); diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java index 37dea581a0e..dc7ee6e0454 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java @@ -100,27 +100,6 @@ class PurgeCommands { session.commit(); profiler.stop(); - profiler.start("deleteResourceReviewComments (review_comments)"); - for (Long resourceId : resourceIds) { - purgeMapper.deleteResourceReviewComments(resourceId); - } - session.commit(); - profiler.stop(); - - profiler.start("deleteResourceActionPlansReviews (action_plans_reviews)"); - for (Long resourceId : resourceIds) { - purgeMapper.deleteResourceActionPlansReviews(resourceId); - } - session.commit(); - profiler.stop(); - - profiler.start("deleteResourceReviews (reviews)"); - for (Long resourceId : resourceIds) { - purgeMapper.deleteResourceReviews(resourceId); - } - session.commit(); - profiler.stop(); - profiler.start("deleteResourceIssueChanges (issue_changes)"); for (Long resourceId : resourceIds) { purgeMapper.deleteResourceIssueChanges(resourceId); @@ -204,8 +183,6 @@ class PurgeCommands { deleteSnapshotSources(snapshotIds); - deleteSnapshotViolations(snapshotIds); - deleteSnapshotGraphs(snapshotIds); deleteSnapshotData(snapshotIds); @@ -231,8 +208,6 @@ class PurgeCommands { deleteSnapshotSources(snapshotIds); - deleteSnapshotViolations(snapshotIds); - deleteSnapshotGraphs(snapshotIds); deleteSnapshotData(snapshotIds); @@ -286,15 +261,6 @@ class PurgeCommands { profiler.stop(); } - private void deleteSnapshotViolations(final List<Long> snapshotIds) { - profiler.start("deleteSnapshotViolations (rule_failures)"); - for (Long snapshotId : snapshotIds) { - purgeMapper.deleteSnapshotViolations(snapshotId); - } - session.commit(); - profiler.stop(); - } - private void deleteSnapshotSources(final List<Long> snapshotIds) { profiler.start("deleteSnapshotSource (snapshot_sources)"); for (Long snapshotId : snapshotIds) { diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java index d8eb96947b5..6f25476627a 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java @@ -163,7 +163,7 @@ public class PurgeDao { mapper.deleteResourceIndex(resourceId); mapper.setSnapshotIsLastToFalse(resourceId); mapper.disableResource(resourceId); - mapper.closeResourceReviews(resourceId); + //TODO mapper.closeResourceReviews(resourceId); } public PurgeDao deleteSnapshots(PurgeSnapshotQuery query) { diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java index 8a1aad0b74d..1c3c282fd1c 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java @@ -43,8 +43,6 @@ public interface PurgeMapper { void deleteSnapshotSource(long snapshotId); - void deleteSnapshotViolations(long snapshotId); - void deleteSnapshotGraphs(long snapshotId); List<Long> selectMetricIdsWithoutHistoricalData(); @@ -77,8 +75,6 @@ public interface PurgeMapper { void deleteResourceManualMeasures(long resourceId); - void deleteResourceReviews(long resourceId); - void deleteResourceEvents(long resourceId); void deleteResourceActionPlans(long resourceId); @@ -87,18 +83,12 @@ public interface PurgeMapper { void deleteAuthors(long developerId); - void closeResourceReviews(long resourceId); - List<PurgeableSnapshotDto> selectPurgeableSnapshotsWithEvents(long resourceId); List<PurgeableSnapshotDto> selectPurgeableSnapshotsWithoutEvents(long resourceId); List<Long> selectResourceIdsByRootId(long rootProjectId); - void deleteResourceReviewComments(long resourceId); - - void deleteResourceActionPlansReviews(long resourceId); - void deleteSnapshotData(long snapshotId); void deleteResourceIssueChanges(long resourceId); diff --git a/sonar-core/src/main/java/org/sonar/core/review/ReviewCommentDao.java b/sonar-core/src/main/java/org/sonar/core/review/ReviewCommentDao.java deleted file mode 100644 index d721531dfbb..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/review/ReviewCommentDao.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.review; - -import org.apache.ibatis.session.SqlSession; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; -import org.sonar.core.persistence.MyBatis; - -/** - * @since 3.1 - */ -public class ReviewCommentDao implements BatchComponent, ServerComponent { - private final MyBatis mybatis; - - public ReviewCommentDao(MyBatis mybatis) { - this.mybatis = mybatis; - } - - public void insert(ReviewCommentDto reviewCommentDto) { - SqlSession session = mybatis.openSession(); - ReviewCommentMapper mapper = session.getMapper(ReviewCommentMapper.class); - try { - mapper.insert(reviewCommentDto); - session.commit(); - } finally { - MyBatis.closeQuietly(session); - } - } -} diff --git a/sonar-core/src/main/java/org/sonar/core/review/ReviewCommentDto.java b/sonar-core/src/main/java/org/sonar/core/review/ReviewCommentDto.java deleted file mode 100644 index 680bcbb19b7..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/review/ReviewCommentDto.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.review; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -import java.util.Date; - -/** - * @since 3.1 - */ -public final class ReviewCommentDto { - - private Long id; - private Long reviewId; - private Long userId; - private String text; - private Date createdAt; - private Date updatedAt; - - public Long getId() { - return id; - } - - public ReviewCommentDto setId(Long id) { - this.id = id; - return this; - } - - public Long getUserId() { - return userId; - } - - public ReviewCommentDto setUserId(Long userId) { - this.userId = userId; - return this; - } - - public Long getReviewId() { - return reviewId; - } - - public ReviewCommentDto setReviewId(Long reviewId) { - this.reviewId = reviewId; - return this; - } - - public String getText() { - return text; - } - - public ReviewCommentDto setText(String text) { - this.text = text; - return this; - } - - public Date getCreatedAt() { - return createdAt; - } - - public ReviewCommentDto setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - return this; - } - - public Date getUpdatedAt() { - return updatedAt; - } - - public ReviewCommentDto setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - ReviewCommentDto reviewDto = (ReviewCommentDto) o; - return !(id != null ? !id.equals(reviewDto.id) : reviewDto.id != null); - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } -} diff --git a/sonar-core/src/main/java/org/sonar/core/review/ReviewCommentMapper.java b/sonar-core/src/main/java/org/sonar/core/review/ReviewCommentMapper.java deleted file mode 100644 index 1e20e78e65e..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/review/ReviewCommentMapper.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.review; - -/** - * @since 3.1 - */ -public interface ReviewCommentMapper { - void insert(ReviewCommentDto reviewCommentDto); -} diff --git a/sonar-core/src/main/java/org/sonar/core/review/ReviewDao.java b/sonar-core/src/main/java/org/sonar/core/review/ReviewDao.java deleted file mode 100644 index badf0e36ac7..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/review/ReviewDao.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.review; - -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.collect.Collections2; -import org.apache.ibatis.session.SqlSession; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; -import org.sonar.core.persistence.MyBatis; - -import javax.annotation.Nullable; - -import java.util.Collection; - -public class ReviewDao implements BatchComponent, ServerComponent { - private final MyBatis mybatis; - private final Cache<Long, Collection<ReviewDto>> cacheByResource; - - public ReviewDao(MyBatis mybatis) { - this.mybatis = mybatis; - this.cacheByResource = CacheBuilder.newBuilder() - .weakValues() - .build(new CacheLoader<Long, Collection<ReviewDto>>() { - @Override - public Collection<ReviewDto> load(Long resourceId) { - return doSelectOpenByResourceId(resourceId); - } - }); - } - - /** - * @since 3.1 - */ - public ReviewDto findById(long reviewId) { - SqlSession session = mybatis.openSession(); - try { - ReviewMapper mapper = session.getMapper(ReviewMapper.class); - return mapper.findById(reviewId); - } finally { - MyBatis.closeQuietly(session); - } - } - - public Collection<ReviewDto> selectOpenByResourceId(long resourceId, @Nullable Predicate<ReviewDto>... predicates) { - Collection<ReviewDto> reviews = cacheByResource.getUnchecked(resourceId); - if (!reviews.isEmpty() && predicates != null) { - reviews = Collections2.filter(reviews, Predicates.and(predicates)); - } - return reviews; - } - - public Collection<ReviewDto> selectOnDeletedResources(long rootProjectId, long rootSnapshotId) { - SqlSession session = mybatis.openSession(); - try { - ReviewMapper mapper = session.getMapper(ReviewMapper.class); - return mapper.selectOnDeletedResources(rootProjectId, rootSnapshotId); - } finally { - MyBatis.closeQuietly(session); - } - } - - private Collection<ReviewDto> doSelectOpenByResourceId(long resourceId) { - SqlSession session = mybatis.openSession(); - try { - ReviewMapper mapper = session.getMapper(ReviewMapper.class); - return mapper.selectByResourceId(resourceId); - } finally { - MyBatis.closeQuietly(session); - } - } - - public ReviewDao update(Collection<ReviewDto> reviews) { - Preconditions.checkNotNull(reviews); - - SqlSession session = mybatis.openBatchSession(); - try { - ReviewMapper mapper = session.getMapper(ReviewMapper.class); - for (ReviewDto review : reviews) { - mapper.update(review); - } - session.commit(); - return this; - - } finally { - MyBatis.closeQuietly(session); - } - } -} diff --git a/sonar-core/src/main/java/org/sonar/core/review/ReviewMapper.java b/sonar-core/src/main/java/org/sonar/core/review/ReviewMapper.java deleted file mode 100644 index 43878d785e0..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/review/ReviewMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.review; - -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * @since 2.13 - */ -public interface ReviewMapper { - ReviewDto findById(long reviewId); - - List<ReviewDto> selectByResourceId(long resourceId); - - void update(ReviewDto review); - - List<ReviewDto> selectOnDeletedResources(@Param("rootProjectId") long rootProjectId, @Param("rootSnapshotId") long rootSnapshotId); -} diff --git a/sonar-core/src/main/java/org/sonar/core/review/ReviewPredicates.java b/sonar-core/src/main/java/org/sonar/core/review/ReviewPredicates.java deleted file mode 100644 index 8440266966a..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/review/ReviewPredicates.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.review; - -import com.google.common.base.Predicate; -import org.apache.commons.lang.ArrayUtils; - -import javax.annotation.Nullable; - -/** - * @since 2.14 - */ -public final class ReviewPredicates { - - private ReviewPredicates() { - } - - public static Predicate<ReviewDto> status(String... statuses) { - return new StatusPredicate(statuses); - } - - public static Predicate<ReviewDto> resolution(String... resolutions) { - return new ResolutionPredicate(resolutions); - } - - public static Predicate<ReviewDto> manualViolation() { - return ManualViolationPredicate.INSTANCE; - } - - public static Predicate<ReviewDto> manualSeverity() { - return ManualSeverityPredicate.INSTANCE; - } - - private static final class StatusPredicate implements Predicate<ReviewDto> { - private String[] statuses; - - private StatusPredicate(String... statuses) { - this.statuses = statuses; - } - - public boolean apply(@Nullable ReviewDto review) { - return review!=null && ArrayUtils.contains(statuses, review.getStatus()); - } - } - - private static final class ResolutionPredicate implements Predicate<ReviewDto> { - private String[] resolutions; - - private ResolutionPredicate(String... resolutions) { - this.resolutions = resolutions; - } - - public boolean apply(@Nullable ReviewDto review) { - return review!=null && ArrayUtils.contains(resolutions, review.getResolution()); - } - } - - private static final class ManualViolationPredicate implements Predicate<ReviewDto> { - private static final ManualViolationPredicate INSTANCE = new ManualViolationPredicate(); - - private ManualViolationPredicate() { - } - - public boolean apply(@Nullable ReviewDto review) { - return review!=null && review.isManualViolation(); - } - } - - private static final class ManualSeverityPredicate implements Predicate<ReviewDto> { - private static final ManualSeverityPredicate INSTANCE = new ManualSeverityPredicate(); - - private ManualSeverityPredicate() { - } - - public boolean apply(@Nullable ReviewDto review) { - return review!=null && review.isManualSeverity(); - } - } -} diff --git a/sonar-core/src/main/java/org/sonar/core/review/package-info.java b/sonar-core/src/main/java/org/sonar/core/review/package-info.java deleted file mode 100644 index 8d3d1488173..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/review/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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. - */ -@ParametersAreNonnullByDefault -package org.sonar.core.review; - -import javax.annotation.ParametersAreNonnullByDefault;
\ No newline at end of file diff --git a/sonar-core/src/main/java/org/sonar/core/workflow/ReviewDatabaseStore.java b/sonar-core/src/main/java/org/sonar/core/workflow/ReviewDatabaseStore.java deleted file mode 100644 index bff8f61d8d8..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/workflow/ReviewDatabaseStore.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.workflow; - -import com.google.common.annotations.VisibleForTesting; -import org.apache.ibatis.session.SqlSession; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.sonar.api.ServerComponent; -import org.sonar.api.config.Settings; -import org.sonar.api.utils.KeyValueFormat; -import org.sonar.core.persistence.MyBatis; -import org.sonar.core.properties.PropertiesMapper; -import org.sonar.core.properties.PropertyDto; -import org.sonar.core.review.ReviewCommentDto; -import org.sonar.core.review.ReviewCommentMapper; -import org.sonar.core.review.ReviewDto; -import org.sonar.core.review.ReviewMapper; -import org.sonar.api.workflow.Comment; -import org.sonar.api.workflow.internal.DefaultReview; -import java.util.Date; -import java.util.List; - -public class ReviewDatabaseStore implements ReviewStore, ServerComponent { - private static final Logger LOG = LoggerFactory.getLogger(ReviewDatabaseStore.class); - - private MyBatis mybatis; - - public ReviewDatabaseStore(MyBatis mb) { - this.mybatis = mb; - } - - public void store(DefaultReview review) { - store(review, new Date()); - } - - @VisibleForTesting - void store(DefaultReview review, Date now) { - if (review.getReviewId() == null) { - LOG.error("Review has no id. Violation id is: " + review.getViolationId()); - return; - } - - SqlSession session = mybatis.openSession(); - ReviewMapper mapper = session.getMapper(ReviewMapper.class); - ReviewCommentMapper commentMapper = session.getMapper(ReviewCommentMapper.class); - try { - ReviewDto dto = mapper.findById(review.getReviewId()); - dto.setResolution(review.getResolution()); - dto.setStatus(review.getStatus()); - dto.setData(KeyValueFormat.format(review.getProperties())); - dto.setUpdatedAt(now); - mapper.update(dto); - - for (Comment comment : review.getNewComments()) { - ReviewCommentDto commentDto = new ReviewCommentDto(); - commentDto.setReviewId(dto.getId()); - commentDto.setText(comment.getMarkdownText()); - commentDto.setCreatedAt(now); - commentDto.setUpdatedAt(now); - commentDto.setUserId(comment.getUserId()); - commentMapper.insert(commentDto); - } - session.commit(); - - } finally { - MyBatis.closeQuietly(session); - } - } - - public void completeProjectSettings(Long projectId, Settings settings, List<String> propertyKeys) { - if (propertyKeys.isEmpty()) { - return; - } - - SqlSession session = mybatis.openSession(); - PropertiesMapper mapper = session.getMapper(PropertiesMapper.class); - try { - List<PropertyDto> dtos = mapper.selectSetOfResourceProperties(projectId, propertyKeys); - for (PropertyDto dto : dtos) { - settings.setProperty(dto.getKey(), dto.getValue()); - } - - } finally { - MyBatis.closeQuietly(session); - } - } -} diff --git a/sonar-core/src/main/resources/META-INF/persistence.xml b/sonar-core/src/main/resources/META-INF/persistence.xml index c8ac4392caf..ffe8c102dd7 100644 --- a/sonar-core/src/main/resources/META-INF/persistence.xml +++ b/sonar-core/src/main/resources/META-INF/persistence.xml @@ -20,7 +20,6 @@ <class>org.sonar.api.measures.Metric</class> <class>org.sonar.api.database.model.ResourceModel</class> <class>org.sonar.api.database.model.SnapshotSource</class> - <class>org.sonar.api.database.model.RuleFailureModel</class> <class>org.sonar.api.rules.Rule</class> <class>org.sonar.api.rules.RuleParam</class> <class>org.sonar.api.resources.ProjectLink</class> diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index 4273361092d..79c6ec72cb9 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -213,15 +213,6 @@ CREATE TABLE "DUPLICATIONS_INDEX" ( "END_LINE" INTEGER NOT NULL ); -CREATE TABLE "REVIEW_COMMENTS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "REVIEW_ID" INTEGER, - "USER_ID" INTEGER, - "REVIEW_TEXT" VARCHAR(16777215) -); - CREATE TABLE "ACTIVE_RULE_CHANGES" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "USERNAME" VARCHAR(200), @@ -281,26 +272,6 @@ CREATE TABLE "PROJECTS" ( "CREATED_AT" TIMESTAMP ); -CREATE TABLE "REVIEWS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "USER_ID" INTEGER, - "ASSIGNEE_ID" INTEGER, - "TITLE" VARCHAR(500), - "STATUS" VARCHAR(10), - "SEVERITY" VARCHAR(10), - "RULE_FAILURE_PERMANENT_ID" INTEGER, - "PROJECT_ID" INTEGER, - "RESOURCE_ID" INTEGER, - "RESOURCE_LINE" INTEGER, - "RESOLUTION" VARCHAR(200), - "RULE_ID" INTEGER, - "MANUAL_VIOLATION" BOOLEAN NOT NULL, - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "DATA" VARCHAR(4000) -); - CREATE TABLE "MANUAL_MEASURES" ( "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "METRIC_ID" INTEGER NOT NULL, @@ -382,21 +353,6 @@ CREATE TABLE "DASHBOARDS" ( "UPDATED_AT" TIMESTAMP ); -CREATE TABLE "RULE_FAILURES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "SNAPSHOT_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "COST" DOUBLE, - "CREATED_AT" TIMESTAMP, - "CHECKSUM" VARCHAR(1000), - "PERMANENT_ID" INTEGER, - "SWITCHED_OFF" BOOLEAN, - "PERSON_ID" INTEGER -); - CREATE TABLE "METRICS" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(64) NOT NULL, @@ -445,11 +401,6 @@ CREATE TABLE "ACTION_PLANS" ( "UPDATED_AT" TIMESTAMP ); -CREATE TABLE "ACTION_PLANS_REVIEWS" ( - "ACTION_PLAN_ID" INTEGER, - "REVIEW_ID" INTEGER -); - CREATE TABLE "ACTIVE_RULE_NOTES" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "ACTIVE_RULE_ID" INTEGER, @@ -607,12 +558,6 @@ CREATE INDEX "M_DATA_SID" ON "MEASURE_DATA" ("SNAPSHOT_ID"); CREATE INDEX "MEASURE_DATA_MEASURE_ID" ON "MEASURE_DATA" ("MEASURE_ID"); -CREATE INDEX "RF_PERMANENT_ID" ON "RULE_FAILURES" ("PERMANENT_ID"); - -CREATE INDEX "RULE_FAILURE_RULE_ID" ON "RULE_FAILURES" ("RULE_ID"); - -CREATE INDEX "RULE_FAILURE_SNAPSHOT_ID" ON "RULE_FAILURES" ("SNAPSHOT_ID"); - CREATE INDEX "EVENTS_SNAPSHOT_ID" ON "EVENTS" ("SNAPSHOT_ID"); CREATE INDEX "EVENTS_RESOURCE_ID" ON "EVENTS" ("RESOURCE_ID"); @@ -653,16 +598,10 @@ CREATE INDEX "RESOURCE_INDEX_RID" ON "RESOURCE_INDEX" ("RESOURCE_ID"); CREATE INDEX "INDEX_ACTION_PLANS_ON_PROJET_ID" ON "ACTION_PLANS" ("PROJECT_ID"); -CREATE INDEX "INDEX_ACTION_PLANS_REVIEWS_ON_ACTION_PLAN_ID" ON "ACTION_PLANS_REVIEWS" ("ACTION_PLAN_ID"); - -CREATE INDEX "INDEX_ACTION_PLANS_REVIEWS_ON_REVIEW_ID" ON "ACTION_PLANS_REVIEWS" ("REVIEW_ID"); - CREATE INDEX "INDEX_ACTIVE_RULE_NOTES_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_NOTES" ("ACTIVE_RULE_ID"); CREATE INDEX "INDEX_RULE_NOTES_ON_ACTIVE_RULE_ID" ON "RULE_NOTES" ("RULE_ID"); -CREATE INDEX "REVIEWS_RID" ON "REVIEWS" ("RESOURCE_ID"); - CREATE UNIQUE INDEX "UNIQ_SEMAPHORE_CHECKSUMS" ON "SEMAPHORES" ("CHECKSUM"); CREATE INDEX "SEMAPHORE_NAMES" ON "SEMAPHORES" ("NAME"); diff --git a/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml b/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml index 13d5deab3da..ab1e532a38f 100644 --- a/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml @@ -96,10 +96,6 @@ delete from snapshot_sources where snapshot_id=#{id} </delete> - <delete id="deleteSnapshotViolations" parameterType="long"> - delete from rule_failures where snapshot_id=#{id} - </delete> - <delete id="deleteSnapshotGraphs" parameterType="long"> delete from graphs where snapshot_id=#{id} </delete> @@ -142,11 +138,6 @@ update projects set enabled=${_false} where id=#{id} </update> - <update id="closeResourceReviews" parameterType="long"> - update reviews set status='CLOSED', updated_at=CURRENT_TIMESTAMP where resource_id=#{id} - </update> - - <delete id="deleteResourceIndex" parameterType="long"> delete from resource_index where resource_id=#{id} </delete> @@ -179,10 +170,6 @@ delete from manual_measures where resource_id=#{id} </delete> - <delete id="deleteResourceReviews" parameterType="long"> - delete from reviews where resource_id=#{id} - </delete> - <delete id="deleteResourceEvents" parameterType="long"> delete from events where resource_id=#{id} </delete> @@ -203,42 +190,10 @@ update snapshots set islast=${_false} where project_id=#{id} </update> - <delete id="deleteResourceReviewComments" parameterType="long"> - delete from review_comments rc where exists (select * from reviews r where rc.review_id=r.id and - r.resource_id=#{id}) - </delete> - - <delete id="deleteResourceActionPlansReviews" parameterType="long"> - delete from action_plans_reviews apr where exists (select * from action_plans ap where ap.id=apr.action_plan_id and - ap.project_id=#{id}) - </delete> - <delete id="deleteSnapshotData" parameterType="long"> delete from snapshot_data where snapshot_id=#{id} </delete> - <!-- Mssql --> - <delete id="deleteResourceReviewComments" databaseId="mssql" parameterType="long"> - delete review_comments from review_comments - inner join reviews on review_comments.review_id=reviews.id - where reviews.resource_id=#{id} - </delete> - - <delete id="deleteResourceActionPlansReviews" databaseId="mssql" parameterType="long"> - delete action_plans_reviews from action_plans_reviews - inner join action_plans on action_plans.id=action_plans_reviews.action_plan_id - where action_plans.project_id=#{id} - </delete> - - <!-- Mysql --> - <delete id="deleteResourceReviewComments" databaseId="mysql" parameterType="long"> - delete rc from review_comments as rc, reviews as r where rc.review_id=r.id and r.resource_id=#{id} - </delete> - - <delete id="deleteResourceActionPlansReviews" databaseId="mysql" parameterType="long"> - delete apr from action_plans_reviews as apr, action_plans as ap where ap.id=apr.action_plan_id and ap.project_id=#{id} - </delete> - <delete id="deleteResourceIssueChanges" parameterType="long"> delete from issue_changes ic where exists (select * from issues i where i.kee=ic.issue_key and i.resource_id=#{id}) diff --git a/sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper.xml b/sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper.xml deleted file mode 100644 index a99dca4ffa3..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - -<mapper namespace="org.sonar.core.review.ReviewCommentMapper"> - - <insert id="insert" parameterType="ReviewComment" useGeneratedKeys="true" keyProperty ="id"> - INSERT INTO review_comments (review_id, user_id, review_text, created_at, updated_at) - VALUES (#{reviewId}, #{userId}, #{text}, - #{createdAt}, #{updatedAt}) - </insert> - - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="ReviewComment" keyColumn="id" useGeneratedKeys="true" keyProperty ="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id" > - select review_comments_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO review_comments (id, review_id, user_id, review_text, created_at, updated_at) - VALUES (#{id}, #{reviewId}, #{userId}, #{text}, - #{createdAt}, #{updatedAt}) - </insert> - -</mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/review/ReviewMapper.xml b/sonar-core/src/main/resources/org/sonar/core/review/ReviewMapper.xml deleted file mode 100644 index b9f400d5d30..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/review/ReviewMapper.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - -<mapper namespace="org.sonar.core.review.ReviewMapper"> - - <sql id="reviewColumns"> - r.id, r.created_at as createdAt, r.updated_at as updatedAt, r.user_id as userId, r.assignee_id as assigneeId, - r.status as status, r.resolution as resolution, r.title as title, r.severity as severity, - r.rule_failure_permanent_id as violationPermanentId, r.project_id as projectId, r.resource_id as resourceId, r.resource_line as line, r.rule_id as ruleId, - r.manual_severity as manualSeverity, r.manual_violation as manualViolation, r.data as data - </sql> - - <select id="findById" parameterType="long" resultType="Review"> - select <include refid="reviewColumns"/>, apr.action_plan_id as actionPlanId - from reviews r left outer join action_plans_reviews apr on r.id=apr.review_id - where r.id=#{id} - </select> - - <select id="selectByResourceId" parameterType="long" resultType="Review"> - select <include refid="reviewColumns"/>, apr.action_plan_id as actionPlanId - from reviews r left outer join action_plans_reviews apr on r.id=apr.review_id - where r.resource_id=#{id} and r.status <> 'CLOSED' - </select> - - <update id="update" parameterType="Review"> - update reviews set - created_at=#{createdAt}, - updated_at=#{updatedAt}, - user_id=#{userId}, - assignee_id=#{assigneeId}, - status=#{status}, - resolution=#{resolution}, - title=#{title}, - severity=#{severity}, - rule_failure_permanent_id=#{violationPermanentId}, - project_id=#{projectId}, - resource_id=#{resourceId}, - resource_line=#{line}, - rule_id=#{ruleId}, - manual_severity=#{manualSeverity}, - manual_violation=#{manualViolation}, - data=#{data} - where id = #{id} - </update> - - <select id="selectOnDeletedResources" parameterType="long" resultType="Review"> - select <include refid="reviewColumns"/> - from reviews r - where r.status <> 'CLOSED' and r.project_id=#{rootProjectId} and r.resource_id in ( - select prev.project_id from snapshots prev where prev.root_project_id=#{rootProjectId} - and prev.islast=${_true} and not exists( - select cur.id from snapshots cur where root_snapshot_id=#{rootSnapshotId} and cur.created_at > prev.created_at AND cur.root_project_id=#{rootProjectId} AND - cur.project_id=prev.project_id)) - </select> -</mapper> - diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java index 5f9df88773d..9a90a179606 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java @@ -84,19 +84,6 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase { } @Test - public void should_create_database_with_violations_and_reviews() throws IOException, SQLException { - setupData("should_create_database_with_violations_and_reviews"); - - when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.getRoot()); - - byte[] database = localDatabaseFactory.createDatabaseForDryRun(123L); - dataSource = createDatabase(database); - - assertThat(rowCount("rule_failures")).isEqualTo(1); - assertThat(rowCount("reviews")).isEqualTo(1); - } - - @Test public void should_create_database_with_issues() throws IOException, SQLException { setupData("should_create_database_with_issues"); diff --git a/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java b/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java index ba7a7208d6b..1f4ec0a07ca 100644 --- a/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java @@ -50,7 +50,7 @@ public class PurgeCommandsTest extends AbstractDaoTestCase { MyBatis.closeQuietly(session); } checkTables("shouldDeleteSnapshot", - "snapshots", "project_measures", "measure_data", "rule_failures", "snapshot_sources", "duplications_index", "events", "dependencies", "snapshot_data"); + "snapshots", "project_measures", "measure_data", "snapshot_sources", "duplications_index", "events", "dependencies", "snapshot_data"); } /** @@ -67,7 +67,7 @@ public class PurgeCommandsTest extends AbstractDaoTestCase { MyBatis.closeQuietly(session); } checkTables("shouldPurgeSnapshot", - "snapshots", "project_measures", "measure_data", "rule_failures", "snapshot_sources", "duplications_index", "events", "dependencies", "reviews", "snapshot_data"); + "snapshots", "project_measures", "measure_data", "snapshot_sources", "duplications_index", "events", "dependencies", "snapshot_data"); } @Test @@ -92,7 +92,7 @@ public class PurgeCommandsTest extends AbstractDaoTestCase { } finally { MyBatis.closeQuietly(session); } - assertEmptyTables("projects", "snapshots", "events", "reviews", "review_comments", "issues", "issue_changes", "authors"); + assertEmptyTables("projects", "snapshots", "events", "issues", "issue_changes", "authors"); } } diff --git a/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java b/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java index 71a455924c3..f629da7b04c 100644 --- a/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java @@ -52,23 +52,6 @@ public class PurgeDaoTest extends AbstractDaoTestCase { } @Test - public void shouldCloseReviewWhenDisablingResource() { - setupData("shouldCloseReviewWhenDisablingResource"); - - SqlSession session = getMyBatis().openSession(); - try { - dao.disableResource(1L, session.getMapper(PurgeMapper.class)); - - // the above method does not commit and close the session - session.commit(); - - } finally { - MyBatis.closeQuietly(session); - } - checkTables("shouldCloseReviewWhenDisablingResource", /* excluded column */new String[] {"updated_at"}, "reviews"); - } - - @Test public void shouldPurgeProject() { setupData("shouldPurgeProject"); dao.purge(1, new String[0]); @@ -111,7 +94,7 @@ public class PurgeDaoTest extends AbstractDaoTestCase { public void shouldDeleteProject() { setupData("shouldDeleteProject"); dao.deleteResourceTree(1L); - assertEmptyTables("projects", "snapshots", "action_plans", "action_plans_reviews", "reviews", "review_comments", "issues", "issue_changes"); + assertEmptyTables("projects", "snapshots", "action_plans", "issues", "issue_changes"); } static final class SnapshotMatcher extends BaseMatcher<PurgeableSnapshotDto> { diff --git a/sonar-core/src/test/java/org/sonar/core/review/ReviewCommentDaoTest.java b/sonar-core/src/test/java/org/sonar/core/review/ReviewCommentDaoTest.java deleted file mode 100644 index 4a7fceeb55d..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/review/ReviewCommentDaoTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.review; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.core.persistence.AbstractDaoTestCase; - -import java.util.Date; - -public class ReviewCommentDaoTest extends AbstractDaoTestCase { - - private ReviewCommentDao dao; - - @Before - public void createDao() { - dao = new ReviewCommentDao(getMyBatis()); - } - - @Test - public void shouldFindReviewById() { - setupData("insert"); - - ReviewCommentDto reviewCommentDto = new ReviewCommentDto(); - reviewCommentDto.setReviewId(12L); - reviewCommentDto.setUserId(8L); - reviewCommentDto.setText("Hello"); - Date today = new Date(); - reviewCommentDto.setCreatedAt(today); - reviewCommentDto.setUpdatedAt(today); - - dao.insert(reviewCommentDto); - - checkTables("insert", new String[] {"id", "created_at", "updated_at"}, "review_comments"); - } -} diff --git a/sonar-core/src/test/java/org/sonar/core/review/ReviewDaoTest.java b/sonar-core/src/test/java/org/sonar/core/review/ReviewDaoTest.java deleted file mode 100644 index 6824c0e05f7..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/review/ReviewDaoTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.review; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.utils.DateUtils; -import org.sonar.core.persistence.AbstractDaoTestCase; - -import java.util.Collection; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; - -public class ReviewDaoTest extends AbstractDaoTestCase { - - private ReviewDao dao; - - @Before - public void createDao() { - dao = new ReviewDao(getMyBatis()); - } - - @Test - public void shouldFindReviewById() { - setupData("shared"); - - ReviewDto review = dao.findById(100L); - assertThat(review.getId(), is(100L)); - assertThat(review.getStatus(), is("OPEN")); - assertThat(review.getResolution(), is(nullValue())); - assertThat(review.getProjectId(), is(20)); - assertThat(review.getViolationPermanentId(), is(1)); - assertThat(review.getSeverity(), is("BLOCKER")); - assertThat(review.getUserId(), is(300)); - assertThat(review.getResourceId(), is(400)); - assertThat(review.getRuleId(), is(500)); - assertThat(review.getManualViolation(), is(true)); - assertThat(review.getActionPlanId(), is(1)); - } - - @Test - public void shouldSelectOpenByResourceId() { - setupData("shared"); - - // only a single review is open on this resource - Collection<ReviewDto> reviews = dao.selectOpenByResourceId(400L); - assertThat(reviews.size(), is(1)); - ReviewDto review = reviews.iterator().next(); - assertThat(review.getId(), is(100L)); - assertThat(review.getStatus(), is("OPEN")); - assertThat(review.getResolution(), is(nullValue())); - assertThat(review.getProjectId(), is(20)); - assertThat(review.getViolationPermanentId(), is(1)); - assertThat(review.getSeverity(), is("BLOCKER")); - assertThat(review.getUserId(), is(300)); - assertThat(review.getResourceId(), is(400)); - assertThat(review.getRuleId(), is(500)); - assertThat(review.getManualViolation(), is(true)); - assertThat(review.getActionPlanId(), is(1)); - } - - @Test - public void shouldReturnEmptyCollectionIfResourceNotFound() { - setupData("shared"); - assertThat(dao.selectOpenByResourceId(123456789L).isEmpty(), is(true)); - } - - @Test - public void shouldFilterResults() { - setupData("shared"); - Collection<ReviewDto> reviews = dao.selectOpenByResourceId(401L, - ReviewPredicates.status(ReviewDto.STATUS_REOPENED)); - - assertThat(reviews.size(), is(1)); - ReviewDto review = reviews.iterator().next(); - assertThat(review.getId(), is(103L)); - assertThat(review.getStatus(), is(ReviewDto.STATUS_REOPENED)); - } - - @Test - public void update() { - setupData("update"); - Collection<ReviewDto> reviews = dao.selectOpenByResourceId(400L); - ReviewDto review = reviews.iterator().next(); - review.setLine(1000); - review.setResolution("NEW_RESOLUTION"); - review.setStatus("NEW_STATUS"); - review.setSeverity("NEW_SEV"); - review.setAssigneeId(1001L); - review.setManualSeverity(true); - review.setManualViolation(false); - review.setTitle("NEW_TITLE"); - review.setCreatedAt(DateUtils.parseDate("2012-05-18")); - review.setUpdatedAt(DateUtils.parseDate("2012-07-01")); - review.setData("big=bang"); - - dao.update(reviews); - - checkTables("update", "reviews"); - } -} diff --git a/sonar-core/src/test/java/org/sonar/core/review/ReviewDtoTest.java b/sonar-core/src/test/java/org/sonar/core/review/ReviewDtoTest.java deleted file mode 100644 index 0793944eafd..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/review/ReviewDtoTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.review; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -public class ReviewDtoTest { - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Test - public void setData_check_maximal_length() { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Review data must not exceed 4000 characters: "); - - StringBuilder s = new StringBuilder(4500); - for (int i=0 ; i<4500 ; i++) { - s.append('a'); - } - new ReviewDto().setData(s.toString()); - } -} diff --git a/sonar-core/src/test/java/org/sonar/core/review/ReviewPredicatesTest.java b/sonar-core/src/test/java/org/sonar/core/review/ReviewPredicatesTest.java deleted file mode 100644 index 915224a1cf1..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/review/ReviewPredicatesTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.review; - -import com.google.common.base.Predicate; -import com.google.common.collect.Collections2; -import com.google.common.collect.Lists; -import org.junit.Test; - -import java.util.Collection; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -public class ReviewPredicatesTest { - @Test - public void testStatusPredicate() { - Predicate<ReviewDto> predicate = ReviewPredicates.status(ReviewDto.STATUS_REOPENED); - Collection<ReviewDto> filtered = Collections2.filter(Lists.<ReviewDto>newArrayList( - new ReviewDto().setStatus(ReviewDto.STATUS_OPEN), - new ReviewDto().setStatus(ReviewDto.STATUS_REOPENED), - new ReviewDto().setStatus(ReviewDto.STATUS_REOPENED)), predicate); - - assertThat(filtered.size(), is(2)); - } - - @Test - public void testResolutionPredicate() { - Predicate<ReviewDto> predicate = ReviewPredicates.resolution(ReviewDto.RESOLUTION_FALSE_POSITIVE); - Collection<ReviewDto> filtered = Collections2.filter(Lists.<ReviewDto>newArrayList( - new ReviewDto().setResolution(null), - new ReviewDto().setResolution(ReviewDto.RESOLUTION_FALSE_POSITIVE), - new ReviewDto().setResolution(ReviewDto.RESOLUTION_FIXED)), predicate); - - assertThat(filtered.size(), is(1)); - } - - @Test - public void testManualViolationPredicate() { - Predicate<ReviewDto> predicate = ReviewPredicates.manualViolation(); - Collection<ReviewDto> filtered = Collections2.filter(Lists.<ReviewDto>newArrayList( - new ReviewDto().setManualViolation(false), - new ReviewDto().setManualViolation(false), - new ReviewDto().setManualViolation(true)), predicate); - - assertThat(filtered.size(), is(1)); - } - - @Test - public void testManualSeverityPredicate() { - Predicate<ReviewDto> predicate = ReviewPredicates.manualSeverity(); - Collection<ReviewDto> filtered = Collections2.filter(Lists.<ReviewDto>newArrayList( - new ReviewDto().setManualSeverity(false), - new ReviewDto().setManualSeverity(false), - new ReviewDto().setManualSeverity(true)), predicate); - - assertThat(filtered.size(), is(1)); - } -} diff --git a/sonar-core/src/test/java/org/sonar/core/workflow/ReviewDatabaseStoreTest.java b/sonar-core/src/test/java/org/sonar/core/workflow/ReviewDatabaseStoreTest.java deleted file mode 100644 index 89c54acc81a..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/workflow/ReviewDatabaseStoreTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.core.workflow; - -import org.junit.Test; -import org.sonar.api.config.Settings; -import org.sonar.api.utils.DateUtils; -import org.sonar.api.workflow.Comment; -import org.sonar.api.workflow.internal.DefaultReview; -import org.sonar.core.persistence.AbstractDaoTestCase; - -import java.util.Arrays; -import java.util.Date; - -import static org.fest.assertions.Assertions.assertThat; - -public class ReviewDatabaseStoreTest extends AbstractDaoTestCase { - - @Test - public void store() { - setupData("store"); - ReviewDatabaseStore store = new ReviewDatabaseStore(getMyBatis()); - DefaultReview review = new DefaultReview().setReviewId(1234L); - review.setStatus("CLOSED"); - review.setResolution("RESOLVED"); - review.setProperty("who", "me"); - review.setProperty("why", "because"); - Comment comment = review.createComment(); - comment.setMarkdownText("this is a comment"); - comment.setUserId(555L); - - Date now = DateUtils.parseDate("2012-05-18"); - store.store(review, now); - - checkTables("store", "reviews"); - checkTables("store", new String[]{"id"}, "review_comments"); - } - - @Test - public void completeProjectSettings() { - setupData("completeProjectSettings"); - ReviewDatabaseStore store = new ReviewDatabaseStore(getMyBatis()); - - Settings settings = new Settings(); - store.completeProjectSettings(100L, settings, Arrays.asList("not.available.on.project", "jira.project.key")); - - assertThat(settings.getString("not.available.on.project")).isNull(); - - // project property - assertThat(settings.getString("jira.project.key")).isEqualTo("FOO"); - } -} diff --git a/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_violations_and_reviews.xml b/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_violations_and_reviews.xml deleted file mode 100644 index 0b99565ca99..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_violations_and_reviews.xml +++ /dev/null @@ -1,30 +0,0 @@ -<dataset> - <metrics id="1" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="[false]" delete_historical_data="[null]"/> - <metrics id="2" name="coverage" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" delete_historical_data="[null]"/> - - <rules_profiles id="1" name="Sonar way with Findbugs" language="java" parent_name="" version="1" - used_profile="[false]"/> - - - <projects id="123" root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="[null]" long_name="Apache Struts" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" created_at="2013-01-25 02:04:06.00"/> - - <snapshots id="1000" project_id="123" root_project_id="123" root_snapshot_id="1000" parent_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" path="1000." depth="1" - purge_status="[null]" 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]" - created_at="2013-01-25 02:04:06.00" build_date="2013-01-25 02:04:06.00" - version="1.0" status="P" islast="[true]"/> - - <rule_failures id="1" snapshot_id="1000" rule_id="1" failure_level="2" message="msg1" cost="[null]" switched_off="[null]" permanent_id="[null]"/> - - <reviews id="1" project_id="123" resource_id="2" status="OPEN" - rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" resource_line="200" severity="BLOCKER" - user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]"/> - -</dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml index e8a31f031de..7286e76a2af 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml @@ -18,12 +18,6 @@ <events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]" event_date="2008-12-02 13:58:00.00" created_at="[null]"/> - <reviews id="1" project_id="1" resource_id="1" status="CLOSED" - rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" resource_line="200" severity="BLOCKER" - user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]"/> - - <review_comments id="1" created_at="[null]" updated_at="[null]" review_id="1" user_id="1223" review_text="abc"/> - <issues id="1" kee="ABCDE" resource_id="1" status="CLOSED" resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]" diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml index 02e17b8031c..028d67e409d 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml @@ -14,10 +14,6 @@ path="[null]"/> <snapshot_sources ID="1" SNAPSHOT_ID="1" DATA="foo"/> - <rule_failures switched_off="[null]" permanent_id="[null]" ID="1" SNAPSHOT_ID="1" RULE_ID="1" FAILURE_LEVEL="2" - MESSAGE="msg1" LINE="[null]" COST="[null]" - created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> <project_measures ID="1" characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml index 18553c8b9d4..69ee6858e9b 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml @@ -12,10 +12,6 @@ version="[null]" path="[null]"/> <snapshot_sources ID="1" SNAPSHOT_ID="1" DATA="foo"/> - <rule_failures switched_off="[null]" permanent_id="[null]" ID="1" SNAPSHOT_ID="1" RULE_ID="1" FAILURE_LEVEL="2" - MESSAGE="msg1" LINE="[null]" COST="[null]" - created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> <project_measures ID="1" characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" @@ -47,14 +43,6 @@ version="[null]" path="[null]"/> <snapshot_sources ID="2" SNAPSHOT_ID="5" DATA="foo"/> - <rule_failures switched_off="[null]" permanent_id="[null]" ID="3" SNAPSHOT_ID="5" RULE_ID="1" FAILURE_LEVEL="2" - MESSAGE="msg3" LINE="[null]" COST="[null]" - created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> - <rule_failures switched_off="[null]" permanent_id="[null]" ID="4" SNAPSHOT_ID="5" RULE_ID="1" FAILURE_LEVEL="2" - MESSAGE="msg4" LINE="[null]" COST="[null]" - created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> <project_measures ID="2" characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml index 90b1395df31..382e60aa518 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml @@ -20,7 +20,6 @@ Note that measures, events and reviews are not deleted. <!--<snapshot_sources ID="1" SNAPSHOT_ID="1" DATA="foo"/>--> - <!--<rule_failures ID="1" SNAPSHOT_ID="1"--> <!--switched_off="[null]" permanent_id="[null]" RULE_ID="1" FAILURE_LEVEL="2"--> <!--MESSAGE="msg1" LINE="[null]" COST="[null]"--> <!--created_at="2008-12-02 13:58:00.00"--> @@ -48,10 +47,6 @@ Note that measures, events and reviews are not deleted. <!--<duplications_index id="1" project_snapshot_id="1" snapshot_id="1"--> <!--hash="bb" index_in_file="0" start_line="0" end_line="0"/>--> - <reviews id="1" project_id="1" resource_id="1" status="OPEN" - rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" updated_at="[null]" resource_line="200" severity="BLOCKER" - user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]" data="[null]"/> - <!-- The following is not purged but is kept for DBUnit --> <snapshots id="2" @@ -66,12 +61,6 @@ Note that measures, events and reviews are not deleted. <snapshot_sources ID="2" SNAPSHOT_ID="2" DATA="foo"/> - <rule_failures ID="2" SNAPSHOT_ID="2" - switched_off="[null]" permanent_id="[null]" RULE_ID="1" FAILURE_LEVEL="2" - MESSAGE="msg1" LINE="[null]" COST="[null]" - created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> - <project_measures ID="2" project_id="2" SNAPSHOT_ID="2" RULE_ID="[null]" characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" VALUE="10.0" METRIC_ID="1" rules_category_id="[null]" @@ -94,10 +83,6 @@ Note that measures, events and reviews are not deleted. <duplications_index id="2" project_snapshot_id="2" snapshot_id="2" hash="bb" index_in_file="0" start_line="0" end_line="0"/> - <reviews id="2" project_id="2" resource_id="2" status="OPEN" - rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" updated_at="[null]" resource_line="200" severity="BLOCKER" - user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]" data="[null]"/> - <snapshot_data id="2" resource_id="5" snapshot_id="5" snapshot_data="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" /> </dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml index 6d634a6df4d..065d64d23cc 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml @@ -12,12 +12,6 @@ <snapshot_sources ID="1" SNAPSHOT_ID="1" DATA="foo"/> - <rule_failures ID="1" SNAPSHOT_ID="1" - switched_off="[null]" permanent_id="[null]" RULE_ID="1" FAILURE_LEVEL="2" - MESSAGE="msg1" LINE="[null]" COST="[null]" - created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> - <project_measures ID="1" project_id="1" SNAPSHOT_ID="1" RULE_ID="[null]" characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" VALUE="10.0" METRIC_ID="1" rules_category_id="[null]" @@ -40,10 +34,6 @@ <duplications_index id="1" project_snapshot_id="1" snapshot_id="1" hash="bb" index_in_file="0" start_line="0" end_line="0"/> - <reviews id="1" project_id="1" resource_id="1" status="OPEN" - rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" updated_at="[null]" resource_line="200" severity="BLOCKER" - user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]" data="[null]"/> - <snapshot_data id="1" resource_id="1" snapshot_id="1" snapshot_data="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" /> @@ -60,12 +50,6 @@ <snapshot_sources ID="2" SNAPSHOT_ID="2" DATA="foo"/> - <rule_failures ID="2" SNAPSHOT_ID="2" - switched_off="[null]" permanent_id="[null]" RULE_ID="1" FAILURE_LEVEL="2" - MESSAGE="msg1" LINE="[null]" COST="[null]" - created_at="2008-12-02 13:58:00.00" - checksum="[null]" person_id="[null]"/> - <project_measures ID="2" project_id="2" SNAPSHOT_ID="2" RULE_ID="[null]" characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" VALUE="10.0" METRIC_ID="1" rules_category_id="[null]" @@ -88,10 +72,6 @@ <duplications_index id="2" project_snapshot_id="2" snapshot_id="2" hash="bb" index_in_file="0" start_line="0" end_line="0"/> - <reviews id="2" project_id="2" resource_id="2" status="OPEN" - rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" updated_at="[null]" resource_line="200" severity="BLOCKER" - user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]" data="[null]"/> - <snapshot_data id="2" resource_id="5" snapshot_id="5" snapshot_data="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" /> </dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldCloseReviewWhenDisablingResource-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldCloseReviewWhenDisablingResource-result.xml deleted file mode 100644 index b93691f0c7c..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldCloseReviewWhenDisablingResource-result.xml +++ /dev/null @@ -1,15 +0,0 @@ -<!-- - -Changes: -* review.status=CLOSED - -Note that the column updated_at has been removed because it's excluded from DBUnit comparison. ---> - -<dataset> - - <reviews id="1" project_id="1" resource_id="1" status="CLOSED" - rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" resource_line="200" severity="BLOCKER" - user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]" data="[null]"/> - -</dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldCloseReviewWhenDisablingResource.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldCloseReviewWhenDisablingResource.xml deleted file mode 100644 index 6134ec488d9..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldCloseReviewWhenDisablingResource.xml +++ /dev/null @@ -1,16 +0,0 @@ -<dataset> - - <snapshots id="1" - project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - 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]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/> - - <reviews id="1" project_id="1" resource_id="1" status="OPEN" - rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" updated_at="[null]" resource_line="200" severity="BLOCKER" - user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]" data="[null]"/> -</dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml index 5c57259dab6..2a77f9e60b7 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml @@ -19,18 +19,6 @@ <action_plans id="1" kee="ABCD" project_id="1" name="SHORT_TERM" description="[null]" deadline="[null]" user_login="igor" status="[null]" created_at="[null]" updated_at="[null]" /> - <action_plans_reviews action_plan_id="1" review_id="250" /> - - <reviews id="1" project_id="1" resource_id="1" status="CLOSED" - rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" resource_line="200" severity="BLOCKER" - user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]"/> - - <reviews id="2" project_id="1" resource_id="1" status="CLOSED" - rule_failure_permanent_id="2" resolution="[null]" created_at="[null]" resource_line="200" severity="BLOCKER" - user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]"/> - - <review_comments id="1" created_at="[null]" updated_at="[null]" review_id="2" user_id="1223" review_text="abc"/> - <issues id="1" kee="ABCDE" resource_id="1" status="CLOSED" resolution="[null]" line="200" severity="BLOCKER" reporter="perceval" assignee="arthur" rule_id="500" manual_severity="[false]" diff --git a/sonar-core/src/test/resources/org/sonar/core/review/ReviewCommentDaoTest/insert-result.xml b/sonar-core/src/test/resources/org/sonar/core/review/ReviewCommentDaoTest/insert-result.xml deleted file mode 100644 index 3d798ef5622..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/review/ReviewCommentDaoTest/insert-result.xml +++ /dev/null @@ -1,9 +0,0 @@ -<dataset> - - <review_comments - review_id="12" - user_id="8" - review_text="Hello" - /> - -</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/review/ReviewCommentDaoTest/insert.xml b/sonar-core/src/test/resources/org/sonar/core/review/ReviewCommentDaoTest/insert.xml deleted file mode 100644 index 871dedcb5e9..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/review/ReviewCommentDaoTest/insert.xml +++ /dev/null @@ -1,3 +0,0 @@ -<dataset> - -</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/review/ReviewDaoTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/review/ReviewDaoTest/shared.xml deleted file mode 100644 index 376ff96eb8c..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/review/ReviewDaoTest/shared.xml +++ /dev/null @@ -1,94 +0,0 @@ -<dataset> - - <action_plans_reviews action_plan_id="1" review_id="100"/> - <action_plans_reviews action_plan_id="2" review_id="101"/> - - <!-- First resource --> - <reviews - id="100" - status="OPEN" - rule_failure_permanent_id="1" - resolution="[null]" - created_at="[null]" - updated_at="[null]" - project_id="20" - resource_line="200" - severity="BLOCKER" - user_id="300" - assignee_id="300" - resource_id="400" - rule_id="500" - manual_violation="[true]" - manual_severity="[false]"/> - - <reviews - id="101" - status="CLOSED" - rule_failure_permanent_id="1" - resolution="FIXED" - created_at="[null]" - updated_at="[null]" - project_id="30" - resource_line="120" - severity="MAJOR" - user_id="300" - assignee_id="[null]" - resource_id="400" - rule_id="505" - manual_violation="[false]" - manual_severity="[false]"/> - - - <!-- Second resource --> - <reviews - id="102" - status="OPEN" - rule_failure_permanent_id="1" - resolution="[null]" - created_at="[null]" - updated_at="[null]" - project_id="20" - resource_line="200" - severity="BLOCKER" - user_id="300" - assignee_id="300" - resource_id="401" - rule_id="500" - manual_violation="[true]" - manual_severity="[false]"/> - - <reviews - id="103" - status="REOPENED" - rule_failure_permanent_id="1" - resolution="[null]" - created_at="[null]" - updated_at="[null]" - project_id="20" - resource_line="200" - severity="BLOCKER" - user_id="300" - assignee_id="[null]" - resource_id="401" - rule_id="500" - manual_violation="[false]" - manual_severity="[false]"/> - - <reviews - id="104" - status="RESOLVED" - rule_failure_permanent_id="1" - resolution="FALSE-POSITIVE" - created_at="[null]" - updated_at="[null]" - project_id="20" - resource_line="200" - severity="BLOCKER" - user_id="300" - assignee_id="300" - resource_id="401" - rule_id="500" - manual_violation="[false]" - manual_severity="[false]"/> - -</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/review/ReviewDaoTest/update-result.xml b/sonar-core/src/test/resources/org/sonar/core/review/ReviewDaoTest/update-result.xml deleted file mode 100644 index 97382156bb6..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/review/ReviewDaoTest/update-result.xml +++ /dev/null @@ -1,23 +0,0 @@ -<dataset> - - <reviews - id="100" - status="NEW_STATUS" - rule_failure_permanent_id="100" - resolution="NEW_RESOLUTION" - created_at="2012-05-18" - updated_at="2012-07-01" - project_id="20" - resource_line="1000" - severity="NEW_SEV" - user_id="300" - assignee_id="1001" - title="NEW_TITLE" - resource_id="400" - rule_id="500" - manual_severity="[true]" - manual_violation="[false]" - data="big=bang" - /> - -</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/review/ReviewDaoTest/update.xml b/sonar-core/src/test/resources/org/sonar/core/review/ReviewDaoTest/update.xml deleted file mode 100644 index aa32e65a963..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/review/ReviewDaoTest/update.xml +++ /dev/null @@ -1,22 +0,0 @@ -<dataset> - - <reviews - id="100" - status="OPEN" - rule_failure_permanent_id="100" - resolution="RESOLVE" - created_at="[null]" - updated_at="[null]" - project_id="20" - resource_line="200" - severity="BLOCKER" - user_id="300" - assignee_id="[null]" - title="[null]" - resource_id="400" - rule_id="500" - manual_violation="[false]" - manual_severity="[false]" - data="prop1=foo;prop2=bar"/> - -</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/workflow/ReviewDatabaseStoreTest/completeProjectSettings.xml b/sonar-core/src/test/resources/org/sonar/core/workflow/ReviewDatabaseStoreTest/completeProjectSettings.xml deleted file mode 100644 index fffa07e6a9d..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/workflow/ReviewDatabaseStoreTest/completeProjectSettings.xml +++ /dev/null @@ -1,12 +0,0 @@ -<dataset> - - <!-- global --> - <properties id="1" prop_key="jira.url" text_value="http://jira.mycompany.com" resource_id="[null]" user_id="[null]"/> - - <!-- project --> - <properties id="2" prop_key="jira.project.key" text_value="FOO" resource_id="100" user_id="[null]"/> - - <!-- user --> - <properties id="3" prop_key="user.key" text_value="new_user" resource_id="[null]" user_id="100"/> - -</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/workflow/ReviewDatabaseStoreTest/store-result.xml b/sonar-core/src/test/resources/org/sonar/core/workflow/ReviewDatabaseStoreTest/store-result.xml deleted file mode 100644 index a389f7ff88c..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/workflow/ReviewDatabaseStoreTest/store-result.xml +++ /dev/null @@ -1,31 +0,0 @@ -<dataset> - - <reviews - id="1234" - rule_failure_permanent_id="1" - created_at="2012-01-01" - project_id="20" - title="[null]" - resource_line="200" - severity="BLOCKER" - user_id="300" - assignee_id="33" - resource_id="400" - rule_id="500" - manual_violation="[true]" - manual_severity="[false]" - - updated_at="2012-05-18" - status="CLOSED" - resolution="RESOLVED" - data="who=me;why=because" - /> - - <review_comments - review_id="1234" - user_id="555" - review_text="this is a comment" - created_at="2012-05-18" - updated_at="2012-05-18" - /> -</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/workflow/ReviewDatabaseStoreTest/store.xml b/sonar-core/src/test/resources/org/sonar/core/workflow/ReviewDatabaseStoreTest/store.xml deleted file mode 100644 index 8de7eda9f7c..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/workflow/ReviewDatabaseStoreTest/store.xml +++ /dev/null @@ -1,24 +0,0 @@ -<dataset> - - <reviews - id="1234" - rule_failure_permanent_id="1" - created_at="2012-01-01" - project_id="20" - title="[null]" - resource_line="200" - severity="BLOCKER" - user_id="300" - assignee_id="33" - resource_id="400" - rule_id="500" - manual_violation="[true]" - manual_severity="[false]" - - updated_at="[null]" - status="OPEN" - resolution="[null]" - data="[null]" - /> - -</dataset> |