-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorporated review comments for issue #1744.
Signed-off-by: mallikagogoi7 <[email protected]>
- Loading branch information
1 parent
3d3cca6
commit f575689
Showing
15 changed files
with
211 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ava/org/opensearch/dataprepper/plugins/certificate/s3/CertificateProviderFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.plugins.certificate.s3; | ||
|
||
import org.hamcrest.core.IsInstanceOf; | ||
import org.junit.jupiter.api.Test; | ||
import org.opensearch.dataprepper.plugins.certificate.CertificateProvider; | ||
import org.opensearch.dataprepper.plugins.certificate.acm.ACMCertificateProvider; | ||
import org.opensearch.dataprepper.plugins.certificate.file.FileCertificateProvider; | ||
import software.amazon.awssdk.regions.Region; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
class CertificateProviderFactoryTest { | ||
private final String TEST_SSL_CERTIFICATE_FILE = getClass().getClassLoader().getResource("test_cert.crt").getFile(); | ||
private final String TEST_SSL_KEY_FILE = getClass().getClassLoader().getResource("test_decrypted_key.key").getFile(); | ||
|
||
private CertificateProviderFactory certificateProviderFactory; | ||
|
||
@Test | ||
void getCertificateProviderFileCertificateProviderSuccess() { | ||
certificateProviderFactory = new CertificateProviderFactory(false, Region.of("us-east-1"), | ||
"arn:aws:acm:us-east-1:account:certificate/1234-567-856456", 5L, "test", false, TEST_SSL_CERTIFICATE_FILE, TEST_SSL_KEY_FILE); | ||
|
||
final CertificateProvider certificateProvider = certificateProviderFactory.getCertificateProvider(); | ||
|
||
assertThat(certificateProvider, IsInstanceOf.instanceOf(FileCertificateProvider.class)); | ||
} | ||
|
||
@Test | ||
void getCertificateProviderS3ProviderSuccess() { | ||
|
||
certificateProviderFactory = new CertificateProviderFactory(false, Region.of("us-east-1"), | ||
"arn:aws:acm:us-east-1:account:certificate/1234-567-856456", 5L, "test", true, TEST_SSL_CERTIFICATE_FILE, TEST_SSL_KEY_FILE); | ||
|
||
final CertificateProvider certificateProvider = certificateProviderFactory.getCertificateProvider(); | ||
|
||
assertThat(certificateProvider, IsInstanceOf.instanceOf(S3CertificateProvider.class)); | ||
} | ||
|
||
@Test | ||
void getCertificateProviderAcmProviderSuccess() { | ||
certificateProviderFactory = new CertificateProviderFactory(true, Region.of("us-east-1"), | ||
"arn:aws:acm:us-east-1:account:certificate/1234-567-856456", 5L, "test", false, TEST_SSL_CERTIFICATE_FILE, TEST_SSL_KEY_FILE); | ||
final CertificateProvider certificateProvider = certificateProviderFactory.getCertificateProvider(); | ||
|
||
assertThat(certificateProvider, IsInstanceOf.instanceOf(ACMCertificateProvider.class)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.