-
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.
Fixed checkstyle errors, add new test file
Signed-off-by: Kondaka <[email protected]>
- Loading branch information
Showing
12 changed files
with
45 additions
and
49 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
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
41 changes: 41 additions & 0 deletions
41
.../java/org/opensearch/dataprepper/plugins/lambda/common/config/LambdaCommonConfigTest.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,41 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.plugins.lambda.common.config; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import org.junit.jupiter.api.Test; | ||
import software.amazon.awssdk.regions.Region; | ||
public class LambdaCommonConfigTest { | ||
private final ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory().enable(YAMLGenerator.Feature.USE_PLATFORM_LINE_BREAKS)); | ||
|
||
@Test | ||
void test_defaults() { | ||
final LambdaCommonConfig lambdaCommonConfig = new LambdaCommonConfig(); | ||
assertThat(lambdaCommonConfig.getFunctionName(), equalTo(null)); | ||
assertThat(lambdaCommonConfig.getAwsAuthenticationOptions(), equalTo(null)); | ||
assertThat(lambdaCommonConfig.getBatchOptions(), equalTo(null)); | ||
assertThat(lambdaCommonConfig.getResponseCodecConfig(), equalTo(null)); | ||
assertThat(lambdaCommonConfig.getConnectionTimeout(), equalTo(LambdaCommonConfig.DEFAULT_CONNECTION_TIMEOUT)); | ||
assertThat(lambdaCommonConfig.getMaxConnectionRetries(), equalTo(LambdaCommonConfig.DEFAULT_CONNECTION_RETRIES)); | ||
assertThat(lambdaCommonConfig.getInvocationType(), equalTo(InvocationType.REQUEST_RESPONSE)); | ||
} | ||
|
||
@Test | ||
public void testAwsAuthenticationOptionsNotNull() throws JsonProcessingException { | ||
final String config = " function_name: test_function\n" + " aws:\n" + " region: ap-south-1\n" + " sts_role_arn: arn:aws:iam::524239988912:role/app-test\n" + " sts_header_overrides: {\"test\":\"test\"}\n" + " max_retries: 10\n"; | ||
final LambdaCommonConfig lambdaCommonConfig = objectMapper.readValue(config, LambdaCommonConfig.class); | ||
|
||
assertThat(lambdaCommonConfig.getMaxConnectionRetries(), equalTo(10)); | ||
assertThat(lambdaCommonConfig.getAwsAuthenticationOptions().getAwsRegion(), equalTo(Region.AP_SOUTH_1)); | ||
assertThat(lambdaCommonConfig.getAwsAuthenticationOptions().getAwsStsRoleArn(), equalTo("arn:aws:iam::524239988912:role/app-test")); | ||
assertThat(lambdaCommonConfig.getAwsAuthenticationOptions().getAwsStsHeaderOverrides().get("test"), equalTo("test")); | ||
} | ||
} |
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