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

Classes

class  DiscoveryUtilsTest
 

Typedefs

using Properties = CapabilityConfiguration::Properties
 Alias for CapabilityConfiguration::Properties. More...
 

Functions

AVSDiscoveryEndpointAttributes getTestEndpointAttributes ()
 
AVSDiscoveryEndpointAttributes createEndpointAttributes (const std::string &endpointId, const std::string &friendlyName, const std::string &description, const std::string &manufacturerName, const std::vector< std::string > &displayCategories)
 
void validateEndpointConfigJson (const std::string &endpointConfigJson)
 
void validateDiscoveryEvent (const std::string &eventJson, const std::string &expectedName, const std::string &expectedAuthToken, const std::vector< std::string > &expectedEndpointIds, const std::string &expectedEventCorrelationToken="")
 
 TEST_F (DiscoveryUtilsTest, test_validateCapabilityConfiguration)
 
 TEST_F (DiscoveryUtilsTest, test_validateAVSDiscoveryEndpointAttributes)
 
 TEST_F (DiscoveryUtilsTest, test_formatEndpointConfigJson)
 
 TEST_F (DiscoveryUtilsTest, test_getDeleteReportEndpointConfigJson)
 
 TEST_F (DiscoveryUtilsTest, test_discoveryAddOrUpdateReportEvent)
 
 TEST_F (DiscoveryUtilsTest, test_deleteReportEvent)
 
 TEST_F (DiscoveryUtilsTest, test_compareEndpointConfigJsons)
 

Variables

static const std::string TEST_TYPE_1 = "TEST_TYPE_1"
 A Test CapabilityConfiguration type. More...
 
static const std::string TEST_INTERFACE_NAME_1 = "TEST_INTERFACE_NAME_1"
 A Test CapabilityConfiguration interface name. More...
 
static const std::string TEST_VERSION_1 = "TEST_VERSION_1"
 A Test CapabilityConfiguration version. More...
 
static const std::string TEST_TYPE_2 = "TEST_TYPE_2"
 A Test CapabilityConfiguration type. More...
 
static const std::string TEST_INTERFACE_NAME_2 = "TEST_INTERFACE_NAME_2"
 A Test CapabilityConfiguration interface name. More...
 
static const std::string TEST_VERSION_2 = "TEST_VERSION_2"
 A Test CapabilityConfiguration version. More...
 
static const Optional< std::string > TEST_INSTANCE_NAME ("TEST_INSTANCE_NAME")
 A Test CapabilityConfiguration instance name. More...
 
static const std::vector< std::string > TEST_SUPPORTED_LIST {"TEST_PROPERTY_1", "TEST_PROPERTY_2"}
 A Test CapabilityConfiguration properties supportedList. More...
 
static const Optional< PropertiesTEST_PROPERTIES = Properties(false, false, TEST_SUPPORTED_LIST)
 A Test CapabilityConfiguration Optional properties. More...
 
static const std::string EXPECTED_TEST_PROPERTIES_STRING
 A Test CapabilityConfiguration supported properties string. More...
 
static const std::string TEST_VALID_CONFIG_JSON = R"({"key":{"key1":"value1"}})"
 A Test valid JSON value. More...
 
static const CapabilityConfiguration::AdditionalConfigurations TEST_ADDITIONAL_CONFIGURATIONS
 A Test CapabilityConfiguration type. More...
 
static const std::string TEST_ENDPOINT_ID = "TEST_ENDPOINT_ID"
 A Test Endpoint Id. More...
 
static const std::string TEST_FRIENDLY_NAME = "TEST_FRIENDLY_NAME"
 A Test Friendly name. More...
 
static const std::string TEST_DESCRIPTION = "TEST_DESCRIPTION"
 A Test description. More...
 
static const std::string TEST_MANUFACTURER_NAME = "TEST_MANUFACTURER_NAME"
 A Test manufacturer name. More...
 
static const std::vector< std::string > TEST_DISPLAY_CATEGORIES = {"TEST_DISPLAY_CATEGORY_1", "TEST_DISPLAY_CATEGORY_2"}
 A Test display category list. More...
 
static const std::string TEST_CUSTOMER_IDENTIFIER = "TEST_CUSTOMER_IDENTIFIER"
 A Test customer identifier. More...
 
static const std::string TEST_SOFTWARE_VERSION = "TEST_SOFTWARE_VERSION"
 A Test software version. More...
 
