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

Classes

class  HTTP2TransportTest
 Test harness for HTTP2Transport class. More...
 
class  MessageRequestHandlerTest
 
class  MockExchangeHandlerContext
 
class  MockMessageRouterObserver
 
class  MockPostConnectObserver
 
class  MockPostConnectOperation
 
class  MockPostConnectOperationProvider
 
class  MockTransport
 
class  MockTransportObserver
 
class  PostConnectSequencerFactoryTest
 
class  PostConnectSequencerTest
 

Functions

 TEST_F (HTTP2TransportTest, testSlow_emptyAuthToken)
 
 TEST_F (HTTP2TransportTest, testSlow_waitAuthDelegateInterface)
 
 TEST_F (HTTP2TransportTest, test_bearerTokenInRequest)
 
 TEST_F (HTTP2TransportTest, test_triggerPostConnectObject)
 
 TEST_F (HTTP2TransportTest, test_connectionStatusOnPostConnect)
 
 TEST_F (HTTP2TransportTest, testSlow_retryOnDownchannelConnectionFailure)
 
 TEST_F (HTTP2TransportTest, test_messageRequestContent)
 
 TEST_F (HTTP2TransportTest, test_messageRequestWithAttachment)
 
 TEST_F (HTTP2TransportTest, test_pauseSendWhenSDSEmpty)
 
 TEST_F (HTTP2TransportTest, testSlow_messageRequestsQueuing)
 
 TEST_F (HTTP2TransportTest, messageRequests_SequentialSend)
 
 TEST_F (HTTP2TransportTest, messageRequests_concurrentSend)
 
 TEST_F (HTTP2TransportTest, test_onSendCompletedNotification)
 
 TEST_F (HTTP2TransportTest, test_onExceptionReceivedNon200Content)
 
 TEST_F (HTTP2TransportTest, test_messageConsumerReceiveDirective)
 
 TEST_F (HTTP2TransportTest, test_onServerSideDisconnectOnDownchannelClosure)
 
 TEST_F (HTTP2TransportTest, test_messageRequestTimeoutPingRequest)
 
 TEST_F (HTTP2TransportTest, testTimer_networkInactivityPingRequest)
 
 TEST_F (HTTP2TransportTest, testSlow_tearDownPingTimeout)
 
 TEST_F (HTTP2TransportTest, testSlow_tearDownPingFailure)
 
 TEST_F (HTTP2TransportTest, testSlow_avsStreamsLimit)
 
 TEST_F (HTTP2TransportTest, test_onPostConnectFailureInitiatesShutdownAndNotifiesObservers)
 
 TEST_F (HTTP2TransportTest, test_eventTracerIsNotifiedForMessagesSent)
 
 TEST_F (HTTP2TransportTest, test_eventTracerIsNotNotifiedForFailedMessages)
 
 TEST_F (HTTP2TransportTest, test_eventTracerNotifiedForEmptyMessageContent)
 
 TEST_F (HTTP2TransportTest, test_eventTracerIsNotifiedForMultipleMessages)
 
 TEST_F (MessageRequestHandlerTest, test_headers)
 
void initializeMockTransport (MockTransport *transport)
 
void connectMockTransport (MockTransport *transport)
 
void disconnectMockTransport (MockTransport *transport)
 
 TEST_F (PostConnectSequencerFactoryTest, test_createWithNullProviders)
 
 TEST_F (PostConnectSequencerFactoryTest, test_createPostConnectCallsProviders)
 
 TEST_F (PostConnectSequencerFactoryTest, test_createPostConnectWhenProviderReturnsNull)
 
 TEST_F (PostConnectSequencerTest, test_postConnectOperationsSet)
 
 TEST_F (PostConnectSequencerTest, test_postConnectOperationsSetRemovesDuplicates)
 
 TEST_F (PostConnectSequencerTest, test_happyPathAndPostConnectObserverGetsNotified)
 
 TEST_F (PostConnectSequencerTest, test_doPostConnectReturnFalseOnSecondCall)
 
 TEST_F (PostConnectSequencerTest, test_subsequentOperationsDontExecute)
 
 TEST_F (PostConnectSequencerTest, test_onDisconnectStopsExecution)
 

Variables

static const std::string TEST_AVS_GATEWAY_STRING = "http://avs-alexa-na.amazon.com"
 Test AVS Gateway. More...
 
static const std::string AVS_DOWNCHANNEL_URL_PATH_EXTENSION = "/v20160207/directives"
 Expected Downchannel URL sent on requests. More...
 
