[Release] wrt-commons_0.2.134
authorJihoon Chung <jihoon.chung@samsung.com>
Mon, 24 Jun 2013 14:39:22 +0000 (23:39 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Mon, 24 Jun 2013 14:39:22 +0000 (23:39 +0900)
Change-Id: Ib3164844a629a8ced82e2316eb8449c9799e8c5d

modules/support/wrt_plugin_export.h
modules/widget_dao/dao/plugin_dao_read_only.cpp
modules/widget_dao/dao/property_dao_read_only.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h
packaging/wrt-commons.spec
tests/dao/TestCases_PropertyDAO.cpp
tests/dao/wrt_dao_tests_prepare_db.sh

index ae1e8e1..0cf4e37 100644 (file)
@@ -138,7 +138,7 @@ typedef enum class_definition_iframe_behaviour_e
     //it is default one
     NONE,
     //object should be copied as reference to each iframe
-    REFERENCE,
+    REFERENCE, // deprecated
     //object should be created for each iframe and NOT inform plugin
     CREATE_INSTANCE
 } class_definition_iframe_behaviour_t;
@@ -153,9 +153,9 @@ typedef enum class_definition_iframe_notice_e
 typedef enum class_definition_iframe_overlay_e
 {
     IGNORED,
-    USE_OVERLAYED,
-    OVERLAYED_BEFORE_ORIGINAL
-} class_definition_iframe_overlay_t;
+    USE_OVERLAYED, //deprecated
+    OVERLAYED_BEFORE_ORIGINAL //deprecated
+} class_definition_iframe_overlay_t; //deprecated
 
 typedef void* js_object_instance_t;
 //global_context - id
@@ -170,7 +170,7 @@ typedef struct class_definition_options_s
     class_definition_type_t type;
     class_definition_iframe_behaviour_t iframe_option;
     class_definition_iframe_notice_t iframe_notice;
-    class_definition_iframe_overlay_t iframe_overlay;
+    class_definition_iframe_overlay_t iframe_overlay;   //deprecated
     iframe_loaded_cb cb;
     void * private_data;
     js_function_impl function;
index 045cdd6..a90e013 100644 (file)
@@ -275,6 +275,35 @@ DbPluginHandle PluginDAOReadOnly::getPluginHandleForImplementedObject(
     }
 }
 
+ImplementedObjectsList PluginDAOReadOnly::getImplementedObjects()
+{
+    LogDebug("getImplementedObjects");
+
+    Try
+    {
+        ImplementedObjectsList objectList;
+        using namespace DPL::DB::ORM;
+        using namespace DPL::DB::ORM::wrt;
+
+        WRT_DB_SELECT(select, PluginImplementedObjects, &WrtDatabase::interface())
+        std::list<DPL::String> valueList = select->GetValueList<PluginImplementedObjects::PluginObject>();
+
+        if (!valueList.empty()) {
+            FOREACH(it, valueList)
+            {
+                objectList.push_back(DPL::ToUTF8String(*it));
+            }
+        } else {
+            LogWarning("PluginHandle for object not found");
+        }
+        return objectList;
+    }
+    Catch(DPL::DB::SqlConnection::Exception::Base) {
+        ReThrowMsg(PluginDAOReadOnly::Exception::DatabaseError,
+                   "Failed in GetPluginHandleForImplementedObject");
+    }
+}
+
 ImplementedObjectsList PluginDAOReadOnly::getImplementedObjectsForPluginHandle(
     DbPluginHandle handle)
 {
index 5e06afc..3676d5a 100644 (file)
@@ -133,42 +133,40 @@ WidgetPropertyKeyList GetPropertyKeyList(TizenAppId tzAppid)
     }
 }
 
-//deprecated
-WidgetPreferenceList GetPropertyList(DbWidgetHandle widgetHandle)
-{
-    Try {
-        TizenAppId tzAppid = WidgetDAOReadOnly::getTzAppId(widgetHandle);
-        return GetPropertyList(tzAppid);
-    } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist){
-        WidgetPreferenceList empty;
-        return empty;
-    }
-}
 
