AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Functions | Variables
AssetManagerInitTest.cpp File Reference
#include <rapidjson/document.h>
#include <rapidjson/istreamwrapper.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
#include "AssetManagerTest.h"
Include dependency graph for AssetManagerInitTest.cpp:

Classes

struct  MetadataFileState
 
class  InitTest
 

Functions

 TEST_P (InitTest, AssetManagerRestarts)
 
 INSTANTIATE_TEST_CASE_P (RequestersTestCases, InitTest, ValuesIn< vector< MetadataFileState >>({{REQUESTER_VALID, RESOURCE_VALID, WILL_LOAD, "Loading a valid requester will succeed"}, {REQUESTER_EMPTY_TYPE, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with empty type will fail"}, {REQUESTER_MISSING_TYPE, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with missing type will fail"}, {REQUESTER_EMPTY_KEY, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with empty key will fail"}, {REQUESTER_MISSING_KEY, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with missing key will fail"}, {REQUESTER_EMPTY_FILTER_KEY, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with empty filter_key will fail"}, {REQUESTER_INVALID_FILTER_VALUE, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with invalid filter_value will fail"}, {REQUESTER_MISSING_FILTER_VALUE, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with missing filter_value will fail"}, {REQUESTER_INVALID_ENDPOINT, RESOURCE_VALID, WILL_LOAD, "Loading requester with invalid endpoint will succeed"}, {REQUESTER_EMPTY_ENDPOINT, RESOURCE_VALID, WILL_LOAD, "Loading requester with empty endpoint will succeed"}, {REQUESTER_MISSING_ENDPOINT, RESOURCE_VALID, WILL_LOAD, "Loading requester with missing endpoint will succeed"}, {REQUESTER_INVALID_UNPACK, RESOURCE_VALID, WILL_LOAD, "Loading requester with invalid unpack will succeed"}, {REQUESTER_MISSING_UNPACK, RESOURCE_VALID, WILL_LOAD, "Loading requester with missing unpack will succeed"}, {REQUESTER_EMPTY_RESOURCE_ID, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with empty resource id will fail"}, {REQUESTER_MISSING_RESOURCE_ID, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with missing resource id will fail"}, {REQUESTER_INVALID_PRIORITY, RESOURCE_VALID, WILL_LOAD, "Loading requester with invalid priority will succeed"}, {REQUESTER_EMPTY_PRIORITY, RESOURCE_VALID, WILL_LOAD, "Loading requester with empty priority will succeed"}, {REQUESTER_MISSING_PRIORITY, RESOURCE_VALID, WILL_LOAD, "Loading requester with missing priority will succeed"}, {REQUESTER_EMPTY_TIMESTAMP, RESOURCE_VALID, WILL_LOAD, "Loading requester with empty timestamp will succeed"}, {REQUESTER_MISSING_TIMESTAMP, RESOURCE_VALID, WILL_LOAD, "Loading requester with missing timestamp will succeed"} }), PrintDescription())
 
 INSTANTIATE_TEST_CASE_P (ResourceTestCases, InitTest, ValuesIn< vector< MetadataFileState >>({{REQUESTER_VALID, RESOURCE_VALID, WILL_LOAD, "Loading a valid resource will succeed"}, {REQUESTER_VALID, RESOURCE_EMPTY_ID, WILL_LOAD, "Loading a resource with empty id will succeed"}, {REQUESTER_VALID, RESOURCE_MISSING_ID, WILL_LOAD, "Loading a resource with missing id will succeed"}, {REQUESTER_VALID, RESOURCE_EMPTY_SIZE, WILL_LOAD, "Loading a resource with empty size will succeed"}, {REQUESTER_VALID, RESOURCE_MISSING_SIZE, WILL_LOAD, "Loading a resource with missing size will succeed"}, {REQUESTER_VALID, RESOURCE_EMPTY_NAME, WILL_LOAD, "Loading a resource with empty name will succeed"}, {REQUESTER_VALID, RESOURCE_MISSING_NAME, WILL_LOAD, "Loading a resource with missing name will succeed"} }), PrintDescription())
 

Variables

static constexpr bool WILL_LOAD = true
 
static constexpr bool WILL_BE_ERASED = false
 
static auto REQUESTER_VALID = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_EMPTY_TYPE = R"({"artifactType":"", "artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_MISSING_TYPE = R"({ "artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_EMPTY_KEY = R"({"artifactType":"T","artifactKey":"", "filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_MISSING_KEY = R"({"artifactType":"T", "filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_EMPTY_FILTER_KEY = R"({"artifactType":"T","artifactKey":"K","filters":{"" :["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_INVALID_FILTER_VALUE = R"({"artifactType":"T","artifactKey":"K","filters":{"F" :[]}, "endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_MISSING_FILTER_VALUE = R"({"artifactType":"T","artifactKey":"K", "endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_INVALID_ENDPOINT = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":9, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_EMPTY_ENDPOINT = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":"","unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_MISSING_ENDPOINT = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]}, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_INVALID_UNPACK = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":"huh","resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_MISSING_UNPACK = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "resourceId":"R","priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_EMPTY_RESOURCE_ID = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"", "priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_MISSING_RESOURCE_ID = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false, "priority":3, "usedTimestamp":10})"
 
static auto REQUESTER_INVALID_PRIORITY = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":7, "usedTimestamp":10})"
 
static auto REQUESTER_EMPTY_PRIORITY = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":"","usedTimestamp":10})"
 
static auto REQUESTER_MISSING_PRIORITY = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R", "usedTimestamp":10})"
 
static auto REQUESTER_EMPTY_TIMESTAMP = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":""})"
 
static auto REQUESTER_MISSING_TIMESTAMP = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3 })"
 
static auto RESOURCE_VALID = R"({"id":"R","size":1 ,"name":"file"})"
 
static auto RESOURCE_EMPTY_ID = R"({"id":"" ,"size":1 ,"name":"file"})"
 
static auto RESOURCE_MISSING_ID = R"({ "size":1 ,"name":"file"})"
 
static auto RESOURCE_EMPTY_SIZE = R"({"id":"R","size":"","name":"file"})"
 
static auto RESOURCE_MISSING_SIZE = R"({"id":"R", "name":"file"})"
 
static auto RESOURCE_EMPTY_NAME = R"({"id":"R","size":1 ,"name":"" })"
 
static auto RESOURCE_MISSING_NAME = R"({"id":"R","size":1 })"
 
static size_t RESOURCE_SIZE = 1
 
static const string RESOURCE_NAME = "file"
 
static const string RESOURCE_ID = "R"
 
static const string RESOURCE_METADATA_JSON = "metadata.json"
 

Function Documentation

◆ INSTANTIATE_TEST_CASE_P() [1/2]

INSTANTIATE_TEST_CASE_P ( RequestersTestCases  ,
InitTest  ,
ValuesIn< vector< MetadataFileState >>  {{REQUESTER_VALID, RESOURCE_VALID, WILL_LOAD, "Loading a valid requester will succeed"}, {REQUESTER_EMPTY_TYPE, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with empty type will fail"}, {REQUESTER_MISSING_TYPE, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with missing type will fail"}, {REQUESTER_EMPTY_KEY, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with empty key will fail"}, {REQUESTER_MISSING_KEY, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with missing key will fail"}, {REQUESTER_EMPTY_FILTER_KEY, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with empty filter_key will fail"}, {REQUESTER_INVALID_FILTER_VALUE, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with invalid filter_value will fail"}, {REQUESTER_MISSING_FILTER_VALUE, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with missing filter_value will fail"}, {REQUESTER_INVALID_ENDPOINT, RESOURCE_VALID, WILL_LOAD, "Loading requester with invalid endpoint will succeed"}, {REQUESTER_EMPTY_ENDPOINT, RESOURCE_VALID, WILL_LOAD, "Loading requester with empty endpoint will succeed"}, {REQUESTER_MISSING_ENDPOINT, RESOURCE_VALID, WILL_LOAD, "Loading requester with missing endpoint will succeed"}, {REQUESTER_INVALID_UNPACK, RESOURCE_VALID, WILL_LOAD, "Loading requester with invalid unpack will succeed"}, {REQUESTER_MISSING_UNPACK, RESOURCE_VALID, WILL_LOAD, "Loading requester with missing unpack will succeed"}, {REQUESTER_EMPTY_RESOURCE_ID, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with empty resource id will fail"}, {REQUESTER_MISSING_RESOURCE_ID, RESOURCE_VALID, WILL_BE_ERASED, "Loading requester with missing resource id will fail"}, {REQUESTER_INVALID_PRIORITY, RESOURCE_VALID, WILL_LOAD, "Loading requester with invalid priority will succeed"}, {REQUESTER_EMPTY_PRIORITY, RESOURCE_VALID, WILL_LOAD, "Loading requester with empty priority will succeed"}, {REQUESTER_MISSING_PRIORITY, RESOURCE_VALID, WILL_LOAD, "Loading requester with missing priority will succeed"}, {REQUESTER_EMPTY_TIMESTAMP, RESOURCE_VALID, WILL_LOAD, "Loading requester with empty timestamp will succeed"}, {REQUESTER_MISSING_TIMESTAMP, RESOURCE_VALID, WILL_LOAD, "Loading requester with missing timestamp will succeed"} },
PrintDescription()   
)

◆ INSTANTIATE_TEST_CASE_P() [2/2]

INSTANTIATE_TEST_CASE_P ( ResourceTestCases  ,
InitTest  ,
ValuesIn< vector< MetadataFileState >>  {{REQUESTER_VALID, RESOURCE_VALID, WILL_LOAD, "Loading a valid resource will succeed"}, {REQUESTER_VALID, RESOURCE_EMPTY_ID, WILL_LOAD, "Loading a resource with empty id will succeed"}, {REQUESTER_VALID, RESOURCE_MISSING_ID, WILL_LOAD, "Loading a resource with missing id will succeed"}, {REQUESTER_VALID, RESOURCE_EMPTY_SIZE, WILL_LOAD, "Loading a resource with empty size will succeed"}, {REQUESTER_VALID, RESOURCE_MISSING_SIZE, WILL_LOAD, "Loading a resource with missing size will succeed"}, {REQUESTER_VALID, RESOURCE_EMPTY_NAME, WILL_LOAD, "Loading a resource with empty name will succeed"}, {REQUESTER_VALID, RESOURCE_MISSING_NAME, WILL_LOAD, "Loading a resource with missing name will succeed"} },
PrintDescription()   
)

◆ TEST_P()

TEST_P ( InitTest  ,
AssetManagerRestarts   
)

Variable Documentation

◆ REQUESTER_EMPTY_ENDPOINT

auto REQUESTER_EMPTY_ENDPOINT = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":"","unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_EMPTY_FILTER_KEY

auto REQUESTER_EMPTY_FILTER_KEY = R"({"artifactType":"T","artifactKey":"K","filters":{"" :["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_EMPTY_KEY

auto REQUESTER_EMPTY_KEY = R"({"artifactType":"T","artifactKey":"", "filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_EMPTY_PRIORITY

auto REQUESTER_EMPTY_PRIORITY = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":"","usedTimestamp":10})"
static

◆ REQUESTER_EMPTY_RESOURCE_ID

auto REQUESTER_EMPTY_RESOURCE_ID = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"", "priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_EMPTY_TIMESTAMP

auto REQUESTER_EMPTY_TIMESTAMP = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":""})"
static

◆ REQUESTER_EMPTY_TYPE

auto REQUESTER_EMPTY_TYPE = R"({"artifactType":"", "artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_INVALID_ENDPOINT

auto REQUESTER_INVALID_ENDPOINT = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":9, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_INVALID_FILTER_VALUE

auto REQUESTER_INVALID_FILTER_VALUE = R"({"artifactType":"T","artifactKey":"K","filters":{"F" :[]}, "endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_INVALID_PRIORITY

auto REQUESTER_INVALID_PRIORITY = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":7, "usedTimestamp":10})"
static

◆ REQUESTER_INVALID_UNPACK

auto REQUESTER_INVALID_UNPACK = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":"huh","resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_MISSING_ENDPOINT

auto REQUESTER_MISSING_ENDPOINT = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]}, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_MISSING_FILTER_VALUE

