Skip to content

Commit b3f94a5

Browse files
committed
adding sns preservePath test
1 parent bb88aba commit b3f94a5

File tree

4 files changed

+107
-0
lines changed

4 files changed

+107
-0
lines changed

cmake/sdksCommon.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ list(APPEND SDK_TEST_PROJECT_LIST "s3:tests/aws-cpp-sdk-s3-unit-tests")
105105
list(APPEND SDK_TEST_PROJECT_LIST "s3-crt:tests/aws-cpp-sdk-s3-crt-integration-tests")
106106
list(APPEND SDK_TEST_PROJECT_LIST "s3-encryption:tests/aws-cpp-sdk-s3-encryption-tests,tests/aws-cpp-sdk-s3-encryption-integration-tests")
107107
list(APPEND SDK_TEST_PROJECT_LIST "s3control:tests/aws-cpp-sdk-s3control-integration-tests")
108+
list(APPEND SDK_TEST_PROJECT_LIST "sns:tests/aws-cpp-sdk-sns-integration-tests")
108109
list(APPEND SDK_TEST_PROJECT_LIST "sqs:tests/aws-cpp-sdk-sqs-integration-tests")
109110
list(APPEND SDK_TEST_PROJECT_LIST "sqs:tests/aws-cpp-sdk-sqs-unit-tests")
110111
list(APPEND SDK_TEST_PROJECT_LIST "transfer:tests/aws-cpp-sdk-transfer-tests")
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
add_project(aws-cpp-sdk-sns-integration-tests
2+
"Tests for the AWS SNS C++ SDK"
3+
aws-cpp-sdk-sns
4+
testing-resources
5+
aws-cpp-sdk-core)
6+
7+
file(GLOB AWS_SNS_SRC
8+
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
9+
)
10+
11+
file(GLOB AWS_SNS_INTEGRATION_TESTS_SRC
12+
${AWS_SNS_SRC}
13+
)
14+
15+
if(MSVC AND BUILD_SHARED_LIBS)
16+
add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)
17+
endif()
18+
19+
enable_testing()
20+
21+
if(PLATFORM_ANDROID AND BUILD_SHARED_LIBS)
22+
add_library(${PROJECT_NAME} ${AWS_SNS_INTEGRATION_TESTS_SRC})
23+
else()
24+
add_executable(${PROJECT_NAME} ${AWS_SNS_INTEGRATION_TESTS_SRC})
25+
endif()
26+
27+
set_compiler_flags(${PROJECT_NAME})
28+
set_compiler_warnings(${PROJECT_NAME})
29+
30+
target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBS})
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#include <gtest/gtest.h>
2+
#include <aws/testing/AwsTestHelpers.h>
3+
#include <aws/core/client/ClientConfiguration.h>
4+
#include <aws/core/Aws.h>
5+
#include <aws/core/utils/UUID.h>
6+
7+
#include <aws/sns/SNSClient.h>
8+
#include <aws/sns/model/ListTopicsRequest.h>
9+
#include <aws/sns/model/CreateTopicRequest.h>
10+
#include <aws/sns/model/DeleteTopicRequest.h>
11+
12+
using namespace Aws;
13+
using namespace Aws::SNS;
14+
using namespace Aws::SNS::Model;
15+
16+
namespace
17+
{
18+
static const char ALLOCATION_TAG[] = "PreservePathSeparatorsTest";
19+
20+
class PreservePathSeparatorsTest : public ::testing::Test
21+
{
22+
protected:
23+
void SetUp() override
24+
{
25+
options.httpOptions.preservePathSeparators = true;
26+
Aws::InitAPI(options);
27+
snsClient = Aws::MakeShared<SNSClient>(ALLOCATION_TAG);
28+
}
29+
30+
void TearDown() override
31+
{
32+
snsClient = nullptr;
33+
Aws::ShutdownAPI(options);
34+
}
35+
36+
std::shared_ptr<SNSClient> snsClient;
37+
Aws::SDKOptions options;
38+
};
39+
40+
TEST_F(PreservePathSeparatorsTest, TestSNSListTopicsWithPreservePathSeparators)
41+
{
42+
ListTopicsRequest request;
43+
auto outcome = snsClient->ListTopics(request);
44+
ASSERT_TRUE(outcome.IsSuccess());
45+
46+
}
47+
48+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// Created by Pulim, Snigdha on 7/31/25.
3+
//
4+
#include <gtest/gtest.h>
5+
#include <aws/core/Aws.h>
6+
#include <aws/testing/platform/PlatformTesting.h>
7+
#include <aws/testing/TestingEnvironment.h>
8+
#include <aws/testing/MemoryTesting.h>
9+
10+
int main(int argc, char** argv)
11+
{
12+
Aws::Testing::SetDefaultSigPipeHandler();
13+
Aws::SDKOptions options;
14+
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
15+
AWS_BEGIN_MEMORY_TEST_EX(options, 1024, 128);
16+
17+
Aws::Testing::InitPlatformTest(options);
18+
Aws::Testing::ParseArgs(argc, argv);
19+
20+
Aws::InitAPI(options);
21+
::testing::InitGoogleTest(&argc, argv);
22+
int exitCode = RUN_ALL_TESTS();
23+
24+
Aws::ShutdownAPI(options);
25+
AWS_END_MEMORY_TEST_EX;
26+
Aws::Testing::ShutdownPlatformTest(options);
27+
return exitCode;
28+
}

0 commit comments

Comments
 (0)