SET(TARGET_CERTIFICATE_DAO_LIB "wrt-commons-certificate-dao")
SET(TARGET_DPL_UTILS_EFL "lib${PROJECT_NAME}-utils-efl")
SET(TARGET_DPL_ENCRYPTION "lib${PROJECT_NAME}-encryption")
+SET(TARGET_I18N_DAO_RO_LIB "wrt-commons-i18n-dao-ro")
macro(configure_and_install_pkg PKG_FILE)
CONFIGURE_FILE(${PKG_FILE}.in ${PKG_FILE} @ONLY)
ADD_SUBDIRECTORY(support)
ADD_SUBDIRECTORY(encryption)
ADD_SUBDIRECTORY(certificate_dao)
+ADD_SUBDIRECTORY(i18n)
--- /dev/null
+# 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 CMakeLists.txt
+# @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+# @brief
+#
+
+configure_and_install_pkg(wrt-commons-i18n-dao-ro.pc)
--- /dev/null
+prefix=/usr
+exec_prefix=${prefix}
+
+libdir=${prefix}/lib
+includedir=${prefix}/include
+Name: wrt-commons-i18n-dao-ro
+Description: wrt-commons-i18n-dao-ro
+
+Version: @VERSION@
+Requires: dpl-efl
+Libs: -lwrt-commons-i18n-dao-ro -L${libdir}
+Cflags: -I${includedir}/dpl-efl
create_db $name $DB_PATH
done
-for name in wrt_custom_handler
+for name in wrt_custom_handler wrt_i18n
do
create_db $name $DB_USER_PATH
done
ADD_SUBDIRECTORY(security_origin_dao)
ADD_SUBDIRECTORY(custom_handler_dao)
ADD_SUBDIRECTORY(certificate_dao)
+ADD_SUBDIRECTORY(i18n)
include(utils/config.cmake)
include(localization/config.cmake)
include(support/config.cmake)
--- /dev/null
+ADD_SUBDIRECTORY(dao)
--- /dev/null
+SET(TARGET_I18N_DAO_DB "Sqlite3DbI18n")
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_BINARY_DIR}/modules/i18n/dao/database_checksum_i18n.h
+ COMMAND ${CMAKE_SOURCE_DIR}/modules/i18n/dao/orm/gen_db_md5.sh
+ ARGS ${CMAKE_BINARY_DIR}/modules/i18n/dao/database_checksum_i18n.h
+ ${CMAKE_SOURCE_DIR}/modules/i18n/dao/orm/iana_db
+ DEPENDS ${CMAKE_SOURCE_DIR}/modules/i18n/dao/orm/iana_db
+ ${CMAKE_SOURCE_DIR}/modules/i18n/dao/orm/gen_db_md5.sh
+ COMMENT "Generating WRT i18n database checksum"
+ )
+
+ADD_CUSTOM_COMMAND( OUTPUT .wrt_i18n.db
+ COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/.wrt_i18n.db
+ COMMAND gcc -Wall -include ${CMAKE_BINARY_DIR}/modules/i18n/dao/database_checksum_i18n.h -I${PROJECT_SOURCE_DIR}/modules/db/include -I${PROJECT_SOURCE_DIR}/modules/i18n/dao/orm -E ${PROJECT_SOURCE_DIR}/modules/i18n/dao/orm/i18n_db_sql_generator.h | grep --invert-match "^#" > ${CMAKE_CURRENT_BINARY_DIR}/wrt_i18n_db.sql
+ COMMAND sqlite3 ${CMAKE_CURRENT_BINARY_DIR}/.wrt_i18n.db ".read ${CMAKE_CURRENT_BINARY_DIR}/wrt_i18n_db.sql" || rm -f ${CMAKE_CURRENT_BINARY_DIR}/.wrt_i18n.db
+ DEPENDS ${CMAKE_BINARY_DIR}/modules/i18n/dao/database_checksum_i18n.h ${PROJECT_SOURCE_DIR}/modules/i18n/dao/orm/i18n_db_sql_generator.h ${PROJECT_SOURCE_DIR}/modules/i18n/dao/orm/iana_db
+ )
+
+ADD_CUSTOM_COMMAND( OUTPUT .wrt_i18n.db-journal
+ COMMAND touch
+ ARGS ${CMAKE_CURRENT_BINARY_DIR}/.wrt_i18n.db-journal
+ )
+
+ADD_CUSTOM_TARGET(${TARGET_I18N_DAO_DB} ALL DEPENDS .wrt_i18n.db .wrt_i18n.db-journal)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wrt_i18n_db.sql DESTINATION share/wrt-engine/)
+
+###############################################################################
+
+SET(I18N_DAO_INCLUDE_DIRS
+ ${PROJECT_SOURCE_DIR}/modules/i18n/dao/include
+ ${PROJECT_SOURCE_DIR}/modules/i18n/dao/orm
+ ${PROJECT_SOURCE_DIR}/modules/core/include
+ ${PROJECT_SOURCE_DIR}/modules/db/include
+ ${PROJECT_SOURCE_DIR}/modules/log/include
+)
+
+
+SET(I18N_DAO_RO_SOURCES
+ src/i18n_database.cpp
+ src/i18n_dao_read_only.cpp
+)
+
+INCLUDE_DIRECTORIES(${I18N_DAO_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(SYSTEM ${I18N_DAO_DEPS_INCLUDE_DIRS})
+
+ADD_LIBRARY(${TARGET_I18N_DAO_RO_LIB} SHARED ${I18N_DAO_RO_SOURCES})
+SET_TARGET_PROPERTIES(${TARGET_I18N_DAO_RO_LIB} PROPERTIES SOVERSION ${API_VERSION} VERSION ${VERSION})
+SET_TARGET_PROPERTIES(${TARGET_I18N_DAO_RO_LIB} PROPERTIES COMPILE_FLAGS "-include ${CMAKE_BINARY_DIR}/modules/i18n/dao/database_checksum_i18n.h")
+TARGET_LINK_LIBRARIES(${TARGET_I18N_DAO_RO_LIB} ${TARGET_DPL_DB_EFL})
+ADD_DEPENDENCIES(${TARGET_I18N_DAO_RO_LIB} ${TARGET_I18N_DAO_DB})
+
+INSTALL(TARGETS ${TARGET_I18N_DAO_RO_LIB} DESTINATION lib)
+
+INSTALL(FILES
+ include/wrt-commons/i18n-dao-ro/i18n_database.h
+ include/wrt-commons/i18n-dao-ro/i18n_dao_read_only.h
+ DESTINATION include/dpl-efl/wrt-commons/i18n-dao-ro
+)
--- /dev/null
+/*
+ * 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.
+ */
+/**
+ * This file contains the declaration of i18n dao namespace.
+ *
+ * @file i18n_dao_read_only.h
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief This file contains the declaration of i18n dao.
+ */
+
+#ifndef _I18N_DAO_READ_ONLY_H_
+#define _I18N_DAO_READ_ONLY_H_
+
+#include <dpl/string.h>
+
+namespace I18n {
+namespace DB {
+namespace I18nDAOReadOnly {
+bool IsValidSubTag(const DPL::String& tag, int type);
+} // namespace I18nDAOReadOnly
+} // namespace DB
+} // namespace I18n
+
+#endif // _I18N_DAO_READ_ONLY_H_
+
--- /dev/null
+/*
+ * 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.
+ */
+
+#ifndef _I18N_DATABASE_H_
+#define _I18N_DATABASE_H_
+
+#include <dpl/thread.h>
+#include <dpl/mutex.h>
+#include <dpl/db/thread_database_support.h>
+
+namespace I18n {
+namespace DB {
+namespace Interface {
+void attachDatabaseRO();
+void detachDatabase();
+
+extern DPL::Mutex g_dbQueriesMutex;
+extern DPL::DB::ThreadDatabaseSupport g_dbInterface;
+} // namespace Interface
+} // namespace DB
+} // namespace I18n
+
+#define I18N_DB_INTERNAL(tlsCommand, InternalType) \
+ static DPL::ThreadLocalVariable<InternalType> *tlsCommand##Ptr = NULL; \
+ { \
+ DPL::Mutex::ScopedLock lock( \
+ &I18n::DB::Interface::g_dbQueriesMutex); \
+ if (!tlsCommand##Ptr) { \
+ static DPL::ThreadLocalVariable<InternalType> tmp; \
+ tlsCommand##Ptr = &tmp; \
+ } \
+ } \
+ DPL::ThreadLocalVariable<InternalType> &tlsCommand = *tlsCommand##Ptr; \
+ if (tlsCommand.IsNull()) \
+ { \
+ tlsCommand = InternalType(&I18n::DB::Interface::g_dbInterface); \
+ }
+
+#define I18N_DB_SELECT(name, type) \
+ I18N_DB_INTERNAL(name, type::Select)
+
+#endif /* _I18N_DATABASE_H_ */
+
--- /dev/null
+#!/bin/sh
+# 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.
+#
+CHECKSUM=`cat ${2} ${3} 2>/dev/null | md5sum 2>/dev/null | cut -d\ -f1 2>/dev/null`
+echo "#define DB_CHECKSUM DB_VERSION_${CHECKSUM}" > ${1}
+echo "#define DB_CHECKSUM_STR \"DB_VERSION_${CHECKSUM}\"" >> ${1}
+
--- /dev/null
+DATABASE_START(i18n)
+
+#include "iana_db"
+#include "version_db"
+
+DATABASE_END()
--- /dev/null
+/*
+ * 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 i18n_db_sql_generator.h
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief Macro definitions for generating the SQL
+ * input file from database definition.
+ */
+
+//Do not include this file directly! It is used only for SQL code generation.
+#include <dpl/db/orm_macros.h>
+
+#include "i18n_db_definitions"
--- /dev/null
+/*
+ * 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.
+ */
+
+#ifndef _ORM_GENERATOR_I18N_H_
+#define _ORM_GENERATOR_I18N_H_
+
+#define ORM_GENERATOR_DATABASE_NAME i18n_db_definitions
+#include <dpl/db/orm_generator.h>
+#undef ORM_GENERATOR_DATABASE_NAME
+
+#endif // _ORM_GENERATOR_I18N_H_
--- /dev/null
+SQL(
+ BEGIN TRANSACTION;
+ CREATE TABLE DB_CHECKSUM (version INT);
+ COMMIT;
+)
--- /dev/null
+/*
+ * Copyright (c) 2011 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.
+ */
+/**
+ * This file contains the definition of i18n dao namespace.
+ *
+ * @file i18n_dao_read_only.cpp
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief This file contains the definition of i18n dao
+ */
+
+#include <wrt-commons/i18n-dao-ro/i18n_dao_read_only.h>
+#include <wrt-commons/i18n-dao-ro/i18n_database.h>
+
+#include <orm_generator_i18n.h>
+
+using namespace DPL::DB::ORM;
+using namespace DPL::DB::ORM::i18n;
+
+namespace I18n {
+namespace DB {
+namespace I18nDAOReadOnly {
+bool IsValidSubTag(const DPL::String& tag, int type)
+{
+ I18N_DB_SELECT(select, iana_records)
+ select->Where(And(Equals<iana_records::SUBTAG>(tag),
+ Equals<iana_records::TYPE>(type)));
+ return !select->GetRowList().empty();
+}
+}
+}
+}
--- /dev/null
+/*
+ * 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.
+ */
+#include <wrt-commons/i18n-dao-ro/i18n_database.h>
+
+namespace I18n {
+namespace DB {
+namespace Interface {
+namespace {
+const char* const I18N_DB_FILE_PATH = "/opt/usr/dbspace/.wrt_i18n.db";
+
+DPL::DB::SqlConnection::Flag::Type I18N_DB_FLAGS =
+ DPL::DB::SqlConnection::Flag::UseLucene;
+}
+
+DPL::Mutex g_dbQueriesMutex;
+DPL::DB::ThreadDatabaseSupport g_dbInterface(I18N_DB_FILE_PATH,
+ I18N_DB_FLAGS);
+
+void attachDatabaseRO()
+{
+ g_dbInterface.AttachToThread(DPL::DB::SqlConnection::Flag::RO);
+}
+
+void detachDatabase()
+{
+ g_dbInterface.DetachFromThread();
+}
+} //namespace Interface
+} //namespace DB
+} //namespace I18n
COMMAND ${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/gen_db_md5.sh
ARGS ${CMAKE_BINARY_DIR}/modules/widget_dao/database_checksum.h
${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/wrt_db
- ${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/iana_db
DEPENDS ${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/wrt_db
- ${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/iana_db
${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/gen_db_md5.sh
COMMENT "Generating WRT database checksum"
)
COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/.wrt.db
COMMAND gcc -Wall -include ${CMAKE_BINARY_DIR}/modules/widget_dao/database_checksum.h -I${PROJECT_SOURCE_DIR}/modules/db/include -I${PROJECT_SOURCE_DIR}/modules/widget_dao/orm -E ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/wrt_db_sql_generator.h | grep --invert-match "^#" > ${CMAKE_CURRENT_BINARY_DIR}/wrt_db.sql
COMMAND sqlite3 ${CMAKE_CURRENT_BINARY_DIR}/.wrt.db ".read ${CMAKE_CURRENT_BINARY_DIR}/wrt_db.sql" || rm -f ${CMAKE_CURRENT_BINARY_DIR}/.wrt.db
- DEPENDS ${CMAKE_BINARY_DIR}/modules/widget_dao/database_checksum.h ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/wrt_db_sql_generator.h ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/wrt_db ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/iana_db
+ DEPENDS ${CMAKE_BINARY_DIR}/modules/widget_dao/database_checksum.h ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/wrt_db_sql_generator.h ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/wrt_db
)
ADD_CUSTOM_COMMAND( OUTPUT .wrt.db-journal
return select->GetSingleValue<GlobalProperties::secure_by_default>();
}
-bool GlobalDAOReadOnly::IsValidSubTag(const DPL::String& tag, int type)
-{
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- WRT_DB_SELECT(select, iana_records, &WrtDatabase::interface())
- select->Where(Equals<iana_records::SUBTAG>(tag));
- auto row = select->GetRowList();
- if (row.empty() || row.front().Get_TYPE() != type) {
- return false;
- } else {
- return true;
- }
-}
-
GlobalDAOReadOnly::NetworkAccessMode
GlobalDAOReadOnly::GetHomeNetworkDataUsage()
{
public:
- static bool IsValidSubTag(const DPL::String& tag, int type);
-
static bool GetSecureByDefault();
static WidgetAccessInfoList GetWhiteURIList();
DATABASE_START(wrt)
#include "wrt_db"
-#include "iana_db"
#include "version_db"
DATABASE_END()
chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db-journal
chsmack -a 'wrt-commons::db_wrt' /opt/usr/dbspace/.wrt_custom_handler.db
chsmack -a 'wrt-commons::db_wrt' /opt/usr/dbspace/.wrt_custom_handler.db-journal
+chsmack -a 'wrt-commons::db_wrt_i18n' /opt/usr/dbspace/.wrt_i18n.db
+chsmack -a 'wrt-commons::db_wrt_i18n' /opt/usr/dbspace/.wrt_i18n.db-journal
echo "[WRT] wrt-commons postinst done ..."
ADD_SUBDIRECTORY(files_localization)
ADD_SUBDIRECTORY(localizationTagsProvider)
ADD_SUBDIRECTORY(utils)
+ADD_SUBDIRECTORY(i18n)
IF(WITH_CHILD)
MESSAGE(STATUS "Additional test subdirectory is being added")
--- /dev/null
+# Copyright (c) 2011 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 CMakeLists.txt
+# @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+# @version 1.0
+# @brief
+#
+
+#
+# Test files
+#
+# Define all DPL tests sources.
+# Runner is responsible for runnint it all and
+# generating proper output files
+#
+
+SET(TARGET_NAME "wrt-commons-tests-i18n")
+
+# Set DPL tests sources
+SET(DPL_TESTS_I18N_SOURCES
+ ${TESTS_DIR}/i18n/main.cpp
+ ${TESTS_DIR}/i18n/test_i18n_dao_read_only.cpp
+)
+
+#include subdirectory
+WRT_TEST_ADD_INTERNAL_DEPENDENCIES(${TARGET_NAME} ${TARGET_I18N_DAO_RO_LIB})
+WRT_TEST_BUILD(${TARGET_NAME} ${DPL_TESTS_I18N_SOURCES})
+WRT_TEST_INSTALL(${TARGET_NAME})
--- /dev/null
+/*
+ * Copyright (c) 2011 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 main.cpp
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief This file is the implementation file of main.
+ */
+
+#include <dpl/test/test_runner.h>
+
+int main(int argc, char *argv[])
+{
+ return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 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 test_i18n_dao_read_only.cpp
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief This file is the implementation file of i18n dao tests
+ */
+#include <dpl/test/test_runner.h>
+#include <dpl/log/log.h>
+#include <wrt-commons/i18n-dao-ro/i18n_database.h>
+#include <wrt-commons/i18n-dao-ro/i18n_dao_read_only.h>
+
+RUNNER_TEST_GROUP_INIT(I18N)
+
+/*
+Name: I18nDAOReadOnly_IsValidSubTag_True
+Description: Test valid IANA subtag presence
+Expected: Subtag found
+*/
+RUNNER_TEST(I18nDAOReadOnly_IsValidSubTag_True)
+{
+ I18n::DB::Interface::attachDatabaseRO();
+ bool result = I18n::DB::I18nDAOReadOnly::IsValidSubTag(L"aa", 0);
+ I18n::DB::Interface::detachDatabase();
+ RUNNER_ASSERT_MSG(result, "Subtag not found");
+}
+
+/*
+Name: I18nDAOReadOnly_IsValidSubTag_False
+Description: Test invalid IANA subtag presence
+Expected: Subtag not found
+*/
+RUNNER_TEST(I18nDAOReadOnly_IsValidSubTag_False)
+{
+ I18n::DB::Interface::attachDatabaseRO();
+ bool result = I18n::DB::I18nDAOReadOnly::IsValidSubTag(L"xxx000xxx", -1);
+ I18n::DB::Interface::detachDatabase();
+ RUNNER_ASSERT_MSG(!result, "Subtag found");
+}