AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Namespaces | Macros | Typedefs | Functions | Variables
BaseAPLCapabilityAgentTest.cpp File Reference
#include <condition_variable>
#include <future>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "acsdk/APLCapabilityCommonInterfaces/PresentationToken.h"
#include "gmock/gmock-spec-builders.h"
#include <rapidjson/document.h>
#include <AVSCommon/AVS/Attachment/MockAttachmentManager.h>
#include <AVSCommon/SDKInterfaces/MockContextManager.h>
#include <AVSCommon/SDKInterfaces/MockDirectiveHandlerResult.h>
#include <AVSCommon/SDKInterfaces/MockExceptionEncounteredSender.h>
#include <AVSCommon/SDKInterfaces/MockMessageSender.h>
#include <AVSCommon/Utils/Memory/Memory.h>
#include <AVSCommon/Utils/JSON/JSONUtils.h>
#include <AVSCommon/Utils/Logger/Logger.h>
#include <acsdk/APLCapabilityCommonInterfaces/MockAPLCapabilityAgent.h>
#include <acsdk/APLCapabilityCommonInterfaces/MockVisualStateProvider.h>
#include <acsdk/APLCapabilityCommonInterfaces/MockAPLCapabilityAgentObserver.h>
#include <acsdk/APLCapabilityCommon/BaseAPLCapabilityAgent.h>
Include dependency graph for BaseAPLCapabilityAgentTest.cpp:

Classes

class  alexaClientSDK::aplCapabilityCommon::test::APLCATest
 
class  alexaClientSDK::aplCapabilityCommon::test::BaseAPLCapabilityAgentTest
 Test harness for BaseAPLCapabilityAgent class. More...
 

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::aplCapabilityCommon
 
 alexaClientSDK::aplCapabilityCommon::test
 

Macros

#define TAG   "BaseAPLCapabilityAgentTest"
 String to identify log entries originating from this file. More...
 
#define LX(event)   alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)
 

Typedefs

using alexaClientSDK::aplCapabilityCommon::test::JSONStream = std::vector< std::shared_ptr< std::istream > >
 Alias for JSON stream type used in ConfigurationNode initialization. More...
 

Functions

static std::chrono::milliseconds alexaClientSDK::aplCapabilityCommon::test::TIMEOUT (1000)
 Timeout when waiting for futures to be set. More...
 
const std::string alexaClientSDK::aplCapabilityCommon::test::makeDocumentAplPayload (const std::string &token, const std::string &timeoutType)
 
static void alexaClientSDK::aplCapabilityCommon::test::setConfig ()
 
static aplCapabilityCommonInterfaces::aplEventPayload::UserEvent alexaClientSDK::aplCapabilityCommon::test::createUserEventPayload (aplCapabilityCommonInterfaces::PresentationToken token, std::string arguments, std::string source, std::string components)
 
static aplCapabilityCommonInterfaces::aplEventPayload::DataSourceFetch alexaClientSDK::aplCapabilityCommon::test::createDataSourceFetchPayload (aplCapabilityCommonInterfaces::PresentationToken token, std::string dataSourceType, std::string fetchPayload)
 
static aplCapabilityCommonInterfaces::aplEventPayload::VisualContext alexaClientSDK::aplCapabilityCommon::test::createVisualContextPayload (aplCapabilityCommonInterfaces::PresentationToken token, std::string version, std::string visualContext, std::string datasourceContext)
 
static void alexaClientSDK::aplCapabilityCommon::test::verifySendMessage (std::shared_ptr< avsCommon::avs::MessageRequest > request, const std::string expectedEventName, const std::string expectedPayload, const std::string expectedNameSpace)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testTimeoutShort)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testTimeoutTransient)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testTimeoutLong)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testUnknownDirective)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testMissingTimeoutTypeRenderDocumentDirective)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testInvalidTimeoutTypeRenderDocumentDirective)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testMalformedRenderDocumentDirective)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testMalformedRenderDocumentDirective2)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testMalformedExecuteCommandDirective)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testMalformedExecuteCommandDirective2)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testExecuteCommandAfterMismatchedAPLCard)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testExecuteCommandAfterRightAPL)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testSendUserEvent)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testIndexListDataSourceFetchRequestEvent)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testTokenListDataSourceFetchRequestEvent)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testAPLProactiveStateReportNotSentIfNotRendering)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testAPLProactiveStateReportSentIfRendering)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testAPLProactiveStateReportSentIndependentOfProvideStateResponse)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testAPLProactiveStateReportNotSentIfRenderingNotComplete)
 
 alexaClientSDK::aplCapabilityCommon::test::TEST_F (BaseAPLCapabilityAgentTest, testRenderDocumentReceivedTimestamp)
 

Variables

