From 81ea38d19c7fd3bc1392624d8ada0e8e54e05e61 Mon Sep 17 00:00:00 2001 From: Krzysztof Jackiewicz Date: Tue, 18 Dec 2012 09:56:26 +0100 Subject: [PATCH] Unit test for custom handler dao stub [Issue#] N/A [Feature] Custom handlers implementation test [Problem] N/A [Cause] N/A [Solution] Basic test implemented [Verification] Successfull compilation. Test should pass. Change-Id: I23a89ed881a8181be75d328cf056ab872a9e6d30 --- tests/dao/CMakeLists.txt | 4 ++-- tests/dao/TestCases_CustomHandlerDAO.cpp | 35 ++++++++++++++++++++++++++++++++ tests/dao/tests_dao.cpp | 3 +++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 tests/dao/TestCases_CustomHandlerDAO.cpp diff --git a/tests/dao/CMakeLists.txt b/tests/dao/CMakeLists.txt index 8b0a964..75ff334 100644 --- a/tests/dao/CMakeLists.txt +++ b/tests/dao/CMakeLists.txt @@ -20,12 +20,12 @@ # common part FILE(GLOB DAO_TESTS_SOURCES "${PROJECT_SOURCE_DIR}/tests/dao/*DAO.cpp") - +MESSAGE(STATUS "DAO_TESTS_SOURCES: ${DAO_TESTS_SOURCES}") # target wrt-tests-dao SET(TARGET_DAO_TEST "wrt-tests-dao") WRT_TEST_INCLUDE_DIRECTORIES(${TARGET_DAO_TEST} ${PROJECT_SOURCE_DIR}/modules/support/) -WRT_TEST_ADD_INTERNAL_DEPENDENCIES(${TARGET_DAO_TEST} ${TARGET_WRT_DAO_RW_LIB}) +WRT_TEST_ADD_INTERNAL_DEPENDENCIES(${TARGET_DAO_TEST} ${TARGET_WRT_DAO_RW_LIB} ${TARGET_CUSTOM_HANDLER_DAO_RW_LIB}) WRT_TEST_BUILD(${TARGET_DAO_TEST} ${DAO_TESTS_SOURCES} tests_dao.cpp) WRT_TEST_INSTALL(${TARGET_DAO_TEST}) diff --git a/tests/dao/TestCases_CustomHandlerDAO.cpp b/tests/dao/TestCases_CustomHandlerDAO.cpp new file mode 100644 index 0000000..cfc820e --- /dev/null +++ b/tests/dao/TestCases_CustomHandlerDAO.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file TestCases_CustomHandlerDAO.cpp + * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) + * @version 1.0 + * @brief This file contains tests for custom handler dao class. + */ + +#include +#include +#include +#include + +using namespace CustomHandlerDB; + +RUNNER_TEST_GROUP_INIT(DAO) + +RUNNER_TEST(custom_handler_dao_basic) +{ + CustomHandlerDAO dao(L"test"); +} diff --git a/tests/dao/tests_dao.cpp b/tests/dao/tests_dao.cpp index 0b32edb..5d0422f 100644 --- a/tests/dao/tests_dao.cpp +++ b/tests/dao/tests_dao.cpp @@ -23,6 +23,7 @@ #include #include #include +#include int main (int argc, char *argv[]) { @@ -34,10 +35,12 @@ int main (int argc, char *argv[]) } WrtDB::WrtDatabase::attachToThreadRW(); + CustomHandlerDB::Interface::attachDatabaseRW(); LogInfo("Starting tests"); int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv); + CustomHandlerDB::Interface::detachDatabase(); WrtDB::WrtDatabase::detachFromThread(); ret = system("/usr/bin/wrt_dao_tests_prepare_db.sh stop"); -- 2.7.4