auto REQUESTER_MISSING_FILTER_VALUE = R"({"artifactType":"T","artifactKey":"K", "endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_MISSING_KEY

auto REQUESTER_MISSING_KEY = R"({"artifactType":"T", "filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_MISSING_PRIORITY

auto REQUESTER_MISSING_PRIORITY = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R", "usedTimestamp":10})"
static

◆ REQUESTER_MISSING_RESOURCE_ID

auto REQUESTER_MISSING_RESOURCE_ID = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false, "priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_MISSING_TIMESTAMP

auto REQUESTER_MISSING_TIMESTAMP = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3 })"
static

◆ REQUESTER_MISSING_TYPE

auto REQUESTER_MISSING_TYPE = R"({ "artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_MISSING_UNPACK

auto REQUESTER_MISSING_UNPACK = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ REQUESTER_VALID

auto REQUESTER_VALID = R"({"artifactType":"T","artifactKey":"K","filters":{"F":["A"]},"endpoint":0, "unpack":false,"resourceId":"R","priority":3, "usedTimestamp":10})"
static

◆ RESOURCE_EMPTY_ID

auto RESOURCE_EMPTY_ID = R"({"id":"" ,"size":1 ,"name":"file"})"
static

◆ RESOURCE_EMPTY_NAME

