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

Classes

class  HTTPContentTest
 
class  LogEntryStreamTest
 
class  LoggerTest
 
class  MockLogger
 
class  MockModuleLogger
 
class  TestLogger
 

Functions

 TEST_F (HTTPContentTest, test_readStatusCodeSuccess)
 Test that isStatusCodeSuccess returns true for SUCCESS_STATUS_CODE. More...
 
 TEST_F (HTTPContentTest, test_readStatusCodePartialContentSuccess)
 Test that isStatusCodeSuccess returns true for SUCCESS_PARTIAL_CONTENT_STATUS_CODE. More...
 
 TEST_F (HTTPContentTest, test_readStatusCodeNotSuccess)
 Test that isStatusCodeSuccess returns false for BAD_STATUS_CODE. More...
 
 TEST_F (HTTPContentTest, test_readStatusCodeMoreThanOnce)
 Test that we can use getStatusCode() to get the status code after using isStatusCodeSuccess(). More...
 
 TEST_F (HTTPContentTest, test_readContentTypeMoreThanOnce)
 Test that we can use getContentType() to get the status code after using isStatusCodeSuccess(). More...
 
 TEST_F (HTTPContentTest, test_getDataStream)
 Test that we can retrieve the attachment reader, even if it's nullptr. More...
 
 TEST_F (LogEntryStreamTest, test_emptyStream)
 Test that a new LogEntryStream instance's c_str() returns an empty string. More...
 
 TEST_F (LogEntryStreamTest, test_shortString)
 Send a character to an empty LogEntryStream. Expect that c_str() returns a string with just that character. More...
 
 TEST_F (LogEntryStreamTest, test_mediumString)
 Send a medium sized string test to an empty LogEntryStream. Expect that c_str() returns a matching string. More...
 
 TEST_F (LogEntryStreamTest, test_longString)
 Send a long string test to an empty LogEntryStream. Expect that c_str() returns a matching string. More...
 
 TEST_F (LogEntryStreamTest, test_aFewStrings)
 Send a few short strings. Expect that c_str() returns the concatenation of those strings. More...
 
 TEST_F (LogEntryStreamTest, test_aLotOfStrings)
 Send a bunch of ints and strings. Expect that c_str() matches the result of sending the same to ostringstream. More...
 
 TEST_F (LoggerTest, test_logDebug9Level)
 
 TEST_F (LoggerTest, test_logDebug8Level)
 
 TEST_F (LoggerTest, test_logDebug7Level)
 
 TEST_F (LoggerTest, test_logDebug6Level)
 
 TEST_F (LoggerTest, test_logDebug5Level)
 
 TEST_F (LoggerTest, test_logDebug4Level)
 
 TEST_F (LoggerTest, test_logDebug3Level)
 
 TEST_F (LoggerTest, test_logDebug2Level)
 
 TEST_F (LoggerTest, test_logDebug1Level)
 
 TEST_F (LoggerTest, test_logDebug0Level)
 
 TEST_F (LoggerTest, test_logInfoLevel)
 
 TEST_F (LoggerTest, test_logWarnLevel)
 
 TEST_F (LoggerTest, test_logErrorLevel)
 
 TEST_F (LoggerTest, test_logCriticalLevel)
 
 TEST_F (LoggerTest, test_logNoneLevel)
 
 TEST_F (LoggerTest, test_moduleLoggerObserver)
 
 TEST_F (LoggerTest, test_multipleModuleLoggerObservers)
 

Variables

static const long SUCCESS_STATUS_CODE {200}
 A status code that represents success. More...
 
static const long SUCCESS_PARTIAL_CONTENT_STATUS_CODE {206}
 A status code that represents partial content. More...
 
static const long BAD_STATUS_CODE {0}
 A status code that represents failure. More...
 
static const std::string TEST_CONTENT_TYPE {"unknown"}
 A content type. More...
 
static const std::string TEST_SOURCE_STRING = "<The_Source_Of_Log_Entries>"
 String used to test that the source component is logged. More...
 
static const std::string TEST_EVENT_STRING = "[Some_Event_Worth_Logging]"
 String used to test that the event component is logged. More...
 