static const std::string TEST_FIRMWARE_VERSION = "TEST_FIRMWARE_VERSION"
 A Test firmware version. More...
 
static const std::string TEST_SERIAL_NUMBER = "TEST_SERIAL_NUMBER"
 A Test serial number. More...
 
static const std::string TEST_MODEL = "TEST_MODEL"
 A Test model. More...
 
static const std::string TEST_MANUFACTURER = "TEST_MANUFACTURER"
 A Test manufacturer. More...
 
static const std::string TEST_PRODUCT_ID = "TEST_PRODUCT_ID"
 A Test product ID. More...
 
static const std::string TEST_REGISTRATION_KEY = "TEST_REGISTRATION_KEY"
 A Test registration key. More...
 
static const std::string TEST_PRODUCT_ID_KEY = "TEST_PRODUCT_ID_KEY"
 A Test product ID key. More...
 
static const std::string TEST_ENDPOINT_CONFIG = R"({"endpointId":")" + TEST_ENDPOINT_ID + R"("})"
 A Test Endpoint configuration JSON. More...
 
static const std::string TEST_AUTH_TOKEN = "TEST_AUTH_TOKEN"
 A Test auth token. More...
 
static const std::vector< std::map< std::string, std::string > > TEST_CONNECTIONS_DATA
 A test connections data. More...
 
static const std::map< std::string, std::string > TEST_COOKIE_DATA = {{"KEY1", "VALUE1"}, {"KEY2", "VALUE2"}}
 A test cookie data. More...
 
static const std::string ADD_OR_UPDATE_REPORT_EVENT_NAME = "AddOrUpdateReport"
 The expected name that appears in the header of the Discovery.AddOrUpdateReport event. More...
 
static const std::string DELETE_REPORT_EVENT_NAME = "DeleteReport"
 The expected name that appears in the header of the Discovery.DeleteReport event. More...
 

Typedef Documentation

◆ Properties

Alias for CapabilityConfiguration::Properties.

Function Documentation

◆ createEndpointAttributes()

AVSDiscoveryEndpointAttributes alexaClientSDK::capabilitiesDelegate::utils::test::createEndpointAttributes ( const std::string &  endpointId,
const std::string &  friendlyName,
const std::string &  description,
const std::string &  manufacturerName,
const std::vector< std::string > &  displayCategories 
)

Creates an AVSDiscoveryEndpointAttributes structure using the parameters passed in.

Parameters
endpointIdThe endpoint ID string.
friendlyNameThe friendly name string.
descriptionThe description string.
manufacturerNameThe manufacturer name string.
displayCategoriesThe display categories list.
Returns
an AVSDiscoveryEndpointAttributes structure containing the params passed in.

◆ getTestEndpointAttributes()

AVSDiscoveryEndpointAttributes alexaClientSDK::capabilitiesDelegate::utils::test::getTestEndpointAttributes ( )

This method returns a test AVSDiscoveryEndpointAttributes structure.

Returns
a new AVSDiscoveryEndpointAttributes structure containing test fields.

◆ TEST_F() [1/7]

alexaClientSDK::capabilitiesDelegate::utils::test::TEST_F ( DiscoveryUtilsTest  ,
test_validateCapabilityConfiguration   
)

Test if the validateCapabilityConfiguration method works as expected.

Invalid Type

Invalid Interface Name

Invalid Version

Invalid instance name

Invalid supported list

Invalid custom configuration

Valid case with fully loaded CapabilityConfiguration.

◆ TEST_F() [2/7]

alexaClientSDK::capabilitiesDelegate::utils::test::TEST_F ( DiscoveryUtilsTest  ,
test_validateAVSDiscoveryEndpointAttributes   
)

Test if the validateAVSDiscoveryEndpointAttributes method works as expected.

Invalid EndpointID.

Invalid Description

Invalid Manufacturer Name

Invalid Display Categories

Valid Endpoint Attributes

◆ TEST_F() [3/7]

alexaClientSDK::capabilitiesDelegate::utils::test::TEST_F ( DiscoveryUtilsTest  ,
test_formatEndpointConfigJson   
)

Test if the getEndpointConfigJson method works as expected.

Check if endpoint configuration is valid even after flipping the contents of the capabilities array.

◆ TEST_F() [4/7]

alexaClientSDK::capabilitiesDelegate::utils::test::TEST_F ( DiscoveryUtilsTest  ,
test_getDeleteReportEndpointConfigJson   
)

Test Endpoint configuration json for DeleteReport events.

◆ TEST_F() [5/7]

alexaClientSDK::capabilitiesDelegate::utils::test::TEST_F ( DiscoveryUtilsTest  ,
test_discoveryAddOrUpdateReportEvent   
)

Test event format for Discovery.AddOrUpdateReport event.

◆ TEST_F() [6/7]

alexaClientSDK::capabilitiesDelegate::utils::test::TEST_F ( DiscoveryUtilsTest  ,
test_deleteReportEvent   
)

Test event format for Discovery.DeleteReport event.

◆ TEST_F() [7/7]

alexaClientSDK::capabilitiesDelegate::utils::test::TEST_F ( DiscoveryUtilsTest  ,
test_compareEndpointConfigJsons   
)

Contents of the JSON are same.

Elements out of order

Order of arrays doesn't match

◆ validateDiscoveryEvent()

void alexaClientSDK::capabilitiesDelegate::utils::test::validateDiscoveryEvent ( const std::string &  eventJson,
const std::string &  expectedName,
const std::string &  expectedAuthToken,
const std::vector< std::string > &  expectedEndpointIds,
const std::string &  expectedEventCorrelationToken = "" 
)

Parses the JSON and validates if the expected fields for Discovery events are present.

Parameters
eventJsonThe JSON string representation of the event which will be validated.
expectedNameThe expected name of the event.
expectedAuthTokenThe expected authorization token of the event.
expectedEndpointIdsThe expected endpointIds to be sent in the event.
expectedEventCorrelationTokenThe expected eventCorrelationToken that needs to be sent.

header

Payload

Scope

Endpoints

◆ validateEndpointConfigJson()

void alexaClientSDK::capabilitiesDelegate::utils::test::validateEndpointConfigJson ( const std::string &  endpointConfigJson)

Parses the JSON and validates if the expected fields for AVSDiscoveryEndpointAttributes are present.

Parameters
endpointConfigJsonThe JSON string representation of the endpoint attributes which will be validated.

Additional Attributes

Registration

Connections

iterate through connections

Cookie

Capabilities

iterate through capabilities array.

Variable Documentation

◆ ADD_OR_UPDATE_REPORT_EVENT_NAME

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::ADD_OR_UPDATE_REPORT_EVENT_NAME = "AddOrUpdateReport"
static

The expected name that appears in the header of the Discovery.AddOrUpdateReport event.

◆ DELETE_REPORT_EVENT_NAME

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::DELETE_REPORT_EVENT_NAME = "DeleteReport"
static

The expected name that appears in the header of the Discovery.DeleteReport event.

◆ EXPECTED_TEST_PROPERTIES_STRING

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::EXPECTED_TEST_PROPERTIES_STRING
static
Initial value:
=
R"({"supported":[{"name":"TEST_PROPERTY_1"},{"name":"TEST_PROPERTY_2"}],"proactivelyReported":false,"retrievable":false})"

A Test CapabilityConfiguration supported properties string.

◆ TEST_ADDITIONAL_CONFIGURATIONS

const CapabilityConfiguration::AdditionalConfigurations alexaClientSDK::capabilitiesDelegate::utils::test::TEST_ADDITIONAL_CONFIGURATIONS
static
Initial value:
= {
{"configuration", TEST_VALID_CONFIG_JSON}}
static const std::string TEST_VALID_CONFIG_JSON
A Test valid JSON value.
Definition: DiscoveryUtilsTest.cpp:75

A Test CapabilityConfiguration type.

◆ TEST_AUTH_TOKEN

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_AUTH_TOKEN = "TEST_AUTH_TOKEN"
static

A Test auth token.

◆ TEST_CONNECTIONS_DATA

const std::vector<std::map<std::string, std::string> > alexaClientSDK::capabilitiesDelegate::utils::test::TEST_CONNECTIONS_DATA
static
Initial value:
= {{{"CON_1", "DATA_1"}},
{{"CON_2", "DATA_2"}}}

A test connections data.

◆ TEST_COOKIE_DATA

const std::map<std::string, std::string> alexaClientSDK::capabilitiesDelegate::utils::test::TEST_COOKIE_DATA = {{"KEY1", "VALUE1"}, {"KEY2", "VALUE2"}}
static

A test cookie data.

◆ TEST_CUSTOMER_IDENTIFIER

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_CUSTOMER_IDENTIFIER = "TEST_CUSTOMER_IDENTIFIER"
static

A Test customer identifier.

◆ TEST_DESCRIPTION

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_DESCRIPTION = "TEST_DESCRIPTION"
static

A Test description.

◆ TEST_DISPLAY_CATEGORIES

const std::vector<std::string> alexaClientSDK::capabilitiesDelegate::utils::test::TEST_DISPLAY_CATEGORIES = {"TEST_DISPLAY_CATEGORY_1", "TEST_DISPLAY_CATEGORY_2"}
static

A Test display category list.

◆ TEST_ENDPOINT_CONFIG

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_ENDPOINT_CONFIG = R"({"endpointId":")" + TEST_ENDPOINT_ID + R"("})"
static

A Test Endpoint configuration JSON.

◆ TEST_ENDPOINT_ID

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_ENDPOINT_ID = "TEST_ENDPOINT_ID"
static

A Test Endpoint Id.

◆ TEST_FIRMWARE_VERSION

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_FIRMWARE_VERSION = "TEST_FIRMWARE_VERSION"
static

A Test firmware version.

◆ TEST_FRIENDLY_NAME

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_FRIENDLY_NAME = "TEST_FRIENDLY_NAME"
static

A Test Friendly name.

◆ TEST_INSTANCE_NAME

const Optional<std::string> alexaClientSDK::capabilitiesDelegate::utils::test::TEST_INSTANCE_NAME("TEST_INSTANCE_NAME")
static

A Test CapabilityConfiguration instance name.

◆ TEST_INTERFACE_NAME_1

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_INTERFACE_NAME_1 = "TEST_INTERFACE_NAME_1"
static

A Test CapabilityConfiguration interface name.

◆ TEST_INTERFACE_NAME_2

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_INTERFACE_NAME_2 = "TEST_INTERFACE_NAME_2"
static

A Test CapabilityConfiguration interface name.

◆ TEST_MANUFACTURER

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_MANUFACTURER = "TEST_MANUFACTURER"
static

A Test manufacturer.

◆ TEST_MANUFACTURER_NAME

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_MANUFACTURER_NAME = "TEST_MANUFACTURER_NAME"
static

A Test manufacturer name.

◆ TEST_MODEL

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_MODEL = "TEST_MODEL"
static

A Test model.

◆ TEST_PRODUCT_ID

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_PRODUCT_ID = "TEST_PRODUCT_ID"
static

A Test product ID.

◆ TEST_PRODUCT_ID_KEY

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_PRODUCT_ID_KEY = "TEST_PRODUCT_ID_KEY"
static

A Test product ID key.

◆ TEST_PROPERTIES

const Optional<Properties> alexaClientSDK::capabilitiesDelegate::utils::test::TEST_PROPERTIES = Properties(false, false, TEST_SUPPORTED_LIST)
static

A Test CapabilityConfiguration Optional properties.

◆ TEST_REGISTRATION_KEY

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_REGISTRATION_KEY = "TEST_REGISTRATION_KEY"
static

A Test registration key.

◆ TEST_SERIAL_NUMBER

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_SERIAL_NUMBER = "TEST_SERIAL_NUMBER"
static

A Test serial number.

◆ TEST_SOFTWARE_VERSION

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_SOFTWARE_VERSION = "TEST_SOFTWARE_VERSION"
static

A Test software version.

◆ TEST_SUPPORTED_LIST

const std::vector<std::string> alexaClientSDK::capabilitiesDelegate::utils::test::TEST_SUPPORTED_LIST {"TEST_PROPERTY_1", "TEST_PROPERTY_2"}
static

A Test CapabilityConfiguration properties supportedList.

◆ TEST_TYPE_1

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_TYPE_1 = "TEST_TYPE_1"
static

A Test CapabilityConfiguration type.

◆ TEST_TYPE_2

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_TYPE_2 = "TEST_TYPE_2"
static

A Test CapabilityConfiguration type.

◆ TEST_VALID_CONFIG_JSON

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_VALID_CONFIG_JSON = R"({"key":{"key1":"value1"}})"
static

A Test valid JSON value.

◆ TEST_VERSION_1

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_VERSION_1 = "TEST_VERSION_1"
static

A Test CapabilityConfiguration version.

◆ TEST_VERSION_2

const std::string alexaClientSDK::capabilitiesDelegate::utils::test::TEST_VERSION_2 = "TEST_VERSION_2"
static

A Test CapabilityConfiguration version.

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