Search in sources :

Example 41 with PluginInfo

use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.

the class DebtModelPluginRepository method findAvailableXMLFiles.

private void findAvailableXMLFiles() {
    if (contributingPluginKeyToClassLoader == null) {
        contributingPluginKeyToClassLoader = Maps.newTreeMap();
        // Add default model
        contributingPluginKeyToClassLoader.put(DEFAULT_MODEL, getClass().getClassLoader());
        for (PluginInfo pluginInfo : pluginRepository.getPluginInfos()) {
            String pluginKey = pluginInfo.getKey();
            Plugin plugin = pluginRepository.getPluginInstance(pluginKey);
            ClassLoader classLoader = plugin.getClass().getClassLoader();
            if (classLoader.getResource(getXMLFilePath(pluginKey)) != null) {
                contributingPluginKeyToClassLoader.put(pluginKey, classLoader);
            }
        }
    }
    contributingPluginKeyToClassLoader = Collections.unmodifiableMap(contributingPluginKeyToClassLoader);
}
Also used : PluginInfo(org.sonar.core.platform.PluginInfo) Plugin(org.sonar.api.Plugin)

Example 42 with PluginInfo

use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.

the class ScannerSettingsTest method return_license_hash_keys.

@Test
public void return_license_hash_keys() throws Exception {
    PluginInfo pluginInfo = mock(PluginInfo.class);
    when(pluginInfo.getKey()).thenReturn("myplugin");
    when(repository.getPluginInfos()).thenReturn(singletonList(pluginInfo));
    underTest.start();
    assertThat(underTest.getScannerSettingKeys()).contains("sonar.myplugin.licenseHash.secured");
}
Also used : PluginInfo(org.sonar.core.platform.PluginInfo) Test(org.junit.Test)

Example 43 with PluginInfo

use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.

the class ValuesActionTest method setUp.

@Before
public void setUp() throws Exception {
    PluginInfo pluginInfo = mock(PluginInfo.class);
    when(pluginInfo.getKey()).thenReturn("plugin");
    when(repository.getPluginInfos()).thenReturn(singletonList(pluginInfo));
    scannerSettings.start();
    OrganizationDto organizationDto = db.organizations().insert();
    project = componentDb.insertComponent(newProjectDto(organizationDto));
}
Also used : PluginInfo(org.sonar.core.platform.PluginInfo) OrganizationDto(org.sonar.db.organization.OrganizationDto) Before(org.junit.Before)

Example 44 with PluginInfo

use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.

the class InstalledPluginsActionTest method return_plugins_with_plugin_having_no_version.

@Test
public void return_plugins_with_plugin_having_no_version() throws Exception {
    when(pluginRepository.getPluginInfos()).thenReturn(singletonList(new PluginInfo("java").setName("Java")));
    String result = ws.newRequest().execute().getInput();
    assertJson(result).isSimilarTo("[" + "  {" + "    \"key\": \"java\",\n" + "    \"name\": \"Java\"\n" + "  }" + "]");
}
Also used : PluginInfo(org.sonar.core.platform.PluginInfo) Test(org.junit.Test)

Example 45 with PluginInfo

use of org.sonar.core.platform.PluginInfo in project sonarqube by SonarSource.

the class DefaultI18nTest method newPlugin.

private PluginInfo newPlugin(String key) {
    PluginInfo plugin = mock(PluginInfo.class);
    when(plugin.getKey()).thenReturn(key);
    return plugin;
}
Also used : PluginInfo(org.sonar.core.platform.PluginInfo)

Aggregations

PluginInfo (org.sonar.core.platform.PluginInfo)50 Test (org.junit.Test)23 File (java.io.File)9 Plugin (org.sonar.api.Plugin)7 PluginInfo.jarToPluginInfo (org.sonar.core.platform.PluginInfo.jarToPluginInfo)7 PluginRepository (org.sonar.core.platform.PluginRepository)5 ExplodedPlugin (org.sonar.core.platform.ExplodedPlugin)4 FileUtils.copyFile (org.apache.commons.io.FileUtils.copyFile)3 FileUtils.moveFile (org.apache.commons.io.FileUtils.moveFile)3 SonarRuntime (org.sonar.api.SonarRuntime)3 AnalysisMode (org.sonar.api.batch.AnalysisMode)3 ComponentContainer (org.sonar.core.platform.ComponentContainer)3 Version (org.sonar.updatecenter.common.Version)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Before (org.junit.Before)2 ExtensionProvider (org.sonar.api.ExtensionProvider)2 JsonWriter (org.sonar.api.utils.text.JsonWriter)2