Search in sources :

Example 6 with UserException

use of org.opensearch.cli.UserException in project OpenSearch by opensearch-project.

the class InstallPluginCommandTests method testInvalidShaFileMissingFilename.

public void testInvalidShaFileMissingFilename() throws Exception {
    String url = "https://artifacts.opensearch.org/releases/plugins/analysis-icu/" + Build.CURRENT.getQualifiedVersion() + "/analysis-icu-" + Build.CURRENT.getQualifiedVersion() + ".zip";
    MessageDigest digest = MessageDigest.getInstance("SHA-512");
    UserException e = expectThrows(UserException.class, () -> assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, null, false, ".sha512", checksum(digest), null, (b, p) -> null));
    assertEquals(ExitCodes.IO_ERROR, e.exitCode);
    assertTrue(e.getMessage(), e.getMessage().startsWith("Invalid checksum file"));
}
Also used : JcaPGPContentSignerBuilder(org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder) UserException(org.opensearch.cli.UserException) KeyPair(java.security.KeyPair) Matchers.hasToString(org.hamcrest.Matchers.hasToString) NoSuchFileException(java.nio.file.NoSuchFileException) Arrays(java.util.Arrays) ParametersFactory(com.carrotsearch.randomizedtesting.annotations.ParametersFactory) MockTerminal(org.opensearch.cli.MockTerminal) URL(java.net.URL) Date(java.util.Date) BiFunction(java.util.function.BiFunction) Matchers.not(org.hamcrest.Matchers.not) JcePBESecretKeyEncryptorBuilder(org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder) Version(org.opensearch.Version) Build(org.opensearch.Build) FileSystemUtils(org.opensearch.common.io.FileSystemUtils) DirectoryStream(java.nio.file.DirectoryStream) PGPKeyPair(org.bouncycastle.openpgp.PGPKeyPair) ByteArrayInputStream(java.io.ByteArrayInputStream) Locale(java.util.Locale) After(org.junit.After) HashAlgorithmTags(org.bouncycastle.bcpg.HashAlgorithmTags) URI(java.net.URI) PGPException(org.bouncycastle.openpgp.PGPException) Path(java.nio.file.Path) ZipEntry(java.util.zip.ZipEntry) PosixPermissionsResetter(org.opensearch.test.PosixPermissionsResetter) SimpleFileVisitor(java.nio.file.SimpleFileVisitor) KeyPairGenerator(java.security.KeyPairGenerator) SuppressForbidden(org.opensearch.common.SuppressForbidden) PathUtilsForTesting(org.opensearch.common.io.PathUtilsForTesting) PosixFileAttributes(java.nio.file.attribute.PosixFileAttributes) PosixFilePermission(java.nio.file.attribute.PosixFilePermission) PGPPrivateKey(org.bouncycastle.openpgp.PGPPrivateKey) OpenSearchTestCase(org.opensearch.test.OpenSearchTestCase) Set(java.util.Set) BouncyCastleFipsProvider(org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider) PGPEncryptedData(org.bouncycastle.openpgp.PGPEncryptedData) PGPPublicKey(org.bouncycastle.openpgp.PGPPublicKey) Settings(org.opensearch.common.settings.Settings) PGPDigestCalculator(org.bouncycastle.openpgp.operator.PGPDigestCalculator) FileSystem(java.nio.file.FileSystem) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) StandardCharsets(java.nio.charset.StandardCharsets) Matchers.startsWith(org.hamcrest.Matchers.startsWith) LuceneTestCase(org.apache.lucene.tests.util.LuceneTestCase) Tuple(org.opensearch.common.collect.Tuple) RegexMatcher.matches(org.opensearch.test.hamcrest.RegexMatcher.matches) PGPSecretKey(org.bouncycastle.openpgp.PGPSecretKey) FileVisitResult(java.nio.file.FileVisitResult) List(java.util.List) BCPGOutputStream(org.bouncycastle.bcpg.BCPGOutputStream) Stream(java.util.stream.Stream) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.endsWith(org.hamcrest.Matchers.endsWith) PathUtils(org.opensearch.common.io.PathUtils) ZipOutputStream(java.util.zip.ZipOutputStream) TestEnvironment(org.opensearch.env.TestEnvironment) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MessageDigest(java.security.MessageDigest) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) PosixFileAttributeView(java.nio.file.attribute.PosixFileAttributeView) GroupPrincipal(java.nio.file.attribute.GroupPrincipal) JcaPGPDigestCalculatorProviderBuilder(org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBuilder) Function(java.util.function.Function) StandardCopyOption(java.nio.file.StandardCopyOption) ArrayList(java.util.ArrayList) PGPSignatureGenerator(org.bouncycastle.openpgp.PGPSignatureGenerator) HashSet(java.util.HashSet) UserPrincipal(java.nio.file.attribute.UserPrincipal) Jimfs(com.google.common.jimfs.Jimfs) JcePBESecretKeyDecryptorBuilder(org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder) ExitCodes(org.opensearch.cli.ExitCodes) Before(org.junit.Before) Environment(org.opensearch.env.Environment) Terminal(org.opensearch.cli.Terminal) Matchers.empty(org.hamcrest.Matchers.empty) Configuration(com.google.common.jimfs.Configuration) MalformedURLException(java.net.MalformedURLException) Files(java.nio.file.Files) JcaPGPKeyPair(org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyPair) PGPSignature(org.bouncycastle.openpgp.PGPSignature) IOException(java.io.IOException) FileAlreadyExistsException(java.nio.file.FileAlreadyExistsException) BasicFileAttributes(java.nio.file.attribute.BasicFileAttributes) ArmoredOutputStream(org.bouncycastle.bcpg.ArmoredOutputStream) MessageDigests(org.opensearch.common.hash.MessageDigests) StringReader(java.io.StringReader) BufferedReader(java.io.BufferedReader) NoSuchProviderException(java.security.NoSuchProviderException) Collections(java.util.Collections) InputStream(java.io.InputStream) Matchers.hasToString(org.hamcrest.Matchers.hasToString) Matchers.containsString(org.hamcrest.Matchers.containsString) UserException(org.opensearch.cli.UserException) MessageDigest(java.security.MessageDigest)

