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

Public Member Functions

void SetUp ()
 SetUp before each test case. More...
 
void TearDown ()
 TearDown after each test case. More...
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 

Protected Member Functions

void closeAndDeleteDB ()
 Cleanup function to close and delete the database. More...
 
bool createLegacyDatabase ()
 Function to create legacy database. More...
 
bool insertEntryLegacy (const std::string &uuid, const std::string &mac)
 Insert Entry for legacy database. More...
 
bool setupDatabase (bool migratedDatabase)
 
void getOrderedMacHelper (bool ascending)
 
void getRowsHelper (std::function< bool(SQLiteBluetoothStorage &, std::unordered_map< std::string, std::string > *)> retrieveRows, const std::unordered_map< std::string, std::string > &macToUuids, const std::unordered_map< std::string, std::string > &expected)
 
void getRetrieveValueHelper (std::function< bool(SQLiteBluetoothStorage &, const std::string &, std::string *)> retrieveValue, const std::string &key, const std::string &expectedValue, const std::unordered_map< std::string, std::string > &macToUuids)
 
- Protected Member Functions inherited from testing::Test
 Test ()
 

Protected Attributes

std::unique_ptr< SQLiteBluetoothStoragem_db
 The database instance. Protected because it needs to be accessed in test cases. More...
 
std::unique_ptr< alexaClientSDK::storage::sqliteStorage::SQLiteDatabasem_sqLiteDb
 SQLiteDatabase instance. More...
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 

Member Function Documentation

◆ closeAndDeleteDB()

void alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::closeAndDeleteDB ( )
protected

Cleanup function to close and delete the database.

◆ createLegacyDatabase()

bool alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::createLegacyDatabase ( )
protected

Function to create legacy database.

◆ getOrderedMacHelper()

void alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::getOrderedMacHelper ( bool  ascending)
protected

Helper function that abstracts the test logic for getOrderedMac teste cases.

Parameters
ascendingWhether we're testing the ascending or descending case.

◆ getRetrieveValueHelper()

void alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::getRetrieveValueHelper ( std::function< bool(SQLiteBluetoothStorage &, const std::string &, std::string *)>  retrieveValue,
const std::string &  key,
const std::string &  expectedValue,
const std::unordered_map< std::string, std::string > &  macToUuids 
)
protected

Helper function that abstracts the logic for insertByMac given a macToUuids map and verifies the expected value with the one returned by the retrieveValue function.

Parameters
retrieveValuefunction to retrieve value from database (getMac/getUuid/getCategory).
keyThe key (either the mac or uuid).
expectedValueThe expected value from the given retrieveValue function call.
macToUuidsA map of macToUuids to initialize the database with.

◆ getRowsHelper()

void alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::getRowsHelper ( std::function< bool(SQLiteBluetoothStorage &, std::unordered_map< std::string, std::string > *)>  retrieveRows,
const std::unordered_map< std::string, std::string > &  macToUuids,
const std::unordered_map< std::string, std::string > &  expected 
)
protected

Helper function that abstracts the logic for getMacToUuid and getUuidToMac test cases.

Parameters
retrieveRowsEither the getMacToUuid or getUuidToMac function.
macToUuidsA map of macToUuids to initialize the database with.
expectedThe expected results.

◆ insertEntryLegacy()

bool alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::insertEntryLegacy ( const std::string &  uuid,
const std::string &  mac 
)
protected

Insert Entry for legacy database.

◆ SetUp()

void alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::SetUp ( )
virtual

SetUp before each test case.

Reimplemented from testing::Test.

◆ setupDatabase()

bool alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::setupDatabase ( bool  migratedDatabase)
protected

Helper function to setup database.

Parameters
migratedWhether using migrated database.
Returns
bool Whether database setup successful.

◆ TearDown()

void alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::TearDown ( )
virtual

TearDown after each test case.

Reimplemented from testing::Test.

Member Data Documentation

◆ m_db

std::unique_ptr<SQLiteBluetoothStorage> alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::m_db
protected

The database instance. Protected because it needs to be accessed in test cases.

◆ m_sqLiteDb

std::unique_ptr<alexaClientSDK::storage::sqliteStorage::SQLiteDatabase> alexaClientSDK::acsdkBluetooth::test::SQLiteBluetoothStorageTest::m_sqLiteDb
protected

SQLiteDatabase instance.


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