Search in sources :

Example 1 with InstalledPluginsState

use of com.intellij.ide.plugins.InstalledPluginsState in project intellij-community by JetBrains.

the class UpdatePluginsFromCustomRepositoryTest method testOnlyCompatiblePluginsAreChecked.

@Test
public void testOnlyCompatiblePluginsAreChecked() throws Exception {
    Map<PluginId, PluginDownloader> toUpdate = new LinkedHashMap<>();
    IdeaPluginDescriptor[] descriptors = new IdeaPluginDescriptor[] { loadDescriptor("plugin1.xml"), loadDescriptor("plugin2.xml") };
    BuildNumber currentBuildNumber = BuildNumber.fromString("IU-142.100");
    for (IdeaPluginDescriptor descriptor : descriptors) {
        PluginDownloader downloader = PluginDownloader.createDownloader(descriptor, null, currentBuildNumber);
        UpdateChecker.checkAndPrepareToInstall(downloader, new InstalledPluginsState(), toUpdate, new ArrayList<>(), null);
    }
    assertEquals("Found: " + toUpdate.size(), 1, toUpdate.size());
    PluginDownloader downloader = toUpdate.values().iterator().next();
    assertNotNull(downloader);
    assertEquals("0.1", downloader.getPluginVersion());
}
Also used : PluginDownloader(com.intellij.openapi.updateSettings.impl.PluginDownloader) InstalledPluginsState(com.intellij.ide.plugins.InstalledPluginsState) BuildNumber(com.intellij.openapi.util.BuildNumber) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) PluginId(com.intellij.openapi.extensions.PluginId) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Aggregations

IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)1 InstalledPluginsState (com.intellij.ide.plugins.InstalledPluginsState)1 PluginId (com.intellij.openapi.extensions.PluginId)1 PluginDownloader (com.intellij.openapi.updateSettings.impl.PluginDownloader)1 BuildNumber (com.intellij.openapi.util.BuildNumber)1 LinkedHashMap (java.util.LinkedHashMap)1 Test (org.junit.Test)1