Example 7 with UserException

use of org.opensearch.cli.UserException in project OpenSearch by opensearch-project.

the class InstallPluginCommandTests method testSha1Mismatch.

public void testSha1Mismatch() throws Exception {
    String url = "https://repo1.maven.org/maven2/mygroup/myplugin/1.0.0/myplugin-1.0.0.zip";
    UserException e = expectThrows(UserException.class, () -> assertInstallPluginFromUrl("mygroup:myplugin:1.0.0", "myplugin", url, null, false, ".sha1", bytes -> "foobar", null, (b, p) -> null));
    assertEquals(ExitCodes.IO_ERROR, e.exitCode);
    assertTrue(e.getMessage(), e.getMessage().contains("SHA-1 mismatch, expected foobar"));
}
Also used : JcaPGPContentSignerBuilder(org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder) UserException(org.opensearch.cli.UserException) KeyPair(java.security.KeyPair) Matchers.hasToString(org.hamcrest.Matchers.hasToString) NoSuchFileException(java.nio.file.NoSuchFileException) Arrays(java.util.Arrays) ParametersFactory(com.carrotsearch.randomizedtesting.annotations.ParametersFactory) MockTerminal(org.opensearch.cli.MockTerminal) URL(java.net.URL) Date(java.util.Date) BiFunction(java.util.function.BiFunction) Matchers.not(org.hamcrest.Matchers.not) JcePBESecretKeyEncryptorBuilder(org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder) Version(org.opensearch.Version) Build(org.opensearch.Build) FileSystemUtils(org.opensearch.common.io.FileSystemUtils) DirectoryStream(java.nio.file.DirectoryStream) PGPKeyPair(org.bouncycastle.openpgp.PGPKeyPair) ByteArrayInputStream(java.io.ByteArrayInputStream) Locale(java.util.Locale) After(org.junit.After) HashAlgorithmTags(org.bouncycastle.bcpg.HashAlgorithmTags) URI(java.net.URI) PGPException(org.bouncycastle.openpgp.PGPException) Path(java.nio.file.Path) ZipEntry(java.util.zip.ZipEntry) PosixPermissionsResetter(org.opensearch.test.PosixPermissionsResetter) SimpleFileVisitor(java.nio.file.SimpleFileVisitor) KeyPairGenerator(java.security.KeyPairGenerator) SuppressForbidden(org.opensearch.common.SuppressForbidden) PathUtilsForTesting(org.opensearch.common.io.PathUtilsForTesting) PosixFileAttributes(java.nio.file.attribute.PosixFileAttributes) PosixFilePermission(java.nio.file.attribute.PosixFilePermission) PGPPrivateKey(org.bouncycastle.openpgp.PGPPrivateKey) OpenSearchTestCase(org.opensearch.test.OpenSearchTestCase) Set(java.util.Set) BouncyCastleFipsProvider(org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider) PGPEncryptedData(org.bouncycastle.openpgp.PGPEncryptedData) PGPPublicKey(org.bouncycastle.openpgp.PGPPublicKey) Settings(org.opensearch.common.settings.Settings) PGPDigestCalculator(org.bouncycastle.openpgp.operator.PGPDigestCalculator) FileSystem(java.nio.file.FileSystem) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) StandardCharsets(java.nio.charset.StandardCharsets) Matchers.startsWith(org.hamcrest.Matchers.startsWith) LuceneTestCase(org.apache.lucene.tests.util.LuceneTestCase) Tuple(org.opensearch.common.collect.Tuple) RegexMatcher.matches(org.opensearch.test.hamcrest.RegexMatcher.matches) PGPSecretKey(org.bouncycastle.openpgp.PGPSecretKey) FileVisitResult(java.nio.file.FileVisitResult) List(java.util.List) BCPGOutputStream(org.bouncycastle.bcpg.BCPGOutputStream) Stream(java.util.stream.Stream) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.endsWith(org.hamcrest.Matchers.endsWith) PathUtils(org.opensearch.common.io.PathUtils) ZipOutputStream(java.util.zip.ZipOutputStream) TestEnvironment(org.opensearch.env.TestEnvironment) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MessageDigest(java.security.MessageDigest) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) PosixFileAttributeView(java.nio.file.attribute.PosixFileAttributeView) GroupPrincipal(java.nio.file.attribute.GroupPrincipal) JcaPGPDigestCalculatorProviderBuilder(org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBuilder) Function(java.util.function.Function) StandardCopyOption(java.nio.file.StandardCopyOption) ArrayList(java.util.ArrayList) PGPSignatureGenerator(org.bouncycastle.openpgp.PGPSignatureGenerator) HashSet(java.util.HashSet) UserPrincipal(java.nio.file.attribute.UserPrincipal) Jimfs(com.google.common.jimfs.Jimfs) JcePBESecretKeyDecryptorBuilder(org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder) ExitCodes(org.opensearch.cli.ExitCodes) Before(org.junit.Before) Environment(org.opensearch.env.Environment) Terminal(org.opensearch.cli.Terminal) Matchers.empty(org.hamcrest.Matchers.empty) Configuration(com.google.common.jimfs.Configuration) MalformedURLException(java.net.MalformedURLException) Files(java.nio.file.Files) JcaPGPKeyPair(org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyPair) PGPSignature(org.bouncycastle.openpgp.PGPSignature) IOException(java.io.IOException) FileAlreadyExistsException(java.nio.file.FileAlreadyExistsException) BasicFileAttributes(java.nio.file.attribute.BasicFileAttributes) ArmoredOutputStream(org.bouncycastle.bcpg.ArmoredOutputStream) MessageDigests(org.opensearch.common.hash.MessageDigests) StringReader(java.io.StringReader) BufferedReader(java.io.BufferedReader) NoSuchProviderException(java.security.NoSuchProviderException) Collections(java.util.Collections) InputStream(java.io.InputStream) Matchers.hasToString(org.hamcrest.Matchers.hasToString) Matchers.containsString(org.hamcrest.Matchers.containsString) UserException(org.opensearch.cli.UserException)

