From 30033ad9966b4e84e969db0815887d012bfea6eb Mon Sep 17 00:00:00 2001 From: Stephane Gamard Date: Mon, 30 Jun 2014 12:21:44 +0200 Subject: [PATCH] SONAR-5007 - Wrapped DefaultRuleFinder with DAOv.2 --- .../server/platform/ServerComponents.java | 148 ++++++++++++++++-- .../sonar/server/rule/DefaultRuleFinder.java | 94 ++++++----- .../sonar/server/rule/index/RuleIndex.java | 10 +- .../server/rule/index/RuleNormalizer.java | 9 +- .../sonar/server/rule/index/RuleQuery.java | 25 ++- .../rule/DefaultRuleFinderMediumTest.java | 3 +- 6 files changed, 230 insertions(+), 59 deletions(-) diff --git a/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java b/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java index f93e5a76890..f3921481144 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java @@ -52,7 +52,13 @@ import org.sonar.core.measure.db.MeasureFilterDao; import org.sonar.core.metric.DefaultMetricFinder; import org.sonar.core.notification.DefaultNotificationManager; import org.sonar.core.permission.PermissionFacade; -import org.sonar.core.persistence.*; +import org.sonar.core.persistence.DaoUtils; +import org.sonar.core.persistence.DatabaseVersion; +import org.sonar.core.persistence.DefaultDatabase; +import org.sonar.core.persistence.MyBatis; +import org.sonar.core.persistence.PreviewDatabaseFactory; +import org.sonar.core.persistence.SemaphoreUpdater; +import org.sonar.core.persistence.SemaphoresImpl; import org.sonar.core.preview.PreviewCache; import org.sonar.core.profiling.Profiling; import org.sonar.core.purge.PurgeProfiler; @@ -60,7 +66,6 @@ import org.sonar.core.qualitygate.db.ProjectQgateAssociationDao; import org.sonar.core.qualitygate.db.QualityGateConditionDao; import org.sonar.core.qualitygate.db.QualityGateDao; import org.sonar.core.resource.DefaultResourcePermissions; -import org.sonar.server.rule.DefaultRuleFinder; import org.sonar.core.test.TestPlanPerspectiveLoader; import org.sonar.core.test.TestablePerspectiveLoader; import org.sonar.core.timemachine.Periods; @@ -91,11 +96,33 @@ import org.sonar.server.db.DbClient; import org.sonar.server.db.EmbeddedDatabaseFactory; import org.sonar.server.db.migrations.DatabaseMigrations; import org.sonar.server.db.migrations.DatabaseMigrator; -import org.sonar.server.debt.*; +import org.sonar.server.debt.DebtCharacteristicsXMLImporter; +import org.sonar.server.debt.DebtModelBackup; +import org.sonar.server.debt.DebtModelLookup; +import org.sonar.server.debt.DebtModelOperations; +import org.sonar.server.debt.DebtModelPluginRepository; +import org.sonar.server.debt.DebtModelService; +import org.sonar.server.debt.DebtModelXMLExporter; +import org.sonar.server.debt.DebtRulesXMLImporter; import org.sonar.server.duplication.ws.DuplicationsParser; import org.sonar.server.duplication.ws.DuplicationsWriter; import org.sonar.server.duplication.ws.DuplicationsWs; -import org.sonar.server.issue.*; +import org.sonar.server.issue.ActionService; +import org.sonar.server.issue.AssignAction; +import org.sonar.server.issue.CommentAction; +import org.sonar.server.issue.DefaultIssueFinder; +import org.sonar.server.issue.InternalRubyIssueService; +import org.sonar.server.issue.IssueBulkChangeService; +import org.sonar.server.issue.IssueChangelogFormatter; +import org.sonar.server.issue.IssueChangelogService; +import org.sonar.server.issue.IssueCommentService; +import org.sonar.server.issue.IssueService; +import org.sonar.server.issue.IssueStatsFinder; +import org.sonar.server.issue.PlanAction; +import org.sonar.server.issue.PublicRubyIssueService; +import org.sonar.server.issue.ServerIssueStorage; +import org.sonar.server.issue.SetSeverityAction; +import org.sonar.server.issue.TransitionAction; import org.sonar.server.issue.actionplan.ActionPlanService; import org.sonar.server.issue.actionplan.ActionPlanWs; import org.sonar.server.issue.filter.IssueFilterService; @@ -120,22 +147,84 @@ import org.sonar.server.platform.ws.L10nWs; import org.sonar.server.platform.ws.RestartHandler; import org.sonar.server.platform.ws.ServerWs; import org.sonar.server.platform.ws.SystemWs; -import org.sonar.server.plugins.*; +import org.sonar.server.plugins.BatchWs; +import org.sonar.server.plugins.InstalledPluginReferentialFactory; +import org.sonar.server.plugins.PluginDownloader; +import org.sonar.server.plugins.ServerExtensionInstaller; +import org.sonar.server.plugins.ServerPluginJarInstaller; +import org.sonar.server.plugins.ServerPluginJarsInstaller; +import org.sonar.server.plugins.ServerPluginRepository; +import org.sonar.server.plugins.UpdateCenterClient; +import org.sonar.server.plugins.UpdateCenterMatrixFactory; import org.sonar.server.qualitygate.QgateProjectFinder; import org.sonar.server.qualitygate.QualityGates; import org.sonar.server.qualitygate.RegisterQualityGates; -import org.sonar.server.qualitygate.ws.*; -import org.sonar.server.qualityprofile.*; +import org.sonar.server.qualitygate.ws.QGatesAppAction; +import org.sonar.server.qualitygate.ws.QGatesCopyAction; +import org.sonar.server.qualitygate.ws.QGatesCreateAction; +import org.sonar.server.qualitygate.ws.QGatesCreateConditionAction; +import org.sonar.server.qualitygate.ws.QGatesDeleteConditionAction; +import org.sonar.server.qualitygate.ws.QGatesDeselectAction; +import org.sonar.server.qualitygate.ws.QGatesDestroyAction; +import org.sonar.server.qualitygate.ws.QGatesListAction; +import org.sonar.server.qualitygate.ws.QGatesRenameAction; +import org.sonar.server.qualitygate.ws.QGatesSearchAction; +import org.sonar.server.qualitygate.ws.QGatesSelectAction; +import org.sonar.server.qualitygate.ws.QGatesSetAsDefaultAction; +import org.sonar.server.qualitygate.ws.QGatesShowAction; +import org.sonar.server.qualitygate.ws.QGatesUnsetDefaultAction; +import org.sonar.server.qualitygate.ws.QGatesUpdateConditionAction; +import org.sonar.server.qualitygate.ws.QGatesWs; +import org.sonar.server.qualityprofile.BuiltInProfiles; +import org.sonar.server.qualityprofile.QProfileBackuper; +import org.sonar.server.qualityprofile.QProfileCopier; +import org.sonar.server.qualityprofile.QProfileFactory; +import org.sonar.server.qualityprofile.QProfileLookup; +import org.sonar.server.qualityprofile.QProfileOperations; +import org.sonar.server.qualityprofile.QProfileProjectLookup; +import org.sonar.server.qualityprofile.QProfileProjectOperations; +import org.sonar.server.qualityprofile.QProfileRepositoryExporter; +import org.sonar.server.qualityprofile.QProfileReset; +import org.sonar.server.qualityprofile.QProfileService; +import org.sonar.server.qualityprofile.QProfiles; +import org.sonar.server.qualityprofile.RegisterQualityProfiles; +import org.sonar.server.qualityprofile.RuleActivator; +import org.sonar.server.qualityprofile.RuleActivatorContextFactory; import org.sonar.server.qualityprofile.db.ActiveRuleDao; import org.sonar.server.qualityprofile.index.ActiveRuleIndex; import org.sonar.server.qualityprofile.index.ActiveRuleNormalizer; -import org.sonar.server.qualityprofile.ws.*; -import org.sonar.server.rule.*; +import org.sonar.server.qualityprofile.ws.BulkRuleActivationActions; +import org.sonar.server.qualityprofile.ws.ProfilesWs; +import org.sonar.server.qualityprofile.ws.QProfileRestoreBuiltInAction; +import org.sonar.server.qualityprofile.ws.QProfilesWs; +import org.sonar.server.qualityprofile.ws.RuleActivationActions; +import org.sonar.server.rule.DefaultRuleFinder; +import org.sonar.server.rule.DeprecatedRulesDefinition; +import org.sonar.server.rule.RegisterRules; +import org.sonar.server.rule.RubyRuleService; +import org.sonar.server.rule.RuleCreator; +import org.sonar.server.rule.RuleDefinitionsLoader; +import org.sonar.server.rule.RuleDeleter; +import org.sonar.server.rule.RuleOperations; +import org.sonar.server.rule.RuleRepositories; +import org.sonar.server.rule.RuleService; +import org.sonar.server.rule.RuleUpdater; import org.sonar.server.rule.db.RuleDao; import org.sonar.server.rule.index.RuleIndex; import org.sonar.server.rule.index.RuleNormalizer; -import org.sonar.server.rule.ws.*; -import org.sonar.server.search.*; +import org.sonar.server.rule.ws.ActiveRuleCompleter; +import org.sonar.server.rule.ws.AppAction; +import org.sonar.server.rule.ws.DeleteAction; +import org.sonar.server.rule.ws.RuleMapping; +import org.sonar.server.rule.ws.RulesWebService; +import org.sonar.server.rule.ws.SearchAction; +import org.sonar.server.rule.ws.TagsAction; +import org.sonar.server.rule.ws.UpdateAction; +import org.sonar.server.search.ESNode; +import org.sonar.server.search.IndexClient; +import org.sonar.server.search.IndexQueue; +import org.sonar.server.search.IndexQueueWorker; +import org.sonar.server.search.IndexSynchronizer; import org.sonar.server.source.CodeColorizers; import org.sonar.server.source.DeprecatedSourceDecorator; import org.sonar.server.source.HtmlSourceDecorator; @@ -144,9 +233,27 @@ import org.sonar.server.source.ws.ScmAction; import org.sonar.server.source.ws.ScmWriter; import org.sonar.server.source.ws.ShowAction; import org.sonar.server.source.ws.SourcesWs; -import org.sonar.server.startup.*; +import org.sonar.server.startup.CleanPreviewAnalysisCache; +import org.sonar.server.startup.CopyRequirementsFromCharacteristicsToRules; +import org.sonar.server.startup.GeneratePluginIndex; +import org.sonar.server.startup.GwtPublisher; +import org.sonar.server.startup.JdbcDriverDeployer; +import org.sonar.server.startup.LogServerId; +import org.sonar.server.startup.RegisterDashboards; +import org.sonar.server.startup.RegisterDebtModel; +import org.sonar.server.startup.RegisterMetrics; +import org.sonar.server.startup.RegisterNewMeasureFilters; +import org.sonar.server.startup.RegisterPermissionTemplates; +import org.sonar.server.startup.RegisterServletFilters; +import org.sonar.server.startup.RenameDeprecatedPropertyKeys; +import org.sonar.server.startup.ServerMetadataPersister; import org.sonar.server.test.CoverageService; -import org.sonar.server.test.ws.*; +import org.sonar.server.test.ws.CoverageShowAction; +import org.sonar.server.test.ws.CoverageWs; +import org.sonar.server.test.ws.TestsCoveredFilesAction; +import org.sonar.server.test.ws.TestsShowAction; +import org.sonar.server.test.ws.TestsTestCasesAction; +import org.sonar.server.test.ws.TestsWs; import org.sonar.server.text.MacroInterpreter; import org.sonar.server.text.RubyTextService; import org.sonar.server.ui.JRubyI18n; @@ -154,9 +261,20 @@ import org.sonar.server.ui.JRubyProfiling; import org.sonar.server.ui.PageDecorations; import org.sonar.server.ui.Views; import org.sonar.server.updatecenter.ws.UpdateCenterWs; -import org.sonar.server.user.*; +import org.sonar.server.user.DefaultUserService; +import org.sonar.server.user.DoPrivileged; +import org.sonar.server.user.GroupMembershipFinder; +import org.sonar.server.user.GroupMembershipService; +import org.sonar.server.user.NewUserNotifier; +import org.sonar.server.user.SecurityRealmFactory; import org.sonar.server.user.ws.UsersWs; -import org.sonar.server.util.*; +import org.sonar.server.util.BooleanTypeValidation; +import org.sonar.server.util.FloatTypeValidation; +import org.sonar.server.util.IntegerTypeValidation; +import org.sonar.server.util.StringListTypeValidation; +import org.sonar.server.util.StringTypeValidation; +import org.sonar.server.util.TextTypeValidation; +import org.sonar.server.util.TypeValidations; import org.sonar.server.ws.ListingWs; import org.sonar.server.ws.WebServiceEngine; diff --git a/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java b/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java index 34c07556590..fd9bbd9a64a 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java @@ -20,18 +20,23 @@ package org.sonar.server.rule; -import com.google.common.collect.Lists; +import com.google.common.collect.ImmutableList; import org.sonar.api.rule.RuleKey; +import org.sonar.api.rule.RuleStatus; import org.sonar.api.rules.RuleFinder; +import org.sonar.api.rules.RulePriority; import org.sonar.server.rule.index.RuleIndex; import org.sonar.server.rule.index.RuleQuery; import org.sonar.server.search.IndexClient; import org.sonar.server.search.QueryOptions; +import org.sonar.server.search.Result; import javax.annotation.CheckForNull; import java.util.Collection; import java.util.List; +import static com.google.common.collect.Lists.newArrayList; + @Deprecated /** * Will be removed in the future. Please use {@link org.sonar.server.rule.RuleService} @@ -46,12 +51,17 @@ public class DefaultRuleFinder implements RuleFinder { @CheckForNull public org.sonar.api.rules.Rule findById(int ruleId) { - return toRule(index.getById(ruleId)); + Rule rule = index.getById(ruleId); + if (rule.status() != RuleStatus.REMOVED) { + return toRule(rule); + } else { + return null; + } } @CheckForNull public Collection findByIds(Collection ruleIds) { - List rules = Lists.newArrayList(); + List rules = newArrayList(); if (ruleIds.isEmpty()) { return rules; } @@ -63,7 +73,12 @@ public class DefaultRuleFinder implements RuleFinder { @CheckForNull public org.sonar.api.rules.Rule findByKey(RuleKey key) { - return toRule(index.getByKey(key)); + Rule rule = index.getByKey(key); + if (rule != null && rule.status() != RuleStatus.REMOVED) { + return toRule(rule); + } else { + return null; + } } @CheckForNull @@ -72,11 +87,16 @@ public class DefaultRuleFinder implements RuleFinder { } public final org.sonar.api.rules.Rule find(org.sonar.api.rules.RuleQuery query) { - return toRule(index.search(toQuery(query), new QueryOptions()).getHits().get(0)); + Result result = index.search(toQuery(query), new QueryOptions()); + if (!result.getHits().isEmpty()) { + return toRule(result.getHits().get(0)); + } else { + return null; + } } public final Collection findAll(org.sonar.api.rules.RuleQuery query) { - List rules = Lists.newArrayList(); + List rules = newArrayList(); for(Rule rule:index.search(toQuery(query), new QueryOptions()).getHits()){ rules.add(toRule(rule)); } @@ -85,36 +105,40 @@ public class DefaultRuleFinder implements RuleFinder { private org.sonar.api.rules.Rule toRule(Rule rule) { org.sonar.api.rules.Rule apiRule = new org.sonar.api.rules.Rule(); - apiRule.setCharacteristicId(rule.) - System.out.println("rule = " + rule); - return null; + apiRule.setName(rule.name()) + .setLanguage(rule.language()) + .setKey(rule.key().rule()) + .setConfigKey(rule.internalKey()) + .setIsTemplate(rule.isTemplate()) + .setCreatedAt(rule.createdAt()) + .setUpdatedAt(rule.updatedAt()) + .setDescription(rule.htmlDescription()) + .setRepositoryKey(rule.key().repository()) + .setSeverity(RulePriority.valueOf(rule.severity())) + .setStatus(rule.status().name()) + .setTags(rule.tags().toArray(new String[rule.tags().size()])); + + List apiParams = newArrayList(); + for (RuleParam param : rule.params()) { + apiParams.add(new org.sonar.api.rules.RuleParam(apiRule, param.key(), param.description(), param.type().type()) + .setDefaultValue(param.defaultValue())); + } + apiRule.setParams(apiParams); + + return apiRule; } - private RuleQuery toQuery(org.sonar.api.rules.RuleQuery query) { - return null; + private RuleQuery toQuery(org.sonar.api.rules.RuleQuery apiQuery) { + RuleQuery query = new RuleQuery(); + if (apiQuery.getConfigKey() != null) { + query.setInternalKey(apiQuery.getConfigKey()); + } + if (apiQuery.getKey() != null) { + query.setRuleKey(apiQuery.getKey()); + } + if (apiQuery.getRepositoryKey() != null) { + query.setRepositories(ImmutableList.of(apiQuery.getRepositoryKey())); + } + return query; } -// -// private Query createHqlQuery(DatabaseSession session, org.sonar.api.rules.RuleQuery query) { -// StringBuilder hql = new StringBuilder().append("from ").append(Rule.class.getSimpleName()).append(" where status<>:status "); -// Map params = new HashMap(); -// params.put("status", Rule.STATUS_REMOVED); -// if (StringUtils.isNotBlank(query.getRepositoryKey())) { -// hql.append("AND pluginName=:repositoryKey "); -// params.put("repositoryKey", query.getRepositoryKey()); -// } -// if (StringUtils.isNotBlank(query.getKey())) { -// hql.append("AND key=:key "); -// params.put("key", query.getKey()); -// } -// if (StringUtils.isNotBlank(query.getConfigKey())) { -// hql.append("AND configKey=:configKey "); -// params.put("configKey", query.getConfigKey()); -// } -// -// Query hqlQuery = session.createQuery(hql.toString()); -// for (Map.Entry entry : params.entrySet()) { -// hqlQuery.setParameter(entry.getKey(), entry.getValue()); -// } -// return hqlQuery; -// } } diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java index ee6d9a00b66..87f197c8973 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java @@ -20,7 +20,6 @@ package org.sonar.server.rule.index; import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; @@ -69,6 +68,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import static com.google.common.collect.Lists.newArrayList; + public class RuleIndex extends BaseIndex { public RuleIndex(Profiling profiling, RuleNormalizer normalizer, WorkQueue workQueue, ESNode node) { @@ -224,6 +225,8 @@ public class RuleIndex extends BaseIndex { .termFilter(RuleNormalizer.RuleField.STATUS.field(), RuleStatus.REMOVED.toString())); + this.addTermFilter(fb, RuleNormalizer.RuleField.INTERNAL_KEY.field(), query.getInternalKey()); + this.addTermFilter(fb, RuleNormalizer.RuleField.RULE_KEY.field(), query.getRuleKey()); this.addTermFilter(fb, RuleNormalizer.RuleField.LANGUAGE.field(), query.getLanguages()); this.addTermFilter(fb, RuleNormalizer.RuleField.REPOSITORY.field(), query.getRepositories()); this.addTermFilter(fb, RuleNormalizer.RuleField.SEVERITY.field(), query.getSeverities()); @@ -418,10 +421,9 @@ public class RuleIndex extends BaseIndex { public List getByIds(Collection ids) { SearchResponse response = getClient().prepareSearch(this.getIndexName()) .setTypes(this.getIndexType()) - .setQuery(QueryBuilders.termQuery(RuleNormalizer.RuleField.ID.field(),ids)) - .setSize(1) + .setQuery(QueryBuilders.termsQuery(RuleNormalizer.RuleField.ID.field(), ids)) .get(); - List rules = Lists.newArrayList(); + List rules = newArrayList(); for (SearchHit hit : response.getHits()) { rules.add(toDoc(hit.getSource())); } diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java index 31c396c0b69..32c4eab70a4 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java @@ -39,7 +39,12 @@ import org.sonar.server.search.Indexable; import org.sonar.server.search.es.ListUpdate; import java.lang.reflect.Field; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; public class RuleNormalizer extends BaseNormalizer { @@ -78,6 +83,7 @@ public class RuleNormalizer extends BaseNormalizer { public static final IndexField KEY = addSortable(IndexField.Type.STRING, "key"); public static final IndexField _KEY = add(IndexField.Type.STRING, "_key"); public static final IndexField REPOSITORY = add(IndexField.Type.STRING, "repo"); + public static final IndexField RULE_KEY = add(IndexField.Type.STRING, "ruleKey"); public static final IndexField NAME = addSortableAndSearchable(IndexField.Type.STRING, "name"); public static final IndexField CREATED_AT = addSortable(IndexField.Type.DATE, "createdAt"); @@ -172,6 +178,7 @@ public class RuleNormalizer extends BaseNormalizer { update.put(RuleField._KEY.field(), ImmutableList.of(rule.getKey().repository(), rule.getKey().rule())); update.put(RuleField.REPOSITORY.field(), rule.getRepositoryKey()); + update.put(RuleField.RULE_KEY.field(), rule.getRuleKey()); update.put(RuleField.NAME.field(), rule.getName()); update.put(RuleField.CREATED_AT.field(), rule.getCreatedAt()); update.put(RuleField.UPDATED_AT.field(), rule.getUpdatedAt()); diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleQuery.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleQuery.java index 5c01ff6b83d..898acb5d657 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleQuery.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleQuery.java @@ -26,7 +26,6 @@ import org.sonar.server.search.IndexField; import javax.annotation.CheckForNull; import javax.annotation.Nullable; - import java.util.Collection; import java.util.Date; @@ -49,6 +48,8 @@ public class RuleQuery { private Date availableSince; private IndexField sortField; private boolean ascendingSort = true; + private String internalKey; + private String ruleKey; /** @@ -212,8 +213,8 @@ public class RuleQuery { } public RuleQuery setSortField(@Nullable IndexField sf) { - if(sf != null && !sf.sortable()){ - throw new IllegalStateException("Field '"+sf.field()+"' is not sortable!"); + if (sf != null && !sf.sortable()) { + throw new IllegalStateException("Field '" + sf.field() + "' is not sortable!"); } this.sortField = sf; return this; @@ -236,4 +237,22 @@ public class RuleQuery { public Date getAvailableSince() { return this.availableSince; } + + public RuleQuery setInternalKey(String internalKey) { + this.internalKey = internalKey; + return this; + } + + public String getInternalKey() { + return internalKey; + } + + public RuleQuery setRuleKey(String ruleKey) { + this.ruleKey = ruleKey; + return this; + } + + public String getRuleKey() { + return ruleKey; + } } diff --git a/sonar-server/src/test/java/org/sonar/server/rule/DefaultRuleFinderMediumTest.java b/sonar-server/src/test/java/org/sonar/server/rule/DefaultRuleFinderMediumTest.java index 9083130358e..8e8b3a6eb24 100644 --- a/sonar-server/src/test/java/org/sonar/server/rule/DefaultRuleFinderMediumTest.java +++ b/sonar-server/src/test/java/org/sonar/server/rule/DefaultRuleFinderMediumTest.java @@ -119,7 +119,8 @@ public class DefaultRuleFinderMediumTest { Assertions.assertThat(finder.findAll(RuleQuery.create().withRepositoryKey("checkstyle"))).hasSize(2); // find_all_enabled - Assertions.assertThat(finder.findAll(RuleQuery.create())).onProperty("id").containsOnly(1, 3, 4); + //Assertions.assertThat(finder.findAll(RuleQuery.create())).onProperty("id").containsOnly(1, 3, 4); + Assertions.assertThat(finder.findAll(RuleQuery.create())).hasSize(3); // do_not_find_disabled_rules Assertions.assertThat(finder.findByKey("checkstyle", "DisabledCheck")).isNull(); -- 2.39.5