diff --git a/services/tunnelbroker/test/DatabaseManagerTest.cpp b/services/tunnelbroker/test/DatabaseManagerTest.cpp --- a/services/tunnelbroker/test/DatabaseManagerTest.cpp +++ b/services/tunnelbroker/test/DatabaseManagerTest.cpp @@ -22,3 +22,31 @@ Aws::ShutdownAPI({}); } }; + +TEST_F(DatabaseManagerTest, TestOperationsOnDeviceSessionItem) { + const database::DeviceSessionItem item( + tools::generateUUID(), + "mobile:" + tools::generateRandomString(DEVICEID_CHAR_LENGTH), + tools::generateRandomString(451), + tools::generateRandomString(64), + tools::generateRandomString(12), + tools::generateRandomString(12), + tools::generateRandomString(12)); + EXPECT_EQ( + database::DatabaseManager::getInstance().isTableAvailable( + item.getTableName()), + true); + database::DatabaseManager::getInstance().putSessionItem(item); + std::shared_ptr foundItem = + database::DatabaseManager::getInstance().findSessionItem( + item.getSessionID()); + EXPECT_NE(foundItem, nullptr); + EXPECT_EQ(item.getDeviceID(), foundItem->getDeviceID()); + EXPECT_EQ(item.getPubKey(), foundItem->getPubKey()); + EXPECT_EQ(item.getNotifyToken(), foundItem->getNotifyToken()); + EXPECT_EQ(item.getDeviceType(), foundItem->getDeviceType()); + EXPECT_EQ(item.getAppVersion(), foundItem->getAppVersion()); + EXPECT_EQ(item.getDeviceOs(), foundItem->getDeviceOs()); + database::DatabaseManager::getInstance().removeSessionItem( + item.getSessionID()); +}