Example 8 with UserException

use of org.opensearch.cli.UserException in project OpenSearch by opensearch-project.

the class InstallPluginCommandTests method testOfficialShaMissing.

public void testOfficialShaMissing() throws Exception {
    String url = "https://artifacts.opensearch.org/releases/plugins/analysis-icu/" + Build.CURRENT.getQualifiedVersion() + "/analysis-icu-" + Build.CURRENT.getQualifiedVersion() + ".zip";
    MessageDigest digest = MessageDigest.getInstance("SHA-1");
    UserException e = expectThrows(UserException.class, () -> assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, null, false, ".sha1", checksum(digest), null, (b, p) -> null));
    assertEquals(ExitCodes.IO_ERROR, e.exitCode);
    assertEquals("Plugin checksum missing: " + url + ".sha512", e.getMessage());
}
Also used : JcaPGPContentSignerBuilder(org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder) UserException(org.opensearch.cli.UserException) KeyPair(java.security.KeyPair) Matchers.hasToString(org.hamcrest.Matchers.hasToString) NoSuchFileException(java.nio.file.NoSuchFileException) Arrays(java.util.Arrays) ParametersFactory(com.carrotsearch.randomizedtesting.annotations.ParametersFactory) MockTerminal(org.opensearch.cli.MockTerminal) URL(java.net.URL) Date(java.util.Date) BiFunction(java.util.function.BiFunction) Matchers.not(org.hamcrest.Matchers.not) JcePBESecretKeyEncryptorBuilder(org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder) Version(org.opensearch.Version) Build(org.opensearch.Build) FileSystemUtils(org.opensearch.common.io.FileSystemUtils) DirectoryStream(java.nio.file.DirectoryStream) PGPKeyPair(org.bouncycastle.openpgp.PGPKeyPair) ByteArrayInputStream(java.io.ByteArrayInputStream) Locale(java.util.Locale) After(org.junit.After) HashAlgorithmTags(org.bouncycastle.bcpg.HashAlgorithmTags) URI(java.net.URI) PGPException(org.bouncycastle.openpgp.PGPException) Path(java.nio.file.Path) ZipEntry(java.util.zip.ZipEntry) PosixPermissionsResetter(org.opensearch.test.PosixPermissionsResetter) SimpleFileVisitor(java.nio.file.SimpleFileVisitor) KeyPairGenerator(java.security.KeyPairGenerator) SuppressForbidden(org.opensearch.common.SuppressForbidden) PathUtilsForTesting(org.opensearch.common.io.PathUtilsForTesting) PosixFileAttributes(java.nio.file.attribute.PosixFileAttributes) PosixFilePermission(java.nio.file.attribute.PosixFilePermission) PGPPrivateKey(org.bouncycastle.openpgp.PGPPrivateKey) OpenSearchTestCase(org.opensearch.test.OpenSearchTestCase) Set(java.util.Set) BouncyCastleFipsProvider(org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider) PGPEncryptedData(org.bouncycastle.openpgp.PGPEncryptedData) PGPPublicKey(org.bouncycastle.openpgp.PGPPublicKey) Settings(org.opensearch.common.settings.Settings) PGPDigestCalculator(org.bouncycastle.openpgp.operator.PGPDigestCalculator) FileSystem(java.nio.file.FileSystem) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) StandardCharsets(java.nio.charset.StandardCharsets) Matchers.startsWith(org.hamcrest.Matchers.startsWith) LuceneTestCase(org.apache.lucene.tests.util.LuceneTestCase) Tuple(org.opensearch.common.collect.Tuple) RegexMatcher.matches(org.opensearch.test.hamcrest.RegexMatcher.matches) PGPSecretKey(org.bouncycastle.openpgp.PGPSecretKey) FileVisitResult(java.nio.file.FileVisitResult) List(java.util.List) BCPGOutputStream(org.bouncycastle.bcpg.BCPGOutputStream) Stream(java.util.stream.Stream) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.endsWith(org.hamcrest.Matchers.endsWith) PathUtils(org.opensearch.common.io.PathUtils) ZipOutputStream(java.util.zip.ZipOutputStream) TestEnvironment(org.opensearch.env.TestEnvironment) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MessageDigest(java.security.MessageDigest) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) PosixFileAttributeView(java.nio.file.attribute.PosixFileAttributeView) GroupPrincipal(java.nio.file.attribute.GroupPrincipal) JcaPGPDigestCalculatorProviderBuilder(org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBuilder) Function(java.util.function.Function) StandardCopyOption(java.nio.file.StandardCopyOption) ArrayList(java.util.ArrayList) PGPSignatureGenerator(org.bouncycastle.openpgp.PGPSignatureGenerator) HashSet(java.util.HashSet) UserPrincipal(java.nio.file.attribute.UserPrincipal) Jimfs(com.google.common.jimfs.Jimfs) JcePBESecretKeyDecryptorBuilder(org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder) ExitCodes(org.opensearch.cli.ExitCodes) Before(org.junit.Before) Environment(org.opensearch.env.Environment) Terminal(org.opensearch.cli.Terminal) Matchers.empty(org.hamcrest.Matchers.empty) Configuration(com.google.common.jimfs.Configuration) MalformedURLException(java.net.MalformedURLException) Files(java.nio.file.Files) JcaPGPKeyPair(org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyPair) PGPSignature(org.bouncycastle.openpgp.PGPSignature) IOException(java.io.IOException) FileAlreadyExistsException(java.nio.file.FileAlreadyExistsException) BasicFileAttributes(java.nio.file.attribute.BasicFileAttributes) ArmoredOutputStream(org.bouncycastle.bcpg.ArmoredOutputStream) MessageDigests(org.opensearch.common.hash.MessageDigests) StringReader(java.io.StringReader) BufferedReader(java.io.BufferedReader) NoSuchProviderException(java.security.NoSuchProviderException) Collections(java.util.Collections) InputStream(java.io.InputStream) Matchers.hasToString(org.hamcrest.Matchers.hasToString) Matchers.containsString(org.hamcrest.Matchers.containsString) UserException(org.opensearch.cli.UserException) MessageDigest(java.security.MessageDigest)

