[Release] wrt-commons_0.2.94 by sync with master branch submit/sdk/20130125.135807
authorTaejeong Lee <taejeong.lee@samsung.com>
Fri, 25 Jan 2013 13:50:35 +0000 (22:50 +0900)
committerTaejeong Lee <taejeong.lee@samsung.com>
Fri, 25 Jan 2013 13:57:38 +0000 (22:57 +0900)
Change-Id: Ie0f6f0b7084c750e3197bffe0e6df9cc9c45d33c

21 files changed:
debian/changelog
modules/core/include/dpl/singleton.h
modules/core/include/dpl/singleton_impl.h
modules/core/include/dpl/singleton_safe_impl.h
modules/db/include/dpl/db/orm.h
modules/db/src/orm.cpp
modules/dbus/src/connection.cpp
modules/event/include/dpl/event/property.h
modules/log/src/old_style_log_provider.cpp
modules/utils/src/wrt_utility.cpp
modules/widget_dao/dao/widget_dao.cpp
modules/widget_dao/dao/widget_dao_read_only.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h
modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h
modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h
packaging/wrt-commons.spec
tests/dao/TestCases_WidgetDAO.cpp
tests/dao/wrt_dao_tests_prepare_db.sh
tests/dpl/db/test_orm.cpp
tests/dpl/localization/mockup_include/dpl/wrt-dao-rw/widget_dao.h
tests/dpl/localization/mockup_src/widget_dao.cpp

index 736b898245df91385acc3e28455a6dfd42702ef5..226583a365efde52b4e842f59ff3891b49ed5eb3 100644 (file)
@@ -1,3 +1,23 @@
+wrt-commons (0.2.94) unstable; urgency=low
+
+  * Revert "Change pkgname to appid and add package id PART 1."
+  * Revert "change pkgname to appid PART 2."
+  * Fix build break in tests after API has been changed.
+
+ -- Tae-Jeong Lee <taejeong.lee@samsung.com>  Fri, 25 Jan 2013 22:32:36 +0900
+
+wrt-commons (0.2.93) unstable; urgency=low
+
+  * Changed PkgName type from Optional<String> to String PART 5
+  * Support for GCC 4.7
+  * Removing hard-coding in ORDER BY statement
+  * Fixing saving locale for each icon
+  * Singleton guard thread removal
+  * Change pkgname to appid and add package id PART 1.
+  * change pkgname to appid PART 2.
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Thu, 24 Jan 2013 15:53:03 +0900
+
 wrt-commons (0.2.92) unstable; urgency=low
 
   * Removal of popup implementation
index 4e5b281d5e0867265150a601c55611da52646722..44886d950cac643b4a01389dc50263ef98d37ba1 100644 (file)
@@ -45,7 +45,6 @@ private:
     }
 
     typedef Optional<Thread *> OptionalThreadPtr;
-    OptionalThreadPtr m_guard;
 
     static Singleton &InternalInstance();
 
@@ -55,10 +54,6 @@ public:
     }
 
     static Class &Instance();
-
-    // Thread guarding
-    static void SetThreadGuard(Thread *thread);
-    static void ResetThreadGuard();
 };
 
 } // namespace DPL
index 365ec15a03ec50e41e3edfe33fc79cd6508e6b67..6ebe48c3bcb06f4a855c605cbd6d7e6e9f09f448 100644 (file)
@@ -44,37 +44,13 @@ template<typename Class>
 Class &Singleton<Class>::Instance()
 {
     Singleton<Class>& instance = Singleton<Class>::InternalInstance();
-
-    if (!!instance.m_guard)
-    {
-        Assert(Thread::GetCurrentThread() == *instance.m_guard &&
-               "Singleton thread guard failed. A forbidden call from foreign thread was detected!");
-    }
-
     return instance;
 }
 
-// Thread guarding
-template<typename Class>
-void Singleton<Class>::SetThreadGuard(Thread *thread)
-{
-    Singleton<Class>& instance = Singleton<Class>::InternalInstance();
-    instance.m_guard = OptionalThreadPtr(thread);
-}
-
-template<typename Class>
-void Singleton<Class>::ResetThreadGuard()
-{
-    Singleton<Class>& instance = Singleton<Class>::InternalInstance();
-    instance.m_guard = OptionalThreadPtr::Null;
-}
-
 } // namespace DPL
 
 #define IMPLEMENT_SINGLETON(Type)                                           \
 template DPL::Singleton<Type>& DPL::Singleton<Type>::InternalInstance();    \
 template Type& DPL::Singleton<Type>::Instance();                            \
-template void DPL::Singleton<Type>::SetThreadGuard(DPL::Thread *thread);    \
-template void DPL::Singleton<Type>::ResetThreadGuard();
 
 #endif // DPL_SINGLETON_IMPL_H