static const std::string AVS_PING_URL_PATH_EXTENSION = "/ping"
 Expected ping URL sent on requests. More...
 
static const std::string FULL_DOWNCHANNEL_URL = TEST_AVS_GATEWAY_STRING + AVS_DOWNCHANNEL_URL_PATH_EXTENSION
 Expected Full Downchannel URL sent on requests. More...
 
static const std::string FULL_PING_URL = TEST_AVS_GATEWAY_STRING + AVS_PING_URL_PATH_EXTENSION
 Expected Full ping URL sent on requests. More...
 
static const auto ONE_HUNDRED_MILLISECOND_DELAY = std::chrono::milliseconds(100)
 A 100 millisecond delay used in tests. More...
 
static const auto TEN_MILLISECOND_DELAY = std::chrono::milliseconds(10)
 A 10 millisecond delay used in tests. More...
 
static const auto SHORT_DELAY = std::chrono::seconds(1)
 A short delay used in tests. More...
 
static const auto RESPONSE_TIMEOUT = std::chrono::seconds(5)
 Typical Timeout used in waiting for responses. More...
 
static const auto LONG_RESPONSE_TIMEOUT = std::chrono::seconds(10)
 A longer timeout used in waiting for responses. More...
 
static const std::string HTTP_AUTHORIZATION_HEADER_BEARER = "Authorization: Bearer"
 HTTP Authorization header. More...
 
static const std::string CBL_AUTHORIZATION_TOKEN = "AUTH_TOKEN"
 Authorization Token. More...
 
static const std::string TEST_ATTACHMENT_ID_STRING_ONE = "testAttachmentId_1"
 A test AttachmentId string. More...
 
static const std::string TEST_MESSAGE = "aaabbccc"
 
static const std::string TEST_ATTACHMENT_MESSAGE = "MY_A_T_T_ACHMENT"
 
static const std::string TEST_ATTACHMENT_FIELD = "ATTACHMENT"
 
static const long NO_CALL = -2
 
static const std::string NON_MIME_PAYLOAD = "A_NON_MIME_PAYLOAD"
 
static const std::string DIRECTIVE1
 
static const std::string DIRECTIVE2
 
static const std::string MIME_BOUNDARY = "thisisaboundary"
 
static const std::string MIME_BODY_DIRECTIVE1
 
static const std::string MIME_BODY_DIRECTIVE2
 
static const std::string HTTP_BOUNDARY_HEADER
 
static const unsigned MAX_PING_STREAMS = 1
 
static const unsigned MAX_DOWNCHANNEL_STREAMS = 1
 
static const unsigned MAX_AVS_STREAMS = 10
 
static const unsigned MAX_POST_STREAMS = MAX_AVS_STREAMS - MAX_DOWNCHANNEL_STREAMS - MAX_PING_STREAMS
 
static const std::string AUTHORIZATION_HEADER = "Authorization: Bearer "
 
static const std::string AUTH_TOKEN = "authToken"
 
static const auto SHORT_DELAY = std::chrono::seconds(1)
 A short delay used in tests. More...
 

Function Documentation

◆ connectMockTransport()

void alexaClientSDK::acl::transport::test::connectMockTransport ( MockTransport transport)

Puts the mock transport into a connected state.

◆ disconnectMockTransport()

void alexaClientSDK::acl::transport::test::disconnectMockTransport ( MockTransport transport)

Puts the mock transport into a disconnected state.

◆ initializeMockTransport()

void alexaClientSDK::acl::transport::test::initializeMockTransport ( MockTransport transport)

Puts the mock transport into a ready to connect state.

◆ TEST_F() [1/36]

alexaClientSDK::acl::transport::test::TEST_F ( PostConnectSequencerFactoryTest  ,
test_createWithNullProviders   
)

Test if create returns nullptr when one of the providers is a nullptr.

◆ TEST_F() [2/36]

alexaClientSDK::acl::transport::test::TEST_F ( PostConnectSequencerFactoryTest  ,
test_createPostConnectCallsProviders   
)

Test if the createPostConnectOperation() is called on all the providers when createPostConnect() is called.

◆ TEST_F() [3/36]

alexaClientSDK::acl::transport::test::TEST_F ( PostConnectSequencerTest  ,
test_postConnectOperationsSet   
)

Check if the PostConnectOperationsSet sequences operations based on priority.

◆ TEST_F() [4/36]

