AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | List of all members
alexaClientSDK::integration::test::TestDirectiveHandler Class Reference

#include <TestDirectiveHandler.h>

Inheritance diagram for alexaClientSDK::integration::test::TestDirectiveHandler:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::integration::test::TestDirectiveHandler:
Collaboration graph
[legend]

Classes

class  DirectiveParams
 

Public Member Functions

 TestDirectiveHandler (avsCommon::avs::DirectiveHandlerConfiguration config)
 
void handleDirectiveImmediately (std::shared_ptr< avsCommon::avs::AVSDirective > directive) override
 
void preHandleDirective (std::shared_ptr< avsCommon::avs::AVSDirective > directive, std::unique_ptr< avsCommon::sdkInterfaces::DirectiveHandlerResultInterface > result) override
 
bool handleDirective (const std::string &messageId) override
 
void cancelDirective (const std::string &messageId) override
 
avsCommon::avs::DirectiveHandlerConfiguration getConfiguration () const override
 
void onDeregistered () override
 
DirectiveParams waitForNext (const std::chrono::seconds duration)
 
- 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
 

Detailed Description

TestDirectiveHandler is a mock of the DirectiveHandlerInterface and allows tests to wait for invocations upon those interfaces and inspect the parameters of those invocations.

Constructor & Destructor Documentation

◆ TestDirectiveHandler()

alexaClientSDK::integration::test::TestDirectiveHandler::TestDirectiveHandler ( avsCommon::avs::DirectiveHandlerConfiguration  config)

Constructor.

Parameters
configThe avsCommon::avs::DirectiveHandlerConfiguration for the directive handler for registering with a directive sequencer.

Member Function Documentation

◆ cancelDirective()

void alexaClientSDK::integration::test::TestDirectiveHandler::cancelDirective ( const std::string &  messageId)
overridevirtual

Cancel an ongoing preHandleDirective() or handleDirective() operation for the specified AVSDirective. Once this has been called the DirectiveHandler 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
messageIdThe message ID of a directive previously passed to preHandleDirective().

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

◆ getConfiguration()

avsCommon::avs::DirectiveHandlerConfiguration alexaClientSDK::integration::test::TestDirectiveHandler::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()

bool alexaClientSDK::integration::test::TestDirectiveHandler::handleDirective ( const std::string &  messageId)
overridevirtual

Handle the action specified by the directive identified by messageId. The handling of subsequent directives with the same DialogRequestId may be blocked until the DirectiveHandler calls the setSucceeded() method of the DirectiveHandlingResult instance passed in to the preHandleDirective() call for the directive specified by messageId. If handling of this directive fails such that subsequent directives with the same DialogRequestId should be cancelled, this DirectiveHandler should instead call setFailed() to indicate a failure.

Note
If this operation fails, an ExceptionEncountered message should be sent to AVS.
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
messageIdThe message ID of a directive previously passed to preHandleDirective().
Returns
false when messageId is not recognized, else true. Any errors related to handling of a valid messageId should be reported using DirectiveHandlerResultInterface::setFailed().

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

◆ handleDirectiveImmediately()

void alexaClientSDK::integration::test::TestDirectiveHandler::handleDirectiveImmediately ( std::shared_ptr< avsCommon::avs::AVSDirective directive)
override

◆ onDeregistered()

void alexaClientSDK::integration::test::TestDirectiveHandler::onDeregistered ( )
overridevirtual

Notification that this handler has been de-registered and will not receive any more calls.

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

◆ preHandleDirective()

void alexaClientSDK::integration::test::TestDirectiveHandler::preHandleDirective ( std::shared_ptr< avsCommon::avs::AVSDirective directive,
std::unique_ptr< avsCommon::sdkInterfaces::DirectiveHandlerResultInterface result 
)
override

◆ waitForNext()

TestDirectiveHandler::DirectiveParams alexaClientSDK::integration::test::TestDirectiveHandler::waitForNext ( const std::chrono::seconds  duration)

Function to retrieve the next DirectiveParams in the test queue or time out if the queue is empty. Takes a duration in seconds to wait before timing out.


The documentation for this class was generated from the following files:

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