use of org.sonarsource.sonarlint.core.analysis.api.ClientModuleInfo 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();
}
use of org.sonarsource.sonarlint.core.analysis.api.ClientModuleInfo 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();
}
use of org.sonarsource.sonarlint.core.analysis.api.ClientModuleInfo in project sonarlint-core by SonarSource.
the class ConnectedIssueMediumTests method prepare.
@BeforeAll
static void prepare(@TempDir Path slHome) throws Exception {
var storage = newStorage(SERVER_ID).withJSPlugin().withJavaPlugin().withProject("test-project").withProject(JAVA_MODULE_KEY, project -> project.withRuleSet("java", ruleSet -> ruleSet.withActiveRule("java:S106", "MAJOR").withActiveRule("java:S1220", "MINOR").withActiveRule("java:S1481", "BLOCKER"))).withProject("stale_module", ProjectStorageFixture.ProjectStorageBuilder::stale).create(slHome);
var nodeJsHelper = new NodeJsHelper();
nodeJsHelper.detect(null);
var config = ConnectedGlobalConfiguration.builder().setConnectionId(SERVER_ID).setSonarLintUserHome(slHome).setStorageRoot(storage.getPath()).setLogOutput(createNoOpLogOutput()).addEnabledLanguages(Language.JAVA, Language.JS).setNodeJs(nodeJsHelper.getNodeJsPath(), nodeJsHelper.getNodeJsVersion()).setModulesProvider(() -> List.of(new ClientModuleInfo("key", mock(ClientModuleFileSystem.class)))).build();
sonarlint = new ConnectedSonarLintEngineImpl(config);
}
use of org.sonarsource.sonarlint.core.analysis.api.ClientModuleInfo in project sonarlint-core by SonarSource.
the class LogMediumTests method prepare.
@BeforeEach
void prepare() throws IOException {
logs = Multimaps.synchronizedListMultimap(LinkedListMultimap.create());
var config = StandaloneGlobalConfiguration.builder().addPlugin(PluginLocator.getJavaScriptPluginPath()).setLogOutput(createLogOutput(logs)).setModulesProvider(() -> List.of(new ClientModuleInfo("key", mock(ClientModuleFileSystem.class)))).build();
sonarlint = new StandaloneSonarLintEngineImpl(config);
}
use of org.sonarsource.sonarlint.core.analysis.api.ClientModuleInfo in project sonarlint-core by SonarSource.
the class StandaloneNoPluginMediumTests method prepare.
@BeforeEach
void prepare() throws IOException {
ClientLogOutput logOutput = (msg, level) -> logs.put(level, msg);
sonarlint = new StandaloneSonarLintEngineImpl(StandaloneGlobalConfiguration.builder().setLogOutput(logOutput).setModulesProvider(() -> List.of(new ClientModuleInfo("key", mock(ClientModuleFileSystem.class)))).build());
}
Aggregations