From 48250940c4ad53bf04538deda83669f53cc367a3 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Fri, 10 Jan 2014 08:20:30 +0100 Subject: SONAR-4923 Remove no more used code --- .../sonar/server/configuration/ProfilesManager.java | 13 ------------- .../server/configuration/InheritedProfilesTest.java | 21 --------------------- 2 files changed, 34 deletions(-) diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java index ae5854e39d5..534967f0203 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java @@ -196,19 +196,6 @@ public class ProfilesManager extends BaseDao { return actions; } - /** - * @return true, if setting childProfile as a child of parentProfile adds cycle - */ - boolean isCycle(RulesProfile childProfile, RulesProfile parentProfile) { - while (parentProfile != null) { - if (childProfile.equals(parentProfile)) { - return true; - } - parentProfile = getParentProfile(parentProfile); - } - return false; - } - public void revert(int profileId, int activeRuleId, String userName) { RulesProfile profile = getSession().getEntity(RulesProfile.class, profileId); ActiveRule oldActiveRule = getSession().getEntity(ActiveRule.class, activeRuleId); diff --git a/sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java b/sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java index a235e50ce0a..2659e347493 100644 --- a/sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java +++ b/sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java @@ -21,15 +21,11 @@ package org.sonar.server.configuration; import org.junit.Before; import org.junit.Test; -import org.sonar.api.profiles.RulesProfile; import org.sonar.core.preview.PreviewCache; import org.sonar.jpa.test.AbstractDbUnitTestCase; import org.sonar.server.qualityprofile.RuleInheritanceActions; import static org.fest.assertions.Assertions.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; import static org.mockito.Mockito.mock; public class InheritedProfilesTest extends AbstractDbUnitTestCase { @@ -40,23 +36,6 @@ public class InheritedProfilesTest extends AbstractDbUnitTestCase { profilesManager = new ProfilesManager(getSession(), null, mock(PreviewCache.class)); } - @Test - public void shouldCheckCycles() { - setupData("shouldCheckCycles"); - RulesProfile level1 = profilesManager.getProfile("java", "level1"); - RulesProfile level2 = profilesManager.getProfile("java", "level2"); - RulesProfile level3 = profilesManager.getProfile("java", "level3"); - - assertThat(profilesManager.getParentProfile(level1), nullValue()); - assertThat(profilesManager.getParentProfile(level2), is(level1)); - assertThat(profilesManager.getParentProfile(level3), is(level2)); - - assertThat(profilesManager.isCycle(level1, level1), is(true)); - assertThat(profilesManager.isCycle(level1, level3), is(true)); - assertThat(profilesManager.isCycle(level1, level2), is(true)); - assertThat(profilesManager.isCycle(level2, level3), is(true)); - } - @Test public void shouldSetParent() { setupData("shouldSetParent"); -- cgit v1.2.3