alexaClientSDK::acl::transport::test::TEST_F ( MessageRequestHandlerTest  ,
test_headers   
)

Test if extra headers are preserved in message request handler

◆ TEST_F() [5/36]

alexaClientSDK::acl::transport::test::TEST_F ( PostConnectSequencerFactoryTest  ,
test_createPostConnectWhenProviderReturnsNull   
)

Test createPostConnect() does not fail if one of the providers returns nullptr.

◆ TEST_F() [6/36]

alexaClientSDK::acl::transport::test::TEST_F ( PostConnectSequencerTest  ,
test_postConnectOperationsSetRemovesDuplicates   
)

Check if the PostConnectOperationsSet keeps only one instance with the same priority.

◆ TEST_F() [7/36]

alexaClientSDK::acl::transport::test::TEST_F ( PostConnectSequencerTest  ,
test_happyPathAndPostConnectObserverGetsNotified   
)

Check if all PostConnectOperations are executed in sequence and the PostConnectObserver will be notified.

◆ TEST_F() [8/36]

alexaClientSDK::acl::transport::test::TEST_F ( PostConnectSequencerTest  ,
test_doPostConnectReturnFalseOnSecondCall   
)

Check if doPostConnect() gets called twice in a row, the method returns false..

◆ TEST_F() [9/36]

alexaClientSDK::acl::transport::test::TEST_F ( PostConnectSequencerTest  ,
test_subsequentOperationsDontExecute   
)

Check if PostConnectSequencer stops execution of PostConnectOperations if the performOperation() fails on one of them.

It is possible that the destructor gets called first which initiates an abortOperation before the mainLoopThread exits.

◆ TEST_F() [10/36]

alexaClientSDK::acl::transport::test::TEST_F ( PostConnectSequencerTest  ,
test_onDisconnectStopsExecution   
)

Check if onDisconnect() stops execution of PostConnectOperations.

◆ TEST_F() [11/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
testSlow_emptyAuthToken   
)

Test non-authorization on empty auth token.

◆ TEST_F() [12/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
testSlow_waitAuthDelegateInterface   
)

Test waiting for AuthDelegateInterface.

◆ TEST_F() [13/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_bearerTokenInRequest   
)

Test verifying the proper inclusion of bearer token in requests.

◆ TEST_F() [14/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_triggerPostConnectObject   
)

Test creation and triggering of post-connect object.

◆ TEST_F() [15/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_connectionStatusOnPostConnect   
)

Test delay of connection status until post-connect object created / notifies success.

◆ TEST_F() [16/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
testSlow_retryOnDownchannelConnectionFailure   
)

Test retry upon failed downchannel connection.

◆ TEST_F() [17/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_messageRequestContent   
)

Test sending of MessageRequest content.

◆ TEST_F() [18/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_messageRequestWithAttachment   
)

Test sending of MessageRequest with attachment data.

◆ TEST_F() [19/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_pauseSendWhenSDSEmpty   
)

Test pause of sending message when attachment buffer (SDS) empty but not closed.

◆ TEST_F() [20/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
testSlow_messageRequestsQueuing   
)

Test queuing MessageRequests until a response code has been received for any outstanding MessageRequest

◆ TEST_F() [21/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
messageRequests_SequentialSend   
)

Test MessageRequests are sent sequentially.

◆ TEST_F() [22/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
messageRequests_concurrentSend   
)

Test concurrent send of non sequential MessageRequests.

◆ TEST_F() [23/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_onSendCompletedNotification   
)

Test notification of onSendCompleted (check mapping of all cases and their mapping to MessageRequestObserverInterface::Status).

◆ TEST_F() [24/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_onExceptionReceivedNon200Content   
)

Test onExceptionReceived() notification for non 200 content.

◆ TEST_F() [25/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_messageConsumerReceiveDirective   
)

Test MessageConsumerInterface receipt of directives on Downchannel and Event streams.

◆ TEST_F() [26/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_onServerSideDisconnectOnDownchannelClosure   
)

Test broadcast onServerSideDisconnect() upon closure of successfully opened downchannel.

◆ TEST_F() [27/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_messageRequestTimeoutPingRequest   
)

Test detection of MessageRequest timeout and trigger of ping request.

◆ TEST_F() [28/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
testTimer_networkInactivityPingRequest   
)

Test detection of network inactivity and trigger of ping request and continued ping for continued inactivity.

◆ TEST_F() [29/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
testSlow_tearDownPingTimeout   
)

