use of org.elasticsearch.cli.UserException in project elasticsearch by elastic.
the class InstallPluginCommandTests method testBinContainsDir.
public void testBinContainsDir() throws Exception {
Tuple<Path, Environment> env = createEnv(fs, temp);
Path pluginDir = createPluginDir(temp);
Path dirInBinDir = pluginDir.resolve("bin").resolve("foo");
Files.createDirectories(dirInBinDir);
Files.createFile(dirInBinDir.resolve("somescript"));
String pluginZip = createPlugin("fake", pluginDir);
UserException e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
assertTrue(e.getMessage(), e.getMessage().contains("Directories not allowed in bin dir for plugin"));
assertInstallCleaned(env.v2());
}
use of org.elasticsearch.cli.UserException in project elasticsearch by elastic.
the class InstallPluginCommandTests method testUnknownPlugin.
public void testUnknownPlugin() throws Exception {
Tuple<Path, Environment> env = createEnv(fs, temp);
UserException e = expectThrows(UserException.class, () -> installPlugin("foo", env.v1()));
assertTrue(e.getMessage(), e.getMessage().contains("Unknown plugin foo"));
}
use of org.elasticsearch.cli.UserException in project elasticsearch by elastic.
the class InstallPluginCommandTests method testBuiltinModule.
public void testBuiltinModule() throws Exception {
Tuple<Path, Environment> env = createEnv(fs, temp);
Path pluginDir = createPluginDir(temp);
String pluginZip = createPlugin("lang-painless", pluginDir);
UserException e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
assertTrue(e.getMessage(), e.getMessage().contains("is a system module"));
assertInstallCleaned(env.v2());
}
use of org.elasticsearch.cli.UserException in project elasticsearch by elastic.
the class RemovePluginCommandTests method testMissing.
public void testMissing() throws Exception {
UserException e = expectThrows(UserException.class, () -> removePlugin("dne", home));
assertTrue(e.getMessage(), e.getMessage().contains("plugin dne not found"));
assertRemoveCleaned(env);
}
use of org.elasticsearch.cli.UserException in project elasticsearch by elastic.
the class InstallPluginCommandTests method testBinNotDir.
public void testBinNotDir() throws Exception {
Tuple<Path, Environment> env = createEnv(fs, temp);
Path pluginDir = createPluginDir(temp);
Path binDir = pluginDir.resolve("bin");
Files.createFile(binDir);
String pluginZip = createPlugin("fake", pluginDir);
UserException e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
assertTrue(e.getMessage(), e.getMessage().contains("not a directory"));
assertInstallCleaned(env.v2());
}
Aggregations