From: Simon Brandhof Date: Wed, 18 Jan 2017 17:32:56 +0000 (+0100) Subject: Remove unused RubyTextService X-Git-Tag: 6.3-RC1~485 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b162b95108b99b3476c1f2a876bf914dcdc7941e;p=sonarqube.git Remove unused RubyTextService --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index 2630320711e..4413a3e512e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -190,7 +190,6 @@ import org.sonar.server.test.index.TestIndexer; import org.sonar.server.test.ws.CoveredFilesAction; import org.sonar.server.test.ws.TestsWs; import org.sonar.server.text.MacroInterpreter; -import org.sonar.server.text.RubyTextService; import org.sonar.server.ui.PageDecorations; import org.sonar.server.ui.PageRepository; import org.sonar.server.ui.DeprecatedViews; @@ -434,7 +433,6 @@ public class PlatformLevel4 extends PlatformLevel { // text MacroInterpreter.class, - RubyTextService.class, // Notifications NotificationModule.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/text/RubyTextService.java b/server/sonar-server/src/main/java/org/sonar/server/text/RubyTextService.java deleted file mode 100644 index 29f644af0bb..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/text/RubyTextService.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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.server.text; - -import org.sonar.api.server.ServerSide; -import org.sonar.markdown.Markdown; - -/** - * @since 3.6 - */ -@ServerSide -public class RubyTextService { - - private final MacroInterpreter macroInterpreter; - - public RubyTextService(MacroInterpreter macroInterpreter) { - this.macroInterpreter = macroInterpreter; - } - - // TODO add ruby example - public String interpretMacros(String text) { - return macroInterpreter.interpret(text); - } - - // TODO add ruby example - public String markdownToHtml(String markdown) { - return Markdown.convertToHtml(markdown); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java deleted file mode 100644 index 80d151efc86..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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.server.text; - -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -public class RubyTextServiceTest { - - MacroInterpreter macroInterpreter = mock(MacroInterpreter.class); - RubyTextService text = new RubyTextService(macroInterpreter); - - @Test - public void interpretMacros() { - text.interpretMacros("text with macros"); - verify(macroInterpreter, times(1)).interpret("text with macros"); - } - - @Test - public void markdownToHtml() { - String html = text.markdownToHtml("some *markdown*"); - assertThat(html).isEqualTo("some markdown"); - } - - @Test - public void should_escape_markdown_input() { - String html = text.markdownToHtml("a > b"); - assertThat(html).isEqualTo("a > b"); - } -} diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/api/utils.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/api/utils.rb index e07144d3c1f..221a7d257e5 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/api/utils.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/api/utils.rb @@ -115,10 +115,6 @@ class Api::Utils false end - def self.markdown_to_html(markdown='') - Internal.text.markdownToHtml(markdown) - end - # Splits a string into an array of lines # For history reference: # - http://jira.sonarsource.com/browse/SONAR-2282 first modified the behaviour to keep the trailing lines diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/internal.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/internal.rb index 8bbf4897aaa..e0f5c76376f 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/internal.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/internal.rb @@ -26,10 +26,6 @@ class Internal component(Java::OrgSonarServerIssue::InternalRubyIssueService.java_class) end - def self.text - component(Java::OrgSonarServerText::RubyTextService.java_class) - end - def self.users_api component(Java::OrgSonarApiUser::RubyUserService.java_class) end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/issue.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/issue.rb index 9a3ca087188..a763d0fdedc 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/issue.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/issue.rb @@ -20,13 +20,4 @@ class Issue - def self.comment_to_hash(comment) - { - :key => comment.key(), - :login => comment.userLogin(), - :htmlText => Internal.text.markdownToHtml(comment.markdownText()), - :createdAt => Api::Utils.format_datetime(comment.createdAt()) - } - end - end