Test connection tear down for ping timeout.

◆ TEST_F() [30/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
testSlow_tearDownPingFailure   
)

Test connection tear down for ping failure.

◆ TEST_F() [31/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
testSlow_avsStreamsLimit   
)

Test limiting use of AVS streams to 10.

◆ TEST_F() [32/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_onPostConnectFailureInitiatesShutdownAndNotifiesObservers   
)

Test if the HTTP2Transport receives the onPostConnectFailure() event, it notifies observers with onDisconnected() and ChangeReason as UNRECOVERABLE_ERROR

◆ TEST_F() [33/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_eventTracerIsNotifiedForMessagesSent   
)

◆ TEST_F() [34/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_eventTracerIsNotNotifiedForFailedMessages   
)

Test the event tracer does not get notified if message fails to send.

◆ TEST_F() [35/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_eventTracerNotifiedForEmptyMessageContent   
)

Test that the event tracer does get notified when the contents of the sent message is empty.

◆ TEST_F() [36/36]

alexaClientSDK::acl::transport::test::TEST_F ( HTTP2TransportTest  ,
test_eventTracerIsNotifiedForMultipleMessages   
)

Test if the event tracer gets notified for multiple message requests.

Variable Documentation

◆ AUTH_TOKEN

const std::string alexaClientSDK::acl::transport::test::AUTH_TOKEN = "authToken"
static

◆ AUTHORIZATION_HEADER

const std::string alexaClientSDK::acl::transport::test::AUTHORIZATION_HEADER = "Authorization: Bearer "
static

◆ AVS_DOWNCHANNEL_URL_PATH_EXTENSION

const std::string alexaClientSDK::acl::transport::test::AVS_DOWNCHANNEL_URL_PATH_EXTENSION = "/v20160207/directives"
static

Expected Downchannel URL sent on requests.

◆ AVS_PING_URL_PATH_EXTENSION

const std::string alexaClientSDK::acl::transport::test::AVS_PING_URL_PATH_EXTENSION = "/ping"
static

Expected ping URL sent on requests.

◆ CBL_AUTHORIZATION_TOKEN

const std::string alexaClientSDK::acl::transport::test::CBL_AUTHORIZATION_TOKEN = "AUTH_TOKEN"
static

Authorization Token.

◆ DIRECTIVE1

const std::string alexaClientSDK::acl::transport::test::DIRECTIVE1
static
Initial value:
=
"{\"namespace:\"SpeechSynthesizer\",name:\"Speak\",messageId:\"351df0ff-8041-4891-a925-136f52d54da1\","
"dialogRequestId:\"58352bb2-7d07-4ba2-944b-10e6df25d193\"}"

◆ DIRECTIVE2

const std::string alexaClientSDK::acl::transport::test::DIRECTIVE2
static
Initial value:
=
"{\"namespace:\"Alerts\",name:\"SetAlert\",messageId:\"ccc005b8-ca8f-4c34-aeb5-73a8dbbd8d37\",dialogRequestId:"
"\"dca0bece-16a7-44f3-b940-e6c4ecc2b1f5\"}"

◆ FULL_DOWNCHANNEL_URL

const std::string alexaClientSDK::acl::transport::test::FULL_DOWNCHANNEL_URL = TEST_AVS_GATEWAY_STRING + AVS_DOWNCHANNEL_URL_PATH_EXTENSION
static

Expected Full Downchannel URL sent on requests.

◆ FULL_PING_URL

const std::string alexaClientSDK::acl::transport::test::FULL_PING_URL = TEST_AVS_GATEWAY_STRING + AVS_PING_URL_PATH_EXTENSION
static

Expected Full ping URL sent on requests.

◆ HTTP_AUTHORIZATION_HEADER_BEARER

const std::string alexaClientSDK::acl::transport::test::HTTP_AUTHORIZATION_HEADER_BEARER = "Authorization: Bearer"
static

HTTP Authorization header.

◆ HTTP_BOUNDARY_HEADER

const std::string alexaClientSDK::acl::transport::test::HTTP_BOUNDARY_HEADER
static
Initial value:
=
"Content-Type: multipart/related; boundary=" + MIME_BOUNDARY + "; type=application/json"
static const std::string MIME_BOUNDARY
Definition: HTTP2TransportTest.cpp:130

◆ LONG_RESPONSE_TIMEOUT

const auto alexaClientSDK::acl::transport::test::LONG_RESPONSE_TIMEOUT = std::chrono::seconds(10)
static

