@Test public void testSimplifiedNaming() throws IOException { String pluginName = randomAsciiOfLength(10); PluginManager.PluginHandle handle = PluginManager.PluginHandle.parse(pluginName); assertThat(handle.urls(), hasSize(1)); URL expected = new URL( "http", "download.elastic.co", "/org.elasticsearch.plugins/" + pluginName + "/" + pluginName + "-" + Version.CURRENT.number() + ".zip"); assertThat(handle.urls().get(0), is(expected)); }
@Test public void testThatConfigDirectoryCanBeOutsideOfElasticsearchHomeDirectory() throws IOException { String pluginName = randomAsciiOfLength(10); Path homeFolder = createTempDir(); Path genericConfigFolder = createTempDir(); Settings settings = settingsBuilder() .put("path.conf", genericConfigFolder) .put("path.home", homeFolder) .build(); Environment environment = new Environment(settings); PluginManager.PluginHandle pluginHandle = new PluginManager.PluginHandle(pluginName, "version", "user", "repo"); String configDirPath = Files.simplifyPath(pluginHandle.configDir(environment).normalize().toString()); String expectedDirPath = Files.simplifyPath(genericConfigFolder.resolve(pluginName).normalize().toString()); assertThat(configDirPath, is(expectedDirPath)); }