Example 9 with UserException

use of org.opensearch.cli.UserException in project OpenSearch by opensearch-project.

the class InstallPluginCommandTests method testInstallMisspelledOfficialPlugins.

public void testInstallMisspelledOfficialPlugins() throws Exception {
    Tuple<Path, Environment> env = createEnv(fs, temp);
    UserException e = expectThrows(UserException.class, () -> installPlugin("analysis-smartnc", env.v1()));
    assertThat(e.getMessage(), containsString("Unknown plugin analysis-smartnc, did you mean [analysis-smartcn]?"));
    e = expectThrows(UserException.class, () -> installPlugin("repository", env.v1()));
    assertThat(e.getMessage(), containsString("Unknown plugin repository, did you mean any of [repository-s3, repository-gcs]?"));
    e = expectThrows(UserException.class, () -> installPlugin("unknown_plugin", env.v1()));
    assertThat(e.getMessage(), containsString("Unknown plugin unknown_plugin"));
}
Also used : Path(java.nio.file.Path) TestEnvironment(org.opensearch.env.TestEnvironment) Environment(org.opensearch.env.Environment) UserException(org.opensearch.cli.UserException)

Example 10 with UserException

use of org.opensearch.cli.UserException in project OpenSearch by opensearch-project.

the class InstallPluginCommandTests method testInvalidShaFileContainingExtraLine.

