diff --git a/AVSCommon/Utils/include/AVSCommon/Utils/SDKVersion.h b/AVSCommon/Utils/include/AVSCommon/Utils/SDKVersion.h index a7ef716871..f10aa17f3d 100644 --- a/AVSCommon/Utils/include/AVSCommon/Utils/SDKVersion.h +++ b/AVSCommon/Utils/include/AVSCommon/Utils/SDKVersion.h @@ -29,7 +29,7 @@ namespace utils { namespace sdkVersion { inline static std::string getCurrentVersion() { - return "1.20.0"; + return "1.20.1"; } inline static int getMajorVersion() { @@ -41,7 +41,7 @@ inline static int getMinorVersion() { } inline static int getPatchVersion() { - return 0; + return 1; } } // namespace sdkVersion diff --git a/ApplicationUtilities/SDKComponent/src/SDKComponent.cpp b/ApplicationUtilities/SDKComponent/src/SDKComponent.cpp index 89462a6a08..3cb1e4355d 100644 --- a/ApplicationUtilities/SDKComponent/src/SDKComponent.cpp +++ b/ApplicationUtilities/SDKComponent/src/SDKComponent.cpp @@ -26,7 +26,7 @@ namespace SDKComponent { using namespace avsCommon::utils::logger; // Name of the Component to add to ComponentReporter -static const std::string SDK_COMPONENT_NAME = "com.amazon.sdk"; +static const std::string SDK_COMPONENT_NAME = "com.amazon.alexa.deviceSDK"; /// String to identify log entries originating from this file. static const std::string TAG("SDKComponent"); diff --git a/ApplicationUtilities/SDKComponent/test/SDKComponentTest.cpp b/ApplicationUtilities/SDKComponent/test/SDKComponentTest.cpp index efbf74a7e4..3bedd650fc 100644 --- a/ApplicationUtilities/SDKComponent/test/SDKComponentTest.cpp +++ b/ApplicationUtilities/SDKComponent/test/SDKComponentTest.cpp @@ -33,7 +33,7 @@ using namespace ::testing; using namespace avsCommon::avs; // Name of the SDK Component Added to Component Reporter -static const std::string SDK_COMPONENT_NAME = "com.amazon.sdk"; +static const std::string SDK_COMPONENT_NAME = "com.amazon.alexa.deviceSDK"; /** * Test SDKComponent correctly returns sdk version in SDKVersion.h diff --git a/CHANGELOG.md b/CHANGELOG.md index 7379b23828..19a3de6d8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ ## ChangeLog + +### Version 1.20.1 - August 6 2020 +Feature enhancements, updates, and resolved issues from all releases are available on the [Amazon developer portal](https://developer.amazon.com/docs/alexa/avs-device-sdk/release-notes.html) + ### Version 1.20.0 - June 22 2020 Feature enhancements, updates, and resolved issues from all releases are available on the [Amazon developer portal](https://developer.amazon.com/docs/alexa/avs-device-sdk/release-notes.html) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c0fbbf79b..918363082e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) # Set project information -project(AlexaClientSDK VERSION 1.20.0 LANGUAGES CXX) +project(AlexaClientSDK VERSION 1.20.1 LANGUAGES CXX) set(PROJECT_BRIEF "A cross-platform, modular SDK for interacting with the Alexa Voice Service") # This variable should be used by extension packages to include cmake files from this project. diff --git a/CapabilityAgents/TemplateRuntime/src/TemplateRuntime.cpp b/CapabilityAgents/TemplateRuntime/src/TemplateRuntime.cpp index b4f2e3a48d..2eb555a414 100644 --- a/CapabilityAgents/TemplateRuntime/src/TemplateRuntime.cpp +++ b/CapabilityAgents/TemplateRuntime/src/TemplateRuntime.cpp @@ -286,7 +286,7 @@ void TemplateRuntime::doShutdown() { m_activeRenderPlayerInfoCardsProvider.reset(); m_audioItemsInExecution.clear(); m_audioPlayerInfo.clear(); - for (const auto renderPlayerInfoCardsInterface : m_renderPlayerInfoCardsInterfaces) { + for (const auto& renderPlayerInfoCardsInterface : m_renderPlayerInfoCardsInterfaces) { renderPlayerInfoCardsInterface->setObserver(nullptr); } m_renderPlayerInfoCardsInterfaces.clear(); diff --git a/CertifiedSender/src/CertifiedSender.cpp b/CertifiedSender/src/CertifiedSender.cpp index 553c3160b0..d7055b66e1 100644 --- a/CertifiedSender/src/CertifiedSender.cpp +++ b/CertifiedSender/src/CertifiedSender.cpp @@ -17,10 +17,9 @@ #include #include +#include #include -#include - namespace alexaClientSDK { namespace certifiedSender { @@ -168,23 +167,6 @@ bool CertifiedSender::init() { } } - /// Load stored messages from storage. - std::queue storedMessages; - if (!m_storage->load(&storedMessages)) { - ACSDK_ERROR(LX("initFailed").m("Could not load messages from database file.")); - return false; - } - - while (!storedMessages.empty()) { - auto storedMessage = storedMessages.front(); - { - std::lock_guard lock{m_mutex}; - m_messagesToSend.push_back(std::make_shared( - storedMessage.message, storedMessage.id, storedMessage.uriPathExtension)); - } - storedMessages.pop(); - } - m_workerThread = std::thread(&CertifiedSender::mainloop, this); return true; diff --git a/CertifiedSender/test/CertifiedSenderTest.cpp b/CertifiedSender/test/CertifiedSenderTest.cpp index 26fe6c5eff..5df896c2f3 100644 --- a/CertifiedSender/test/CertifiedSenderTest.cpp +++ b/CertifiedSender/test/CertifiedSenderTest.cpp @@ -14,8 +14,8 @@ */ #include +#include #include -#include #include @@ -85,22 +85,20 @@ class CertifiedSenderTest : public ::testing::Test { (*configuration) << CONFIGURATION; ASSERT_TRUE(avsCommon::avs::initialization::AlexaClientSDKInit::initialize({configuration})); - m_customerDataManager = std::make_shared(); + auto customerDataManager = std::make_shared(); m_mockMessageSender = std::make_shared(); m_connection = std::make_shared(); m_storage = std::make_shared(); EXPECT_CALL(*m_storage, open()).Times(1).WillOnce(Return(true)); - EXPECT_CALL(*m_storage, load(_)).Times(1).WillOnce(Return(true)); - m_certifiedSender = - CertifiedSender::create(m_mockMessageSender, m_connection, m_storage, m_customerDataManager); + m_certifiedSender = CertifiedSender::create(m_mockMessageSender, m_connection, m_storage, customerDataManager); } void TearDown() override { if (avsCommon::avs::initialization::AlexaClientSDKInit::isInitialized()) { avsCommon::avs::initialization::AlexaClientSDKInit::uninitialize(); } - m_certifiedSender->shutdown(); + m_connection->removeConnectionStatusObserver(m_certifiedSender); } /// Class under test. @@ -113,9 +111,6 @@ class CertifiedSenderTest : public ::testing::Test { /// be deleted. std::shared_ptr m_connection; - /// The pointer to the customer data manager - std::shared_ptr m_customerDataManager; - /// The mock message sender instance. std::shared_ptr m_mockMessageSender; }; @@ -128,101 +123,17 @@ TEST_F(CertifiedSenderTest, test_clearData) { m_certifiedSender->clearData(); } -/** - * Tests various failure scenarios for the init method. - */ -TEST_F(CertifiedSenderTest, test_initFailsWhenStorageMethodsFail) { - /// Test if the init method fails when createDatabase on storage fails. - { - EXPECT_CALL(*m_storage, open()).Times(1).WillOnce(Return(false)); - EXPECT_CALL(*m_storage, createDatabase()).Times(1).WillOnce(Return(false)); - EXPECT_CALL(*m_storage, load(_)).Times(0); - auto certifiedSender = - CertifiedSender::create(m_mockMessageSender, m_connection, m_storage, m_customerDataManager); - ASSERT_EQ(certifiedSender, nullptr); - } - - /// Test if the init method fails when load from storage fails. - { - EXPECT_CALL(*m_storage, open()).Times(1).WillOnce(Return(true)); - EXPECT_CALL(*m_storage, load(_)).Times(1).WillOnce(Return(false)); - auto certifiedSender = - CertifiedSender::create(m_mockMessageSender, m_connection, m_storage, m_customerDataManager); - ASSERT_EQ(certifiedSender, nullptr); - } -} - -/** - * Tests if the stored messages get sent when a connection is established. - */ -TEST_F(CertifiedSenderTest, testTimer_storedMessagesGetSent) { - EXPECT_CALL(*m_storage, open()).Times(1).WillOnce(Return(true)); - - /// Return messages from storage. - EXPECT_CALL(*m_storage, load(_)) - .Times(1) - .WillOnce(Invoke([](std::queue* storedMessages) { - storedMessages->push(MessageStorageInterface::StoredMessage(1, "testMessage_1")); - storedMessages->push(MessageStorageInterface::StoredMessage(2, "testMessage_2")); - return true; - })); - - avsCommon::utils::PromiseFuturePair allRequestsSent; - { - InSequence s; - - EXPECT_CALL(*m_mockMessageSender, sendMessage(_)) - .Times(1) - .WillOnce(Invoke([](std::shared_ptr request) { - ASSERT_EQ(request->getJsonContent(), "testMessage_1"); - request->sendCompleted(avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status::SUCCESS); - })); - EXPECT_CALL(*m_storage, erase(1)).WillOnce(Return(true)); - - EXPECT_CALL(*m_mockMessageSender, sendMessage(_)) - .Times(1) - .WillOnce(Invoke([](std::shared_ptr request) { - ASSERT_EQ(request->getJsonContent(), "testMessage_2"); - request->sendCompleted(avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status::SUCCESS); - })); - EXPECT_CALL(*m_storage, erase(2)).WillOnce(Invoke([&allRequestsSent](int messageId) { - allRequestsSent.setValue(true); - return true; - })); - } - - auto certifiedSender = CertifiedSender::create(m_mockMessageSender, m_connection, m_storage, m_customerDataManager); - - std::static_pointer_cast(certifiedSender) - ->onConnectionStatusChanged( - avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status::CONNECTED, - avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::SUCCESS); - - /// wait for requests to get sent out. - EXPECT_TRUE(allRequestsSent.waitFor(TEST_TIMEOUT)); - - /// Cleanup - certifiedSender->shutdown(); -} - /** * Verify that a message with a URI specified will be sent out by the sender with the URI. */ TEST_F(CertifiedSenderTest, testTimer_SendMessageWithURI) { avsCommon::utils::PromiseFuturePair> requestSent; - + EXPECT_CALL(*m_mockMessageSender, sendMessage(_)) + .WillOnce(Invoke([&requestSent](std::shared_ptr request) { + requestSent.setValue(request); + })); EXPECT_CALL(*m_storage, store(_, TEST_URI, _)).WillOnce(Return(true)); - { - InSequence s; - EXPECT_CALL(*m_mockMessageSender, sendMessage(_)) - .WillOnce(Invoke([&requestSent](std::shared_ptr request) { - requestSent.setValue(request); - request->sendCompleted(avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status::SUCCESS); - })); - EXPECT_CALL(*m_storage, erase(_)).WillOnce(Return(true)); - } - std::static_pointer_cast(m_certifiedSender) ->onConnectionStatusChanged( avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status::CONNECTED,