-WidgetPreferenceList GetPropertyList(TizenAppId tzAppId)
+WidgetPreferenceList GetPropertyListRows(DbWidgetHandle widgetHandle)
 {
-    LogDebug("Get Property list. tizenAppId: " << tzAppId);
     Try {
         using namespace DPL::DB::ORM;
         using namespace DPL::DB::ORM::wrt;
-
-        DbWidgetHandle widgetHandle(WidgetDAOReadOnly::getHandle(tzAppId));
-
         WRT_DB_SELECT(select, WidgetPreference, &WrtDatabase::interface())
-        select->Where(Equals<WidgetPreference::app_id>(widgetHandle));
-
+            select->Where(Equals<WidgetPreference::app_id>(widgetHandle));
         ORMWidgetPreferenceList ormPrefList = select->GetRowList();
         WidgetPreferenceList prefList;
         convertWidgetPreferenceRow(ormPrefList, prefList);
-
         return prefList;
-    }
-    Catch(DPL::DB::SqlConnection::Exception::Base){
+    }Catch(DPL::DB::SqlConnection::Exception::Base){
         ReThrowMsg(Exception::DatabaseError,
-                   "Failure during getting property list");
+                "Failure during getting property list");
     }
 }
 
+WidgetPreferenceList GetPropertyList(DbWidgetHandle widgetHandle)
+{
+    if(!(WidgetDAOReadOnly::isWidgetInstalled(widgetHandle)))
+        ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist,
+                "Failed to get widget");
+    return GetPropertyListRows(widgetHandle);
+}
+
+WidgetPreferenceList GetPropertyList(TizenAppId tzAppId)
+{
+    LogDebug("Get Property list. tizenAppId: " << tzAppId);
+    DbWidgetHandle widgetHandle(WidgetDAOReadOnly::getHandle(tzAppId));
+    return GetPropertyListRows(widgetHandle);
+}
+
+
 WidgetPropertyValue GetPropertyValue(TizenAppId tzAppid,
                                      const WidgetPropertyKey &key)
 {
index 293cf13..3be2441 100644 (file)
@@ -90,6 +90,7 @@ class PluginDAOReadOnly
     static DbPluginHandle getPluginHandleForImplementedObject(
         const std::string& objectName);
 
+    static ImplementedObjectsList getImplementedObjects();
     static ImplementedObjectsList getImplementedObjectsForPluginHandle(
         DbPluginHandle handle);
 
index 87da17f..42f9bbb 100644 (file)
@@ -1,7 +1,7 @@
 #git:framework/web/wrt-commons
 Name:       wrt-commons
 Summary:    Wrt common library
-Version:    0.2.133
+Version:    0.2.134
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index effd898..8ddc977 100644 (file)
@@ -27,6 +27,7 @@
 #include <dpl/exception.h>
 #include <dpl/wrt-dao-rw/property_dao.h>
 #include <dpl/wrt-dao-ro/wrt_db_types.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 
 using namespace WrtDB;
 using namespace WrtDB::PropertyDAOReadOnly;
@@ -46,6 +47,7 @@ using namespace WrtDB::PropertyDAOReadOnly;
 
 RUNNER_TEST_GROUP_INIT(DAO)
 
+
 /*
  * Name: property_dao_get_lists
  * Description: tests returning list of properties for given id
@@ -55,20 +57,35 @@ RUNNER_TEST_GROUP_INIT(DAO)
 RUNNER_TEST(property_dao_get_lists)
 {
     { //property list
-        std::map<WrtDB::TizenAppId, size_t> prefsMap;
-        prefsMap.insert(std::pair<WrtDB::TizenAppId, size_t>(L"tizenid201", 2));
-        prefsMap.insert(std::pair<WrtDB::TizenAppId, size_t>(L"tizenid202", 1));
-        prefsMap.insert(std::pair<WrtDB::TizenAppId, size_t>(L"tizenid203", 2));
-        //no widget
-        prefsMap.insert(std::pair<WrtDB::TizenAppId, size_t>(L"non_exists", 0));
-
-        FOREACH(it, prefsMap) {
-            PropertyDAOReadOnly::WidgetPreferenceList prefs =
-                PropertyDAOReadOnly::GetPropertyList(it->first);
-            RUNNER_ASSERT(prefs.size() == it->second);
+        struct three_field{
+            WrtDB::TizenAppId   tappid;
+            DbWidgetHandle      whandleid;
+            size_t              nrow;
+        };
+
+        three_field f3;
+        std::list<three_field> prefList;
+        std::list<three_field>::iterator it;
+
+        f3.tappid=L"tizenid201";f3.whandleid=2000;f3.nrow=2;
+        prefList.push_back(f3);
+        f3.tappid=L"tizenid202"; f3.whandleid=2001;f3.nrow=1;
+        prefList.push_back(f3);
+        f3.tappid=L"tizenid203"; f3.whandleid=2002;f3.nrow=2;
+        prefList.push_back(f3);
+        f3.tappid=L"tizenid204"; f3.whandleid=2003;f3.nrow=0;
+        prefList.push_back(f3);
+
+        for(it=prefList.begin();it!=prefList.end();++it)
+        {
+            PropertyDAOReadOnly::WidgetPreferenceList prefs_tid =
+                    PropertyDAOReadOnly::GetPropertyList(it->tappid);
+            RUNNER_ASSERT(prefs_tid.size() == it->nrow);
+            PropertyDAOReadOnly::WidgetPreferenceList prefs_aid =
+                    PropertyDAOReadOnly::GetPropertyList(it->whandleid);
+            RUNNER_ASSERT(prefs_aid.size() == it->nrow);
         }
     }
-
     { //property key list
         WidgetPropertyKeyList orig_2000;
         orig_2000.push_back(DPL::FromUTF8String("key1_for_2000"));
@@ -102,6 +119,46 @@ RUNNER_TEST(property_dao_get_lists)
     }
 }
 
+
+/*
+ * Name: property_dao_get_list_exceptions
+ * Description: tests returning exception for given tizen_appid if is
+ * not inserted into WidgetInfo table
+ * Expected: procedure passes when is exception. Widget absent in the WidgetInfo
+ * table.
+ */
+RUNNER_TEST(property_dao_get_list_exceptions)
+{
+    {
+        bool assert_flag;
+        WrtDB::TizenAppId app_id_non_exists = L"non_exists";
+
+        assert_flag=true;
+        Try{
+            PropertyDAOReadOnly::WidgetPreferenceList prefs =
+                    PropertyDAOReadOnly::GetPropertyList(app_id_non_exists);
+        } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
+        {
+            assert_flag=false;
+        }
+        RUNNER_ASSERT_MSG(!(assert_flag),"Error, value doesn't make exception");
+    }
+    {
+        bool assert_flag;
+        DbWidgetHandle handle_non_exist(2010);
+        assert_flag=true;
+        Try{
+            PropertyDAOReadOnly::WidgetPreferenceList prefs =
+                    PropertyDAOReadOnly::GetPropertyList(handle_non_exist);
+        } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
+        {
+            assert_flag=false;
+        }
+        RUNNER_ASSERT_MSG(!(assert_flag),"Error, value doesn't make exception");
+    }
+}
+
+
 /*
  * Name: property_dao_set_update_remove
  * Description: tests set new property for widget, updating property and
index ccb98f6..9666e87 100755 (executable)
@@ -66,7 +66,7 @@ if [ "x$1" == "xstart" ]; then
     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(tizen_appid, key_name, key_value, readonly)"
+    INS_ALL_WIDGET_PREF="insert into WidgetPreference(app_id,tizen_appid, key_name, key_value, readonly)"
     INS_ALL_WIDGET_FEATURE="insert into WidgetFeature(app_id, name)"
     INS_ALL_WIDGET_WINMODES="insert into WidgetWindowModes(app_id, window_mode)"
     INS_ALL_WIDGET_WARP="insert into WidgetWARPInfo(app_id, iri, subdomain_access)"
@@ -106,11 +106,11 @@ if [ "x$1" == "xstart" ]; then
     sqlite3 $WRT_DB "${INS_ALL_WIDGET_LOC_STARTFILE} VALUES(2003, 4, 'en', '', '')";
 
     #widget properties
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES('tizenid201', 'key1_for_2000', 'value_for_key1_2000', 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES('tizenid201', 'key2_for_2000', 'value_for_key2_2000', 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES('tizenid202', 'key1_for_2001', 'value1_for_key_2001', 1)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES('tizenid203', 'key1_for_2002', 'value1_for_key_2002', 0)";
-    sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES('tizenid203', 'key2_for_2002', 'value2_for_key_2002', 1)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES(2000,'tizenid201', 'key1_for_2000', 'value_for_key1_2000', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES(2000,'tizenid201', 'key2_for_2000', 'value_for_key2_2000', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES(2001,'tizenid202', 'key1_for_2001', 'value1_for_key_2001', 1)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES(2002,'tizenid203', 'key1_for_2002', 'value1_for_key_2002', 0)";
+    sqlite3 $WRT_DB "${INS_ALL_WIDGET_PREF} VALUES(2002,'tizenid203', 'key2_for_2002', 'value2_for_key_2002', 1)";
 
     #create if not exists and fix autoincrement value
     sqlite3 $WRT_DB "INSERT INTO WidgetInfo(tizen_appid) VALUES('temp')";