import org.sonar.core.plugins.RemotePlugin;
import java.io.File;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
public class BatchPluginRepository implements PluginRepository {
private static final Logger LOG = LoggerFactory.getLogger(BatchPluginRepository.class);
private static final String CORE_PLUGIN = "core";
+ private static final String ENGLISH_PACK_PLUGIN = "l10nen";
private ArtifactDownloader artifactDownloader;
private Map<String, Plugin> pluginsByKey;
}
boolean isAccepted(String pluginKey) {
- if (CORE_PLUGIN.equals(pluginKey)) {
+ if (CORE_PLUGIN.equals(pluginKey) || ENGLISH_PACK_PLUGIN.equals(pluginKey)) {
return true;
}
if (whiteList != null) {
return blackList == null || !blackList.contains(pluginKey);
}
- public Map<PluginMetadata,Plugin> getPluginsByMetadata() {
+ public Map<PluginMetadata, Plugin> getPluginsByMetadata() {
Map<PluginMetadata, Plugin> result = Maps.newHashMap();
for (Map.Entry<String, PluginMetadata> entry : metadataByKey.entrySet()) {
String pluginKey = entry.getKey();
assertThat(repository.isAccepted("core"), Matchers.is(true));
}
+ // English Pack plugin should never be blacklisted as it is mandatory for the I18nManager on batch side
+ @Test
+ public void englishPackPluginShouldNeverBeInBlackList() {
+ Settings settings = new Settings();
+ settings.setProperty(CoreProperties.BATCH_EXCLUDE_PLUGINS, "l10nen,findbugs");
+ repository = new BatchPluginRepository(mock(ArtifactDownloader.class), settings);
+ assertThat(repository.isAccepted("l10nen"), Matchers.is(true));
+ }
+
@Test
public void shouldCheckWhitelist() {
Settings settings = new Settings();