Search in sources :

Example 1 with SonarLintConsole

use of org.sonarlint.intellij.ui.SonarLintConsole in project sonarlint-intellij by SonarSource.

the class SonarCleanConsoleActionTest method testAction.

@Test
public void testAction() {
    AnActionEvent event = mock(AnActionEvent.class);
    SonarLintConsole console = mock(SonarLintConsole.class);
    when(event.getProject()).thenReturn(project);
    super.register(project, SonarLintConsole.class, console);
    SonarCleanConsoleAction clean = new SonarCleanConsoleAction(null, null, null);
    clean.actionPerformed(event);
    verify(console).clear();
}
Also used : AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) SonarLintConsole(org.sonarlint.intellij.ui.SonarLintConsole) SonarTest(org.sonarlint.intellij.SonarTest) Test(org.junit.Test)

Example 2 with SonarLintConsole

use of org.sonarlint.intellij.ui.SonarLintConsole in project sonarlint-intellij by SonarSource.

the class ProjectBindingManagerTest method setUp.

@Before
public void setUp() throws InvalidBindingException {
    SonarLintConsole console = mock(SonarLintConsole.class);
    Project project = mock(Project.class);
    engineManager = mock(SonarLintEngineManager.class);
    SonarLintProjectNotifications notifications = mock(SonarLintProjectNotifications.class);
    standaloneEngine = mock(StandaloneSonarLintEngine.class);
    connectedEngine = mock(ConnectedSonarLintEngine.class);
    settings = new SonarLintProjectSettings();
    globalSettings = new SonarLintGlobalSettings();
    when(engineManager.getStandaloneEngine()).thenReturn(standaloneEngine);
    when(engineManager.getConnectedEngine(any(SonarLintProjectNotifications.class), anyString(), anyString())).thenReturn(connectedEngine);
    when(project.getBasePath()).thenReturn("");
    projectBindingManager = new ProjectBindingManager(project, engineManager, settings, globalSettings, notifications, console);
}
Also used : Project(com.intellij.openapi.project.Project) SonarLintGlobalSettings(org.sonarlint.intellij.config.global.SonarLintGlobalSettings) SonarLintProjectSettings(org.sonarlint.intellij.config.project.SonarLintProjectSettings) StandaloneSonarLintEngine(org.sonarsource.sonarlint.core.client.api.standalone.StandaloneSonarLintEngine) ConnectedSonarLintEngine(org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine) SonarLintConsole(org.sonarlint.intellij.ui.SonarLintConsole) Before(org.junit.Before)

Example 3 with SonarLintConsole

use of org.sonarlint.intellij.ui.SonarLintConsole in project sonarlint-intellij by SonarSource.

the class GlobalLogOutputTest method should_not_fail_if_remove_nonexisting_console.

@Test
public void should_not_fail_if_remove_nonexisting_console() {
    SonarLintConsole console = mock(SonarLintConsole.class);
    output.removeConsole(console);
    output.log("msg", LogOutput.Level.WARN);
}
Also used : SonarLintConsole(org.sonarlint.intellij.ui.SonarLintConsole) SonarTest(org.sonarlint.intellij.SonarTest) Test(org.junit.Test)

Example 4 with SonarLintConsole

use of org.sonarlint.intellij.ui.SonarLintConsole in project sonarlint-intellij by SonarSource.

the class ServerUpdateTask method analyzeOpenFiles.

private static void analyzeOpenFiles(Project project) {
    if (!project.isDisposed()) {
        SonarLintConsole console = SonarLintConsole.get(project);
        console.info("Clearing all issues because binding was updated");
        IssueManager store = SonarLintUtils.get(project, IssueManager.class);
        store.clear();
        SonarLintSubmitter submitter = SonarLintUtils.get(project, SonarLintSubmitter.class);
        submitter.submitOpenFilesAuto(TriggerType.BINDING_UPDATE);
    }
}
Also used : SonarLintSubmitter(org.sonarlint.intellij.trigger.SonarLintSubmitter) IssueManager(org.sonarlint.intellij.issue.IssueManager) SonarLintConsole(org.sonarlint.intellij.ui.SonarLintConsole)

Example 5 with SonarLintConsole

use of org.sonarlint.intellij.ui.SonarLintConsole in project sonarlint-intellij by SonarSource.

the class GlobalLogOutputTest method should_log_to_registered_consoles.

@Test
public void should_log_to_registered_consoles() {
    SonarLintConsole console = mock(SonarLintConsole.class);
    output.addConsole(console);
    output.log("warn", LogOutput.Level.WARN);
    verify(console).info("warn");
    output.log("info", LogOutput.Level.INFO);
    verify(console).info("info");
    output.log("debug", LogOutput.Level.DEBUG);
    verify(console).debug("debug");
    output.log("error", LogOutput.Level.ERROR);
    verify(console).error("error");
    output.log("trace", LogOutput.Level.TRACE);
    verify(console).debug("trace");
}
Also used : SonarLintConsole(org.sonarlint.intellij.ui.SonarLintConsole) SonarTest(org.sonarlint.intellij.SonarTest) Test(org.junit.Test)

Aggregations

SonarLintConsole (org.sonarlint.intellij.ui.SonarLintConsole)5 Test (org.junit.Test)3 SonarTest (org.sonarlint.intellij.SonarTest)3 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 Project (com.intellij.openapi.project.Project)1 Before (org.junit.Before)1 SonarLintGlobalSettings (org.sonarlint.intellij.config.global.SonarLintGlobalSettings)1 SonarLintProjectSettings (org.sonarlint.intellij.config.project.SonarLintProjectSettings)1 IssueManager (org.sonarlint.intellij.issue.IssueManager)1 SonarLintSubmitter (org.sonarlint.intellij.trigger.SonarLintSubmitter)1 ConnectedSonarLintEngine (org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine)1 StandaloneSonarLintEngine (org.sonarsource.sonarlint.core.client.api.standalone.StandaloneSonarLintEngine)1