static const std::string UNESCAPED_METADATA_VALUE = R"(reserved_chars['\' ',' ':' '='])"
 Metadata value with characters that must be escaped, to exercise the code that escapes metadata values. More...
 
static std::shared_ptr< MockLoggerg_log
 Global to hold on to the current MockLogger to use. More...
 

Function Documentation

◆ TEST_F() [1/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LogEntryStreamTest  ,
test_emptyStream   
)

Test that a new LogEntryStream instance's c_str() returns an empty string.

◆ TEST_F() [2/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LogEntryStreamTest  ,
test_shortString   
)

Send a character to an empty LogEntryStream. Expect that c_str() returns a string with just that character.

◆ TEST_F() [3/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LogEntryStreamTest  ,
test_mediumString   
)

Send a medium sized string test to an empty LogEntryStream. Expect that c_str() returns a matching string.

◆ TEST_F() [4/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LogEntryStreamTest  ,
test_longString   
)

Send a long string test to an empty LogEntryStream. Expect that c_str() returns a matching string.

◆ TEST_F() [5/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LogEntryStreamTest  ,
test_aFewStrings   
)

Send a few short strings. Expect that c_str() returns the concatenation of those strings.

◆ TEST_F() [6/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( HTTPContentTest  ,
test_readStatusCodeSuccess   
)

Test that isStatusCodeSuccess returns true for SUCCESS_STATUS_CODE.

◆ TEST_F() [7/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( HTTPContentTest  ,
test_readStatusCodePartialContentSuccess   
)

Test that isStatusCodeSuccess returns true for SUCCESS_PARTIAL_CONTENT_STATUS_CODE.

◆ TEST_F() [8/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LogEntryStreamTest  ,
test_aLotOfStrings   
)

Send a bunch of ints and strings. Expect that c_str() matches the result of sending the same to ostringstream.

◆ TEST_F() [9/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( HTTPContentTest  ,
test_readStatusCodeNotSuccess   
)

Test that isStatusCodeSuccess returns false for BAD_STATUS_CODE.

◆ TEST_F() [10/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( HTTPContentTest  ,
test_readStatusCodeMoreThanOnce   
)

Test that we can use getStatusCode() to get the status code after using isStatusCodeSuccess().

◆ TEST_F() [11/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( HTTPContentTest  ,
test_readContentTypeMoreThanOnce   
)

Test that we can use getContentType() to get the status code after using isStatusCodeSuccess().

◆ TEST_F() [12/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( HTTPContentTest  ,
test_getDataStream   
)

Test that we can retrieve the attachment reader, even if it's nullptr.

◆ TEST_F() [13/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logDebug9Level   
)

Test delivery of log messages when the log level is set to DEBUG9. This test sets the log level to DEBUG9 and then verifies that all logs (except those compiled off) are passed through to the emit() method.

◆ TEST_F() [14/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logDebug8Level   
)

Test delivery of log messages when the log level is set to DEBUG8. This test sets the log level to DEBUG8 and then verifies that all logs (except those compiled off) are passed through to the emit() method.

◆ TEST_F() [15/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logDebug7Level   
)

Test delivery of log messages when the log level is set to DEBUG7. This test sets the log level to DEBUG7 and then verifies that all logs (except those compiled off) are passed through to the emit() method.

◆ TEST_F() [16/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logDebug6Level   
)

Test delivery of log messages when the log level is set to DEBUG6. This test sets the log level to DEBUG6 and then verifies that all logs (except those compiled off) are passed through to the emit() method.

◆ TEST_F() [17/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logDebug5Level   
)

Test delivery of log messages when the log level is set to DEBUG5. This test sets the log level to DEBUG5 and then verifies that all logs (except those compiled off) are passed through to the emit() method.

◆ TEST_F() [18/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logDebug4Level   
)

Test delivery of log messages when the log level is set to DEBUG4. This test sets the log level to DEBUG4 and then verifies that all logs (except those compiled off) are passed through to the emit() method.

◆ TEST_F() [19/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logDebug3Level   
)

Test delivery of log messages when the log level is set to DEBUG3. This test sets the log level to DEBUG3 and then verifies that all logs (except those compiled off) are passed through to the emit() method.

◆ TEST_F() [20/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logDebug2Level   
)

Test delivery of log messages when the log level is set to DEBUG2. This test sets the log level to DEBUG2 and then verifies that all logs (except those compiled off) are passed through to the emit() method.

◆ TEST_F() [21/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logDebug1Level   
)

Test delivery of log messages when the log level is set to DEBUG1. This test sets the log level to DEBUG1 and then verifies that only logs of DEBUG or above are passed through to the emit() method.

◆ TEST_F() [22/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logDebug0Level   
)

Test delivery of log messages when the log level is set to DEBUG1. This test sets the log level to DEBUG0 and then verifies that only logs of DEBUG or above are passed through to the emit() method.

◆ TEST_F() [23/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logInfoLevel   
)

Test delivery of log messages when the log level is set to INFO. This test sets the log level to INFO and then verifies that only logs of INFO or above are passed through to the emit() method.

◆ TEST_F() [24/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logWarnLevel   
)

Test delivery of log messages when the log level is set to WARN. This test sets the log level to WARN and then verifies that only logs of WARN or above are passed through to the emit() method.

◆ TEST_F() [25/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logErrorLevel   
)

Test delivery of log messages when the log level is set to ERROR. This test sets the log level to ERROR and then verifies that only logs of ERROR or above are passed through to the emit() method.

◆ TEST_F() [26/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logCriticalLevel   
)

Test delivery of log messages when the log level is set to CRITICAL. This test sets the log level to CRITICAL and then verifies that only CRITICAL logs are passed through to the emit() method.

◆ TEST_F() [27/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_logNoneLevel   
)

Test delivery of log messages when the log level is set to NONE. This test sets the log level to NONE and then verifies that no logs are passed through to the emit() method.

◆ TEST_F() [28/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_moduleLoggerObserver   
)

Test observer mechanism in the MockModuleLogger. Expects that when the logLevel changes for the sink, the callback of the MockModuleLogger is triggered. Also make sure any changes to MockModuleLogger's logLevel will override set log level of the MockModuleLogger and the MockModuleLogger will ignore further changes to the logLevel to the sink.

◆ TEST_F() [29/29]

alexaClientSDK::avsCommon::utils::logger::test::TEST_F ( LoggerTest  ,
test_multipleModuleLoggerObservers   
)

Test observer mechanism with multiple observers. Expects all observers to be notified of the logLevel change.

Variable Documentation

◆ BAD_STATUS_CODE

const long alexaClientSDK::avsCommon::utils::logger::test::BAD_STATUS_CODE {0}
static

A status code that represents failure.

◆ g_log

std::shared_ptr<MockLogger> alexaClientSDK::avsCommon::utils::logger::test::g_log
static

Global to hold on to the current MockLogger to use.

◆ SUCCESS_PARTIAL_CONTENT_STATUS_CODE

const long alexaClientSDK::avsCommon::utils::logger::test::SUCCESS_PARTIAL_CONTENT_STATUS_CODE {206}
static

A status code that represents partial content.

◆ SUCCESS_STATUS_CODE

const long alexaClientSDK::avsCommon::utils::logger::test::SUCCESS_STATUS_CODE {200}
static

A status code that represents success.

◆ TEST_CONTENT_TYPE

const std::string alexaClientSDK::avsCommon::utils::logger::test::TEST_CONTENT_TYPE {"unknown"}
static

A content type.

◆ TEST_EVENT_STRING

const std::string alexaClientSDK::avsCommon::utils::logger::test::TEST_EVENT_STRING = "[Some_Event_Worth_Logging]"
static

String used to test that the event component is logged.

◆ TEST_SOURCE_STRING

const std::string alexaClientSDK::avsCommon::utils::logger::test::TEST_SOURCE_STRING = "<The_Source_Of_Log_Entries>"
static

String used to test that the source component is logged.

◆ UNESCAPED_METADATA_VALUE

const std::string alexaClientSDK::avsCommon::utils::logger::test::UNESCAPED_METADATA_VALUE = R"(reserved_chars['\' ',' ':' '='])"
static

Metadata value with characters that must be escaped, to exercise the code that escapes metadata values.

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