auto RESOURCE_EMPTY_NAME = R"({"id":"R","size":1 ,"name":"" })"
static

◆ RESOURCE_EMPTY_SIZE

auto RESOURCE_EMPTY_SIZE = R"({"id":"R","size":"","name":"file"})"
static

◆ RESOURCE_ID

const string RESOURCE_ID = "R"
static

◆ RESOURCE_METADATA_JSON

const string RESOURCE_METADATA_JSON = "metadata.json"
static

◆ RESOURCE_MISSING_ID

auto RESOURCE_MISSING_ID = R"({ "size":1 ,"name":"file"})"
static

◆ RESOURCE_MISSING_NAME

auto RESOURCE_MISSING_NAME = R"({"id":"R","size":1 })"
static

◆ RESOURCE_MISSING_SIZE

auto RESOURCE_MISSING_SIZE = R"({"id":"R", "name":"file"})"
static

◆ RESOURCE_NAME

const string RESOURCE_NAME = "file"
static

◆ RESOURCE_SIZE

size_t RESOURCE_SIZE = 1
static

◆ RESOURCE_VALID

auto RESOURCE_VALID = R"({"id":"R","size":1 ,"name":"file"})"
static

◆ WILL_BE_ERASED

constexpr bool WILL_BE_ERASED = false
static

◆ WILL_LOAD

constexpr bool WILL_LOAD = true
static

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