AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::avsCommon::test::MockCapabilityAgent Class Reference
Inheritance diagram for alexaClientSDK::avsCommon::test::MockCapabilityAgent:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::avsCommon::test::MockCapabilityAgent:
Collaboration graph
[legend]

Public Types

enum  FunctionCalled {
  FunctionCalled::NONE, FunctionCalled::HANDLE_DIRECTIVE_IMMEDIATELY, FunctionCalled::PREHANDLE_DIRECTIVE, FunctionCalled::HANDLE_DIRECTIVE,
  FunctionCalled::CANCEL_DIRECTIVE
}
 

Public Member Functions

 MockCapabilityAgent (const std::string &nameSpace, const std::shared_ptr< MockExceptionEncounteredSender > &m_exceptionSender)
 
 ~MockCapabilityAgent () override
 
void handleDirectiveImmediately (std::shared_ptr< AVSDirective > directive) override
 
void preHandleDirective (std::shared_ptr< DirectiveInfo > info) override
 
void handleDirective (std::shared_ptr< DirectiveInfo > info) override
 
void cancelDirective (std::shared_ptr< DirectiveInfo > info) override
 
avs::DirectiveHandlerConfiguration getConfiguration () const override
 
void testsendExceptionEncounteredAndReportFailed (std::shared_ptr< AVSDirective > directiveIn, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > resultIn)
 
FunctionCalled waitForFunctionCalls (const std::chrono::milliseconds duration=std::chrono::milliseconds(400))
 
const std::pair< std::string, std::string > callBuildJsonEventString (const std::string &eventName, const std::string &dialogRequestIdValue, const std::string &jsonPayloadValue, const std::string &jsonContext)
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
virtual ~CapabilityAgent ()=default
 
void preHandleDirective (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result) override final
 
bool handleDirective (const std::string &messageId) override final
 
void cancelDirective (const std::string &messageId) override final
 
void onDeregistered () override
 
void onFocusChanged (FocusState newFocus, MixingBehavior behavior) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface
virtual ~DirectiveHandlerInterface ()=default
 
virtual void handleDirectiveImmediately (std::shared_ptr< avsCommon::avs::AVSDirective > directive)=0
 
virtual void preHandleDirective (std::shared_ptr< avsCommon::avs::AVSDirective > directive, std::unique_ptr< DirectiveHandlerResultInterface > result)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ChannelObserverInterface
virtual ~ChannelObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface
virtual ~StateProviderInterface ()=default
 
virtual void provideState (const avs::NamespaceAndName &stateProviderName, const ContextRequestToken stateRequestToken)
 
virtual void provideState (const avs::CapabilityTag &stateProviderName, const ContextRequestToken stateRequestToken)
 
virtual bool canStateBeRetrieved ()
 
virtual bool hasReportableStateProperties ()
 
virtual bool shouldQueryState ()
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface
virtual ~ContextRequesterInterface ()=default
 
virtual void onContextAvailable (const std::string &jsonContext)
 
virtual void onContextAvailable (const endpoints::EndpointIdentifier &endpointId, const avs::AVSContext &endpointContext, ContextRequestToken requestToken)
 
virtual void onContextFailure (const ContextRequestError error)
 
virtual void onContextFailure (const ContextRequestError error, ContextRequestToken token)
 

Static Public Member Functions

static std::shared_ptr< MockCapabilityAgentcreate (const std::string &nameSpace, const std::shared_ptr< MockExceptionEncounteredSender > &m_exceptionSender)
 

Additional Inherited Members

- Protected Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
 CapabilityAgent (const std::string &nameSpace, std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender)
 
virtual std::shared_ptr< DirectiveInfocreateDirectiveInfo (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result)
 
void removeDirective (const std::string &messageId)
 
void sendExceptionEncounteredAndReportFailed (std::shared_ptr< DirectiveInfo > info, const std::string &message, avsCommon::avs::ExceptionErrorType type=avsCommon::avs::ExceptionErrorType::INTERNAL_ERROR)
 
const std::pair< std::string, std::string > buildJsonEventString (const std::string &eventName, const std::string &dialogRequestIdString="", const std::string &payload="{}", const std::string &context="") const
 
- Protected Attributes inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
const std::string m_namespace
 The namespace of the capability agent. More...
 
std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterfacem_exceptionEncounteredSender
 Object to use to send exceptionEncountered messages. More...
 

Member Enumeration Documentation

◆ FunctionCalled

