Unit test for custom handler dao stub
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 18 Dec 2012 08:56:26 +0000 (09:56 +0100)
committerGerrit Code Review <gerrit2@kim11>
Wed, 19 Dec 2012 14:10:42 +0000 (23:10 +0900)
[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
tests/dao/TestCases_CustomHandlerDAO.cpp [new file with mode: 0644]
tests/dao/tests_dao.cpp

index 8b0a964a59d4dc0d73efa131b51f8585b9724b60..75ff334aa39bf40eef4890d4f7a487f1b82f7eed 100644 (file)
 
 # 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 (file)
index 0000000..cfc820e
--- /dev/null
@@ -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 <dpl/test/test_runner.h>
+#include <dpl/foreach.h>
+#include <wrt-commons/custom-handler-dao-rw/custom_handler_dao.h>
+#include <wrt-commons/custom-handler-dao-ro/common_dao_types.h>
+
+using namespace CustomHandlerDB;
+
+RUNNER_TEST_GROUP_INIT(DAO)
+
+RUNNER_TEST(custom_handler_dao_basic)
+{
+    CustomHandlerDAO dao(L"test");
+}
index 0b32edbb3e7ed1c8bee4e22bc931ad0cf8800ae1..5d0422f1c91af2b0b2bb0fca092155f68402fca6 100644 (file)
@@ -23,6 +23,7 @@
 #include <dpl/test/test_runner.h>
 #include <dpl/log/log.h>
 #include <dpl/wrt-dao-ro/WrtDatabase.h>
+#include <wrt-commons/custom-handler-dao-ro/CustomHandlerDatabase.h>
 
 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");