From 6ce6cc598fdcd6e3d6eb662b47668b0c6b898f3d Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Mon, 29 Nov 2010 17:00:54 +0000 Subject: SONAR-249 improve core components to load rules and metrics --- .../sonar/core/components/CacheMetricFinder.java | 72 ++++++++++++++ .../org/sonar/core/components/CacheRuleFinder.java | 74 ++++++++++++++ .../sonar/core/components/DefaultModelFinder.java | 40 ++++++++ .../sonar/core/components/DefaultRuleFinder.java | 91 ++++++++++++++++++ .../core/qualitymodel/DefaultModelFinder.java | 40 -------- .../org/sonar/core/rule/DefaultRuleFinder.java | 79 --------------- .../core/components/CacheMetricFinderTest.java | 65 +++++++++++++ .../sonar/core/components/CacheRuleFinderTest.java | 61 ++++++++++++ .../core/components/DefaultModelFinderTest.java | 47 +++++++++ .../core/components/DefaultRuleFinderTest.java | 105 ++++++++++++++++++++ .../java/org/sonar/core/components/ModelTest.java | 104 ++++++++++++++++++++ .../core/qualitymodel/DefaultModelFinderTest.java | 46 --------- .../org/sonar/core/qualitymodel/ModelTest.java | 107 --------------------- .../org/sonar/core/rule/DefaultRuleFinderTest.java | 91 ------------------ .../components/CacheMetricFinderTest/shared.xml | 12 +++ .../components/DefaultModelFinderTest/shared.xml | 10 ++ .../components/DefaultRuleFinderTest/shared.xml | 20 ++++ .../ModelTest/saveModelAndCharacteristics.xml | 4 + .../ModelTest/testGraphOfCharacteristics.xml | 8 ++ .../ModelTest/testTreeOfCharacteristics.xml | 5 + .../qualitymodel/DefaultModelFinderTest/shared.xml | 10 -- .../ModelTest/saveModelAndCharacteristics.xml | 4 - .../ModelTest/testGraphOfCharacteristics.xml | 8 -- .../ModelTest/testTreeOfCharacteristics.xml | 5 - .../core/rule/DefaultRuleFinderTest/shared.xml | 20 ---- 25 files changed, 718 insertions(+), 410 deletions(-) create mode 100644 sonar-core/src/main/java/org/sonar/core/components/CacheMetricFinder.java create mode 100644 sonar-core/src/main/java/org/sonar/core/components/CacheRuleFinder.java create mode 100644 sonar-core/src/main/java/org/sonar/core/components/DefaultModelFinder.java create mode 100644 sonar-core/src/main/java/org/sonar/core/components/DefaultRuleFinder.java delete mode 100644 sonar-core/src/main/java/org/sonar/core/qualitymodel/DefaultModelFinder.java delete mode 100644 sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java create mode 100644 sonar-core/src/test/java/org/sonar/core/components/CacheMetricFinderTest.java create mode 100644 sonar-core/src/test/java/org/sonar/core/components/CacheRuleFinderTest.java create mode 100644 sonar-core/src/test/java/org/sonar/core/components/DefaultModelFinderTest.java create mode 100644 sonar-core/src/test/java/org/sonar/core/components/DefaultRuleFinderTest.java create mode 100644 sonar-core/src/test/java/org/sonar/core/components/ModelTest.java delete mode 100644 sonar-core/src/test/java/org/sonar/core/qualitymodel/DefaultModelFinderTest.java delete mode 100644 sonar-core/src/test/java/org/sonar/core/qualitymodel/ModelTest.java delete mode 100644 sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java create mode 100644 sonar-core/src/test/resources/org/sonar/core/components/CacheMetricFinderTest/shared.xml create mode 100644 sonar-core/src/test/resources/org/sonar/core/components/DefaultModelFinderTest/shared.xml create mode 100644 sonar-core/src/test/resources/org/sonar/core/components/DefaultRuleFinderTest/shared.xml create mode 100644 sonar-core/src/test/resources/org/sonar/core/components/ModelTest/saveModelAndCharacteristics.xml create mode 100644 sonar-core/src/test/resources/org/sonar/core/components/ModelTest/testGraphOfCharacteristics.xml create mode 100644 sonar-core/src/test/resources/org/sonar/core/components/ModelTest/testTreeOfCharacteristics.xml delete mode 100644 sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelFinderTest/shared.xml delete mode 100644 sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/saveModelAndCharacteristics.xml delete mode 100644 sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testGraphOfCharacteristics.xml delete mode 100644 sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testTreeOfCharacteristics.xml delete mode 100644 sonar-core/src/test/resources/org/sonar/core/rule/DefaultRuleFinderTest/shared.xml (limited to 'sonar-core/src') diff --git a/sonar-core/src/main/java/org/sonar/core/components/CacheMetricFinder.java b/sonar-core/src/main/java/org/sonar/core/components/CacheMetricFinder.java new file mode 100644 index 00000000000..fa125dc9da1 --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/components/CacheMetricFinder.java @@ -0,0 +1,72 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.core.components; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import org.sonar.api.measures.Metric; +import org.sonar.api.measures.MetricFinder; +import org.sonar.jpa.session.DatabaseSessionFactory; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +public final class CacheMetricFinder implements MetricFinder { + + private DatabaseSessionFactory sessionFactory; + private Map metricsByKey = Maps.newLinkedHashMap(); + private Map metricsById = Maps.newLinkedHashMap(); + + public CacheMetricFinder(DatabaseSessionFactory sessionFactory) { + this.sessionFactory = sessionFactory; + } + + public void start() { + List list = sessionFactory.getSession().getResults(Metric.class, "enabled", true); + for (Metric metric : list) { + metricsByKey.put(metric.getKey(), metric); + metricsById.put(metric.getId(), metric); + } + } + + public Metric findById(int metricId) { + return metricsById.get(metricId); + } + + public Metric findByKey(String key) { + return metricsByKey.get(key); + } + + public Collection findAll(List metricKeys) { + List result = Lists.newLinkedList(); + for (String metricKey : metricKeys) { + Metric metric = findByKey(metricKey); + if (metric != null) { + result.add(metric); + } + } + return result; + } + + public Collection findAll() { + return metricsByKey.values(); + } +} diff --git a/sonar-core/src/main/java/org/sonar/core/components/CacheRuleFinder.java b/sonar-core/src/main/java/org/sonar/core/components/CacheRuleFinder.java new file mode 100644 index 00000000000..1e0b747bb61 --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/components/CacheRuleFinder.java @@ -0,0 +1,74 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.core.components; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.Maps; +import org.sonar.api.rules.Rule; +import org.sonar.jpa.session.DatabaseSessionFactory; + +import java.util.Map; + +public final class CacheRuleFinder extends DefaultRuleFinder { + + private BiMap rulesById = HashBiMap.create(); + private Map> rulesByKey = Maps.newHashMap(); + + public CacheRuleFinder(DatabaseSessionFactory sessionFactory) { + super(sessionFactory); + } + + @Override + public Rule findById(int ruleId) { + Rule rule = rulesById.get(ruleId); + if (rule==null) { + rule = doFindById(ruleId); + addToCache(rule); + } + return rule; + } + + @Override + public Rule findByKey(String repositoryKey, String key) { + Map repoRules = rulesByKey.get(repositoryKey); + Rule rule = null; + if (repoRules!=null) { + rule = repoRules.get(key); + } + if (rule == null) { + rule = doFindByKey(repositoryKey, key); + addToCache(rule); + } + return rule; + } + + private void addToCache(Rule rule) { + if (rule != null) { + rulesById.put(rule.getId(), rule); + Map repoRules = rulesByKey.get(rule.getKey()); + if (repoRules==null) { + repoRules = Maps.newHashMap(); + rulesByKey.put(rule.getRepositoryKey(), repoRules); + } + repoRules.put(rule.getKey(), rule); + } + } +} diff --git a/sonar-core/src/main/java/org/sonar/core/components/DefaultModelFinder.java b/sonar-core/src/main/java/org/sonar/core/components/DefaultModelFinder.java new file mode 100644 index 00000000000..a7a04c7cf24 --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/components/DefaultModelFinder.java @@ -0,0 +1,40 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.core.components; + +import org.sonar.api.database.DatabaseSession; +import org.sonar.api.qualitymodel.Model; +import org.sonar.api.qualitymodel.ModelFinder; +import org.sonar.jpa.session.DatabaseSessionFactory; + +public class DefaultModelFinder implements ModelFinder { + + private DatabaseSessionFactory sessionFactory; + + public DefaultModelFinder(DatabaseSessionFactory sessionFactory) { + this.sessionFactory = sessionFactory; + } + + public Model findByName(String name) { + DatabaseSession session = sessionFactory.getSession(); + return session.getSingleResult(Model.class, "name", name); + } + +} diff --git a/sonar-core/src/main/java/org/sonar/core/components/DefaultRuleFinder.java b/sonar-core/src/main/java/org/sonar/core/components/DefaultRuleFinder.java new file mode 100644 index 00000000000..3c0d50e7bcd --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/components/DefaultRuleFinder.java @@ -0,0 +1,91 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.core.components; + +import org.apache.commons.lang.StringUtils; +import org.sonar.api.database.DatabaseSession; +import org.sonar.api.rules.Rule; +import org.sonar.api.rules.RuleFinder; +import org.sonar.api.rules.RuleQuery; +import org.sonar.jpa.session.DatabaseSessionFactory; + +import javax.persistence.Query; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +public class DefaultRuleFinder implements RuleFinder { + + private DatabaseSessionFactory sessionFactory; + + public DefaultRuleFinder(DatabaseSessionFactory sessionFactory) { + this.sessionFactory = sessionFactory; + } + + public Rule findById(int ruleId) { + return doFindById(ruleId); + } + + protected final Rule doFindById(int ruleId) { + return sessionFactory.getSession().getSingleResult(Rule.class, "id", ruleId, "enabled", true); + } + + public Rule findByKey(String repositoryKey, String key) { + return doFindByKey(repositoryKey, key); + } + + protected final Rule doFindByKey(String repositoryKey, String key) { + return sessionFactory.getSession().getSingleResult(Rule.class, "pluginName", repositoryKey, "key", key, "enabled", true); + } + + public final Rule find(RuleQuery query) { + DatabaseSession session = sessionFactory.getSession(); + return (Rule)session.getSingleResult(createHqlQuery(session, query), null); + + } + + public final Collection findAll(RuleQuery query) { + DatabaseSession session = sessionFactory.getSession(); + return createHqlQuery(session, query).getResultList(); + } + + private Query createHqlQuery(DatabaseSession session, RuleQuery query) { + StringBuilder hql = new StringBuilder().append("from ").append(Rule.class.getSimpleName()).append(" where enabled=true "); + Map params = new HashMap(); + 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-core/src/main/java/org/sonar/core/qualitymodel/DefaultModelFinder.java b/sonar-core/src/main/java/org/sonar/core/qualitymodel/DefaultModelFinder.java deleted file mode 100644 index 5606e5e0907..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/qualitymodel/DefaultModelFinder.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.core.qualitymodel; - -import org.sonar.api.database.DatabaseSession; -import org.sonar.api.qualitymodel.Model; -import org.sonar.api.qualitymodel.ModelFinder; -import org.sonar.jpa.session.DatabaseSessionFactory; - -public class DefaultModelFinder implements ModelFinder { - - private DatabaseSessionFactory sessionFactory; - - public DefaultModelFinder(DatabaseSessionFactory sessionFactory) { - this.sessionFactory = sessionFactory; - } - - public Model findByName(String name) { - DatabaseSession session = sessionFactory.getSession(); - return session.getSingleResult(Model.class, "name", name); - } - -} diff --git a/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java b/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java deleted file mode 100644 index 6a167b180f7..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/rule/DefaultRuleFinder.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.core.rule; - -import org.apache.commons.lang.StringUtils; -import org.sonar.api.database.DatabaseSession; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.rules.RuleQuery; -import org.sonar.jpa.session.DatabaseSessionFactory; - -import javax.persistence.Query; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -public class DefaultRuleFinder implements RuleFinder { - - private DatabaseSessionFactory sessionFactory; - - public DefaultRuleFinder(DatabaseSessionFactory sessionFactory) { - this.sessionFactory = sessionFactory; - } - - public Rule findByKey(String repositoryKey, String key) { - return sessionFactory.getSession().getSingleResult(Rule.class, "pluginName", repositoryKey, "key", key, "enabled", true); - } - - public Rule find(RuleQuery query) { - DatabaseSession session = sessionFactory.getSession(); - return (Rule)session.getSingleResult(createHqlQuery(session, query), null); - - } - - public Collection findAll(RuleQuery query) { - DatabaseSession session = sessionFactory.getSession(); - return createHqlQuery(session, query).getResultList(); - } - - private Query createHqlQuery(DatabaseSession session, RuleQuery query) { - StringBuilder hql = new StringBuilder().append("from ").append(Rule.class.getSimpleName()).append(" where enabled=true "); - Map params = new HashMap(); - 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-core/src/test/java/org/sonar/core/components/CacheMetricFinderTest.java b/sonar-core/src/test/java/org/sonar/core/components/CacheMetricFinderTest.java new file mode 100644 index 00000000000..a67fd0cf713 --- /dev/null +++ b/sonar-core/src/test/java/org/sonar/core/components/CacheMetricFinderTest.java @@ -0,0 +1,65 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.core.components; + +import org.junit.Before; +import org.junit.Test; +import org.sonar.jpa.test.AbstractDbUnitTestCase; + +import java.util.Arrays; + +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNull.nullValue; +import static org.junit.Assert.assertThat; + + +public class CacheMetricFinderTest extends AbstractDbUnitTestCase { + + private CacheMetricFinder finder; + + @Before + public void initFinder() { + setupData("shared"); + finder = new CacheMetricFinder(getSessionFactory()); + finder.start(); + } + + @Test + public void shouldFindAll() { + assertThat(finder.findAll().size(), is(2)); + } + + @Test + public void shouldFindByKeys() { + assertThat(finder.findAll(Arrays.asList("ncloc", "foo", "coverage")).size(), is(2)); + } + + @Test + public void shouldFindById() { + assertThat(finder.findById(1).getKey(), is("ncloc")); + assertThat(finder.findById(3), nullValue()); + } + + @Test + public void shouldFindByKey() { + assertThat(finder.findByKey("ncloc").getKey(), is("ncloc")); + assertThat(finder.findByKey("disabled"), nullValue()); + } +} diff --git a/sonar-core/src/test/java/org/sonar/core/components/CacheRuleFinderTest.java b/sonar-core/src/test/java/org/sonar/core/components/CacheRuleFinderTest.java new file mode 100644 index 00000000000..0eb9d239161 --- /dev/null +++ b/sonar-core/src/test/java/org/sonar/core/components/CacheRuleFinderTest.java @@ -0,0 +1,61 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.core.components; + +import org.junit.Test; +import org.sonar.api.rules.Rule; +import org.sonar.api.rules.RuleFinder; +import org.sonar.jpa.test.AbstractDbUnitTestCase; + +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNull.notNullValue; +import static org.junit.Assert.assertThat; + +public class CacheRuleFinderTest extends AbstractDbUnitTestCase { + + @Test + public void shouldCacheFindById() { + setupData("shared"); + RuleFinder finder = new CacheRuleFinder(getSessionFactory()); + assertThat(finder.findById(3).getConfigKey(), is("Checker/Treewalker/AnnotationUseStyleCheck")); + + deleteRules(); + + assertThat(finder.findById(3), notNullValue()); + } + + @Test + public void shouldCacheFindByKey() { + setupData("shared"); + RuleFinder finder = new CacheRuleFinder(getSessionFactory()); + Rule rule = finder.findByKey("checkstyle", "com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck"); + assertThat(rule.getConfigKey(), is("Checker/Treewalker/AnnotationUseStyleCheck")); + + deleteRules(); + + rule = finder.findByKey("checkstyle", "com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck"); + assertThat(rule, notNullValue()); + } + + private void deleteRules() { + getSession().createQuery("delete " + Rule.class.getSimpleName()).executeUpdate(); + getSession().commit(); + } +} diff --git a/sonar-core/src/test/java/org/sonar/core/components/DefaultModelFinderTest.java b/sonar-core/src/test/java/org/sonar/core/components/DefaultModelFinderTest.java new file mode 100644 index 00000000000..222bf4053ed --- /dev/null +++ b/sonar-core/src/test/java/org/sonar/core/components/DefaultModelFinderTest.java @@ -0,0 +1,47 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.core.components; + +import org.junit.Test; +import org.sonar.api.qualitymodel.Model; +import org.sonar.core.components.DefaultModelFinder; +import org.sonar.jpa.test.AbstractDbUnitTestCase; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +public class DefaultModelFinderTest extends AbstractDbUnitTestCase { + + @Test + public void findByName() { + setupData("shared"); + DefaultModelFinder provider = new DefaultModelFinder(getSessionFactory()); + Model model = provider.findByName("M1"); + assertNotNull(model); + assertNotNull(model.getCharacteristicByName("M1C1")); + } + + @Test + public void findByNameNotFound() { + setupData("shared"); + DefaultModelFinder provider = new DefaultModelFinder(getSessionFactory()); + assertNull(provider.findByName("UNKNOWN")); + } +} \ No newline at end of file diff --git a/sonar-core/src/test/java/org/sonar/core/components/DefaultRuleFinderTest.java b/sonar-core/src/test/java/org/sonar/core/components/DefaultRuleFinderTest.java new file mode 100644 index 00000000000..7d2c2b8176a --- /dev/null +++ b/sonar-core/src/test/java/org/sonar/core/components/DefaultRuleFinderTest.java @@ -0,0 +1,105 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.core.components; + +import org.junit.Test; +import org.sonar.api.rules.Rule; +import org.sonar.api.rules.RuleFinder; +import org.sonar.api.rules.RuleQuery; +import org.sonar.jpa.test.AbstractDbUnitTestCase; + +import java.util.Collection; + +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNull.nullValue; +import static org.junit.Assert.*; + +public class DefaultRuleFinderTest extends AbstractDbUnitTestCase { + + @Test + public void shouldFindById() { + setupData("shared"); + RuleFinder finder = new DefaultRuleFinder(getSessionFactory()); + assertThat(finder.findById(3).getConfigKey(), is("Checker/Treewalker/AnnotationUseStyleCheck")); + } + + @Test + public void shouldNotFindDisabledRuleById() { + setupData("shared"); + RuleFinder finder = new DefaultRuleFinder(getSessionFactory()); + assertThat(finder.findById(2), nullValue()); + } + + @Test + public void shouldFindByKey() { + setupData("shared"); + RuleFinder finder = new DefaultRuleFinder(getSessionFactory()); + Rule rule = finder.findByKey("checkstyle", "com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck"); + assertNotNull(rule); + assertThat(rule.getKey(), is("com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck")); + assertThat(rule.isEnabled(), is(true)); + } + + @Test + public void findShouldReturnNullIfNoResults() { + setupData("shared"); + RuleFinder finder = new DefaultRuleFinder(getSessionFactory()); + assertNull(finder.findByKey("checkstyle", "unknown")); + assertNull(finder.find(RuleQuery.create().withRepositoryKey("checkstyle").withConfigKey("unknown"))); + } + + @Test + public void findRepositoryRules() { + setupData("shared"); + RuleFinder finder = new DefaultRuleFinder(getSessionFactory()); + Collection rules = finder.findAll(RuleQuery.create().withRepositoryKey("checkstyle")); + assertNotNull(rules); + assertThat(rules.size(), is(2)); // only enabled checkstyle rules + } + + @Test + public void findAllEnabled() { + setupData("shared"); + RuleFinder finder = new DefaultRuleFinder(getSessionFactory()); + Collection rules = finder.findAll(RuleQuery.create()); + assertNotNull(rules); + assertThat(rules.size(), is(3)); // only enabled checkstyle+pmd rules + for (Rule rule : rules) { + assertThat(rule.getId(), anyOf(is(1), is(3), is(4))); + } + } + + @Test + public void doNotFindDisabledRules() { + setupData("shared"); + RuleFinder finder = new DefaultRuleFinder(getSessionFactory()); + Rule rule = finder.findByKey("checkstyle", "DisabledCheck"); + assertNull(rule); + } + + @Test + public void doNotFindUnknownRules() { + setupData("shared"); + RuleFinder finder = new DefaultRuleFinder(getSessionFactory()); + Collection rules = finder.findAll(RuleQuery.create().withRepositoryKey("unknown_repository")); + assertThat(rules.size(), is(0)); + } +} diff --git a/sonar-core/src/test/java/org/sonar/core/components/ModelTest.java b/sonar-core/src/test/java/org/sonar/core/components/ModelTest.java new file mode 100644 index 00000000000..b614dfbe8d2 --- /dev/null +++ b/sonar-core/src/test/java/org/sonar/core/components/ModelTest.java @@ -0,0 +1,104 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.core.components; + +import org.junit.Test; +import org.sonar.api.qualitymodel.Characteristic; +import org.sonar.api.qualitymodel.Model; +import org.sonar.jpa.test.AbstractDbUnitTestCase; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.*; +import static org.junit.internal.matchers.IsCollectionContaining.hasItems; + +public class ModelTest extends AbstractDbUnitTestCase { + + @Test + public void saveModelAndCharacteristics() { + setupData("saveModelAndCharacteristics"); + Model model = Model.createByName("fake"); + model.createCharacteristicByName("Efficiency"); + model.createCharacteristicByName("Usability"); + getSession().save(model); + getSession().commit(); + + model = getSession().getSingleResult(Model.class, "name", "fake"); + assertThat(model.getName(), is("fake")); + assertThat(model.getCharacteristics().size(), is(2)); + assertThat(model.getRootCharacteristics().size(), is(2)); + assertNotNull(model.getCharacteristicByName("Efficiency")); + } + + /** + * max one parent by characteristic + */ + @Test + public void saveTreeOfCharacteristics() { + setupData("testTreeOfCharacteristics"); + Model model = Model.createByName("fake"); + + Characteristic efficiency = model.createCharacteristicByName("Efficiency"); + Characteristic usability = model.createCharacteristicByName("Usability"); + Characteristic cpuEfficiency = model.createCharacteristicByName("CPU Efficiency"); + Characteristic ramEfficiency = model.createCharacteristicByName("RAM Efficiency"); + + efficiency.addChildren(cpuEfficiency, ramEfficiency); + + getSession().save(model); + getSession().commit(); + + model = getSession().getSingleResult(Model.class, "name", "fake"); + assertThat(model.getCharacteristics().size(), is(4)); + assertThat(model.getCharacteristics(), hasItems(efficiency, usability, ramEfficiency, cpuEfficiency)); + assertThat(efficiency.getChildren(), hasItems(ramEfficiency, cpuEfficiency)); + assertTrue(ramEfficiency.getChildren().isEmpty()); + assertThat(ramEfficiency.getParents(), hasItems(efficiency)); + } + + /** + * many-to-many relation between characteristics + */ + @Test + public void testGraphOfCharacteristics() { + setupData("testGraphOfCharacteristics"); + Model model = Model.createByName("fake"); + + Characteristic level1a = model.createCharacteristicByName("level1a"); + Characteristic level1b = model.createCharacteristicByName("level1b"); + Characteristic level2a = model.createCharacteristicByName("level2a"); + Characteristic level2b = model.createCharacteristicByName("level2b"); + + level1a.addChildren(level2a, level2b); + level1b.addChildren(level2a, level2b); + + getSession().save(model); + getSession().commit(); + + Model persistedModel = getSession().getSingleResult(Model.class, "name", "fake"); + assertThat(persistedModel.getCharacteristics().size(), is(4)); + assertThat(persistedModel.getRootCharacteristics().size(), is(2)); + + assertThat(persistedModel.getCharacteristicByName("level1a").getChildren().size(), is(2)); + assertThat(persistedModel.getCharacteristicByName("level1b").getChildren().size(), is(2)); + + assertThat(persistedModel.getCharacteristicByName("level2a").getParents().size(), is(2)); + assertThat(persistedModel.getCharacteristicByName("level2b").getParents().size(), is(2)); + } +} diff --git a/sonar-core/src/test/java/org/sonar/core/qualitymodel/DefaultModelFinderTest.java b/sonar-core/src/test/java/org/sonar/core/qualitymodel/DefaultModelFinderTest.java deleted file mode 100644 index 9069fab38f4..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/qualitymodel/DefaultModelFinderTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.core.qualitymodel; - -import org.junit.Test; -import org.sonar.api.qualitymodel.Model; -import org.sonar.jpa.test.AbstractDbUnitTestCase; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -public class DefaultModelFinderTest extends AbstractDbUnitTestCase { - - @Test - public void findByName() { - setupData("shared"); - DefaultModelFinder provider = new DefaultModelFinder(getSessionFactory()); - Model model = provider.findByName("M1"); - assertNotNull(model); - assertNotNull(model.getCharacteristicByName("M1C1")); - } - - @Test - public void findByNameNotFound() { - setupData("shared"); - DefaultModelFinder provider = new DefaultModelFinder(getSessionFactory()); - assertNull(provider.findByName("UNKNOWN")); - } -} \ No newline at end of file diff --git a/sonar-core/src/test/java/org/sonar/core/qualitymodel/ModelTest.java b/sonar-core/src/test/java/org/sonar/core/qualitymodel/ModelTest.java deleted file mode 100644 index 0c15154140a..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/qualitymodel/ModelTest.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.core.qualitymodel; - -import org.junit.Test; -import org.sonar.api.qualitymodel.Characteristic; -import org.sonar.api.qualitymodel.Model; -import org.sonar.jpa.test.AbstractDbUnitTestCase; - -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.internal.matchers.IsCollectionContaining.hasItems; - -public class ModelTest extends AbstractDbUnitTestCase { - - @Test - public void saveModelAndCharacteristics() { - setupData("saveModelAndCharacteristics"); - Model model = Model.createByName("fake"); - model.createCharacteristicByName("Efficiency"); - model.createCharacteristicByName("Usability"); - getSession().save(model); - getSession().commit(); - - model = getSession().getSingleResult(Model.class, "name", "fake"); - assertThat(model.getName(), is("fake")); - assertThat(model.getCharacteristics().size(), is(2)); - assertThat(model.getRootCharacteristics().size(), is(2)); - assertNotNull(model.getCharacteristicByName("Efficiency")); - } - - /** - * max one parent by characteristic - */ - @Test - public void saveTreeOfCharacteristics() { - setupData("testTreeOfCharacteristics"); - Model model = Model.createByName("fake"); - - Characteristic efficiency = model.createCharacteristicByName("Efficiency"); - Characteristic usability = model.createCharacteristicByName("Usability"); - Characteristic cpuEfficiency = model.createCharacteristicByName("CPU Efficiency"); - Characteristic ramEfficiency = model.createCharacteristicByName("RAM Efficiency"); - - efficiency.addChildren(cpuEfficiency, ramEfficiency); - - getSession().save(model); - getSession().commit(); - - model = getSession().getSingleResult(Model.class, "name", "fake"); - assertThat(model.getCharacteristics().size(), is(4)); - assertThat(model.getCharacteristics(), hasItems(efficiency, usability, ramEfficiency, cpuEfficiency)); - assertThat(efficiency.getChildren(), hasItems(ramEfficiency, cpuEfficiency)); - assertTrue(ramEfficiency.getChildren().isEmpty()); - assertThat(ramEfficiency.getParents(), hasItems(efficiency)); - } - - /** - * many-to-many relation between characteristics - */ - @Test - public void testGraphOfCharacteristics() { - setupData("testGraphOfCharacteristics"); - Model model = Model.createByName("fake"); - - Characteristic level1a = model.createCharacteristicByName("level1a"); - Characteristic level1b = model.createCharacteristicByName("level1b"); - Characteristic level2a = model.createCharacteristicByName("level2a"); - Characteristic level2b = model.createCharacteristicByName("level2b"); - - level1a.addChildren(level2a, level2b); - level1b.addChildren(level2a, level2b); - - getSession().save(model); - getSession().commit(); - - Model persistedModel = getSession().getSingleResult(Model.class, "name", "fake"); - assertThat(persistedModel.getCharacteristics().size(), is(4)); - assertThat(persistedModel.getRootCharacteristics().size(), is(2)); - - assertThat(persistedModel.getCharacteristicByName("level1a").getChildren().size(), is(2)); - assertThat(persistedModel.getCharacteristicByName("level1b").getChildren().size(), is(2)); - - assertThat(persistedModel.getCharacteristicByName("level2a").getParents().size(), is(2)); - assertThat(persistedModel.getCharacteristicByName("level2b").getParents().size(), is(2)); - } -} diff --git a/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java b/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java deleted file mode 100644 index c80573be1c0..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/rule/DefaultRuleFinderTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.core.rule; - -import org.junit.Test; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleQuery; -import org.sonar.jpa.test.AbstractDbUnitTestCase; - -import java.util.Collection; - -import static org.hamcrest.CoreMatchers.anyOf; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; - -public class DefaultRuleFinderTest extends AbstractDbUnitTestCase { - - @Test - public void findByKey() { - setupData("shared"); - DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory()); - Rule rule = provider.findByKey("checkstyle", "com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck"); - assertNotNull(rule); - assertThat(rule.getKey(), is("com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck")); - assertThat(rule.isEnabled(), is(true)); - } - - @Test - public void findReturnsNullIfNoResults() { - setupData("shared"); - DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory()); - assertNull(provider.findByKey("checkstyle", "unknown")); - assertNull(provider.find(RuleQuery.create().withRepositoryKey("checkstyle").withConfigKey("unknown"))); - } - - @Test - public void findRepositoryRules() { - setupData("shared"); - DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory()); - Collection rules = provider.findAll(RuleQuery.create().withRepositoryKey("checkstyle")); - assertNotNull(rules); - assertThat(rules.size(), is(2)); // only enabled checkstyle rules - } - - @Test - public void findAllEnabled() { - setupData("shared"); - DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory()); - Collection rules = provider.findAll(RuleQuery.create()); - assertNotNull(rules); - assertThat(rules.size(), is(3)); // only enabled checkstyle+pmd rules - for (Rule rule : rules) { - assertThat(rule.getId(), anyOf(is(1), is(3), is(4))); - } - } - - @Test - public void doNotFindDisabledRules() { - setupData("shared"); - DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory()); - Rule rule = provider.findByKey("checkstyle", "DisabledCheck"); - assertNull(rule); - } - - @Test - public void doNotFindUnknownRules() { - setupData("shared"); - DefaultRuleFinder provider = new DefaultRuleFinder(getSessionFactory()); - Collection rules = provider.findAll(RuleQuery.create().withRepositoryKey("unknown_repository")); - assertThat(rules.size(), is(0)); - } -} diff --git a/sonar-core/src/test/resources/org/sonar/core/components/CacheMetricFinderTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/components/CacheMetricFinderTest/shared.xml new file mode 100644 index 00000000000..85709bcbf98 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/components/CacheMetricFinderTest/shared.xml @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/components/DefaultModelFinderTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/components/DefaultModelFinderTest/shared.xml new file mode 100644 index 00000000000..c26de5371bb --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/components/DefaultModelFinderTest/shared.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/components/DefaultRuleFinderTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/components/DefaultRuleFinderTest/shared.xml new file mode 100644 index 00000000000..f6adafee0da --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/components/DefaultRuleFinderTest/shared.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/components/ModelTest/saveModelAndCharacteristics.xml b/sonar-core/src/test/resources/org/sonar/core/components/ModelTest/saveModelAndCharacteristics.xml new file mode 100644 index 00000000000..cd0705734b2 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/components/ModelTest/saveModelAndCharacteristics.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/components/ModelTest/testGraphOfCharacteristics.xml b/sonar-core/src/test/resources/org/sonar/core/components/ModelTest/testGraphOfCharacteristics.xml new file mode 100644 index 00000000000..ee6e959b85b --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/components/ModelTest/testGraphOfCharacteristics.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/components/ModelTest/testTreeOfCharacteristics.xml b/sonar-core/src/test/resources/org/sonar/core/components/ModelTest/testTreeOfCharacteristics.xml new file mode 100644 index 00000000000..ef3d9a58680 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/components/ModelTest/testTreeOfCharacteristics.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelFinderTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelFinderTest/shared.xml deleted file mode 100644 index c26de5371bb..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/DefaultModelFinderTest/shared.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/saveModelAndCharacteristics.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/saveModelAndCharacteristics.xml deleted file mode 100644 index cd0705734b2..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/saveModelAndCharacteristics.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testGraphOfCharacteristics.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testGraphOfCharacteristics.xml deleted file mode 100644 index ee6e959b85b..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testGraphOfCharacteristics.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testTreeOfCharacteristics.xml b/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testTreeOfCharacteristics.xml deleted file mode 100644 index ef3d9a58680..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/qualitymodel/ModelTest/testTreeOfCharacteristics.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/rule/DefaultRuleFinderTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/rule/DefaultRuleFinderTest/shared.xml deleted file mode 100644 index f6adafee0da..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/rule/DefaultRuleFinderTest/shared.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3