Enumerator
NONE 
HANDLE_DIRECTIVE_IMMEDIATELY 
PREHANDLE_DIRECTIVE 
HANDLE_DIRECTIVE 
CANCEL_DIRECTIVE 

Constructor & Destructor Documentation

◆ MockCapabilityAgent()

alexaClientSDK::avsCommon::test::MockCapabilityAgent::MockCapabilityAgent ( const std::string &  nameSpace,
const std::shared_ptr< MockExceptionEncounteredSender > &  m_exceptionSender 
)

MockCapabilityAgent Constructor.

Parameters
nameSpaceThe namespace of the Capability Agent.
m_exceptionSenderThe ExceptionEncounteredSenderInterface instance.

◆ ~MockCapabilityAgent()

alexaClientSDK::avsCommon::test::MockCapabilityAgent::~MockCapabilityAgent ( )
override

Member Function Documentation

◆ callBuildJsonEventString()

const std::pair< std::string, std::string > alexaClientSDK::avsCommon::test::MockCapabilityAgent::callBuildJsonEventString ( const std::string &  eventName,
const std::string &  dialogRequestIdValue,
const std::string &  jsonPayloadValue,
const std::string &  jsonContext 
)

◆ cancelDirective()

void alexaClientSDK::avsCommon::test::MockCapabilityAgent::cancelDirective ( std::shared_ptr< DirectiveInfo info)
overridevirtual

Cancel an ongoing preHandleDirective() or handleDirective() operation for the AVSDirective in . Once this has been called the CapabilityAgent should not expect to receive further calls regarding this directive.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ create()

std::shared_ptr< MockCapabilityAgent > alexaClientSDK::avsCommon::test::MockCapabilityAgent::create ( const std::string &  nameSpace,
const std::shared_ptr< MockExceptionEncounteredSender > &  m_exceptionSender 
)
static

Creates an instance of the MockCapabilityAgent.

Parameters
nameSpaceThe namespace of the Capability Agent.
m_exceptionSenderThe ExceptionEncounteredSenderInterface instance.
Returns
A shared pointer to an instance of the MockCapabilityAgent.

◆ getConfiguration()

avs::DirectiveHandlerConfiguration alexaClientSDK::avsCommon::test::MockCapabilityAgent::getConfiguration ( ) const
overridevirtual

Returns the configuration of the directive handler.

The configuration consists of multiple directive routing rules and their respective blocking policy. The directives will be matched from the most specific rule (with all fields defined) to the least specific rule (which only matches the directive endpointId).

Returns
The avs::DirectiveHandlerConfiguration of the handler.

Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.

◆ handleDirective()

void alexaClientSDK::avsCommon::test::MockCapabilityAgent::handleDirective ( std::shared_ptr< DirectiveInfo info)
overridevirtual

Handle the action specified by the AVSDirective in info. The handling of subsequent directives with the same DialogRequestId may be blocked until the DirectiveHandler calls the setSucceeded() method of the DirectiveHandlingResult present in info. If handling of this directive fails setFailed() should be called to indicate a failure.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ handleDirectiveImmediately()

void alexaClientSDK::avsCommon::test::MockCapabilityAgent::handleDirectiveImmediately ( std::shared_ptr< AVSDirective directive)
override

◆ preHandleDirective()

void alexaClientSDK::avsCommon::test::MockCapabilityAgent::preHandleDirective ( std::shared_ptr< DirectiveInfo info)
overridevirtual

Notification that a directive has arrived. This notification gives the DirectiveHandler a chance to prepare for handling of an AVSDirective. If an error occurs during the pre-Handling phase and that error should cancel the handling of subsequent AVSDirectives with the same DialogRequestId, the DirectiveHandler should call the setFailed method on the result instance passed in to this call.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ testsendExceptionEncounteredAndReportFailed()

void alexaClientSDK::avsCommon::test::MockCapabilityAgent::testsendExceptionEncounteredAndReportFailed ( std::shared_ptr< AVSDirective directiveIn,
std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface resultIn 
)

Wrapper function to test protected method sendExceptionEncounteredAndReportFailed

Parameters
directiveInThe AVSDirective to pass to sendExceptionEncounteredAndReportFailed.
resultInThe DirectiveHandlerResultInterface to pass to sendExceptionEncounteredAndReportFailed.

◆ waitForFunctionCalls()

MockCapabilityAgent::FunctionCalled alexaClientSDK::avsCommon::test::MockCapabilityAgent::waitForFunctionCalls ( const std::chrono::milliseconds  duration = std::chrono::milliseconds(400))

The documentation for this class was generated from the following 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