Search in sources :

Example 6 with SonarLintGlobalSettings

use of org.sonarlint.intellij.config.global.SonarLintGlobalSettings 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 7 with SonarLintGlobalSettings

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

the class SonarLintEngineManagerTest method setUp.

@Before
public void setUp() {
    globalSettings = new SonarLintGlobalSettings();
    engineFactory = mock(SonarLintEngineFactory.class);
    notifications = mock(SonarLintProjectNotifications.class);
    connectedEngine = mock(ConnectedSonarLintEngine.class);
    standaloneEngine = mock(StandaloneSonarLintEngine.class);
    when(engineFactory.createEngine(anyString())).thenReturn(connectedEngine);
    when(engineFactory.createEngine()).thenReturn(standaloneEngine);
    manager = new SonarLintEngineManager(globalSettings, engineFactory);
}
Also used : SonarLintGlobalSettings(org.sonarlint.intellij.config.global.SonarLintGlobalSettings) StandaloneSonarLintEngine(org.sonarsource.sonarlint.core.client.api.standalone.StandaloneSonarLintEngine) ConnectedSonarLintEngine(org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine) Before(org.junit.Before)

Example 8 with SonarLintGlobalSettings

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

the class AutoTriggerStatusPanel method subscribeToEvents.

private void subscribeToEvents() {
    MessageBusConnection busConnection = project.getMessageBus().connect(project);
    busConnection.subscribe(GlobalConfigurationListener.TOPIC, new GlobalConfigurationListener.Adapter() {

        @Override
        public void applied(SonarLintGlobalSettings settings) {
            switchCards();
        }
    });
    busConnection.subscribe(ProjectConfigurationListener.TOPIC, s -> switchCards());
    busConnection.subscribe(PowerSaveMode.TOPIC, this::switchCards);
    busConnection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {

        @Override
        public void selectionChanged(@NotNull FileEditorManagerEvent event) {
            switchCards();
        }
    });
}
Also used : SonarLintGlobalSettings(org.sonarlint.intellij.config.global.SonarLintGlobalSettings) MessageBusConnection(com.intellij.util.messages.MessageBusConnection) GlobalConfigurationListener(org.sonarlint.intellij.messages.GlobalConfigurationListener) FileEditorManagerAdapter(com.intellij.openapi.fileEditor.FileEditorManagerAdapter) FileEditorManagerEvent(com.intellij.openapi.fileEditor.FileEditorManagerEvent)

Example 9 with SonarLintGlobalSettings

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

the class EditorOpenTriggerTest method start.

@Before
public void start() {
    MockitoAnnotations.initMocks(this);
    SonarLintTestUtils.mockMessageBus(project);
    globalSettings = new SonarLintGlobalSettings();
    globalSettings.setAutoTrigger(true);
    editorTrigger = new EditorOpenTrigger(project, submitter, globalSettings);
}
Also used : SonarLintGlobalSettings(org.sonarlint.intellij.config.global.SonarLintGlobalSettings) Before(org.junit.Before)

Example 10 with SonarLintGlobalSettings

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

the class SonarLintCheckinHandlerFactoryTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    SonarLintGlobalSettings settings = new SonarLintGlobalSettings();
    when(panel.getVirtualFiles()).thenReturn(Collections.singletonList(file));
    when(panel.getProject()).thenReturn(project);
    sonarLintCheckinHandlerFactory = new SonarLintCheckinHandlerFactory(settings);
}
Also used : SonarLintGlobalSettings(org.sonarlint.intellij.config.global.SonarLintGlobalSettings) Before(org.junit.Before)

Aggregations

SonarLintGlobalSettings (org.sonarlint.intellij.config.global.SonarLintGlobalSettings)10 Before (org.junit.Before)7 MessageBusConnection (com.intellij.util.messages.MessageBusConnection)2 GlobalConfigurationListener (org.sonarlint.intellij.messages.GlobalConfigurationListener)2 ConnectedSonarLintEngine (org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine)2 StandaloneSonarLintEngine (org.sonarsource.sonarlint.core.client.api.standalone.StandaloneSonarLintEngine)2 EditorEventMulticaster (com.intellij.openapi.editor.event.EditorEventMulticaster)1 FileEditorManagerAdapter (com.intellij.openapi.fileEditor.FileEditorManagerAdapter)1 FileEditorManagerEvent (com.intellij.openapi.fileEditor.FileEditorManagerEvent)1 Project (com.intellij.openapi.project.Project)1 LinkedList (java.util.LinkedList)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Predicate (java.util.function.Predicate)1 Test (org.junit.Test)1 SonarTest (org.sonarlint.intellij.SonarTest)1 VirtualFileTestPredicate (org.sonarlint.intellij.analysis.VirtualFileTestPredicate)1 SonarQubeServer (org.sonarlint.intellij.config.global.SonarQubeServer)1 SonarLintProjectSettings (org.sonarlint.intellij.config.project.SonarLintProjectSettings)1 SonarLintConsole (org.sonarlint.intellij.ui.SonarLintConsole)1