From cba251c929936768308e59365bc44f532bb16756 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 5 Jul 2012 16:40:16 +0200 Subject: SONAR-3618 Support custom default permissions for non-project resources --- .../org/sonar/api/security/DefaultGroupsTest.java | 35 ++++++++++++++++++++ .../java/org/sonar/api/security/GroupRoleTest.java | 37 ---------------------- 2 files changed, 35 insertions(+), 37 deletions(-) create mode 100644 sonar-plugin-api/src/test/java/org/sonar/api/security/DefaultGroupsTest.java delete mode 100644 sonar-plugin-api/src/test/java/org/sonar/api/security/GroupRoleTest.java (limited to 'sonar-plugin-api/src/test/java/org') diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/security/DefaultGroupsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/security/DefaultGroupsTest.java new file mode 100644 index 00000000000..2f1823332d5 --- /dev/null +++ b/sonar-plugin-api/src/test/java/org/sonar/api/security/DefaultGroupsTest.java @@ -0,0 +1,35 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * 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.api.security; + +import org.junit.Test; + +import static org.fest.assertions.Assertions.assertThat; + +public class DefaultGroupsTest { + @Test + public void isAnyone_is_not_case_sensitive() { + assertThat(DefaultGroups.isAnyone("ANYONE")).isTrue(); + assertThat(DefaultGroups.isAnyone("anyone")).isTrue(); + assertThat(DefaultGroups.isAnyone(DefaultGroups.ANYONE)).isTrue(); + + assertThat(DefaultGroups.isAnyone(DefaultGroups.ADMINISTRATORS)).isFalse(); + } +} diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/security/GroupRoleTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/security/GroupRoleTest.java deleted file mode 100644 index 57bb695f975..00000000000 --- a/sonar-plugin-api/src/test/java/org/sonar/api/security/GroupRoleTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * 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.api.security; - -import org.junit.Test; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -public class GroupRoleTest { - - @Test - public void isAnyone() { - GroupRole gr = GroupRole.buildGlobalRole(GroupRole.ANYONE_GROUP_ID, "admin"); - assertThat(gr.isAnyone(), is(true)); - - gr = GroupRole.buildGlobalRole(3, "admin"); - assertThat(gr.isAnyone(), is(false)); - } -} -- cgit v1.2.3