Search in sources :

Example 1 with SonarLintProjectSettings

use of org.sonarlint.intellij.config.project.SonarLintProjectSettings in project sonarlint-intellij by SonarSource.

the class SonarLintConsoleTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    settings = new SonarLintProjectSettings();
    console = new SonarLintConsole(project, consoleView, settings);
}
Also used : SonarLintProjectSettings(org.sonarlint.intellij.config.project.SonarLintProjectSettings) Before(org.junit.Before)

Example 2 with SonarLintProjectSettings

use of org.sonarlint.intellij.config.project.SonarLintProjectSettings in project sonarlint-intellij by SonarSource.

the class UpdateCheckerTest method before.

@Before
public void before() throws InvalidBindingException {
    MockitoAnnotations.initMocks(this);
    settings = new SonarLintProjectSettings();
    settings.setProjectKey("key");
    settings.setServerId("serverId");
    server = createServer();
    super.register(app, SonarApplication.class, mock(SonarApplication.class));
    super.register(app, GlobalLogOutput.class, new GlobalLogOutput(mock(ProjectManager.class)));
    when(bindingManager.getSonarQubeServer()).thenReturn(server);
    when(bindingManager.getConnectedEngine()).thenReturn(engine);
    updateChecker = new UpdateChecker(project, bindingManager, settings, notifications);
}
Also used : SonarLintProjectSettings(org.sonarlint.intellij.config.project.SonarLintProjectSettings) SonarApplication(org.sonarlint.intellij.SonarApplication) GlobalLogOutput(org.sonarlint.intellij.util.GlobalLogOutput) Before(org.junit.Before)

Example 3 with SonarLintProjectSettings

use of org.sonarlint.intellij.config.project.SonarLintProjectSettings 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 4 with SonarLintProjectSettings

use of org.sonarlint.intellij.config.project.SonarLintProjectSettings in project sonarlint-intellij by SonarSource.

the class ServerIssueUpdaterTest method prepare.

@Before
public void prepare() throws IOException {
    MockitoAnnotations.initMocks(this);
    super.register(app, SonarApplication.class, mock(SonarApplication.class));
    projectBaseDir = temp.newFolder().toPath();
    when(indicator.isModal()).thenReturn(false);
    when(project.getBasePath()).thenReturn(FileUtil.toSystemIndependentName(projectBaseDir.toString()));
    settings = new SonarLintProjectSettings();
    settings.setProjectKey(PROJECT_KEY);
    updater = new ServerIssueUpdater(project, issueManager, settings, bindingManager, console);
}
Also used : SonarLintProjectSettings(org.sonarlint.intellij.config.project.SonarLintProjectSettings) SonarApplication(org.sonarlint.intellij.SonarApplication) Before(org.junit.Before)

Example 5 with SonarLintProjectSettings

use of org.sonarlint.intellij.config.project.SonarLintProjectSettings in project sonarlint-intellij by SonarSource.

the class SonarQubeServerMgmtPanel method unbindRemovedServers.

private void unbindRemovedServers() {
    if (deletedServerIds.isEmpty()) {
        return;
    }
    Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
    for (Project p : openProjects) {
        SonarLintProjectSettings projectSettings = SonarLintUtils.get(p, SonarLintProjectSettings.class);
        if (projectSettings.getServerId() != null && deletedServerIds.contains(projectSettings.getServerId())) {
            projectSettings.setBindingEnabled(false);
            projectSettings.setServerId(null);
            projectSettings.setProjectKey(null);
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) SonarLintProjectSettings(org.sonarlint.intellij.config.project.SonarLintProjectSettings)

Aggregations

SonarLintProjectSettings (org.sonarlint.intellij.config.project.SonarLintProjectSettings)13 Before (org.junit.Before)9 Project (com.intellij.openapi.project.Project)5 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ActionPlaces (com.intellij.openapi.actionSystem.ActionPlaces)2 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)2 CommonDataKeys (com.intellij.openapi.actionSystem.CommonDataKeys)2 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 Arrays (java.util.Arrays)2 Collectors (java.util.stream.Collectors)2 SonarApplication (org.sonarlint.intellij.SonarApplication)2 ExclusionItem (org.sonarlint.intellij.config.project.ExclusionItem)2 ProjectConfigurationListener (org.sonarlint.intellij.messages.ProjectConfigurationListener)2 SonarLintConsole (org.sonarlint.intellij.ui.SonarLintConsole)2 SonarLintUtils (org.sonarlint.intellij.util.SonarLintUtils)2 JBList (com.intellij.ui.components.JBList)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1