aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-10-02 16:36:45 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-10-02 16:36:56 +0200
commitd2a19c82b2ee6b8a45e54195e29050baaa54c022 (patch)
treec46c67c2400a7e532721b72194290d27727c7755 /sonar-db
parenta2a92b33b659e5a386cdc64d9d0c1bcbab7eae9b (diff)
downloadsonarqube-d2a19c82b2ee6b8a45e54195e29050baaa54c022.tar.gz
sonarqube-d2a19c82b2ee6b8a45e54195e29050baaa54c022.zip
WS of permission domain are compatible with Views and Developer Cockpit
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/test/java/org/sonar/db/component/ResourceTypesRule.java107
1 files changed, 107 insertions, 0 deletions
diff --git a/sonar-db/src/test/java/org/sonar/db/component/ResourceTypesRule.java b/sonar-db/src/test/java/org/sonar/db/component/ResourceTypesRule.java
new file mode 100644
index 00000000000..e305ca60a63
--- /dev/null
+++ b/sonar-db/src/test/java/org/sonar/db/component/ResourceTypesRule.java
@@ -0,0 +1,107 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 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.db.component;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.sonar.api.resources.ResourceType;
+import org.sonar.api.resources.ResourceTypeTree;
+import org.sonar.api.resources.ResourceTypes;
+
+public class ResourceTypesRule extends ResourceTypes {
+ private final Set<ResourceType> allResourceTypes = new HashSet<>();
+ private final Set<ResourceType> rootResourceTypes = new HashSet<>();
+
+ @Override
+ public Collection<ResourceType> getAll() {
+ return allResourceTypes;
+ }
+
+ @Override
+ public Collection<ResourceType> getRoots() {
+ return rootResourceTypes;
+ }
+
+ public ResourceTypesRule setRootQualifiers(String... qualifiers) {
+ rootResourceTypes.clear();
+ for (String qualifier : qualifiers) {
+ rootResourceTypes.add(ResourceType.builder(qualifier).build());
+ }
+
+ return this;
+ }
+
+ public ResourceTypesRule setAllQualifiers(String... qualifiers) {
+ allResourceTypes.clear();
+ for (String qualifier : qualifiers) {
+ allResourceTypes.add(ResourceType.builder(qualifier).build());
+ }
+
+ return this;
+ }
+
+ @Override
+ public ResourceType get(String qualifier) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Collection<ResourceType> getAllWithPropertyKey(String propertyKey) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Collection<ResourceType> getAllWithPropertyValue(String propertyKey, String propertyValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Collection<ResourceType> getAllWithPropertyValue(String propertyKey, boolean propertyValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public List<String> getChildrenQualifiers(String qualifier) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public List<ResourceType> getChildren(String qualifier) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public List<String> getLeavesQualifiers(String qualifier) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ResourceTypeTree getTree(String qualifier) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ResourceType getRoot(String qualifier) {
+ throw new UnsupportedOperationException();
+ }
+}