diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-01-28 17:14:45 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-01-28 17:14:45 +0100 |
commit | 277f4ed0a860f676d7fbaf239da723e0ae6f34f6 (patch) | |
tree | 1262d7924900811da895b44b87d57d0d39fb829e /sonar-server | |
parent | 2067476497ed6aff6a0f71599428a554a98a694d (diff) | |
download | sonarqube-277f4ed0a860f676d7fbaf239da723e0ae6f34f6.tar.gz sonarqube-277f4ed0a860f676d7fbaf239da723e0ae6f34f6.zip |
SONAR-4092 Use new Test API to display tests data
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java index 154f832d36b..91ad3935e97 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java @@ -20,7 +20,6 @@ package org.sonar.server.ui; import com.google.common.collect.ListMultimap; -import com.google.common.collect.Lists; import org.slf4j.LoggerFactory; import org.sonar.api.CoreProperties; import org.sonar.api.config.License; @@ -37,6 +36,7 @@ import org.sonar.api.resources.ResourceType; import org.sonar.api.resources.ResourceTypes; import org.sonar.api.rules.RulePriority; import org.sonar.api.rules.RuleRepository; +import org.sonar.api.test.TestPlan; import org.sonar.api.utils.ValidationMessages; import org.sonar.api.web.Footer; import org.sonar.api.web.NavigationSection; @@ -47,6 +47,7 @@ import org.sonar.api.workflow.Review; import org.sonar.api.workflow.internal.DefaultReview; import org.sonar.api.workflow.internal.DefaultWorkflowContext; import org.sonar.api.workflow.screen.Screen; +import org.sonar.core.component.PerspectiveLoaders; import org.sonar.core.i18n.RuleI18nManager; import org.sonar.core.measure.MeasureFilterEngine; import org.sonar.core.measure.MeasureFilterResult; @@ -86,6 +87,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import static com.google.common.collect.Lists.newArrayList; + public final class JRubyFacade { private static final JRubyFacade SINGLETON = new JRubyFacade(); @@ -95,6 +98,10 @@ public final class JRubyFacade { return SINGLETON; } + public static String markdownToHtml(String input) { + return Markdown.convertToHtml(input); + } + private <T> T get(Class<T> componentType) { return getContainer().getComponentByType(componentType); } @@ -128,7 +135,7 @@ public final class JRubyFacade { } public List<String> getQualifiersWithProperty(final String propertyKey) { - List<String> qualifiers = Lists.newArrayList(); + List<String> qualifiers = newArrayList(); for (ResourceType type : getResourceTypes()) { if (type.getBooleanProperty(propertyKey) == Boolean.TRUE) { qualifiers.add(type.getQualifier()); @@ -205,10 +212,6 @@ public final class JRubyFacade { } } - public static String markdownToHtml(String input) { - return Markdown.convertToHtml(input); - } - public List<ViewProxy<Widget>> getWidgets(String resourceScope, String resourceQualifier, String resourceLanguage, Object[] availableMeasures) { return get(Views.class).getWidgets(resourceScope, resourceQualifier, resourceLanguage, (String[]) availableMeasures); } @@ -319,7 +322,7 @@ public final class JRubyFacade { public void ruleSeverityChanged(int parentProfileId, int activeRuleId, int oldSeverityId, int newSeverityId, String userName) { getProfilesManager().ruleSeverityChanged(parentProfileId, activeRuleId, RulePriority.values()[oldSeverityId], - RulePriority.values()[newSeverityId], userName); + RulePriority.values()[newSeverityId], userName); } public void ruleDeactivated(int parentProfileId, int deactivatedRuleId, String userName) { @@ -515,10 +518,10 @@ public final class JRubyFacade { // notifier is null when creating the administrator in the migration script 011. if (notifier != null) { notifier.onNewUser(NewUserHandler.Context.builder() - .setLogin(fields.get("login")) - .setName(fields.get("name")) - .setEmail(fields.get("email")) - .build()); + .setLogin(fields.get("login")) + .setName(fields.get("name")) + .setEmail(fields.get("email")) + .build()); } } @@ -537,4 +540,9 @@ public final class JRubyFacade { public String getPeriodAbbreviation(int periodIndex) { return get(Periods.class).abbreviation(periodIndex); } + + public TestPlan getTestPlan(long snapshotId) { + return (TestPlan) get(PerspectiveLoaders.class).as(snapshotId, "testplan"); + } + } |