Clean-up GlobalDAO (HomeNetworkDataUsage)
authorJihoon Chung <jihoon.chung@samsaung.com>
Thu, 17 Oct 2013 06:22:37 +0000 (15:22 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Fri, 18 Oct 2013 11:51:13 +0000 (11:51 +0000)
[Issue#]   LINUXWRT-1031
[Problem]  GlobalDAO has unnecessary API.
[Cause]    N/A
[Solution] Remove "HomeNetworkDataUsage" API
           - This kind of setting should directly use platform setting.
[Verification] Checking API usage.
               - once in WRT https://review.tizendev.org/gerrit/#/c/93298/
[SCMRequest] Must be imported with https://review.tizendev.org/gerrit/#/c/93298/

Change-Id: I295817a6198fedb9ccc5002496fc44887c07501c

modules/widget_dao/dao/global_dao.cpp
modules/widget_dao/dao/global_dao_read_only.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/global_dao_read_only.h
modules/widget_dao/include/dpl/wrt-dao-rw/global_dao.h
modules/widget_dao/orm/wrt_db
tests/dao/TestCases_GlobalDAO.cpp

index 7ba2c66..d32ca71 100644 (file)
@@ -47,25 +47,6 @@ void GlobalDAO::SetSecureByDefault(bool secure)
     }
 }
 
-void GlobalDAO::SetHomeNetworkDataUsage(GlobalDAO::NetworkAccessMode newMode)
-{
-    LogDebug("updating home network data usage to:" << newMode);
-    Try {
-        using namespace DPL::DB::ORM;
-        using namespace DPL::DB::ORM::wrt;
-        GlobalProperties::Row row;
-        row.Set_home_network_data_usage(static_cast<int>(newMode));
-
-        WRT_DB_UPDATE(update, GlobalProperties, &WrtDatabase::interface())
-        update->Values(row);
-        update->Execute();
-    }
-    Catch(DPL::DB::SqlConnection::Exception::Base){
-        ReThrowMsg(GlobalDAO::Exception::DatabaseError,
-                   "Failed to update home network data usage");
-    }
-}
-
 void GlobalDAO::SetRoamingDataUsage(GlobalDAO::NetworkAccessMode newMode)
 {
     LogDebug("updating roaming network data usage to:" << newMode);
index bc26a49..92a467f 100644 (file)
@@ -41,24 +41,6 @@ bool GlobalDAOReadOnly::GetSecureByDefault()
     return select->GetSingleValue<GlobalProperties::secure_by_default>();
 }
 
-GlobalDAOReadOnly::NetworkAccessMode
-GlobalDAOReadOnly::GetHomeNetworkDataUsage()
-{
-    LogDebug("Getting home network data usage");
-    Try {
-        using namespace DPL::DB::ORM;
-        using namespace DPL::DB::ORM::wrt;
-        WRT_DB_SELECT(select, GlobalProperties, &WrtDatabase::interface())
-        return static_cast<GlobalDAOReadOnly::NetworkAccessMode>(
-                   select->GetSingleValue<
-                       GlobalProperties::home_network_data_usage>());
-    }
-    Catch(DPL::DB::SqlConnection::Exception::Base){
-        ReThrowMsg(GlobalDAOReadOnly::Exception::DatabaseError,
-                   "Failed to get home network data usage");
-    }
-}
-
 GlobalDAOReadOnly::NetworkAccessMode GlobalDAOReadOnly::GetRoamingDataUsage()
 {
     LogDebug("Getting roaming network data usage");
index 7133cb7..30bb281 100644 (file)
@@ -68,13 +68,6 @@ class GlobalDAOReadOnly
     };
 
     /**
-     * This method returns network access mode for home network.
-     *
-     * @return Access mode for home network.
-     */
-    static NetworkAccessMode GetHomeNetworkDataUsage() DPL_DEPRECATED;
-
-    /**
      * This method returns network access mode while roaming is enabled.
      *
      * @return Access mode for home network.
index b71db8f..ba5e0a1 100644 (file)
@@ -36,12 +36,6 @@ class GlobalDAO : public GlobalDAOReadOnly
      * This method changes network access mode while roaming is enabled.
      *
      */
-    static void SetHomeNetworkDataUsage(NetworkAccessMode newMode) DPL_DEPRECATED;
-
-    /**
-     * This method changes network access mode while roaming is enabled.
-     *
-     */
     static void SetRoamingDataUsage(NetworkAccessMode newMode) DPL_DEPRECATED;
 
     static void SetCookieSharingMode(bool mode) DPL_DEPRECATED;
index 679eb52..dbc4072 100644 (file)
@@ -5,7 +5,6 @@ SQL(
 /*TODO: secure_by_default should be 0 by default*/
 CREATE_TABLE(GlobalProperties)
     COLUMN_NOT_NULL(secure_by_default,       INT,          DEFAULT 1)
-    COLUMN_NOT_NULL(home_network_data_usage, TINYINT,      DEFAULT 1)
     COLUMN_NOT_NULL(roaming_data_usage,      TINYINT,      DEFAULT 1)
     COLUMN_NOT_NULL(cookie_sharing_mode,          INT,          DEFAULT 0)
 CREATE_TABLE_END()
index ff182af..c56f38c 100644 (file)
@@ -39,33 +39,6 @@ const DPL::String widgetPackage5(L"widgetpackage5");
 RUNNER_TEST_GROUP_INIT(DAO)
 
 /*
- * Name: home_network_data_usage
- * Description: tests if HomeNetworkDataUsage is correctly set and get
- * Expected: received developer shoudl match the one was set
- */
-RUNNER_TEST(home_network_data_usage)
-{
-    GlobalDAO::NetworkAccessMode original =
-        GlobalDAO::GetHomeNetworkDataUsage();
-
-    GlobalDAO::SetHomeNetworkDataUsage(GlobalDAO::CONNECT_AUTOMATICALLY);
-    RUNNER_ASSERT_MSG(GlobalDAO::CONNECT_AUTOMATICALLY ==
-                      GlobalDAO::GetHomeNetworkDataUsage(), "Value not updated");
-
-    GlobalDAO::SetHomeNetworkDataUsage(GlobalDAO::ALWAYS_ASK);
-    RUNNER_ASSERT_MSG(GlobalDAO::ALWAYS_ASK ==
-                      GlobalDAO::GetHomeNetworkDataUsage(), "Value not updated");
-
-    GlobalDAO::SetHomeNetworkDataUsage(GlobalDAO::NEVER_CONNECT);
-    RUNNER_ASSERT_MSG(GlobalDAO::NEVER_CONNECT ==
-                      GlobalDAO::GetHomeNetworkDataUsage(), "Value not updated");
-
-    GlobalDAO::SetHomeNetworkDataUsage(original);
-    RUNNER_ASSERT_MSG(original == GlobalDAO::GetHomeNetworkDataUsage(),
-                      "Value not updated");
-}
-
-/*
  * Name: roaming_data_usage
  * Description: tests if RoamingDataUsage is correctly set and get
  * Expected: received developer shoudl match the one was set