AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Functions | Variables
alexaClientSDK::certifiedSender::test Namespace Reference

Classes

class  CertifiedSenderTest
 
class  MessageStorageTest
 
class  MockCertifiedSender
 
class  MockConnection
 
class  MockMessageStorage
 

Functions

 TEST_F (CertifiedSenderTest, test_clearData)
 
 TEST_F (CertifiedSenderTest, test_initFailsWhenStorageMethodsFail)
 
 TEST_F (CertifiedSenderTest, testTimer_storedMessagesGetSent)
 
 TEST_F (CertifiedSenderTest, testTimer_SendMessageWithURI)
 
 TEST_F (CertifiedSenderTest, testTimer_retryableResponsesAreRetried)
 
 TEST_F (CertifiedSenderTest, testTimer_nonRetryableResponsesAreNotRetried)
 
static bool isOpen (const std::shared_ptr< MessageStorageInterface > &storage)
 
 TEST_F (MessageStorageTest, test_constructionAndDestruction)
 
 TEST_F (MessageStorageTest, test_databaseCreation)
 
 TEST_F (MessageStorageTest, test_openAndCloseDatabase)
 
 TEST_F (MessageStorageTest, test_databaseStoreAndLoad)
 
 TEST_F (MessageStorageTest, test_databaseErase)
 
 TEST_F (MessageStorageTest, test_databaseClear)
 
 TEST_F (MessageStorageTest, test_DatabaseStoreAndLoadWithURI)
 
 TEST_F (MessageStorageTest, test_LegacyDatabase)
 
 TEST_F (MessageStorageTest, test_EraseMessageOverAgeAndSizeLimit)
 

Variables

static const std::string TEST_MESSAGE = "TEST_MESSAGE"
 A sample message. More...
 
static const std::string TEST_URI = "TEST_URI"
 A sample message URI. More...
 
static const auto TEST_TIMEOUT = std::chrono::seconds(5)
 Timeout used in test. More...
 
static const auto LONG_TEST_TIMEOUT = std::chrono::seconds(20)
 Very long timeout used in test. More...
 
static const std::string TEST_DATABASE_FILE_PATH = "messageStorageTestDatabase.db"
 The filename we will use for the test database file. More...
 
static const std::string PATH_DELIMITER = "/"
 The path delimiter used by the OS to identify file locations. More...
 
static std::string g_dbTestFilePath
 The full filepath to the database file we will create and delete during tests. More...
 
static const std::string TEST_MESSAGE_ONE = "test_message_one"
 A test message text. More...
 
static const std::string TEST_MESSAGE_TWO = "test_message_two"
 A test message text. More...
 
static const std::string TEST_MESSAGE_THREE = "test_message_three"
 A test message text. More...
 
static const std::string TEST_MESSAGE_URI = "/v20160207/events/SpeechRecognizer/Recognize"
 A test message uri. More...
 
static const std::string MESSAGES_TABLE_NAME = "messages_with_uri"
 The name of the alerts table. More...
 
static const std::string DATABASE_COLUMN_ID_NAME = "id"
 The name of the 'id' field we will use as the primary key in our tables. More...
 
static const std::string DATABASE_COLUMN_MESSAGE_TEXT_NAME = "message_text"
 The name of the 'message_text' field we will use as the primary key in our tables. More...
 
static const std::string DATABASE_COLUMN_URI = "uri"
 The name of the 'uriPathExtension' field corresponding to the uri path extension of the message. More...
 
static const std::string DATABASE_COLUMN_TIMESTAMP = "timestamp"
 The name of the 'timestamp' field is the creation time of the message. More...
 
static const std::string CREATE_LEGACY_MESSAGES_TABLE_SQL_STRING
 The SQL string to create the alerts table. More...
 

Function Documentation

◆ isOpen()

static bool alexaClientSDK::certifiedSender::test::isOpen ( const std::shared_ptr< MessageStorageInterface > &  storage)
static

Utility function to determine if the storage component is opened.

Parameters
storageThe storage component to check.
Returns
True if the storage component's underlying database is opened, false otherwise.