public void testInvalidShaFileContainingExtraLine() throws Exception {
    String url = "https://artifacts.opensearch.org/releases/plugins/analysis-icu/" + Build.CURRENT.getQualifiedVersion() + "/analysis-icu-" + Build.CURRENT.getQualifiedVersion() + ".zip";
    MessageDigest digest = MessageDigest.getInstance("SHA-512");
    UserException e = expectThrows(UserException.class, () -> assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, null, false, ".sha512", checksumAndString(digest, "  analysis-icu-" + Build.CURRENT.getQualifiedVersion() + ".zip\nfoobar"), null, (b, p) -> null));
    assertEquals(ExitCodes.IO_ERROR, e.exitCode);
    assertTrue(e.getMessage(), e.getMessage().startsWith("Invalid checksum file"));
}
Also used : JcaPGPContentSignerBuilder(org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder) UserException(org.opensearch.cli.UserException) KeyPair(java.security.KeyPair) Matchers.hasToString(org.hamcrest.Matchers.hasToString) NoSuchFileException(java.nio.file.NoSuchFileException) Arrays(java.util.Arrays) ParametersFactory(com.carrotsearch.randomizedtesting.annotations.ParametersFactory) MockTerminal(org.opensearch.cli.MockTerminal) URL(java.net.URL) Date(java.util.Date) BiFunction(java.util.function.BiFunction) Matchers.not(org.hamcrest.Matchers.not) JcePBESecretKeyEncryptorBuilder(org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder) Version(org.opensearch.Version) Build(org.opensearch.Build) FileSystemUtils(org.opensearch.common.io.FileSystemUtils) DirectoryStream(java.nio.file.DirectoryStream) PGPKeyPair(org.bouncycastle.openpgp.PGPKeyPair) ByteArrayInputStream(java.io.ByteArrayInputStream) Locale(java.util.Locale) After(org.junit.After) HashAlgorithmTags(org.bouncycastle.bcpg.HashAlgorithmTags) URI(java.net.URI) PGPException(org.bouncycastle.openpgp.PGPException) Path(java.nio.file.Path) ZipEntry(java.util.zip.ZipEntry) PosixPermissionsResetter(org.opensearch.test.PosixPermissionsResetter) SimpleFileVisitor(java.nio.file.SimpleFileVisitor) KeyPairGenerator(java.security.KeyPairGenerator) SuppressForbidden(org.opensearch.common.SuppressForbidden) PathUtilsForTesting(org.opensearch.common.io.PathUtilsForTesting) PosixFileAttributes(java.nio.file.attribute.PosixFileAttributes) PosixFilePermission(java.nio.file.attribute.PosixFilePermission) PGPPrivateKey(org.bouncycastle.openpgp.PGPPrivateKey) OpenSearchTestCase(org.opensearch.test.OpenSearchTestCase) Set(java.util.Set) BouncyCastleFipsProvider(org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider) PGPEncryptedData(org.bouncycastle.openpgp.PGPEncryptedData) PGPPublicKey(org.bouncycastle.openpgp.PGPPublicKey) Settings(org.opensearch.common.settings.Settings) PGPDigestCalculator(org.bouncycastle.openpgp.operator.PGPDigestCalculator) FileSystem(java.nio.file.FileSystem) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) StandardCharsets(java.nio.charset.StandardCharsets) Matchers.startsWith(org.hamcrest.Matchers.startsWith) LuceneTestCase(org.apache.lucene.tests.util.LuceneTestCase) Tuple(org.opensearch.common.collect.Tuple) RegexMatcher.matches(org.opensearch.test.hamcrest.RegexMatcher.matches) PGPSecretKey(org.bouncycastle.openpgp.PGPSecretKey) FileVisitResult(java.nio.file.FileVisitResult) List(java.util.List) BCPGOutputStream(org.bouncycastle.bcpg.BCPGOutputStream) Stream(java.util.stream.Stream) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.endsWith(org.hamcrest.Matchers.endsWith) PathUtils(org.opensearch.common.io.PathUtils) ZipOutputStream(java.util.zip.ZipOutputStream) TestEnvironment(org.opensearch.env.TestEnvironment) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MessageDigest(java.security.MessageDigest) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) PosixFileAttributeView(java.nio.file.attribute.PosixFileAttributeView) GroupPrincipal(java.nio.file.attribute.GroupPrincipal) JcaPGPDigestCalculatorProviderBuilder(org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBuilder) Function(java.util.function.Function) StandardCopyOption(java.nio.file.StandardCopyOption) ArrayList(java.util.ArrayList) PGPSignatureGenerator(org.bouncycastle.openpgp.PGPSignatureGenerator) HashSet(java.util.HashSet) UserPrincipal(java.nio.file.attribute.UserPrincipal) Jimfs(com.google.common.jimfs.Jimfs) JcePBESecretKeyDecryptorBuilder(org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder) ExitCodes(org.opensearch.cli.ExitCodes) Before(org.junit.Before) Environment(org.opensearch.env.Environment) Terminal(org.opensearch.cli.Terminal) Matchers.empty(org.hamcrest.Matchers.empty) Configuration(com.google.common.jimfs.Configuration) MalformedURLException(java.net.MalformedURLException) Files(java.nio.file.Files) JcaPGPKeyPair(org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyPair) PGPSignature(org.bouncycastle.openpgp.PGPSignature) IOException(java.io.IOException) FileAlreadyExistsException(java.nio.file.FileAlreadyExistsException) BasicFileAttributes(java.nio.file.attribute.BasicFileAttributes) ArmoredOutputStream(org.bouncycastle.bcpg.ArmoredOutputStream) MessageDigests(org.opensearch.common.hash.MessageDigests) StringReader(java.io.StringReader) BufferedReader(java.io.BufferedReader) NoSuchProviderException(java.security.NoSuchProviderException) Collections(java.util.Collections) InputStream(java.io.InputStream) Matchers.hasToString(org.hamcrest.Matchers.hasToString) Matchers.containsString(org.hamcrest.Matchers.containsString) UserException(org.opensearch.cli.UserException) MessageDigest(java.security.MessageDigest)

Aggregations

UserException (org.opensearch.cli.UserException)76 Path (java.nio.file.Path)44 Matchers.containsString (org.hamcrest.Matchers.containsString)38 Environment (org.opensearch.env.Environment)29 Matchers.hasToString (org.hamcrest.Matchers.hasToString)25 TestEnvironment (org.opensearch.env.TestEnvironment)25 IOException (java.io.IOException)16 Settings (org.opensearch.common.settings.Settings)16 ArrayList (java.util.ArrayList)12 BufferedReader (java.io.BufferedReader)11 Files (java.nio.file.Files)11 MockTerminal (org.opensearch.cli.MockTerminal)11 OpenSearchTestCase (org.opensearch.test.OpenSearchTestCase)11 InputStream (java.io.InputStream)10 List (java.util.List)10 Collectors (java.util.stream.Collectors)10 Terminal (org.opensearch.cli.Terminal)10 Tuple (org.opensearch.common.collect.Tuple)10 StringReader (java.io.StringReader)9 URL (java.net.URL)9