use of org.opensearch.cli.UserException in project OpenSearch by opensearch-project.
the class InstallPluginCommandTests method testPluginAlreadyInstalled.
public void testPluginAlreadyInstalled() throws Exception {
Tuple<Path, Environment> env = createEnv(fs, temp);
Path pluginDir = createPluginDir(temp);
String pluginZip = createPluginUrl("fake", pluginDir);
installPlugin(pluginZip, env.v1());
final UserException e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1(), randomFrom(skipJarHellCommand, defaultCommand)));
assertThat(e.getMessage(), equalTo("plugin directory [" + env.v2().pluginsDir().resolve("fake") + "] already exists; " + "if you need to update the plugin, uninstall it first using command 'remove fake'"));
}
use of org.opensearch.cli.UserException in project OpenSearch by opensearch-project.
the class InstallPluginCommandTests method testBuiltinModule.
public void testBuiltinModule() throws Exception {
Tuple<Path, Environment> env = createEnv(fs, temp);
Path pluginDir = createPluginDir(temp);
String pluginZip = createPluginUrl("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.opensearch.cli.UserException in project OpenSearch by opensearch-project.
the class ListKeyStoreCommandTests method testMissing.
public void testMissing() throws Exception {
UserException e = expectThrows(UserException.class, this::execute);
assertEquals(ExitCodes.DATA_ERROR, e.exitCode);
assertThat(e.getMessage(), containsString("keystore not found"));
}
use of org.opensearch.cli.UserException in project OpenSearch by opensearch-project.
the class RemoveSettingKeyStoreCommandTests method testMissing.
public void testMissing() {
String password = "keystorepassword";
terminal.addSecretInput(password);
UserException e = expectThrows(UserException.class, () -> execute("foo"));
assertEquals(ExitCodes.DATA_ERROR, e.exitCode);
assertThat(e.getMessage(), containsString("keystore not found"));
}
use of org.opensearch.cli.UserException in project OpenSearch by opensearch-project.
the class RemoveSettingKeyStoreCommandTests method testNoSettings.
public void testNoSettings() throws Exception {
String password = "keystorepassword";
createKeystore(password);
terminal.addSecretInput(password);
UserException e = expectThrows(UserException.class, this::execute);
assertEquals(ExitCodes.USAGE, e.exitCode);
assertThat(e.getMessage(), containsString("Must supply at least one setting"));
}
Aggregations