avs-device-sdk/CapabilityAgents/Settings/test/SettingsTest.cpp

455 lines
18 KiB
C++
Raw Normal View History

Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
/*
Version 1.4.0 alexa-client-sdk Changes in this update: **Enhancements** * Added the Notifications Capability Agent. This allows a client to receive notification indicators from Alexa. * Added support for the `SoftwareInfo` event. This code is triggered in the `SampleApp` by providing a positive decimal integer as the "firmwareVersion" value in "sampleApp" object of the `AlexaClientSDKConfig.json`. The reported firmware version can be updated after starting the `SampleApp` by calling `SoftwareInfoSender::setFirmwareVersion()`. This code path can be exercised in the `SampleApp` with the new command: `f`. * Added unit tests for Alerts. * The GStreamer-based pipeline allows for the configuration of `MediaPlayer` output based on information provided in `Config`. * Playlist streaming now uses a `BLOCKING` writer, which improves streaming efficiency. **Bug Fixes** * Fixed bug where `SpeechSynthesizer` would not stop playback when a state change timeout was encountered. * Fixed the `SampleApplication` destructor to avoid segfaults if the object is not constructed correctly. * Fixed bug where `AudioPlayer` would erroneously call `executeStop()` in `cancelDirective()`. * [Issue 396](https://github.com/alexa/avs-device-sdk/issues/396) - Fixed bug for compilation error with GCC7 in `AVSCommon/SDKInterfaces/include/AVSCommon/SDKInterfaces/Audio/AlertsAudioFactoryInterface.h` * [Issue 384](https://github.com/alexa/avs-device-sdk/issues/384) - Fixed bug that caused `AuthServer.py` to crash. * Fixed bug where a long delay was encountered after pausing and resuming a large Audible chapter. * Fixed bug that caused named timers and reminders to loop for an additional `loopCount` . * Fixed memory corruption bug in `MessageInterpreter`. * Fixed illegal memory accesses in `MediaPlayer` logging. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * Display Cards for Kindle don't render. * If using the GStreamer-based `MediaPlayer` implementation, after muting and un-muting an audio item, the next item in the queue will begin playing rather than continuing playback of the originally muted audio item. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio.
2018-01-12 23:45:42 +00:00
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/// @file SettingsTest.cpp
#include <memory>
#include <sstream>
#include <iterator>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include <rapidjson/stringbuffer.h>
#include <AVSCommon/AVS/Initialization/AlexaClientSDKInit.h>
#include <AVSCommon/SDKInterfaces/GlobalSettingsObserverInterface.h>
#include <AVSCommon/SDKInterfaces/MockMessageSender.h>
#include <AVSCommon/SDKInterfaces/SingleSettingObserverInterface.h>
#include <AVSCommon/Utils/JSON/JSONUtils.h>
#include "Settings/Settings.h"
#include "Settings/SettingsUpdatedEventSender.h"
#include "Settings/SQLiteSettingStorage.h"
namespace alexaClientSDK {
namespace capabilityAgents {
namespace settings {
namespace test {
using namespace avsCommon::avs::initialization;
using namespace avsCommon::sdkInterfaces;
using namespace avsCommon::sdkInterfaces::test;
using namespace avsCommon::utils::configuration;
using namespace avsCommon::utils::json::jsonUtils;
using namespace ::testing;
/// JSON key for the event section of a message.
static const std::string MESSAGE_EVENT_KEY = "event";
/// JSON key for the header section of a message.
static const std::string MESSAGE_HEADER_KEY = "header";
/// JSON key for the namespace field of a message header.
static const std::string MESSAGE_NAMESPACE_KEY = "namespace";
/// JSON key for the name field of a message header.
static const std::string MESSAGE_NAME_KEY = "name";
/// JSON key for the message ID field of a message header.
static const std::string MESSAGE_ID_KEY = "messageId";
/// JSON key for the payload section of an message.
static const std::string MESSAGE_PAYLOAD_KEY = "payload";
/// JSON key for the settings array filed of the message.
static const std::string MESSAGE_SETTINGS_KEY = "settings";
/// The namespace for this event.
static const std::string SETTINGS_NAMESPACE = "Settings";
/// JSON value for a SettingsUpdated event's name.
static const std::string SETTINGS_UPDATED_EVENT_NAME = "SettingsUpdated";
/// JSON value for the settings array's key.
static const std::string SETTINGS_KEY = "key";
/// JSON value for the settings array's value.
static const std::string SETTINGS_VALUE = "value";
/// JSON text for settings config values for initialization of settings Object.
// clang-format off
static const std::string SETTINGS_CONFIG_JSON =
"{"
"\"settings\":{"
"\"databaseFilePath\":\"settingsUnitTest.db\","
"\"defaultAVSClientSettings\":{"
"\"locale\":\"en-GB\""
"}"
"}"
"}";
// clang-format on
Verison 1.6 of the avs-device-sdk Changes in this update: **Enhancements** * `rapidJson` is now included with "make install". * Updated the `TemplateRuntimeObserverInterface` to support clearing of `displayCards`. * Added Windows SDK support, along with an installation script (MinGW-w64). * Updated `ContextManager` to ignore context reported by a state provider. * The `SharedDataStream` object is now associated by playlist, rather than by URL. * Added the `RegistrationManager` component. Now, when a user logs out all persistent user-specific data is cleared from the SDK. The log out functionality can be exercised in the sample app with the new command: `k`. **Bug Fixes** * [Issue 400](https://github.com/alexa/avs-device-sdk/issues/400) Fixed a bug where the alert reminder did not iterate as intended after loss of network connection. * [Issue 477](https://github.com/alexa/avs-device-sdk/issues/477) Fixed a bug in which Alexa's weather response was being truncated. * Fixed an issue in which there were reports of instability related to the Sensory engine. To correct this, the `portAudio` [`suggestedLatency`](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L62) value can now be configured. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio. * The Windows sample app sometimes hangs on exit. * GDP receives a `SIGPIPE` when troubleshooting the Windows sample app.
2018-03-09 00:55:39 +00:00
/**
* Utility function to determine if the storage component is opened.
*
* @param storage The storage component to check.
* @return True if the storage component's underlying database is opened, false otherwise.
*/
static bool isOpen(const std::shared_ptr<SettingsStorageInterface>& storage) {
std::unordered_map<std::string, std::string> dummyMapOfSettings;
return storage->load(&dummyMapOfSettings);
}
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
/**
* This class allows us to test SingleSettingObserver interaction.
*/
class MockSingleSettingObserver : public SingleSettingObserverInterface {
public:
MockSingleSettingObserver() {
}
MOCK_METHOD2(onSettingChanged, void(const std::string& key, const std::string& value));
};
/**
* This class allows us to test GlobalSettingsObserver interaction.
*/
class MockGlobalSettingsObserver : public GlobalSettingsObserverInterface {
public:
MockGlobalSettingsObserver() {
}
MOCK_METHOD1(onSettingChanged, void(const std::unordered_map<std::string, std::string>& mapOfSettings));
};
/**
* Utility class to take the parameters of SettingsUpdated event and provide functionalities
* to verify the event being sent.
*/
class SettingsVerifyTest {
public:
/**
* Constructs an object which captures <key, value> pair of settings in the map.
*/
SettingsVerifyTest(std::unordered_map<std::string, std::string> mapOfSettings);
/**
* This function verifies that the JSON content of SettingsUpdated event @c MessageRequest is correct.
* This function signature matches that of @c MessageSenderInterface::sendMessage() so that an
* @c ON_CALL() can @c Invoke() this function directly.
*
* @param request The @c MessageRequest to verify.
*/
void verifyMessage(std::shared_ptr<avsCommon::avs::MessageRequest> request);
private:
/// The map of settings which holds the <key, value> pair of settings sent to AVS.
std::unordered_map<std::string, std::string> m_mapOfSettings;
};
SettingsVerifyTest::SettingsVerifyTest(std::unordered_map<std::string, std::string> mapOfSettings) :
m_mapOfSettings{mapOfSettings} {
}
void SettingsVerifyTest::verifyMessage(std::shared_ptr<avsCommon::avs::MessageRequest> request) {
rapidjson::Document document;
document.Parse(request->getJsonContent().c_str());
EXPECT_FALSE(document.HasParseError())
<< "rapidjson detected a parsing error at offset:" << std::to_string(document.GetErrorOffset())
<< ", error message: " << GetParseError_En(document.GetParseError());
auto event = document.FindMember(MESSAGE_EVENT_KEY);
ASSERT_NE(event, document.MemberEnd());
auto header = event->value.FindMember(MESSAGE_HEADER_KEY);
ASSERT_NE(header, event->value.MemberEnd());
auto payload = event->value.FindMember(MESSAGE_PAYLOAD_KEY);
ASSERT_NE(payload, event->value.MemberEnd());
auto settings = payload->value.FindMember(MESSAGE_SETTINGS_KEY);
ASSERT_NE(settings, payload->value.MemberEnd());
std::string temp_string = "";
ASSERT_TRUE(retrieveValue(header->value, MESSAGE_NAMESPACE_KEY, &temp_string));
EXPECT_EQ(temp_string, SETTINGS_NAMESPACE);
ASSERT_TRUE(retrieveValue(header->value, MESSAGE_NAME_KEY, &temp_string));
EXPECT_EQ(temp_string, SETTINGS_UPDATED_EVENT_NAME);
ASSERT_TRUE(retrieveValue(header->value, MESSAGE_ID_KEY, &temp_string));
ASSERT_NE(temp_string, "");
ASSERT_TRUE(jsonArrayExists(payload->value, MESSAGE_SETTINGS_KEY));
rapidjson::Value& array = settings->value;
ASSERT_TRUE(array.Size() == m_mapOfSettings.size());
rapidjson::SizeType i;
std::unordered_map<std::string, std::string>::const_iterator j;
for (i = array.Size() - 1, j = m_mapOfSettings.begin(); j != m_mapOfSettings.end(); i--, j++) {
auto key = array[i].FindMember(SETTINGS_KEY);
ASSERT_NE(key, array[i].MemberEnd());
auto value = array[i].FindMember(SETTINGS_VALUE);
ASSERT_NE(value, array[i].MemberEnd());
ASSERT_TRUE(retrieveValue(array[i], SETTINGS_KEY, &temp_string));
EXPECT_EQ(temp_string, j->first);
ASSERT_TRUE(retrieveValue(array[i], SETTINGS_VALUE, &temp_string));
EXPECT_EQ(temp_string, j->second);
}
}
/// Test harness for @c Settings class.
class SettingsTest : public ::testing::Test {
public:
void SetUp() override;
void TearDown() override;
protected:
/**
* Function to send a SettingsUpdated event and verify that it succeeds. Parameters are passed through
* @c SettingsVerifyTest::SettingsVerifyTest().
*
* @param key The name of the setting to change.
* @param value The value of the setting to which it has to be set.
* @return @c true if the SettingsUpdated event was sent correctly, else @c false.
*/
bool testChangeSettingSucceeds(const std::string& key, const std::string& value);
/// The mock @c MessageSenderInterface.
std::shared_ptr<MockMessageSender> m_mockMessageSender;
/// Global Observer for all the settings which sends the event.
std::shared_ptr<SettingsUpdatedEventSender> m_settingsEventSender;
/// Settings Storage object.
std::shared_ptr<SQLiteSettingStorage> m_storage;
/// The @c Settings Object to test.
std::shared_ptr<Settings> m_settingsObject;
/// The object which verifies the json of message sent.
std::shared_ptr<SettingsVerifyTest> m_settingsVerifyObject;
/// The map which stores all the settings for the object.
std::unordered_map<std::string, std::string> m_mapOfSettings;
Verison 1.6 of the avs-device-sdk Changes in this update: **Enhancements** * `rapidJson` is now included with "make install". * Updated the `TemplateRuntimeObserverInterface` to support clearing of `displayCards`. * Added Windows SDK support, along with an installation script (MinGW-w64). * Updated `ContextManager` to ignore context reported by a state provider. * The `SharedDataStream` object is now associated by playlist, rather than by URL. * Added the `RegistrationManager` component. Now, when a user logs out all persistent user-specific data is cleared from the SDK. The log out functionality can be exercised in the sample app with the new command: `k`. **Bug Fixes** * [Issue 400](https://github.com/alexa/avs-device-sdk/issues/400) Fixed a bug where the alert reminder did not iterate as intended after loss of network connection. * [Issue 477](https://github.com/alexa/avs-device-sdk/issues/477) Fixed a bug in which Alexa's weather response was being truncated. * Fixed an issue in which there were reports of instability related to the Sensory engine. To correct this, the `portAudio` [`suggestedLatency`](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L62) value can now be configured. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio. * The Windows sample app sometimes hangs on exit. * GDP receives a `SIGPIPE` when troubleshooting the Windows sample app.
2018-03-09 00:55:39 +00:00
/// The data manager required to build the base object
std::shared_ptr<registrationManager::CustomerDataManager> m_dataManager;
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
};
void SettingsTest::SetUp() {
Verison 1.6 of the avs-device-sdk Changes in this update: **Enhancements** * `rapidJson` is now included with "make install". * Updated the `TemplateRuntimeObserverInterface` to support clearing of `displayCards`. * Added Windows SDK support, along with an installation script (MinGW-w64). * Updated `ContextManager` to ignore context reported by a state provider. * The `SharedDataStream` object is now associated by playlist, rather than by URL. * Added the `RegistrationManager` component. Now, when a user logs out all persistent user-specific data is cleared from the SDK. The log out functionality can be exercised in the sample app with the new command: `k`. **Bug Fixes** * [Issue 400](https://github.com/alexa/avs-device-sdk/issues/400) Fixed a bug where the alert reminder did not iterate as intended after loss of network connection. * [Issue 477](https://github.com/alexa/avs-device-sdk/issues/477) Fixed a bug in which Alexa's weather response was being truncated. * Fixed an issue in which there were reports of instability related to the Sensory engine. To correct this, the `portAudio` [`suggestedLatency`](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L62) value can now be configured. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio. * The Windows sample app sometimes hangs on exit. * GDP receives a `SIGPIPE` when troubleshooting the Windows sample app.
2018-03-09 00:55:39 +00:00
m_dataManager = std::make_shared<registrationManager::CustomerDataManager>();
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
std::istringstream inString(SETTINGS_CONFIG_JSON);
ASSERT_TRUE(AlexaClientSDKInit::initialize({&inString}));
m_mockMessageSender = std::make_shared<MockMessageSender>();
m_settingsEventSender = SettingsUpdatedEventSender::create(m_mockMessageSender);
ASSERT_NE(m_settingsEventSender, nullptr);
Verison 1.6 of the avs-device-sdk Changes in this update: **Enhancements** * `rapidJson` is now included with "make install". * Updated the `TemplateRuntimeObserverInterface` to support clearing of `displayCards`. * Added Windows SDK support, along with an installation script (MinGW-w64). * Updated `ContextManager` to ignore context reported by a state provider. * The `SharedDataStream` object is now associated by playlist, rather than by URL. * Added the `RegistrationManager` component. Now, when a user logs out all persistent user-specific data is cleared from the SDK. The log out functionality can be exercised in the sample app with the new command: `k`. **Bug Fixes** * [Issue 400](https://github.com/alexa/avs-device-sdk/issues/400) Fixed a bug where the alert reminder did not iterate as intended after loss of network connection. * [Issue 477](https://github.com/alexa/avs-device-sdk/issues/477) Fixed a bug in which Alexa's weather response was being truncated. * Fixed an issue in which there were reports of instability related to the Sensory engine. To correct this, the `portAudio` [`suggestedLatency`](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L62) value can now be configured. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio. * The Windows sample app sometimes hangs on exit. * GDP receives a `SIGPIPE` when troubleshooting the Windows sample app.
2018-03-09 00:55:39 +00:00
m_storage = std::make_shared<SQLiteSettingStorage>("settingsUnitTest.db");
m_settingsObject = Settings::create(m_storage, {m_settingsEventSender}, m_dataManager);
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
ASSERT_NE(m_settingsObject, nullptr);
ASSERT_TRUE(m_storage->load(&m_mapOfSettings));
}
void SettingsTest::TearDown() {
m_mapOfSettings.clear();
m_storage->clearDatabase();
AlexaClientSDKInit::uninitialize();
}
bool SettingsTest::testChangeSettingSucceeds(const std::string& key, const std::string& value) {
std::mutex mutex;
std::condition_variable conditionVariable;
bool done = false;
ON_CALL(*m_mockMessageSender, sendMessage(_))
.WillByDefault(DoAll(
Invoke([this, key, value](std::shared_ptr<avsCommon::avs::MessageRequest> request) {
m_mapOfSettings[key] = value;
m_settingsVerifyObject = std::make_shared<SettingsVerifyTest>(m_mapOfSettings);
m_settingsVerifyObject->verifyMessage(request);
}),
InvokeWithoutArgs([&] {
std::lock_guard<std::mutex> lock(mutex);
done = true;
conditionVariable.notify_one();
})));
m_settingsObject->changeSetting(key, value);
std::unique_lock<std::mutex> lock(mutex);
return conditionVariable.wait_for(lock, std::chrono::seconds(1), [&done] { return done; });
}
/**
* Test to verify the @c create function of @c Settings class.
*/
TEST_F(SettingsTest, createTest) {
ASSERT_EQ(
nullptr,
Verison 1.6 of the avs-device-sdk Changes in this update: **Enhancements** * `rapidJson` is now included with "make install". * Updated the `TemplateRuntimeObserverInterface` to support clearing of `displayCards`. * Added Windows SDK support, along with an installation script (MinGW-w64). * Updated `ContextManager` to ignore context reported by a state provider. * The `SharedDataStream` object is now associated by playlist, rather than by URL. * Added the `RegistrationManager` component. Now, when a user logs out all persistent user-specific data is cleared from the SDK. The log out functionality can be exercised in the sample app with the new command: `k`. **Bug Fixes** * [Issue 400](https://github.com/alexa/avs-device-sdk/issues/400) Fixed a bug where the alert reminder did not iterate as intended after loss of network connection. * [Issue 477](https://github.com/alexa/avs-device-sdk/issues/477) Fixed a bug in which Alexa's weather response was being truncated. * Fixed an issue in which there were reports of instability related to the Sensory engine. To correct this, the `portAudio` [`suggestedLatency`](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L62) value can now be configured. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio. * The Windows sample app sometimes hangs on exit. * GDP receives a `SIGPIPE` when troubleshooting the Windows sample app.
2018-03-09 00:55:39 +00:00
m_settingsObject->create(
m_storage, std::unordered_set<std::shared_ptr<GlobalSettingsObserverInterface>>(), m_dataManager));
ASSERT_EQ(nullptr, m_settingsObject->create(nullptr, {m_settingsEventSender}, m_dataManager));
ASSERT_EQ(nullptr, m_settingsObject->create(m_storage, {nullptr}, m_dataManager));
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
}
/**
* Test to verify if by adding a global observer and changing the setting,
* the global observer is notified of the change. It also verifies that event is being sent in correct JSON format.
*/
TEST_F(SettingsTest, addGlobalSettingsObserverTest) {
std::shared_ptr<MockGlobalSettingsObserver> mockGlobalSettingObserver;
mockGlobalSettingObserver = std::make_shared<MockGlobalSettingsObserver>();
m_settingsObject->addGlobalSettingsObserver(mockGlobalSettingObserver);
EXPECT_CALL(*mockGlobalSettingObserver, onSettingChanged(_)).Times(1);
ASSERT_TRUE(testChangeSettingSucceeds("locale", "en-US"));
}
/**
* Test to verify if by removing a global observer and changing the setting,
* the global observer is not notified of the change. It also verifies that event is being sent in correct JSON format.
*/
TEST_F(SettingsTest, removeGlobalSettingsObserverTest) {
std::shared_ptr<MockGlobalSettingsObserver> mockGlobalSettingObserver;
mockGlobalSettingObserver = std::make_shared<MockGlobalSettingsObserver>();
m_settingsObject->removeGlobalSettingsObserver(mockGlobalSettingObserver);
EXPECT_CALL(*mockGlobalSettingObserver, onSettingChanged(_)).Times(0);
ASSERT_TRUE(testChangeSettingSucceeds("locale", "en-US"));
}
/**
* Test to verify @c addSingleSettingObserver function. This test verifies if the setting key is invalid
* i.e. it doesn't exist in the list of @c SETTINGS_ACCEPTED_KEYS, the observer corresponding to it
* will not be added.
*/
TEST_F(SettingsTest, addSingleSettingObserverWithInvalidKeyTest) {
std::shared_ptr<MockSingleSettingObserver> wakewordObserver;
wakewordObserver = std::make_shared<MockSingleSettingObserver>();
m_settingsObject->addSingleSettingObserver("wakeword", wakewordObserver);
EXPECT_CALL(*wakewordObserver, onSettingChanged(_, _)).Times(0);
ASSERT_FALSE(testChangeSettingSucceeds("wakeword", "Alexa"));
std::shared_ptr<MockSingleSettingObserver> localeObserver;
localeObserver = std::make_shared<MockSingleSettingObserver>();
m_settingsObject->addSingleSettingObserver("local", localeObserver);
EXPECT_CALL(*localeObserver, onSettingChanged(_, _)).Times(0);
ASSERT_FALSE(testChangeSettingSucceeds("local", "en-US"));
}
/**
* Test to verify the function @c removeSingleSettingObserver. The test checks that if an observer is added for
* an invalid key even if it is a typo, the observer will not be removed.
* It also verifies that event is being sent in correct JSON format.
*/
TEST_F(SettingsTest, removeSingleSettingObserverWithInvalidKeyTest) {
std::shared_ptr<MockSingleSettingObserver> localeObserver;
localeObserver = std::make_shared<MockSingleSettingObserver>();
m_settingsObject->addSingleSettingObserver("locale", localeObserver);
m_settingsObject->removeSingleSettingObserver("local", localeObserver);
EXPECT_CALL(*localeObserver, onSettingChanged(_, _)).Times(1);
ASSERT_TRUE(testChangeSettingSucceeds("locale", "en-US"));
}
/**
* Test verifies that if an observer is removed with a valid key, the observer gets removed
* and is not notified when the setting changes. It also verifies that event is being sent in correct JSON format.
*/
TEST_F(SettingsTest, removeSingleSettingObserverWithCorrectKeyTest) {
std::shared_ptr<MockSingleSettingObserver> localeObserver;
localeObserver = std::make_shared<MockSingleSettingObserver>();
m_settingsObject->addSingleSettingObserver("locale", localeObserver);
m_settingsObject->removeSingleSettingObserver("locale", localeObserver);
EXPECT_CALL(*localeObserver, onSettingChanged(_, _)).Times(0);
ASSERT_TRUE(testChangeSettingSucceeds("locale", "en-US"));
}
/**
* Test to check if the settings loaded from the database are same as the default settings.
*/
TEST_F(SettingsTest, defaultSettingsCorrect) {
std::string DEFAULT_SETTINGS = "defaultAVSClientSettings";
std::string settings_json = "";
retrieveValue(SETTINGS_CONFIG_JSON, MESSAGE_SETTINGS_KEY, &settings_json);
std::string default_settings = "";
retrieveValue(settings_json, DEFAULT_SETTINGS, &default_settings);
rapidjson::Document document;
ASSERT_TRUE(parseJSON(default_settings, &document));
std::string value = "";
for (auto& it : m_mapOfSettings) {
auto key = document.FindMember(it.first);
ASSERT_NE(key, document.MemberEnd());
ASSERT_TRUE(retrieveValue(document, it.first, &value));
EXPECT_EQ(it.second, value);
}
}
Verison 1.6 of the avs-device-sdk Changes in this update: **Enhancements** * `rapidJson` is now included with "make install". * Updated the `TemplateRuntimeObserverInterface` to support clearing of `displayCards`. * Added Windows SDK support, along with an installation script (MinGW-w64). * Updated `ContextManager` to ignore context reported by a state provider. * The `SharedDataStream` object is now associated by playlist, rather than by URL. * Added the `RegistrationManager` component. Now, when a user logs out all persistent user-specific data is cleared from the SDK. The log out functionality can be exercised in the sample app with the new command: `k`. **Bug Fixes** * [Issue 400](https://github.com/alexa/avs-device-sdk/issues/400) Fixed a bug where the alert reminder did not iterate as intended after loss of network connection. * [Issue 477](https://github.com/alexa/avs-device-sdk/issues/477) Fixed a bug in which Alexa's weather response was being truncated. * Fixed an issue in which there were reports of instability related to the Sensory engine. To correct this, the `portAudio` [`suggestedLatency`](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L62) value can now be configured. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio. * The Windows sample app sometimes hangs on exit. * GDP receives a `SIGPIPE` when troubleshooting the Windows sample app.
2018-03-09 00:55:39 +00:00
/**
* Test to check that @c clearData() removes any setting stored in the database.
*/
TEST_F(SettingsTest, clearDataTest) {
ASSERT_TRUE(testChangeSettingSucceeds("locale", "en-CA"));
m_settingsObject->clearData();
std::unordered_map<std::string, std::string> tempMap;
ASSERT_TRUE(m_storage->load(&tempMap));
ASSERT_TRUE(tempMap.empty());
}
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
/**
* Test to check clear database works as expected.
*/
TEST_F(SettingsTest, clearDatabaseTest) {
std::unordered_map<std::string, std::string> tempMap;
ASSERT_TRUE(m_storage->clearDatabase());
ASSERT_TRUE(m_storage->load(&tempMap));
ASSERT_TRUE(tempMap.empty());
}
/**
* Test to check the store function of SQLiteSettingStorage class.
*/
TEST_F(SettingsTest, storeDatabaseTest) {
ASSERT_TRUE(m_storage->clearDatabase());
std::map<std::string, std::string> MapToStore = {{"wakeword", "Alexa"}, {"locale", "en-US"}};
for (auto& it : MapToStore) {
ASSERT_TRUE(m_storage->store(it.first, it.second));
}
std::unordered_map<std::string, std::string> LoadMap;
ASSERT_TRUE(m_storage->load(&LoadMap));
ASSERT_EQ(LoadMap.size(), MapToStore.size());
ASSERT_TRUE(std::equal(MapToStore.rbegin(), MapToStore.rend(), LoadMap.begin()));
}
/**
* Test to check the modify function of SQLiteSettingStorage class.
*/
TEST_F(SettingsTest, modifyDatabaseTest) {
ASSERT_TRUE(m_storage->modify("locale", "en-US"));
ASSERT_FALSE(m_storage->modify("local", "en-GB"));
ASSERT_TRUE(m_storage->clearDatabase());
ASSERT_FALSE(m_storage->settingExists("locale"));
}
/**
* Test to check the erase function of SQLiteSettingStorage class.
*/
TEST_F(SettingsTest, eraseTest) {
ASSERT_TRUE(m_storage->erase("locale"));
ASSERT_FALSE(m_storage->settingExists("locale"));
ASSERT_FALSE(m_storage->erase("local"));
}
/**
* Test to check the createDatabase function of SQLiteSettingStorage class.
*/
TEST_F(SettingsTest, createDatabaseTest) {
m_storage->close();
Verison 1.6 of the avs-device-sdk Changes in this update: **Enhancements** * `rapidJson` is now included with "make install". * Updated the `TemplateRuntimeObserverInterface` to support clearing of `displayCards`. * Added Windows SDK support, along with an installation script (MinGW-w64). * Updated `ContextManager` to ignore context reported by a state provider. * The `SharedDataStream` object is now associated by playlist, rather than by URL. * Added the `RegistrationManager` component. Now, when a user logs out all persistent user-specific data is cleared from the SDK. The log out functionality can be exercised in the sample app with the new command: `k`. **Bug Fixes** * [Issue 400](https://github.com/alexa/avs-device-sdk/issues/400) Fixed a bug where the alert reminder did not iterate as intended after loss of network connection. * [Issue 477](https://github.com/alexa/avs-device-sdk/issues/477) Fixed a bug in which Alexa's weather response was being truncated. * Fixed an issue in which there were reports of instability related to the Sensory engine. To correct this, the `portAudio` [`suggestedLatency`](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L62) value can now be configured. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio. * The Windows sample app sometimes hangs on exit. * GDP receives a `SIGPIPE` when troubleshooting the Windows sample app.
2018-03-09 00:55:39 +00:00
ASSERT_FALSE(m_storage->createDatabase());
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
}
/**
* Test to check the open and close functions of SQLiteSettingStorage class.
*/
TEST_F(SettingsTest, openAndCloseDatabaseTest) {
Verison 1.6 of the avs-device-sdk Changes in this update: **Enhancements** * `rapidJson` is now included with "make install". * Updated the `TemplateRuntimeObserverInterface` to support clearing of `displayCards`. * Added Windows SDK support, along with an installation script (MinGW-w64). * Updated `ContextManager` to ignore context reported by a state provider. * The `SharedDataStream` object is now associated by playlist, rather than by URL. * Added the `RegistrationManager` component. Now, when a user logs out all persistent user-specific data is cleared from the SDK. The log out functionality can be exercised in the sample app with the new command: `k`. **Bug Fixes** * [Issue 400](https://github.com/alexa/avs-device-sdk/issues/400) Fixed a bug where the alert reminder did not iterate as intended after loss of network connection. * [Issue 477](https://github.com/alexa/avs-device-sdk/issues/477) Fixed a bug in which Alexa's weather response was being truncated. * Fixed an issue in which there were reports of instability related to the Sensory engine. To correct this, the `portAudio` [`suggestedLatency`](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L62) value can now be configured. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio. * The Windows sample app sometimes hangs on exit. * GDP receives a `SIGPIPE` when troubleshooting the Windows sample app.
2018-03-09 00:55:39 +00:00
ASSERT_FALSE(m_storage->open());
ASSERT_TRUE(isOpen(m_storage));
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
m_storage->close();
Verison 1.6 of the avs-device-sdk Changes in this update: **Enhancements** * `rapidJson` is now included with "make install". * Updated the `TemplateRuntimeObserverInterface` to support clearing of `displayCards`. * Added Windows SDK support, along with an installation script (MinGW-w64). * Updated `ContextManager` to ignore context reported by a state provider. * The `SharedDataStream` object is now associated by playlist, rather than by URL. * Added the `RegistrationManager` component. Now, when a user logs out all persistent user-specific data is cleared from the SDK. The log out functionality can be exercised in the sample app with the new command: `k`. **Bug Fixes** * [Issue 400](https://github.com/alexa/avs-device-sdk/issues/400) Fixed a bug where the alert reminder did not iterate as intended after loss of network connection. * [Issue 477](https://github.com/alexa/avs-device-sdk/issues/477) Fixed a bug in which Alexa's weather response was being truncated. * Fixed an issue in which there were reports of instability related to the Sensory engine. To correct this, the `portAudio` [`suggestedLatency`](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L62) value can now be configured. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio. * The Windows sample app sometimes hangs on exit. * GDP receives a `SIGPIPE` when troubleshooting the Windows sample app.
2018-03-09 00:55:39 +00:00
ASSERT_TRUE(m_storage->open());
ASSERT_TRUE(isOpen(m_storage));
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
}
} // namespace test
} // namespace settings
} // namespace capabilityAgents
} // namespace alexaClientSDK
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
if (argc < 1) {
v1.3.0 released 12/08/2017: **Enhancements** * ContextManager now passes the namespace/name of the desired state to StateProv iderInterface::provideState(). This is helpful when a single StateProvider obje ct provides multiple states, and needs to know which one ContextManager is askin g for. * The mime parser was hardened against duplicate boundaries. * Added functionality to add and remove AudioPlayer observers to the DefaultClie nt. * Unit tests for Alerts were added. * Added en-IN, en-CA and ja-JP to the SampleApp locale selection menu. * Added default alert and timer audio data to the SDK SampleApp. There is no lo nger a requirement to download these audio files and configure them in the json configuration file. * Added support in SDS Reader and AttachmentReader for seeking into the future. This allows a reader to move to an index which has not yet arrived in the SDS a nd poll/block until it arrives. * Added support for blocking Writers in the SharedDataStream class. * Changed the default status code sent by MessageRequestObserverInterface::onSen dCompleted() to SERVER_OTHER_ERROR, and mapped HTTP code 500 to SERVER_INTERNAL_ ERROR_V2. * Added support for parsing stream duration out of playlists. * Added a configuration option ("sampleApp":"displayCardsSupported") that allows the displaying of display cards to be enabled or disabled. * Named Timers and Reminders have been updated to fall back to the on-device bac kground audio sound when cloud urls cannot be accessed or rendered. **Bug Fixes** * Removed floating point dependencies from core SDK libraries. * Fixed bug in SpeechSynthesizer where it's erroneously calling stop more than once. * Fixed an issue in ContentFetcher where it could hang during destruction until an active GET request completed. * Fixed a couple of parsing bugs in LibCurlHttpContentFetcher related to case-sensitivity and mime-type handling. * Fixed a bug where MediaPlayerObserverInterface::onPlaybackResumed() wasn't being called after resuming from a pause with a pending play/resume. * Fixed a bug in LibCurlContentFetcher where it could error out if data is written to the SDS faster than it is consumed. * The GStreamer-based MediaPlayer reference implementation now uses the ACL HTTP configured client. * An API change has been made to MediaPlayerInterface::setSource(). This method now takes in an optional offset as well to allow for immediately streaming to the offset if possible. * Next and Previous buttons now work with Audible. * Pandora resume stuttering is addressed. * Pausing and resuming Amazon music no longer seeks back to the beginning of the song. * libcurl CURLOPT_NOSIGNAL option is set to 1 (https://curl.haxx.se/libcurl/c/CURLOPT_NOSIGNAL.html) to avoid crashes observed in SampleApp. * Fixed the timing of the PlaybackReportIntervalEvent and PlaybackReportDelayEvent as specified in the directives. * Fixed potential deadlocks in MediaPlayer during shutdown related to queued callbacks. * Fixed a crash in MediaPlayer that could occur if the network is disconnected during playback. * Fixed a bug where music could keep playing while Alexa is speaking. * Fixed a bug which was causing problems with pause/resume and next/previous with Amazon Music. * Fixed a bug where music could briefly start playing between speaks. * Fixed a bug where HLS playlists would stop streaming after the initial playlist had been played to completion. * Fixed a bug where Audible playback could not advance to the next chapter. * Fixed some occurrences of SDK entering the IDLE state during the transition between Listening and Speaking states. * Fixed a bug where PlaybackFinished events were not reporting the correct offset. * An API change has been made to MediaPlayerInterface::getOffset(). This method is now required to return the final offset when called after playback has stopped. * Fixed a problem where AIP was erroneously resetting its state upon getting a cancelDirective() callback. **Known Issues** * Capability agent for Notifications is not included in this release. * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed. * GUI cards don't show for Kindle. * The new SpeechSynthesizerState state values GAINING_FOCUS and LOSING_FOCUS were added as part of a work-around. The will likely be removed in subsequent releases. * With the gstreamer-based MediaPlayer, after muting and unmuting, the next item starts playing rather than continuing with the current item.
2017-12-09 00:07:37 +00:00
std::cerr << "USAGE: " << std::string(argv[0]) << std::endl;
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
return 1;
}
return RUN_ALL_TESTS();
Version 1.4.0 alexa-client-sdk Changes in this update: **Enhancements** * Added the Notifications Capability Agent. This allows a client to receive notification indicators from Alexa. * Added support for the `SoftwareInfo` event. This code is triggered in the `SampleApp` by providing a positive decimal integer as the "firmwareVersion" value in "sampleApp" object of the `AlexaClientSDKConfig.json`. The reported firmware version can be updated after starting the `SampleApp` by calling `SoftwareInfoSender::setFirmwareVersion()`. This code path can be exercised in the `SampleApp` with the new command: `f`. * Added unit tests for Alerts. * The GStreamer-based pipeline allows for the configuration of `MediaPlayer` output based on information provided in `Config`. * Playlist streaming now uses a `BLOCKING` writer, which improves streaming efficiency. **Bug Fixes** * Fixed bug where `SpeechSynthesizer` would not stop playback when a state change timeout was encountered. * Fixed the `SampleApplication` destructor to avoid segfaults if the object is not constructed correctly. * Fixed bug where `AudioPlayer` would erroneously call `executeStop()` in `cancelDirective()`. * [Issue 396](https://github.com/alexa/avs-device-sdk/issues/396) - Fixed bug for compilation error with GCC7 in `AVSCommon/SDKInterfaces/include/AVSCommon/SDKInterfaces/Audio/AlertsAudioFactoryInterface.h` * [Issue 384](https://github.com/alexa/avs-device-sdk/issues/384) - Fixed bug that caused `AuthServer.py` to crash. * Fixed bug where a long delay was encountered after pausing and resuming a large Audible chapter. * Fixed bug that caused named timers and reminders to loop for an additional `loopCount` . * Fixed memory corruption bug in `MessageInterpreter`. * Fixed illegal memory accesses in `MediaPlayer` logging. **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * Display Cards for Kindle don't render. * If using the GStreamer-based `MediaPlayer` implementation, after muting and un-muting an audio item, the next item in the queue will begin playing rather than continuing playback of the originally muted audio item. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio.
2018-01-12 23:45:42 +00:00
}