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

Classes

struct  EventData
 
class  PostConnectSynchronizeStateSenderTest
 

Functions

bool parseEventJson (const std::string &eventJson, EventData *eventData)
 
bool validateEvent (const std::string &eventJson)
 
 TEST_F (PostConnectSynchronizeStateSenderTest, test_createWithNullContextManager)
 
 TEST_F (PostConnectSynchronizeStateSenderTest, test_createWithMetricRecorder)
 
 TEST_F (PostConnectSynchronizeStateSenderTest, test_getOperationPriority)
 
 TEST_F (PostConnectSynchronizeStateSenderTest, test_perfromOperationSendsSynchronizeStateEvent)
 
 TEST_F (PostConnectSynchronizeStateSenderTest, test_performOperationRetriesOnContextFailure)
 
 TEST_F (PostConnectSynchronizeStateSenderTest, test_testPerfromOperationRetriesOnUnsuccessfulResponse)
 
 TEST_F (PostConnectSynchronizeStateSenderTest, test_abortOperationWhenContextRequestInProgress)
 
 TEST_F (PostConnectSynchronizeStateSenderTest, test_abortOperationWhenSendMessageInProgress)
 

Variables

static const std::string TEST_CONTEXT_VALUE = "{}"
 String indicating the device's context. More...
 
static const std::string EXPECTED_NAMESPACE = "System"
 String indicating the SynchronizeState event's expected namespace. More...
 
static const std::string EXPECTED_NAME = "SynchronizeState"
 String indicating the SynchronizeState event's expected name. More...
 
static const std::string EXPECTED_PAYLOAD = "{}"
 String indicating the SynchronizeState event's expected payload. More...
 
static const ContextRequestToken MOCK_CONTEXT_REQUEST_TOKEN = 1
 Request token used to mock getContext return value. More...
 
static const int TEST_RETRY_COUNT = 3
 Number of retries used in tests. More...
 

Function Documentation

◆ parseEventJson()

bool alexaClientSDK::synchronizeStateSender::test::parseEventJson ( const std::string &  eventJson,
EventData eventData 
)

◆ TEST_F() [1/8]

alexaClientSDK::synchronizeStateSender::test::TEST_F ( PostConnectSynchronizeStateSenderTest  ,
test_createWithNullContextManager   
)

Test create with null ContextManager.

◆ TEST_F() [2/8]

alexaClientSDK::synchronizeStateSender::test::TEST_F ( PostConnectSynchronizeStateSenderTest  ,
test_createWithMetricRecorder   
)

Test create with MetricRecorder.

◆ TEST_F() [3/8]

alexaClientSDK::synchronizeStateSender::test::TEST_F ( PostConnectSynchronizeStateSenderTest  ,
test_getOperationPriority   
)

Test GetPriority method for PostConnectSynchronizeStateSender.

◆ TEST_F() [4/8]

alexaClientSDK::synchronizeStateSender::test::TEST_F ( PostConnectSynchronizeStateSenderTest  ,
test_perfromOperationSendsSynchronizeStateEvent   
)

Test happy case for performOperation method. SynchronizeState event is sent and performOperation() returns true.

◆ TEST_F() [5/8]

alexaClientSDK::synchronizeStateSender::test::TEST_F ( PostConnectSynchronizeStateSenderTest  ,
test_performOperationRetriesOnContextFailure   
)

Test performOperation() method retries sending SynchronizeState event on context fetch failure.

abort operation after 3 retries.

Synchronize State event not sent.

Abort after 3 retries.

◆ TEST_F() [6/8]

alexaClientSDK::synchronizeStateSender::test::TEST_F ( PostConnectSynchronizeStateSenderTest  ,
test_testPerfromOperationRetriesOnUnsuccessfulResponse   
)

Test performOperation() method retries sending SynchronizeState event on unsuccessful response to SynchronizeState event.

abort operation after 3 retries.

Abort after 3 retries.

◆ TEST_F() [7/8]

alexaClientSDK::synchronizeStateSender::test::TEST_F ( PostConnectSynchronizeStateSenderTest  ,
test_abortOperationWhenContextRequestInProgress   
)

Test abortOperation() triggers performOperation() to return when context fetch is in progress.

Wait for 500 ms and spin a thread to abort the post connect operation.

◆ TEST_F() [8/8]

alexaClientSDK::synchronizeStateSender::test::TEST_F ( PostConnectSynchronizeStateSenderTest  ,
test_abortOperationWhenSendMessageInProgress   
)

Test abortOperation() triggers performOperation() to return when SynchronizeState event send is in progress.

Wait for 500 ms and spin a thread to abort the post connect operation.

◆ validateEvent()

bool alexaClientSDK::synchronizeStateSender::test::validateEvent ( const std::string &  eventJson)

Variable Documentation

◆ EXPECTED_NAME

const std::string alexaClientSDK::synchronizeStateSender::test::EXPECTED_NAME = "SynchronizeState"
static

String indicating the SynchronizeState event's expected name.

◆ EXPECTED_NAMESPACE

const std::string alexaClientSDK::synchronizeStateSender::test::EXPECTED_NAMESPACE = "System"
static

String indicating the SynchronizeState event's expected namespace.

◆ EXPECTED_PAYLOAD

const std::string alexaClientSDK::synchronizeStateSender::test::EXPECTED_PAYLOAD = "{}"
static

String indicating the SynchronizeState event's expected payload.

◆ MOCK_CONTEXT_REQUEST_TOKEN

const ContextRequestToken alexaClientSDK::synchronizeStateSender::test::MOCK_CONTEXT_REQUEST_TOKEN = 1
static

Request token used to mock getContext return value.

◆ TEST_CONTEXT_VALUE

const std::string alexaClientSDK::synchronizeStateSender::test::TEST_CONTEXT_VALUE = "{}"
static

String indicating the device's context.

◆ TEST_RETRY_COUNT

const int alexaClientSDK::synchronizeStateSender::test::TEST_RETRY_COUNT = 3
static

Number of retries used in tests.

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