Search in sources :

Example 1 with ComponentContainer

use of org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer in project sonarlint-core by SonarSource.

the class StandaloneIssueMediumTests method declare_module_should_create_a_module_container_with_loaded_extensions.

@Test
void declare_module_should_create_a_module_container_with_loaded_extensions() throws Exception {
    sonarlint.declareModule(new ClientModuleInfo("key", aClientFileSystemWith(new OnDiskTestClientInputFile(Paths.get("main.py"), "main.py", false, StandardCharsets.UTF_8, null)))).get();
    ComponentContainer moduleContainer = sonarlint.getAnalysisEngine().getModuleRegistry().getContainerFor("key");
    assertThat(moduleContainer).isNotNull();
    assertThat(moduleContainer.getComponentsByType(SonarLintModuleFileSystem.class)).isNotEmpty();
}
Also used : OnDiskTestClientInputFile(testutils.OnDiskTestClientInputFile) ComponentContainer(org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer) ClientModuleInfo(org.sonarsource.sonarlint.core.analysis.api.ClientModuleInfo) Test(org.junit.jupiter.api.Test)

Example 2 with ComponentContainer

use of org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer in project sonarlint-core by SonarSource.

the class ConnectedIssueMediumTests method stop_module_should_stop_the_module_container.

@Test
void stop_module_should_stop_the_module_container() throws Exception {
    sonarlint.declareModule(new ClientModuleInfo("key", aClientFileSystemWith(new OnDiskTestClientInputFile(Paths.get("main.py"), "main.py", false, StandardCharsets.UTF_8, null)))).get();
    ComponentContainer moduleContainer = sonarlint.getAnalysisEngine().getModuleRegistry().getContainerFor("key");
    sonarlint.stopModule("key").get();
    assertThat(moduleContainer.getPicoContainer().getLifecycleState().isStarted()).isFalse();
}
Also used : OnDiskTestClientInputFile(testutils.OnDiskTestClientInputFile) ComponentContainer(org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer) ClientModuleInfo(org.sonarsource.sonarlint.core.analysis.api.ClientModuleInfo) Test(org.junit.jupiter.api.Test)

Example 3 with ComponentContainer

use of org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer in project sonarlint-core by SonarSource.

the class ConnectedIssueMediumTests method declare_module_should_create_a_module_container_with_loaded_extensions.

@Test
void declare_module_should_create_a_module_container_with_loaded_extensions() throws Exception {
    sonarlint.declareModule(new ClientModuleInfo("key", aClientFileSystemWith(new OnDiskTestClientInputFile(Paths.get("main.py"), "main.py", false, StandardCharsets.UTF_8, null)))).get();
    ComponentContainer moduleContainer = sonarlint.getAnalysisEngine().getModuleRegistry().getContainerFor("key");
    assertThat(moduleContainer).isNotNull();
    assertThat(moduleContainer.getComponentsByType(SonarLintModuleFileSystem.class)).isNotEmpty();
}
Also used : OnDiskTestClientInputFile(testutils.OnDiskTestClientInputFile) ComponentContainer(org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer) ClientModuleInfo(org.sonarsource.sonarlint.core.analysis.api.ClientModuleInfo) Test(org.junit.jupiter.api.Test)

Example 4 with ComponentContainer

use of org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer in project sonarlint-core by SonarSource.

the class StandaloneIssueMediumTests method stop_module_should_stop_the_module_container.

@Test
void stop_module_should_stop_the_module_container() throws Exception {
    sonarlint.declareModule(new ClientModuleInfo("key", aClientFileSystemWith(new OnDiskTestClientInputFile(Paths.get("main.py"), "main.py", false, StandardCharsets.UTF_8, null)))).get();
    ComponentContainer moduleContainer = sonarlint.getAnalysisEngine().getModuleRegistry().getContainerFor("key");
    sonarlint.stopModule("key").get();
    assertThat(moduleContainer.getPicoContainer().getLifecycleState().isStarted()).isFalse();
}
Also used : OnDiskTestClientInputFile(testutils.OnDiskTestClientInputFile) ComponentContainer(org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer) ClientModuleInfo(org.sonarsource.sonarlint.core.analysis.api.ClientModuleInfo) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)4 ClientModuleInfo (org.sonarsource.sonarlint.core.analysis.api.ClientModuleInfo)4 ComponentContainer (org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer)4 OnDiskTestClientInputFile (testutils.OnDiskTestClientInputFile)4