index 8fbe009b396483f06d63660cb99eeabf59e5c533..6bf645186d2c0efb1b17a0fd80d339a3f08c5a2a 100644 (file)
@@ -35,31 +35,11 @@ template<>                                                                     \
 Class &Singleton<Class>::Instance()                                            \
 {                                                                              \
     Singleton<Class>& instance = Singleton<Class>::InternalInstance();         \
-    if (!!instance.m_guard)                                                    \
-    {                                                                          \
-        Assert(Thread::GetCurrentThread() == *instance.m_guard &&              \
-               "Singleton thread guard failed. A forbidden call from foreign thread was detected!");\
-    }                                                                          \
     return instance;                                                           \
 }                                                                              \
                                                                                \
-template<>                                                                     \
-void Singleton<Class>::SetThreadGuard(Thread *thread)                          \
-{                                                                              \
-    Singleton<Class>& instance = Singleton<Class>::InternalInstance();         \
-    instance.m_guard = OptionalThreadPtr(thread);                              \
-}                                                                              \
-                                                                               \
-template<>                                                                     \
-void Singleton<Class>::ResetThreadGuard()                                      \
-{                                                                              \
-    Singleton<Class>& instance = Singleton<Class>::InternalInstance();         \
-    instance.m_guard = OptionalThreadPtr::Null;                                \
-}                                                                              \
 template Singleton<Class>& Singleton<Class>::InternalInstance();               \
 template Class& Singleton<Class>::Instance();                                  \
-template void Singleton<Class>::SetThreadGuard(Thread *thread);                \
-template void Singleton<Class>::ResetThreadGuard();                            \
 } // namespace DPL
 
 
index c404fba55295091bfd732c05f7a67c04186b8140..652e8e19dcd6afa3bf29ecbfc038c8397c3b797c 100644 (file)
@@ -86,6 +86,38 @@ public:
 
 typedef std::shared_ptr<Expression> ExpressionPtr;
 