◆ TEST_F() [1/15]

alexaClientSDK::certifiedSender::test::TEST_F ( CertifiedSenderTest  ,
test_clearData   
)

Check that clearData() method clears the persistent message storage and the current msg queue

◆ TEST_F() [2/15]

alexaClientSDK::certifiedSender::test::TEST_F ( CertifiedSenderTest  ,
test_initFailsWhenStorageMethodsFail   
)

Tests various failure scenarios for the init method.

Test if the init method fails when createDatabase on storage fails.

Test if the init method fails when load from storage fails.

◆ TEST_F() [3/15]

alexaClientSDK::certifiedSender::test::TEST_F ( CertifiedSenderTest  ,
testTimer_storedMessagesGetSent   
)

Tests if the stored messages get sent when a connection is established.

Return messages from storage.

wait for requests to get sent out.

Cleanup

◆ TEST_F() [4/15]

alexaClientSDK::certifiedSender::test::TEST_F ( MessageStorageTest  ,
test_constructionAndDestruction   
)

Test basic construction. Database should not be open.

◆ TEST_F() [5/15]

alexaClientSDK::certifiedSender::test::TEST_F ( MessageStorageTest  ,
test_databaseCreation   
)

Test database creation.

◆ TEST_F() [6/15]

alexaClientSDK::certifiedSender::test::TEST_F ( MessageStorageTest  ,
test_openAndCloseDatabase   
)

Test opening and closing a database.

◆ TEST_F() [7/15]

alexaClientSDK::certifiedSender::test::TEST_F ( MessageStorageTest  ,
test_databaseStoreAndLoad   
)

Test storing records in the database.

◆ TEST_F() [8/15]

alexaClientSDK::certifiedSender::test::TEST_F ( CertifiedSenderTest  ,
testTimer_SendMessageWithURI   
)

Verify that a message with a URI specified will be sent out by the sender with the URI.

◆ TEST_F() [9/15]

alexaClientSDK::certifiedSender::test::TEST_F ( MessageStorageTest  ,
test_databaseErase   
)

Test erasing a record from the database.

◆ TEST_F() [10/15]

alexaClientSDK::certifiedSender::test::TEST_F ( CertifiedSenderTest  ,
testTimer_retryableResponsesAreRetried   
)

Tests if messages are re-submitted when the response is a re-tryable response.

◆ TEST_F() [11/15]

alexaClientSDK::certifiedSender::test::TEST_F ( MessageStorageTest  ,
test_databaseClear   
)

Test clearing the database.

◆ TEST_F() [12/15]

alexaClientSDK::certifiedSender::test::TEST_F ( MessageStorageTest  ,
test_DatabaseStoreAndLoadWithURI   
)

Test storing records with URI in the database.

◆ TEST_F() [13/15]

alexaClientSDK::certifiedSender::test::TEST_F ( CertifiedSenderTest  ,
testTimer_nonRetryableResponsesAreNotRetried   
)

Tests if messages are discarded when the response is a non-retryable response.

◆ TEST_F() [14/15]

alexaClientSDK::certifiedSender::test::TEST_F ( MessageStorageTest  ,
test_LegacyDatabase   
)

Test legacy database

◆ TEST_F() [15/15]

alexaClientSDK::certifiedSender::test::TEST_F ( MessageStorageTest  ,
test_EraseMessageOverAgeAndSizeLimit   
)

Test erase legacy message

Variable Documentation

◆ CREATE_LEGACY_MESSAGES_TABLE_SQL_STRING

