@Test
public void testGetPluginsWithMacrosMoreThan20() {
Configuration hConf = new Configuration();
MapReduceContextConfig cfg = new MapReduceContextConfig(hConf);
Map<String, Plugin> mockPlugins = new HashMap<>();
ArtifactId artifactId = new ArtifactId("plugins", new ArtifactVersion("1.0.0"), ArtifactScope.SYSTEM);
Map<String, String> properties = new HashMap<>();
properties.put("path",
"${input.directory}/${a}${b}${c}${d}${e}${f}${g}${h}${i}${j}"
+ "${k}${l}${m}${n}${o}${p}${q}${r}${s}${t}${u}${v}${w}${x}${y}${z}.txt");
hConf.set("input.directory", "/dummy/path");
String[] alphabetsArr = {"a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k", "l", "m", "n", "o", "p", "q",
"r", "s", "t", "u", "v", "w", "x", "y", "z"};
for (String alphabet : alphabetsArr) {
hConf.set(alphabet, alphabet);
}
Set<ArtifactId> parents = new LinkedHashSet<>();
Plugin filePlugin1 = new Plugin(parents, artifactId,
new PluginClass("type", "name", "desc", "clsname", "cfgfield",
Collections.emptyMap()),
PluginProperties.builder().addAll(properties).build());
mockPlugins.put("File1", filePlugin1);
hConf.set(MapReduceContextConfig.HCONF_ATTR_PLUGINS, GSON.toJson(mockPlugins));
Map<String, Plugin> plugins = cfg.getPlugins();
Assert.assertEquals(plugins, mockPlugins);
}
}