+namespace OrderingUtils {
+
+template<typename CompoundType> inline std::string OrderByInternal()
+{
+    std::string order = OrderByInternal<typename CompoundType::Tail>();
+    if(!order.empty()) return CompoundType::Head::GetString() + ", " + order;
+    else return CompoundType::Head::GetString();
+}
+
+template<> inline std::string OrderByInternal<TypeListGuard>()
+{
+    return std::string();
+}
+
+}
+
+template<typename ColumnType>
+class __attribute__ ((visibility("hidden"))) OrderingExpression {
+protected:
+    static std::string GetSchemaAndName()
+    {
+        std::string statement;
+        statement += ColumnType::GetTableName();
+        statement += ".";
+        statement += ColumnType::GetColumnName();
+        statement += " ";
+        return statement;
+    }
+public:
+    virtual ~OrderingExpression() {}
+};
+
 template<const char* Operator, typename LeftExpression, typename RightExpression>
 class __attribute__ ((visibility("hidden"))) BinaryExpression : public Expression {
 protected:
@@ -187,6 +219,22 @@ public:
 ORM_DEFINE_COMPARE_EXPRESSION(Equals, Equal)
 ORM_DEFINE_COMPARE_EXPRESSION(Is, Is)
 
+#define ORM_DEFINE_ORDERING_EXPRESSION(name, value)                                     \
+    template<typename ColumnType>                                                       \
+    class __attribute__ ((visibility("hidden"))) name                                   \
+        : OrderingExpression<ColumnType> {                                              \
+    public:                                                                             \
+        static std::string GetString()                                                  \
+        {                                                                               \
+            std::string statement = OrderingExpression<ColumnType>::GetSchemaAndName(); \
+            statement += value;                                                         \
+            return statement;                                                           \
+        }                                                                               \
+    };
+
+ORM_DEFINE_ORDERING_EXPRESSION(OrderingAscending, "ASC")
+ORM_DEFINE_ORDERING_EXPRESSION(OrderingDescending, "DESC")
+
 template<typename ColumnData1, typename ColumnData2>
 class __attribute__ ((visibility("hidden"))) CompareBinaryColumn {
 private:
@@ -844,11 +892,22 @@ public:
         m_distinctResults = true;
     }
 
-    void OrderBy(const std::string& orderBy)
+    template<typename CompoundType>
+    void OrderBy(const CompoundType&)
+    {
+        m_orderBy = OrderingUtils::OrderByInternal<typename CompoundType::Type>();
+    }
+
+    void OrderBy(const std::string & orderBy) //backward compatibility
     {
         m_orderBy = orderBy;
     }
 
+    void OrderBy(const char * orderBy) //backward compatibility
+    {
+        m_orderBy = std::string(orderBy);
+    }
+
     template<typename ColumnList, typename Expression>
     void Join(const Expression& expression) {
         std::string usedTableNames = TableDefinition::GetName();
index 1d2f6b455e8b7df211ea2374b1c918423465ad24..acdbcca85c3073afdc61cbc6491d5db3ab204408 100644 (file)
@@ -22,6 +22,7 @@
 #include <stddef.h>
 #include <dpl/db/orm.h>
 
+
 namespace DPL {
 namespace DB {
 namespace ORM {
index c9b7f8e09d56f6fd56a78417495d8fb52fa0fe47..53d992c7f2d60865f420633c425c7da4bfb1d80a 100644 (file)
@@ -109,7 +109,7 @@ Connection::~Connection()
 
     std::for_each(m_registeredObjects.begin(),
                   m_registeredObjects.end(),
-                  [m_connection] (const RegisteredObjects::value_type& value)
+                  [this] (const RegisteredObjects::value_type& value)
                   {
                       g_dbus_connection_unregister_object(
                               m_connection,
index 7c87e50e6d05aeef176aee0c123bd2c7a2507edc..2817007873e8ad76ebb4362caa679726391d3860 100644 (file)
@@ -511,7 +511,7 @@ public:
 
         this->m_storage.Set(value);
 
-        EmitEvent(PropertyEvent<Type>(value, this->m_model),
+        this->EmitEvent(PropertyEvent<Type>(value, this->m_model),
                   EmitMode::Auto);
     }
 
index 2ad499fa82ef63a2104b93d91cdd5a278e90f254..bd7db2b7f156078a10c1a666fb5c4b226e0abf79 100644 (file)
@@ -26,6 +26,7 @@
 #include <cstring>
 #include <sstream>
 #include <sys/time.h>
+#include <unistd.h>
 
 namespace DPL
 {
index 9bb218797e09ea587b646bbf2da342d55f6ea3ed..43888b3b16c63a121f61f5cf208bcacde1dc49f4 100644 (file)
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #include <errno.h>
 #include <ctype.h>
+#include <unistd.h>
 #include <dpl/log/log.h>
 #include <dpl/utils/wrt_utility.h>
 
index e078797d1c7ddf75038dc49410831162794b6ac6..bd421dd2aaa2d9be270a2764827074a0f56a27b5 100644 (file)
@@ -96,15 +96,7 @@ void WidgetDAO::setProperty(
     }
 }
 
-void WidgetDAO::setPkgName(const DPL::OptionalString& pkgName)
-{
-
-   // if(!!pkgName)
-        setPkgName_TEMPORARY_API(*pkgName);
-}
-
-
-void WidgetDAO::setPkgName_TEMPORARY_API(const WidgetPkgName& pkgName)
+void WidgetDAO::setPkgName(const WidgetPkgName& pkgName)
 {
     SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
     {
@@ -538,25 +530,7 @@ void WidgetDAO::registerWidgetIcons(DbWidgetHandle widgetHandle,
             row.Set_app_id(widgetHandle);
             row.Set_icon_id(icon_id);
             row.Set_widget_locale(*j);
-            WRT_DB_SELECT(select, WidgetLocalizedIcon, &WrtDatabase::interface())
-            select->Where(And(Equals<WidgetLocalizedIcon::app_id>(widgetHandle),
-                              Equals<WidgetLocalizedIcon::widget_locale>(*j)));
-            WidgetLocalizedIcon::Select::RowList rows = select->GetRowList();
-
-            bool flag = !rows.empty();
-
-            if(flag == true)
-            {
-                // already default icon value of same locale exists
-                WRT_DB_UPDATE(update, WidgetLocalizedIcon, &WrtDatabase::interface())
-                update->Where(And(Equals<WidgetLocalizedIcon::app_id>(widgetHandle),
-                                  Equals<WidgetLocalizedIcon::widget_locale>(*j)));
-                update->Values(row);
-                update->Execute();
-            }else{
-                // any icon value of same locale doesn't exist
-                DO_INSERT(row, WidgetLocalizedIcon)
-            }
+            DO_INSERT(row, WidgetLocalizedIcon)
         }
     }
 }
index ade490b03de3746064b9934178735f18018dadcb..e5a528aeef297395e8ada07562ac26b4eacf4be3 100644 (file)
@@ -413,16 +413,6 @@ WidgetPkgNameList WidgetDAOReadOnly::getPkgnameList()
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get Pkgname list")
 }
 
-WidgetPkgNameList_TEMPORARY_API WidgetDAOReadOnly::getPkgnameList_TEMPORARY_API()
-{
-    LogDebug("Getting Pkgname List ");
-    SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
-    {
-        WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface())
-        return select->GetValueList<WidgetInfo::pkgname>();
-    }
-    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get Pkgname list")
-}
 
 DbWidgetDAOReadOnlyList WidgetDAOReadOnly::getWidgetList()
 {
@@ -528,11 +518,6 @@ WidgetGUID WidgetDAOReadOnly::getGUID() const
     return row.Get_widget_id();
 }
 
-DPL::OptionalString WidgetDAOReadOnly::getPkgname() const
-{
-    return DPL::OptionalString(getPkgName());
-}
-
 DPL::OptionalString WidgetDAOReadOnly::getDefaultlocale() const
 {
     WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
@@ -734,6 +719,7 @@ WidgetDAOReadOnly::WidgetIconList WidgetDAOReadOnly::getIconList() const
     {
         WRT_DB_SELECT(select, wrt::WidgetIcon, &WrtDatabase::interface())
         select->Where(Equals<wrt::WidgetIcon::app_id>(m_widgetHandle));
+        select->OrderBy(DPL::TypeListDecl<OrderingAscending<wrt::WidgetIcon::icon_id> >());
 
         std::list<WidgetIcon::Row> list =
                 select->GetRowList();
index 444f176dd50ab9e9f649efd784524f5e8650242b..362065875a55602a95b64ae69a9ab826123de414 100644 (file)
@@ -237,7 +237,6 @@ typedef std::multiset<DbWidgetFeature> DbWidgetFeatureSet;
 typedef std::list<DbWidgetHandle> DbWidgetHandleList;
 
 typedef std::list<WidgetPkgName> WidgetPkgNameList; //TODO: this cannot be null -> appropriate changes in db schema needed
-typedef std::list<WidgetPkgName> WidgetPkgNameList_TEMPORARY_API; //TODO: this cannot be null -> appropriate changes in db schema needed
 
 class WidgetDAOReadOnly; //forward declaration
 typedef std::shared_ptr<WidgetDAOReadOnly> WidgetDAOReadOnlyPtr;
index f454637fc1f8124749a9831efa41976f7f99cf32..8be742c65b0a3d5212e3730dbfe91dd0e22546ac 100644 (file)
@@ -372,15 +372,6 @@ class WidgetDAOReadOnly
     WidgetGUID getGUID() const;
 
 
-    /**
-    * This method returns the Package name of the widget.
-    *
-    * @return pkgname
-    * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
-    * @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in DB table.
-    */
-    DPL::OptionalString getPkgname() const;
-
     /**
      * This method returns the defaultlocale for the widget.
      *
@@ -574,7 +565,6 @@ class WidgetDAOReadOnly
      * @return list of pkgname of installed packages
      */
     static WidgetPkgNameList getPkgnameList();
-    static WidgetPkgNameList_TEMPORARY_API getPkgnameList_TEMPORARY_API();
 
     /**
      * This method returns a list of all the installed widgets.
index 3f7b819acec3596528c131f77fd268a18db1f7b9..3137c2497c3ced30df2f6cc804b321a929b1b77c 100644 (file)
@@ -132,8 +132,7 @@ class WidgetDAO : public WidgetDAOReadOnly
 
     /* set PkgName
      */
-    void setPkgName(const DPL::OptionalString& pkgName);
-    void setPkgName_TEMPORARY_API(const WidgetPkgName& pkgName);
+    void setPkgName(const WidgetPkgName& pkgName);
 
     /* This function will update of api-feature status.
      * If status is true (feature rejected) plugin connected with this
index e217f8b6cfe1aca70d332483c8ac7feeda43f9aa..56ee397055483fc691bb6d3e4574481806f24fe4 100644 (file)
@@ -1,7 +1,7 @@
-#git:framework/web/wrt-commons wrt-commons 0.2.92
+#git:framework/web/wrt-commons wrt-commons 0.2.94
 Name:       wrt-commons
 Summary:    Wrt common library
-Version:    0.2.92
+Version:    0.2.94
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 4964038f161ce5168ab550efda9646460cce837a..13ea61c50f2772626bfbb05d1d9bad43df779784 100644 (file)
@@ -82,33 +82,33 @@ private:
 
 };
 
-WidgetPkgName _registerWidget(const WidgetRegisterInfo& regInfo,
+TizenAppId _registerWidget(const WidgetRegisterInfo& regInfo,
                              const IWacSecurity& sec,
                              int line)
 {
-    WidgetPkgName pkgname;
+    TizenAppId tizenAppId;
     Try {
-        auto previous = WidgetDAO::getPkgnameList();
+        auto previous = WidgetDAO::getTizenAppidList();
 
         // register widget
-        pkgname = WidgetDAO::registerWidgetGenerateTizenId(regInfo, sec);
+        tizenAppId = WidgetDAO::registerWidgetGeneratePkgId(regInfo, sec);
 
-        RUNNER_ASSERT_MSG(!pkgname.empty(),
+        RUNNER_ASSERT_MSG(!tizenAppId.empty(),
                           "(called from line " << line << ")");
 
-        auto current = WidgetDAO::getPkgnameList();
+        auto current = WidgetDAO::getTizenAppidList();
         RUNNER_ASSERT_MSG(previous.size()+1 == current.size(),
                           "(called from line " << line << ")");
 
-        RUNNER_ASSERT_MSG(WidgetDAO::isWidgetInstalled(pkgname),
-                          "(called from line " << line << " pkgname: " << pkgname << ")");
+        RUNNER_ASSERT_MSG(WidgetDAO::isWidgetInstalled(tizenAppId),
+                          "(called from line " << line << " tizenAppId: " << tizenAppId << ")");
     }
     Catch (WidgetDAO::Exception::AlreadyRegistered) {
         RUNNER_ASSERT_MSG(
                 false,
                 "Unexpected exception (called from line " << line << ")");
     }
-    return pkgname;
+    return tizenAppId;
 }
 
 #define REGISTER_WIDGET(regInfo, sec) _registerWidget((regInfo),(sec), __LINE__)
@@ -257,16 +257,16 @@ RUNNER_TEST(widget_dao_test_register_widget_minimum_info)
     WacSecurityMock sec;
     const std::size_t NUMBER_OF_WIDGETS = 5;
 
-    WidgetPkgName lastPkgname;
+    TizenAppId lastTizenAppId;
 
     for (std::size_t number = 0; number < NUMBER_OF_WIDGETS; ++number)
     {
         WidgetRegisterInfo regInfo;
-        WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+        TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-        lastPkgname = pkgname;
+        lastTizenAppId = tizenAppId;
 
-        WidgetDAO dao(pkgname);
+        WidgetDAO dao(tizenAppId);
         //TODO check nulls
     }
 }
@@ -302,9 +302,9 @@ RUNNER_TEST(widget_dao_test_register_widget_info)
         regInfo.minVersion = DPL::FromUTF8String("1.0");
         regInfo.configInfo.backSupported = true;
 
-        WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+        TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-        WidgetDAO dao(pkgname);
+        WidgetDAO dao(tizenAppId);
         RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(dao.getGUID(), str.str());
         RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(dao.getVersion(), str.str());
         RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(dao.getAuthorName(), str.str());
@@ -340,9 +340,9 @@ RUNNER_TEST(widget_dao_test_register_widget_extended_info)
 //        regInfo.shareHref = str.str();
         regInfo.configInfo.backgroundPage = L"background.html";
 
-        WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+        TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-        WidgetDAO dao(pkgname);
+        WidgetDAO dao(tizenAppId);
 //        RUNNER_ASSERT_WHAT_EQUALS(dao.GetShareHref(), str.str());
 
         RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(dao.getBackgroundPage(),
@@ -391,9 +391,9 @@ RUNNER_TEST(widget_dao_test_register_widget_localized_info)
                     std::make_pair(DPL::FromUTF8String("pl"),locDataPl));
         }
 
-        WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+        TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-        WidgetDAO dao(pkgname);
+        WidgetDAO dao(tizenAppId);
         RUNNER_ASSERT_MSG(dao.getLanguageTags().size() == 2,
                           "language tags list invalid");
 
@@ -450,9 +450,9 @@ RUNNER_TEST(widget_dao_test_register_widget_icons)
     WidgetRegisterInfo::LocalizedIcon locIcon(icon,locs);
     regInfo.localizationData.icons.push_back(locIcon);
 
-    WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+    TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-    WidgetDAO dao(pkgname);
+    WidgetDAO dao(tizenAppId);
     WidgetDAOReadOnly::WidgetIconList list = dao.getIconList();
 
     RUNNER_ASSERT(list.size() == regInfo.localizationData.icons.size());
@@ -524,9 +524,9 @@ RUNNER_TEST(widget_dao_test_register_widget_features)
     FOREACH(it, features)
         regInfo.configInfo.featuresList.insert(*it);
 
-    WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+    TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-    WidgetDAO dao(pkgname);
+    WidgetDAO dao(tizenAppId);
     WidgetFeatureSet out = dao.getFeaturesList();
     RUNNER_ASSERT_MSG(out.size() == features.size(),
                       "wrong number of features");
@@ -544,9 +544,9 @@ RUNNER_TEST(widget_dao_test_register_widget_security_settings)
 {
     WacSecurityMock sec;
     WidgetRegisterInfo regInfo;
-    WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+    TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-    WidgetDAO dao(pkgname);
+    WidgetDAO dao(tizenAppId);
     RUNNER_ASSERT_MSG(dao.getSecurityPopupUsage() == WrtDB::SETTINGS_TYPE_ON, "SecurityPopupUsage is not deafult on");
     RUNNER_ASSERT_MSG(dao.getGeolocationUsage() == WrtDB::SETTINGS_TYPE_ON, "GeolocationUsage is not deafult on");
     RUNNER_ASSERT_MSG(dao.getWebNotificationUsage() == WrtDB::SETTINGS_TYPE_ON, "WebNotificationUsage is not deafult on");
@@ -613,9 +613,9 @@ RUNNER_TEST(widget_dao_test_register_widget_win_modes)
     FOREACH(it, modes)
         regInfo.configInfo.windowModes.insert(*it);
 
-    WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+    TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-    WidgetDAO dao(pkgname);
+    WidgetDAO dao(tizenAppId);
     std::list<DPL::String> wins = dao.getWindowModes();
     RUNNER_ASSERT_MSG(modes.size() == wins.size(),
                       "wrong number of window modes");
@@ -643,9 +643,9 @@ RUNNER_TEST(widget_dao_test_register_widget_warp_info)
     FOREACH(it, orig)
         regInfo.configInfo.accessInfoSet.insert(*it);
 
-    WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+    TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-    WidgetDAO dao(pkgname);
+    WidgetDAO dao(tizenAppId);
 
     WidgetAccessInfoList out;
     dao.getWidgetAccessInfo(out);
@@ -680,9 +680,9 @@ RUNNER_TEST(widget_dao_test_register_widget_certificates)
     certListRef.push_back(cert);
 
     // register widget
-    WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+    TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-    WidgetDAO dao(pkgname);
+    WidgetDAO dao(tizenAppId);
 
     // certificates
     WidgetCertificateDataList recList = dao.getCertificateDataList();
@@ -763,9 +763,9 @@ RUNNER_TEST(widget_dao_test_is_widget_installed)
     WacSecurityMock sec;
     WidgetRegisterInfo regInfo;
 
-    WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+    TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-    RUNNER_ASSERT(WidgetDAO::isWidgetInstalled(pkgname));
+    RUNNER_ASSERT(WidgetDAO::isWidgetInstalled(tizenAppId));
 }
 
 /*
@@ -780,9 +780,9 @@ RUNNER_TEST(widget_dao_test_unregister_widget)
 
     WidgetRegisterInfo regInfo;
 
-    WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+    TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-    WidgetDAO::unregisterWidget(pkgname);
+    WidgetDAO::unregisterWidget(tizenAppId);
 
     RUNNER_ASSERT_MSG(handles.size() == WidgetDAO::getHandleList().size(),
                       "Widget unregister failed");
@@ -805,38 +805,38 @@ RUNNER_TEST(widget_dao_test_register_or_update_widget)
     regInfo2.configInfo.version = L"1.1";
     regInfo2.configInfo.authorName = L"BBB";
 
-    WrtDB::WidgetPkgName pkgname(L"abcdefghij");
+    WrtDB::TizenAppId tizenAppId(L"abcdefghij");
 
     //first installation
-    WidgetDAO::registerWidget(pkgname, regInfo, sec);
-    RUNNER_ASSERT_MSG(WidgetDAO::isWidgetInstalled(pkgname), "Widget is not registered");
+    WidgetDAO::registerWidget(tizenAppId, regInfo, sec);
+    RUNNER_ASSERT_MSG(WidgetDAO::isWidgetInstalled(tizenAppId), "Widget is not registered");
 
     //success full update
-    WidgetDAO::registerOrUpdateWidget(pkgname, regInfo2, sec);
-    RUNNER_ASSERT_MSG(WidgetDAO::isWidgetInstalled(pkgname), "Widget is not reregistered");
-    WidgetDAO dao(pkgname);
+    WidgetDAO::registerOrUpdateWidget(tizenAppId, regInfo2, sec);
+    RUNNER_ASSERT_MSG(WidgetDAO::isWidgetInstalled(tizenAppId), "Widget is not reregistered");
+    WidgetDAO dao(tizenAppId);
     RUNNER_ASSERT_MSG(*dao.getVersion() == L"1.1", "Data widget was not updated");
     RUNNER_ASSERT_MSG(*dao.getAuthorName() == L"BBB", "Data widget was not updated");
 
-    WidgetDAO::unregisterWidget(pkgname);
+    WidgetDAO::unregisterWidget(tizenAppId);
 }
 
 /*
-Name: widget_dao_test_get_widget_pkgname_list
-Description: Tests getPkgnameList API for backendlib
+Name: widget_dao_test_get_widget_tizenAppId_list
+Description: Tests getTizenAppidList API for backendlib
 Expected: For all position in database should be returned one item in list
 */
-RUNNER_TEST(widget_dao_test_get_widget_pkgname_list)
+RUNNER_TEST(widget_dao_test_get_widget_tizenAppId_list)
 {
-    WidgetPkgNameList pkgnames = WidgetDAO::getPkgnameList();
-    RUNNER_ASSERT(pkgnames.size() >= 3);
+    TizenAppIdList tizenAppIds = WidgetDAO::getTizenAppidList();
+    RUNNER_ASSERT(tizenAppIds.size() >= 3);
 }
 
 /*
 Name: widget_dao_test_get_widget_list
-Description: Tests getPkgnameList API for backendlib
+Description: Tests getTizenAppidList API for backendlib
 Expected: For all position in database should be returned one item in list
- Those item should contain valid pkgname
+ Those item should contain valid tizenAppId
 */
 RUNNER_TEST(widget_dao_test_get_widget_list)
 {
@@ -854,8 +854,8 @@ Expected: Attributes should match values inserted into database
 RUNNER_TEST(widget_dao_test_get_widget_attributes)
 {
     {
-        WidgetPkgName pkgname = L"tizenid201";
-        WidgetDAO dao(pkgname);
+        TizenAppId tizenAppId = L"tizenid201";
+        WidgetDAO dao(tizenAppId);
 
         RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(dao.getGUID(), "w_id_2000");
         RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(dao.getVersion(), "1.0.0");
@@ -907,9 +907,9 @@ RUNNER_TEST(widget_dao_test_localization)
     regInfo.localizationData.startFiles.push_back(file);
 
     // register widget
-    WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+    TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
 
-    WidgetDAO dao(pkgname);
+    WidgetDAO dao(tizenAppId);
 
     // check localized icons
     WidgetDAO::WidgetLocalizedIconList locList = dao.getLocalizedIconList();
@@ -956,8 +956,8 @@ RUNNER_TEST(widget_dao_test_wac_security)
     WidgetRegisterInfo regInfo;
     {
         // register widget
-        WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
-        WidgetDAO dao(pkgname);
+        TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
+        WidgetDAO dao(tizenAppId);
 
         RUNNER_ASSERT(!dao.isDistributorSigned());
         RUNNER_ASSERT(!dao.isRecognized());
@@ -968,8 +968,8 @@ RUNNER_TEST(widget_dao_test_wac_security)
     sec.setWacSigned(true);
     {
         // register widget
-        WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
-        WidgetDAO dao(pkgname);
+        TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
+        WidgetDAO dao(tizenAppId);
 
         RUNNER_ASSERT(dao.isDistributorSigned());
         RUNNER_ASSERT(dao.isRecognized());
index 4f989f0c07f9e94b4532c8eccd6eb137c0bd64f9..c2bde9232b82b941cab7e91f2624862d09676deb 100755 (executable)
@@ -59,14 +59,14 @@ if [ "x$1" == "xstart" ]; then
 
     #Widgets
     INS_ALL_WIDGETEXT="insert into WidgetExtendedInfo(app_id, share_href, signature_type)"
-    INS_ALL_WIDGET="insert into WidgetInfo(app_id, widget_id, widget_version, widget_width, widget_height, author_name, author_email, author_href, base_folder, webkit_plugins_required, recognized, wac_signed, distributor_signed, min_version, pkgname)"
+    INS_ALL_WIDGET="insert into WidgetInfo(app_id, widget_id, widget_version, widget_width, widget_height, author_name, author_email, author_href, base_folder, webkit_plugins_required, recognized, wac_signed, distributor_signed, min_version, tizen_appid)"
     INS_ALL_WIDGET_LOC="insert into LocalizedWidgetInfo(app_id, widget_locale, widget_name, widget_shortname, widget_description, widget_license, widget_license_file, widget_license_href)"
     INS_ALL_WIDGET_ICONS="insert into WidgetIcon(app_id, icon_src, icon_width, icon_height)"
     INS_ALL_WIDGET_LOC_ICONS="insert into WidgetLocalizedIcon(app_id, icon_id, widget_locale)"
     INS_ALL_WIDGET_STARTFILE="insert into WidgetStartFile(app_id, src)"
     INS_ALL_WIDGET_LOC_STARTFILE="insert into WidgetLocalizedStartFile(app_id, start_file_id, widget_locale, type, encoding)"
     INS_ALL_WIDGET_DEFPREF="insert into WidgetDefaultPreference(app_id, key_name, key_value, readonly)"
-    INS_ALL_WIDGET_PREF="insert into WidgetPreference(pkgname, key_name, key_value, readonly)"
+    INS_ALL_WIDGET_PREF="insert into WidgetPreference(tizen_appid, key_name, key_value, readonly)"
     INS_ALL_WIDGET_FEATURE="insert into WidgetFeature(app_id, name, required)"
     INS_ALL_WIDGET_FEATURE_PARAM="insert into FeatureParam(widget_feature_id, name, value)"
     INS_ALL_WIDGET_WINMODES="insert into WidgetWindowModes(app_id, window_mode)"
@@ -78,8 +78,8 @@ if [ "x$1" == "xstart" ]; then
 
     sqlite3 $WRT_DB "${INS_ALL_WIDGET} VALUES(2000, 'w_id_2000', '1.0.0', 100, 200, 'a_name_2000', 'a_email_2000', 'a_href_2000', 'basef_2000', 1, 1, 1, 1, '1.0', 'tizenid201')";
     sqlite3 $WRT_DB "${INS_ALL_WIDGET} VALUES(2001, 'w_id_2001', '2.0.0', 100, 200, 'a_name_2001', 'a_email_2001', 'a_href_2001', 'basef_2001', 1, 1, 1, 1, '0.5', 'tizenid202')";
-    sqlite3 $WRT_DB "insert into WidgetInfo(app_id, back_supported, pkgname) VALUES(2002, 0, 'tizenid203')";
-    sqlite3 $WRT_DB "insert into WidgetInfo(app_id, back_supported, pkgname) VALUES(2003, 0, 'tizenid204')"; # for properties tests
+    sqlite3 $WRT_DB "insert into WidgetInfo(app_id, back_supported, tizen_appid) VALUES(2002, 0, 'tizenid203')";
+    sqlite3 $WRT_DB "insert into WidgetInfo(app_id, back_supported, tizen_appid) VALUES(2003, 0, 'tizenid204')"; # for properties tests
 
     sqlite3 $WRT_DB "${INS_ALL_WIDGETEXT} VALUES(2000, 'share_href_2000', 0)";
     sqlite3 $WRT_DB "${INS_ALL_WIDGETEXT} VALUES(2001, 'share_href_2001', 0)";
@@ -114,8 +114,8 @@ if [ "x$1" == "xstart" ]; then
     sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES('tizenid203', 'key2_for_2002', 'value2_for_key_2002', 1)";
 
     #create if not exists and fix autoincrement value
-    sqlite3 $WRT_DB "INSERT INTO WidgetInfo(pkgname) VALUES('temp')";
-    sqlite3 $WRT_DB "DELETE FROM WidgetInfo WHERE pkgname = 'temp'";
+    sqlite3 $WRT_DB "INSERT INTO WidgetInfo(tizen_appid) VALUES('temp')";
+    sqlite3 $WRT_DB "DELETE FROM WidgetInfo WHERE tizen_appid = 'temp'";
     sqlite3 $WRT_DB "UPDATE sqlite_sequence SET seq = 2004 WHERE name = 'WidgetInfo'";
 
     exit $?
index 9295ed2f35fad6a0c1ce59fdb806dc89135f5e40..d2e224f4bbbdcbe41c89263ce5306380e026e58e 100644 (file)
@@ -412,7 +412,7 @@ RUNNER_TEST(ORM_Delete)
     using namespace DPL::DB::ORM;
     using namespace DPL::DB::ORM::dpl_orm_test;
     TestTableDelete::Select selectStart(interface.get());
-    selectStart.OrderBy("ColumnInt2 ASC");
+    selectStart.OrderBy(DPL::TypeListDecl<OrderingAscending<TestTableDelete::ColumnInt2> >());
     std::list<TestTableDelete::Row> list = selectStart.GetRowList();
     std::list<TestTableDelete::Row> originalList = list;
 
@@ -849,3 +849,55 @@ RUNNER_TEST(ORM_Join)
         oss.str(std::string());
     }
 }
+
+RUNNER_TEST(ORM_SelectOrderByMultipleColumns)
+{
+    SmartAttach interface;
+    using namespace DPL::DB::ORM;
+    using namespace DPL::DB::ORM::dpl_orm_test;
+    {
+        TestTableJoin3::Select select(interface.get());
+
+        // testing: " ORDER BY Value3 ASC, TestID DESC, TestID ASC"
+        select.OrderBy(DPL::TypeListDecl<OrderingAscending<TestTableJoin3::Value3>,
+                                OrderingDescending<TestTableJoin3::TestText33>,
+                                OrderingAscending<TestTableJoin3::TestID> >());
+
+        std::list<TestTableJoin3::Row> result = select.GetRowList();
+        std::list<TestTableJoin3::Row>::const_iterator iter = result.begin();
+        { //1 row
+            RUNNER_ASSERT_MSG(*iter->Get_TestText33() == DPL::FromASCIIString("test 6"), "Wrong row 1 order");
+            RUNNER_ASSERT_MSG(iter->Get_TestID() == 10, "Wrong row 1 order");
+            iter++;
+        }
+        { //2 row
+            RUNNER_ASSERT_MSG(*iter->Get_TestText33() == DPL::FromASCIIString("test 5"), "Wrong row 2 order");
+            RUNNER_ASSERT_MSG(iter->Get_TestID() == 7, "Wrong row 2 order");
+            iter++;
+        }
+        { //3 row
+            RUNNER_ASSERT_MSG(iter->Get_Value3() == 111, "Wrong row 3 order");
+            RUNNER_ASSERT_MSG(*iter->Get_TestText33() == DPL::FromASCIIString("test 2"), "Wrong row 3 order");
+            RUNNER_ASSERT_MSG(iter->Get_TestID() == 2, "Wrong row 3 order");
+            iter++;
+        }
+        { //4 row
+            RUNNER_ASSERT_MSG(iter->Get_Value3() == 111, "Wrong row 4 order");
+            RUNNER_ASSERT_MSG(*iter->Get_TestText33() == DPL::FromASCIIString("test 1"), "Wrong row 4 order");
+            RUNNER_ASSERT_MSG(iter->Get_TestID() == 1, "Wrong row 4 order");
+            iter++;
+        }
+        { //5 row
+            RUNNER_ASSERT_MSG(iter->Get_Value3() == 222, "Wrong row 5 order");
+            RUNNER_ASSERT_MSG(*iter->Get_TestText33() == DPL::FromASCIIString("test 4"), "Wrong row 5 order");
+            RUNNER_ASSERT_MSG(iter->Get_TestID() == 6, "Wrong row 5 order");
+            iter++;
+        }
+        { //6 row
+            RUNNER_ASSERT_MSG(iter->Get_Value3() == 222, "Wrong row 6 order");
+            RUNNER_ASSERT_MSG(*iter->Get_TestText33() == DPL::FromASCIIString("test 3"), "Wrong row 6 order");
+            RUNNER_ASSERT_MSG(iter->Get_TestID() == 3, "Wrong row 6 order");
+            iter++;
+        }
+    }
+}
index aae9ce29e3491fca3d667bbf1ae31192571af553..5f580186b3243aa08e3b64aa8df67efe587f6f73 100644 (file)
@@ -158,7 +158,7 @@ class WidgetDAO
      */
     DbWidgetHandle getHandle() const { return m_widgetHandle; }
     DbWidgetHandle getHandle(const WidgetGUID GUID) const;
-    static DbWidgetHandle getHandle(const DPL::String pkgName);
+    static DbWidgetHandle getHandle(const DPL::String tizenAppId);
 
     /**
      * This method returns the root directory of widget resource.
index d781c054bfadff3903be93dc7696bb6d86428878..6dc27390140cec262a0bb92c3699004da7c33c51 100644 (file)
@@ -44,7 +44,7 @@ DbWidgetHandle WidgetDAO::getHandle(const WidgetGUID /* GUID */) const
     return 0;
 }
 
-DbWidgetHandle WidgetDAO::getHandle(const DPL::String /* pkgName */)
+DbWidgetHandle WidgetDAO::getHandle(const DPL::String /* tizenAppId */)
 {
     LogError("Not implemented!");
     return 0;