Clean-up GlobalDAO (RoamingDataUsage)
authorJihoon Chung <jihoon.chung@samsaung.com>
Mon, 21 Oct 2013 13:38:37 +0000 (22:38 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Fri, 25 Oct 2013 02:30:41 +0000 (02:30 +0000)
[Issue#]   LINUXWRT-1032
[Problem]  GlobalDAO has unnecessary API.
[Cause]    N/A
[Solution] Remove "RoamingDataUsage" API
           - Current use cases are unnecessary and this setting should directly use platform setting.
           - Also clean-up GlobalDAO.
[Verification] build repo
[SCMRequest] N/A

Change-Id: I89887fec6d2dea994b61f23780e028eb9b2d9ec0

modules/widget_dao/CMakeLists.txt
modules/widget_dao/dao/global_dao.cpp [deleted file]
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 [deleted file]
modules/widget_dao/orm/wrt_db
tests/dao/TestCases_GlobalDAO.cpp [deleted file]

index 141a29f..0db09c1 100755 (executable)
@@ -55,7 +55,6 @@ set(WRT_DAO_RO_SOURCES
 
 set(WRT_DAO_RW_SOURCES
     dao/feature_dao.cpp
-    dao/global_dao.cpp
     dao/plugin_dao.cpp
     dao/property_dao.cpp
     dao/widget_dao.cpp
@@ -134,7 +133,6 @@ INSTALL(FILES
 
 INSTALL(FILES
     include/dpl/wrt-dao-rw/feature_dao.h
-    include/dpl/wrt-dao-rw/global_dao.h
     include/dpl/wrt-dao-rw/plugin_dao.h
     include/dpl/wrt-dao-rw/property_dao.h
     include/dpl/wrt-dao-rw/widget_dao.h
diff --git a/modules/widget_dao/dao/global_dao.cpp b/modules/widget_dao/dao/global_dao.cpp
deleted file mode 100644 (file)
index 20b4596..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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   global_dao.cpp
- * @author  Pawel Sikorski (p.sikorski@samsung.com)
- * @version 1.0
- * @brief   This file contains the definition of global dao class.
- */
-#include <stddef.h>
-#include <dpl/wrt-dao-rw/global_dao.h>
-#include <dpl/log/log.h>
-#include <dpl/string.h>
-#include <dpl/db/orm.h>
-#include <orm_generator_wrt.h>
-#include <dpl/wrt-dao-ro/webruntime_database.h>
-#include <dpl/wrt-dao-ro/WrtDatabase.h>
-
-namespace WrtDB {
-void GlobalDAO::SetRoamingDataUsage(GlobalDAO::NetworkAccessMode newMode)
-{
-    LogDebug("updating roaming network data usage to:" << newMode);
-    Try {
-        using namespace DPL::DB::ORM;
-        using namespace DPL::DB::ORM::wrt;
-        GlobalProperties::Row row;
-        row.Set_roaming_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 roaming network data usage");
-    }
-}
-
-} // namespace WrtDB
index 2520181..f894d2b 100644 (file)
 #include <dpl/wrt-dao-ro/common_dao_types.h>
 
 namespace WrtDB {
-GlobalDAOReadOnly::NetworkAccessMode GlobalDAOReadOnly::GetRoamingDataUsage()
-{
-    LogDebug("Getting roaming 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::roaming_data_usage>());
-    }
-    Catch(DPL::DB::SqlConnection::Exception::Base){
-        ReThrowMsg(GlobalDAOReadOnly::Exception::DatabaseError,
-                   "Failed to get roaming network data usage");
-    }
-}
-
 DeviceCapabilitySet GlobalDAOReadOnly::GetDeviceCapability(
     const DPL::String &apifeature)
 {
index 6430b63..446b43c 100644 (file)
@@ -51,23 +51,6 @@ class GlobalDAOReadOnly
     };
 
   public:
-
-
-
-    enum NetworkAccessMode
-    {
-        NEVER_CONNECT,
-        ALWAYS_ASK,
-        CONNECT_AUTOMATICALLY
-    };
-
-    /**
-     * This method returns network access mode while roaming is enabled.
-     *
-     * @return Access mode for home network.
-     */
-    static NetworkAccessMode GetRoamingDataUsage() DPL_DEPRECATED;
-
     /**
      * This method returns set of device capabilities used by apifeature.
      */
diff --git a/modules/widget_dao/include/dpl/wrt-dao-rw/global_dao.h b/modules/widget_dao/include/dpl/wrt-dao-rw/global_dao.h
deleted file mode 100644 (file)
index aa150c4..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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    global_dao.h
- * @author  Pawel Sikorski (p.sikorski@samsung.com)
- * @version 1.0
- * @brief   This file contains the declaration of global dao
- */
-
-#ifndef WRT_SRC_CONFIGURATION_GLOBAL_DAO_H_
-#define WRT_SRC_CONFIGURATION_GLOBAL_DAO_H_
-
-#include <dpl/availability.h>
-#include <dpl/wrt-dao-ro/global_dao_read_only.h>
-
-namespace WrtDB {
-class GlobalDAO : public GlobalDAOReadOnly
-{
-  public:
-    /**
-     * This method changes network access mode while roaming is enabled.
-     *
-     */
-    static void SetRoamingDataUsage(NetworkAccessMode newMode) DPL_DEPRECATED;
-
-  private:
-    DPL_DEPRECATED GlobalDAO()
-    {}
-};
-} // namespace WrtDB
-
-#endif /* WRT_SRC_CONFIGURATION_GLOBAL_DAO_H_ */
index ce6c101..b09fdf8 100644 (file)
@@ -2,13 +2,6 @@ SQL(
     PRAGMA foreign_keys = ON;
     BEGIN TRANSACTION;
 )
-CREATE_TABLE(GlobalProperties)
-    COLUMN_NOT_NULL(roaming_data_usage,      TINYINT,      DEFAULT 1)
-CREATE_TABLE_END()
-
-SQL(
-    INSERT INTO GlobalProperties DEFAULT VALUES;
-)
 
 CREATE_TABLE(WidgetInfo)
     COLUMN_NOT_NULL(app_id,         INTEGER, PRIMARY KEY AUTOINCREMENT)
diff --git a/tests/dao/TestCases_GlobalDAO.cpp b/tests/dao/TestCases_GlobalDAO.cpp
deleted file mode 100644 (file)
index c56f38c..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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   TestCases_GlobalDAO.cpp
- * @author  Pawel Sikorski (p.sikorski@samsung.com)
- * @version 1.0
- * @brief   This file contains tests for global dao class.
- */
-
-#include <list>
-#include <vector>
-#include <set>
-#include <dpl/test/test_runner.h>
-#include <dpl/foreach.h>
-#include <dpl/exception.h>
-#include <dpl/string.h>
-#include <dpl/wrt-dao-rw/global_dao.h>
-#include <dpl/wrt-dao-ro/wrt_db_types.h>
-
-using namespace WrtDB;
-
-namespace {
-const DPL::String widgetPackage5(L"widgetpackage5");
-} // namespace
-
-RUNNER_TEST_GROUP_INIT(DAO)
-
-/*
- * Name: roaming_data_usage
- * Description: tests if RoamingDataUsage is correctly set and get
- * Expected: received developer shoudl match the one was set
- */
-RUNNER_TEST(roaming_data_usage)
-{
-    GlobalDAO::NetworkAccessMode original =
-        GlobalDAO::GetRoamingDataUsage();
-
-    GlobalDAO::SetRoamingDataUsage(GlobalDAO::CONNECT_AUTOMATICALLY);
-    RUNNER_ASSERT_MSG(GlobalDAO::CONNECT_AUTOMATICALLY ==
-                      GlobalDAO::GetRoamingDataUsage(), "Value not updated");
-
-    GlobalDAO::SetRoamingDataUsage(GlobalDAO::ALWAYS_ASK);
-    RUNNER_ASSERT_MSG(GlobalDAO::ALWAYS_ASK ==
-                      GlobalDAO::GetRoamingDataUsage(), "Value not updated");
-
-    GlobalDAO::SetRoamingDataUsage(GlobalDAO::NEVER_CONNECT);
-    RUNNER_ASSERT_MSG(GlobalDAO::NEVER_CONNECT ==
-                      GlobalDAO::GetRoamingDataUsage(), "Value not updated");
-
-    GlobalDAO::SetRoamingDataUsage(original);
-    RUNNER_ASSERT_MSG(original == GlobalDAO::GetRoamingDataUsage(),
-                      "Value not updated");
-}