const std::string alexaClientSDK::certifiedSender::test::CREATE_LEGACY_MESSAGES_TABLE_SQL_STRING
static
Initial value:
=
std::string("CREATE TABLE ") + MESSAGES_TABLE_NAME + " (" + DATABASE_COLUMN_ID_NAME + " INT PRIMARY KEY NOT NULL," +
DATABASE_COLUMN_URI + " TEXT NOT NULL," + DATABASE_COLUMN_MESSAGE_TEXT_NAME + " TEXT NOT NULL);"
::std::string string
Definition: gtest-port.h:1097
static const std::string DATABASE_COLUMN_MESSAGE_TEXT_NAME
The name of the &#39;message_text&#39; field we will use as the primary key in our tables.
Definition: MessageStorageTest.cpp:54
static const std::string MESSAGES_TABLE_NAME
The name of the alerts table.
Definition: MessageStorageTest.cpp:50
static const std::string DATABASE_COLUMN_ID_NAME
The name of the &#39;id&#39; field we will use as the primary key in our tables.
Definition: MessageStorageTest.cpp:52
static const std::string DATABASE_COLUMN_URI
The name of the &#39;uriPathExtension&#39; field corresponding to the uri path extension of the message...
Definition: MessageStorageTest.cpp:56

The SQL string to create the alerts table.

◆ DATABASE_COLUMN_ID_NAME

const std::string alexaClientSDK::certifiedSender::test::DATABASE_COLUMN_ID_NAME = "id"
static

The name of the 'id' field we will use as the primary key in our tables.

◆ DATABASE_COLUMN_MESSAGE_TEXT_NAME

const std::string alexaClientSDK::certifiedSender::test::DATABASE_COLUMN_MESSAGE_TEXT_NAME = "message_text"
static

The name of the 'message_text' field we will use as the primary key in our tables.

◆ DATABASE_COLUMN_TIMESTAMP

const std::string alexaClientSDK::certifiedSender::test::DATABASE_COLUMN_TIMESTAMP = "timestamp"
static

The name of the 'timestamp' field is the creation time of the message.

◆ DATABASE_COLUMN_URI

const std::string alexaClientSDK::certifiedSender::test::DATABASE_COLUMN_URI = "uri"
static

The name of the 'uriPathExtension' field corresponding to the uri path extension of the message.

◆ g_dbTestFilePath

std::string alexaClientSDK::certifiedSender::test::g_dbTestFilePath
static

The full filepath to the database file we will create and delete during tests.

◆ LONG_TEST_TIMEOUT

const auto alexaClientSDK::certifiedSender::test::LONG_TEST_TIMEOUT = std::chrono::seconds(20)
static

Very long timeout used in test.

◆ MESSAGES_TABLE_NAME

const std::string alexaClientSDK::certifiedSender::test::MESSAGES_TABLE_NAME = "messages_with_uri"
static

The name of the alerts table.

◆ PATH_DELIMITER

const std::string alexaClientSDK::certifiedSender::test::PATH_DELIMITER = "/"
static

The path delimiter used by the OS to identify file locations.

◆ TEST_DATABASE_FILE_PATH

const std::string alexaClientSDK::certifiedSender::test::TEST_DATABASE_FILE_PATH = "messageStorageTestDatabase.db"
static

The filename we will use for the test database file.

◆ TEST_MESSAGE

const std::string alexaClientSDK::certifiedSender::test::TEST_MESSAGE = "TEST_MESSAGE"
static

A sample message.

◆ TEST_MESSAGE_ONE

const std::string alexaClientSDK::certifiedSender::test::TEST_MESSAGE_ONE = "test_message_one"
static

A test message text.

◆ TEST_MESSAGE_THREE

const std::string alexaClientSDK::certifiedSender::test::TEST_MESSAGE_THREE = "test_message_three"
static

A test message text.

◆ TEST_MESSAGE_TWO

const std::string alexaClientSDK::certifiedSender::test::TEST_MESSAGE_TWO = "test_message_two"
static

A test message text.

◆ TEST_MESSAGE_URI

const std::string alexaClientSDK::certifiedSender::test::TEST_MESSAGE_URI = "/v20160207/events/SpeechRecognizer/Recognize"
static

A test message uri.

◆ TEST_TIMEOUT

const auto alexaClientSDK::certifiedSender::test::TEST_TIMEOUT = std::chrono::seconds(5)
static

Timeout used in test.

◆ TEST_URI

const std::string alexaClientSDK::certifiedSender::test::TEST_URI = "TEST_URI"
static

A sample message URI.

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0