A longer timeout used in waiting for responses.

◆ MAX_AVS_STREAMS

const unsigned alexaClientSDK::acl::transport::test::MAX_AVS_STREAMS = 10
static

◆ MAX_DOWNCHANNEL_STREAMS

const unsigned alexaClientSDK::acl::transport::test::MAX_DOWNCHANNEL_STREAMS = 1
static

◆ MAX_PING_STREAMS

const unsigned alexaClientSDK::acl::transport::test::MAX_PING_STREAMS = 1
static

◆ MAX_POST_STREAMS

const unsigned alexaClientSDK::acl::transport::test::MAX_POST_STREAMS = MAX_AVS_STREAMS - MAX_DOWNCHANNEL_STREAMS - MAX_PING_STREAMS
static

◆ MIME_BODY_DIRECTIVE1

const std::string alexaClientSDK::acl::transport::test::MIME_BODY_DIRECTIVE1
static
Initial value:
= "--" + MIME_BOUNDARY + "\r\nContent-Type: application/json" +
"\r\n\r\n" + DIRECTIVE1 + "\r\n--" + MIME_BOUNDARY + "--\r\n"
static const std::string MIME_BOUNDARY
Definition: HTTP2TransportTest.cpp:130
static const std::string DIRECTIVE1
Definition: HTTP2TransportTest.cpp:120

◆ MIME_BODY_DIRECTIVE2

const std::string alexaClientSDK::acl::transport::test::MIME_BODY_DIRECTIVE2
static
Initial value:
= "--" + MIME_BOUNDARY + "\r\nContent-Type: application/json" +
"\r\n\r\n" + DIRECTIVE2 + "\r\n--" + MIME_BOUNDARY + "\r\n"
static const std::string MIME_BOUNDARY
Definition: HTTP2TransportTest.cpp:130
static const std::string DIRECTIVE2
Definition: HTTP2TransportTest.cpp:125

◆ MIME_BOUNDARY

const std::string alexaClientSDK::acl::transport::test::MIME_BOUNDARY = "thisisaboundary"
static

◆ NO_CALL

const long alexaClientSDK::acl::transport::test::NO_CALL = -2
static

◆ NON_MIME_PAYLOAD

const std::string alexaClientSDK::acl::transport::test::NON_MIME_PAYLOAD = "A_NON_MIME_PAYLOAD"
static

◆ ONE_HUNDRED_MILLISECOND_DELAY

const auto alexaClientSDK::acl::transport::test::ONE_HUNDRED_MILLISECOND_DELAY = std::chrono::milliseconds(100)
static

A 100 millisecond delay used in tests.

◆ RESPONSE_TIMEOUT

const auto alexaClientSDK::acl::transport::test::RESPONSE_TIMEOUT = std::chrono::seconds(5)
static

Typical Timeout used in waiting for responses.

◆ SHORT_DELAY [1/2]

const auto alexaClientSDK::acl::transport::test::SHORT_DELAY = std::chrono::seconds(1)
static

A short delay used in tests.

◆ SHORT_DELAY [2/2]

const auto alexaClientSDK::acl::transport::test::SHORT_DELAY = std::chrono::seconds(1)
static

A short delay used in tests.

◆ TEN_MILLISECOND_DELAY

const auto alexaClientSDK::acl::transport::test::TEN_MILLISECOND_DELAY = std::chrono::milliseconds(10)
static

A 10 millisecond delay used in tests.

◆ TEST_ATTACHMENT_FIELD

const std::string alexaClientSDK::acl::transport::test::TEST_ATTACHMENT_FIELD = "ATTACHMENT"
static

◆ TEST_ATTACHMENT_ID_STRING_ONE

const std::string alexaClientSDK::acl::transport::test::TEST_ATTACHMENT_ID_STRING_ONE = "testAttachmentId_1"
static

A test AttachmentId string.

◆ TEST_ATTACHMENT_MESSAGE

const std::string alexaClientSDK::acl::transport::test::TEST_ATTACHMENT_MESSAGE = "MY_A_T_T_ACHMENT"
static

◆ TEST_AVS_GATEWAY_STRING

const std::string alexaClientSDK::acl::transport::test::TEST_AVS_GATEWAY_STRING = "http://avs-alexa-na.amazon.com"
static

Test AVS Gateway.

◆ TEST_MESSAGE

const std::string alexaClientSDK::acl::transport::test::TEST_MESSAGE = "aaabbccc"
static

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