Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/sdksCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ list(APPEND SDK_TEST_PROJECT_LIST "s3:tests/aws-cpp-sdk-s3-unit-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3-crt:tests/aws-cpp-sdk-s3-crt-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3-encryption:tests/aws-cpp-sdk-s3-encryption-tests,tests/aws-cpp-sdk-s3-encryption-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3control:tests/aws-cpp-sdk-s3control-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "sns:tests/aws-cpp-sdk-sns-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "sqs:tests/aws-cpp-sdk-sqs-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "sqs:tests/aws-cpp-sdk-sqs-unit-tests")
list(APPEND SDK_TEST_PROJECT_LIST "transfer:tests/aws-cpp-sdk-transfer-tests")
Expand Down
2 changes: 1 addition & 1 deletion src/aws-cpp-sdk-core/include/aws/core/http/URI.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ namespace Aws
{
m_pathSegments.push_back(segment);
}
m_pathHasTrailingSlash = (!segments.empty() && segments.back() == '/');
m_pathHasTrailingSlash = (m_pathSegments.empty() || !s_preservePathSeparators) && (!segments.empty() && segments.back() == '/');
}

/**
Expand Down
30 changes: 30 additions & 0 deletions tests/aws-cpp-sdk-sns-integration-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
add_project(aws-cpp-sdk-sns-integration-tests
"Tests for the AWS SNS C++ SDK"
aws-cpp-sdk-sns
testing-resources
aws-cpp-sdk-core)

file(GLOB AWS_SNS_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
)

file(GLOB AWS_SNS_INTEGRATION_TESTS_SRC
${AWS_SNS_SRC}
)

if(MSVC AND BUILD_SHARED_LIBS)
add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)
endif()

enable_testing()

if(PLATFORM_ANDROID AND BUILD_SHARED_LIBS)
add_library(${PROJECT_NAME} ${AWS_SNS_INTEGRATION_TESTS_SRC})
else()
add_executable(${PROJECT_NAME} ${AWS_SNS_INTEGRATION_TESTS_SRC})
endif()

set_compiler_flags(${PROJECT_NAME})
set_compiler_warnings(${PROJECT_NAME})

target_link_libraries(${PROJECT_NAME} ${PROJECT_LIBS})
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <gtest/gtest.h>
#include <aws/testing/AwsTestHelpers.h>
#include <aws/core/client/ClientConfiguration.h>
#include <aws/core/Aws.h>
#include <aws/core/utils/UUID.h>

#include <aws/sns/SNSClient.h>
#include <aws/sns/model/ListTopicsRequest.h>
#include <aws/sns/model/CreateTopicRequest.h>
#include <aws/sns/model/DeleteTopicRequest.h>

using namespace Aws;
using namespace Aws::SNS;
using namespace Aws::SNS::Model;

namespace
{
static const char ALLOCATION_TAG[] = "PreservePathSeparatorsTest";

class PreservePathSeparatorsTest : public ::testing::Test
{
protected:
void SetUp() override
{
options.httpOptions.preservePathSeparators = true;
Aws::InitAPI(options);
snsClient = Aws::MakeShared<SNSClient>(ALLOCATION_TAG);
}

void TearDown() override
{
snsClient = nullptr;
Aws::ShutdownAPI(options);
}

std::shared_ptr<SNSClient> snsClient;
Aws::SDKOptions options;
};

TEST_F(PreservePathSeparatorsTest, TestSNSListTopicsWithPreservePathSeparators)
{
ListTopicsRequest request;
auto outcome = snsClient->ListTopics(request);
ASSERT_TRUE(outcome.IsSuccess());

}

}
28 changes: 28 additions & 0 deletions tests/aws-cpp-sdk-sns-integration-tests/RunTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// Created by Pulim, Snigdha on 7/31/25.
//
#include <gtest/gtest.h>
#include <aws/core/Aws.h>
#include <aws/testing/platform/PlatformTesting.h>
#include <aws/testing/TestingEnvironment.h>
#include <aws/testing/MemoryTesting.h>

int main(int argc, char** argv)
{
Aws::Testing::SetDefaultSigPipeHandler();
Aws::SDKOptions options;
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
AWS_BEGIN_MEMORY_TEST_EX(options, 1024, 128);

Aws::Testing::InitPlatformTest(options);
Aws::Testing::ParseArgs(argc, argv);

Aws::InitAPI(options);
::testing::InitGoogleTest(&argc, argv);
int exitCode = RUN_ALL_TESTS();

Aws::ShutdownAPI(options);
AWS_END_MEMORY_TEST_EX;
Aws::Testing::ShutdownPlatformTest(options);
return exitCode;
}
Loading