11// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22// SPDX-License-Identifier: Apache-2.0
33
4- import aws.sdk.kotlin.runtime.auth.credentials.EnvironmentCredentialsProvider
54import aws.sdk.kotlin.services.secretsmanager.SecretsManagerClient
65import aws.sdk.kotlin.services.secretsmanager.model.GetSecretValueRequest
76import com.google.gson.Gson
@@ -16,21 +15,18 @@ import org.junit.jupiter.api.Order
1615import org.junit.jupiter.api.Test
1716import org.junit.jupiter.api.TestInstance
1817import org.junit.jupiter.api.TestMethodOrder
18+ import org.slf4j.Logger
19+ import org.slf4j.LoggerFactory
1920
2021@TestInstance(TestInstance .Lifecycle .PER_CLASS )
2122@TestMethodOrder(OrderAnnotation ::class )
2223class SESTest {
24+ private val logger: Logger = LoggerFactory .getLogger(SESTest ::class .java)
2325 private var sender = " "
2426 private var recipient = " "
2527 private var subject = " "
2628 private var fileLocation = " "
2729
28- private val bodyText =
29- """
30- Hello,
31- Please see the attached file for a list of customers to contact.
32- """ .trimIndent()
33-
3430 private val bodyHTML = """
3531 <html>
3632 <head></head>
@@ -52,34 +48,22 @@ class SESTest {
5248 recipient = values.recipient.toString()
5349 subject = values.subject.toString()
5450 fileLocation = values.fileLocation.toString()
55-
56- // Uncomment this code block if you prefer using a config.properties file to retrieve AWS values required for these tests.
57-
58- /*
59- val input: InputStream = this.javaClass.getClassLoader().getResourceAsStream("config.properties")
60- val prop = Properties()
61- prop.load(input)
62- sender = prop.getProperty("sender")
63- recipient = prop.getProperty("recipient")
64- subject = prop.getProperty("subject")
65- fileLocation = prop.getProperty("fileLocation")
66- */
6751 }
6852
6953 @Test
7054 @Order(1 )
7155 fun sendMessageTest () =
7256 runBlocking {
7357 send(sender, recipient, subject, bodyHTML)
74- println (" Test 1 passed" )
58+ logger.info (" Test 1 passed" )
7559 }
7660
7761 @Test
7862 @Order(2 )
7963 fun listIdentitiesTest () =
8064 runBlocking {
8165 listSESIdentities()
82- println (" Test 3 passed" )
66+ logger.info (" Test 2 passed" )
8367 }
8468
8569 private suspend fun getSecretValues (): String {
@@ -90,7 +74,6 @@ class SESTest {
9074 }
9175 SecretsManagerClient {
9276 region = " us-east-1"
93- credentialsProvider = EnvironmentCredentialsProvider ()
9477 }.use { secretClient ->
9578 val valueResponse = secretClient.getSecretValue(valueRequest)
9679 return valueResponse.secretString.toString()
0 commit comments