static std::string alexaClientSDK::aplCapabilityCommon::test::TESTPRESENTATIONAPL_CONFIGURATION_ROOT_KEY = "TestPresentationAPLCapabilityAgent"
 The key in our config file to find the root of APL CA configuration. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::NAMESPACE = "Test.Presentation.APL"
 The namespace registered for this capability agent. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::UNKNOWN_DIRECTIVE = "Unknown"
 An unknown directive signature. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::USER_EVENT_EVENT = "UserEvent"
 The name for UserEvent event. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::LOAD_INDEX_LIST_DATA = "LoadIndexListData"
 The name for LoadIndexListData event. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::LOAD_TOKEN_LIST_DATA = "LoadTokenListData"
 The name for LoadTokenListData event. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::MESSAGE_ID = "messageId"
 The MessageId identifer. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::MESSAGE_ID_2 = "messageId2"
 The MessageId identifer. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::SAMPLE_USER_EVENT_PAYLOAD
 Payload to be sent for UserEvent. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::DYNAMIC_INDEX_LIST = "dynamicIndexList"
 DynamicIndexList DataSource type. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::SAMPLE_INDEX_DATA_SOURCE_FETCH_REQUEST
 Payload to be sent for ListDataSourceFetchRequest. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::SAMPLE_INDEX_DATA_SOURCE_FETCH_APL_REQUEST
 Payload to be sent for ListDataSourceFetchRequest from APLCore. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::DYNAMIC_TOKEN_LIST = "dynamicTokenList"
 DynamicTokenList DataSource type. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::SAMPLE_TOKEN_DATA_SOURCE_FETCH_REQUEST
 Payload to be sent for TokenDataSourceFetchRequest. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::SAMPLE_TOKEN_DATA_SOURCE_FETCH_APL_REQUEST
 Payload to be sent for TokenDataSourceFetchRequest from APLCore. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::MESSAGE_EVENT_KEY = "event"
 JSON key for the event section of a message. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::MESSAGE_NAMESPACE_KEY = "namespace"
 JSON key for the namespace field of a message header. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::MESSAGE_NAME_KEY = "name"
 JSON key for the name field of a message header. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::MESSAGE_HEADER_KEY = "header"
 JSON key for the header section of a message. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::MESSAGE_PAYLOAD_KEY = "payload"
 JSON key for the payload section of an message. More...
 
static const char * alexaClientSDK::aplCapabilityCommon::test::SEND_INDEX_LIST_DATA = "SendIndexListData"
 The name for SendIndexListData directive. More...
 
static const char * alexaClientSDK::aplCapabilityCommon::test::UPDATE_INDEX_LIST_DATA = "UpdateIndexListData"
 The name for UpdateIndexListData directive. More...
 
static const char * alexaClientSDK::aplCapabilityCommon::test::SEND_TOKEN_LIST_DATA = "SendTokenListData"
 The name for SendTokenListData directive. More...
 
static const NamespaceAndName alexaClientSDK::aplCapabilityCommon::test::DOCUMENT {NAMESPACE, "RenderDocument"}
 The RenderDocument directive signature. More...
 
static const NamespaceAndName alexaClientSDK::aplCapabilityCommon::test::COMMAND {NAMESPACE, "ExecuteCommands"}
 The ExecuteCommands directive signature. More...
 
static const NamespaceAndName alexaClientSDK::aplCapabilityCommon::test::INDEX_LIST_DATA {NAMESPACE, SEND_INDEX_LIST_DATA}
 The SendIndexListData directive signature. More...
 
static const NamespaceAndName alexaClientSDK::aplCapabilityCommon::test::INDEX_LIST_UPDATE {NAMESPACE, UPDATE_INDEX_LIST_DATA}
 The UpdateIndexListData directive signature. More...
 
static const NamespaceAndName alexaClientSDK::aplCapabilityCommon::test::TOKEN_LIST_DATA {NAMESPACE, SEND_TOKEN_LIST_DATA}
 The SendTokenListData directive signature. More...
 
static const char alexaClientSDK::aplCapabilityCommon::test::SKILL_ID [] = "skillId"
 Identifier for the skilld in presentationSession. More...
 
static const char alexaClientSDK::aplCapabilityCommon::test::PRESENTATION_SESSION_ID [] = "id"
 Identifier for the id in presentationSession. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::DOCUMENT_APL_PAYLOAD
 A RenderDocument directive with APL payload. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::DOCUMENT_APL_PAYLOAD_2
 A 2nd RenderDocument directive with APL payload. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::DOCUMENT_APL_PAYLOAD_MISSING_TIMEOUTTYPE
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::DOCUMENT_APL_PAYLOAD_INVALID_TIMEOUTTYPE
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::DOCUMENT_APL_PAYLOAD_MALFORMED
 A malformed RenderDocument directive with APL payload without presentationToken. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::DOCUMENT_APL_PAYLOAD_MALFORMED_2
 A malformed RenderDocument directive with APL payload without document. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::EXECUTE_COMMAND_PAYLOAD_MALFORMED
 A malformed ExecuteCommand directive with APL payload without commands. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::EXECUTE_COMMAND_PAYLOAD_MALFORMED_2
 A malformed ExecuteCommand directive with APL payload without presentationToken. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::EXECUTE_COMMAND_PAYLOAD
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::SETTINGS_CONFIG
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::WINDOW_ID = "WINDOW_ID"
 Test window ID. More...
 
static const unsigned int alexaClientSDK::aplCapabilityCommon::test::STATE_REQUEST_TOKEN = 1
 A visual state request token. More...
 
static const unsigned int alexaClientSDK::aplCapabilityCommon::test::PROACTIVE_STATE_REQUEST_TOKEN = 0
 A state request token for a proactive state request. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::APL_TOKEN = "APL_TOKEN"
 APL_TOKEN used in documents. More...
 
static const char *const alexaClientSDK::aplCapabilityCommon::test::APL_TOKEN_2 = "APL_TOKEN_2"
 APL_TOKEN_2 used in documents. More...
 
static const std::string alexaClientSDK::aplCapabilityCommon::test::TEST_METRIC_NAME = "APLCATest"
 Metric name for the test CA. More...
 
static std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > alexaClientSDK::aplCapabilityCommon::test::metricRecorder
 Metric recorder shared ptr. More...
 
std::mutex alexaClientSDK::aplCapabilityCommon::test::m
 
std::condition_variable alexaClientSDK::aplCapabilityCommon::test::conditionVariable
 

Macro Definition Documentation

◆ LX

#define LX (   event)    alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)

Create a LogEntry using this file's TAG and the specified event string.

Parameters
Theevent string for this LogEntry.

◆ TAG

#define TAG   "BaseAPLCapabilityAgentTest"

String to identify log entries originating from this file.

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