Remove exclusive type
authorJinWang An <jinwang.an@samsung.com>
Mon, 24 Feb 2020 01:38:07 +0000 (10:38 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Wed, 18 Mar 2020 08:53:50 +0000 (17:53 +0900)
15 files changed:
example/mode/tizen_asyncValidErr_mode.xml
example/mode/tizen_conflictErrExclusive_mode.xml
example/mode/tizen_invalidValErr1_mode.xml
example/mode/tizen_invalidValErr2_mode.xml
example/mode/tizen_normalEx2_mode.xml
include/modes_constants.h
schema/tizen_mode.xsd
supervisor/ConflictManager.cpp
supervisor/Mode.h
supervisor/ModeCareTaker.cpp
supervisor/ModeCareTaker.h
supervisor/ModeXMLParser.cpp
supervisor/XMLGenerator.cpp
unittest/modes_test_client.cpp
unittest/modes_test_conflict.cpp

index 763c8ff94b23212a452ef923d101c84a67c44f6b..9ef4ab31374f544e0a29bc4650a255186071bb6d 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="async_valied" type="exclusive" hidden="true">
-    <action rule="test.sleepErrorReturn" stopOnErr="true" type="async">5</action>
+  <mode name="async_valied" type="normal" hidden="true">
+    <action rule="test.sleepErrorReturn" restrict="lock" stopOnErr="true" type="async">5</action>
   </mode>
 </tizenModes>
index 43cb35b9884b3d1de94984abe9f91af865f14028..b4d7858d55c47f10a2b393d085134515209049ae 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="conflict3" type="exclusive">
+  <mode name="conflict3" type="normal">
     <action ID="test" rule="test.printBool" restrict="lock">true</action>
   </mode>
 </tizenModes>
index c34416b432fc0a3c758700a60d143d2f33f089a2..134df11aff00ea49e01601d83ceba698e274d7e9 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="invalid1" type="exclusive">
-    <action rule="test.printBool">123</action>
+  <mode name="invalid1" type="normal">
+    <action rule="test.printBool" restrict="lock">123</action>
   </mode>
 </tizenModes>
index 374eef154a291412b4502dd6b25348fabfe70927..0078fffe83fa00d14dea682e9b553624518eb01f 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="invalid2" type="exclusive">
-    <action rule="test.printInt">PRINT_TREE</action>
+  <mode name="invalid2" type="normal">
+    <action rule="test.printInt" restrict="lock">PRINT_TREE</action>
   </mode>
 </tizenModes>
index e062a2169ed7985ebd7ed6fde2c2e2f33da812a6..22614f1058d959aa0626727e0e69562ac72282e7 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="ex2" type="exclusive" hidden="true">
+  <mode name="ex2" type="normal" hidden="true">
     <action ID="1" rule="test.printInt" stopOnErr="true" restrict="lock" priority="-100">PRINT_FOUR</action>
     <action ID="wifiOff" rule="test.printBool" restrict="lock" priority="-100">off</action>
   </mode>
index a8cdfb1811b251635f8cf450eba9113da8a0d256..e74e18e56ba03407d5cf5c770448d8a976d17a7a 100644 (file)
@@ -43,8 +43,6 @@
 typedef enum {
        MODES_TYPE_MODE_NORMAL = 0, /**< Indicates normal mode that is allowed to undo and apply other mode  */
        MODES_TYPE_MODE_ONESHOT = (1 << 0), /**< Indicates one-shot mode that has no management(undo) */
-       // Exclusive is not valide type on making by user.
-       //MODES_TYPE_MODE_EXCLUSIVE = (1 << 1), /**< Indicates exclusive mode that is only allowed to undo */
 } modes_type_mode_e;
 
 
index 9f48f1f370885fd6001da56ca498284e62f4a709..3692d821479188162c4a6544ad482caca0acee7f 100644 (file)
@@ -52,7 +52,6 @@
     <xs:restriction base="xs:string">
       <xs:enumeration value="normal"/>
       <xs:enumeration value="oneshot"/>
-      <xs:enumeration value="exclusive"/>
     </xs:restriction>
   </xs:simpleType>
 </xs:schema>
index be93fd1fda929f824666b19ae76886646acfa706..599072ce263540e8e72e3c4c82aff8160d24b9c1 100644 (file)
@@ -28,7 +28,7 @@ ConflictManager::ConflictManager(ModeCareTaker &careTaker)
 
 bool ConflictManager::isConflict(const Mode &mode)
 {
-       if (careTaker.isSavedMode(mode.getName()) || careTaker.isExclusive())
+       if (careTaker.isSavedMode(mode.getName()))
                return true;
 
        if (careTaker.checkConflictAction(mode))
index 60f9d1a5312b573af4e2f237d0eb5a574c34f990..c22a838f031620edae1a1e9dfceca67965f51c04 100644 (file)
@@ -28,7 +28,6 @@ public:
        typedef enum {
                MODE_NORMAL,
                MODE_ONESHOT,
-               MODE_EXCLUSIVE
        } ModeType;
 
        Mode();
index 76c0675e32efbad55f6caef0a4bbf697ede00c89..3e7c710ccdb26dff868d79a3844fa9ac7a2dfcc7 100644 (file)
@@ -22,7 +22,7 @@
 MODES_NAMESPACE_USE;
 
 ModeCareTaker::ModeCareTaker()
-       : undoDir(MODES_UNDO_INFO_DEFAULT_DIR), exclusive(false)
+       : undoDir(MODES_UNDO_INFO_DEFAULT_DIR)
 {
 }
 
@@ -34,13 +34,11 @@ void ModeCareTaker::setOptions(const std::string &undoInfoDir)
 void ModeCareTaker::restoreMode(const Mode &mode)
 {
        savedModes.insert(std::pair<std::string, Mode>(mode.getName(), mode));
-       exclusive = (Mode::MODE_EXCLUSIVE == mode.getModeType());
 }
 
 void ModeCareTaker::pushMode(const Mode &mode)
 {
        savedModes.insert(std::pair<std::string, Mode>(mode.getName(), mode));
-       exclusive = (Mode::MODE_EXCLUSIVE == mode.getModeType());
 
        if (mode.hasEssential())
                handleEssentialAction(mode);
@@ -69,9 +67,6 @@ int ModeCareTaker::popMode(const std::string &name, Mode &mode)
        }
 
        mode = found->second;
-       if (Mode::MODE_EXCLUSIVE == mode.getModeType())
-               exclusive = false;
-
        savedModes.erase(found);
 
        return MODES_ERROR_NONE;
@@ -88,13 +83,6 @@ bool ModeCareTaker::isSavedMode(const std::string &name)
        return false;
 }
 
-bool ModeCareTaker::isExclusive()
-{
-       if (exclusive)
-               ERR("exclusive Mode is applied");
-       return exclusive;
-}
-
 bool ModeCareTaker::findLockedAction(const std::string &ruleName)
 {
        for (auto modeIt = savedModes.begin(); modeIt != savedModes.end(); modeIt++) {
index c5ed7fec89c3351ea3d2e72ce7be298c896b0f3e..7803dbf09d679a287118b14dab82f0ecf11a6457 100644 (file)
@@ -33,7 +33,6 @@ public:
        void pushMode(const Mode &mode);
        int popMode(const std::string &name, Mode &mode);
        bool isSavedMode(const std::string &name);
-       bool isExclusive();
        bool checkConflictAction(const Mode &mode);
        void update(const std::string &rule);
 private:
@@ -42,7 +41,6 @@ private:
        std::map<std::string, Mode> savedModes;
        std::multimap<std::string, std::string> essentialMap;
        std::string undoDir;
-       bool exclusive;
 };
 
 MODES_NAMESPACE_END
index f20aecdd68ddfe06c502a63220d4e26df4f01a84..06eb4b52c09bf0dc80b7f4f371356483b14d6e77 100644 (file)
@@ -153,8 +153,6 @@ Mode::ModeType ModeXMLParser::extractModeType(xmlNodePtr node)
        Mode::ModeType type;
        if ("normal" == val)
                type = Mode::MODE_NORMAL;
-       else if ("exclusive" == val)
-               type = Mode::MODE_EXCLUSIVE;
        else
                type = Mode::MODE_ONESHOT;
        return type;
index a99d27f978ec68e83814d44354f620e64d87dcd0..9d7ae97d48e2609528554552caf82eaacef372f4 100644 (file)
@@ -60,8 +60,6 @@ const std::string XMLGenerator::getModeTypeStr(Mode::ModeType t)
        switch (t) {
        case Mode::MODE_ONESHOT:
                return "oneshot";
-       case Mode::MODE_EXCLUSIVE:
-               return "exclusive";
        case Mode::MODE_NORMAL:
        default:
                return "normal";
index 4b9a61f6e4bd93c35334bf0d772980f642756c89..9c4d6e1af2a1e5f95c216d7ab98df57437260d29 100644 (file)
@@ -114,16 +114,6 @@ TEST_F(ClientTest, canApplyModeN)
        EXPECT_EQ(MODES_ERROR_NO_DATA, ret);
 }
 
-TEST_F(ClientTest, canApplyModeConflictExclusive)
-{
-       modes_undo_mode(handle, "ex2");
-       g_idle_add(applyModeIdler, (gpointer)"ex2");
-       g_main_loop_run(loop);
-       int ret = modes_can_apply(handle, "ex1");
-       EXPECT_EQ(MODES_ERROR_CONFLICT, ret);
-       modes_undo_mode(handle, "ex2");
-}
-
 TEST_F(ClientTest, registerMode)
 {
        g_idle_add(registerModeIdler, NULL);
@@ -149,10 +139,9 @@ TEST_F(ClientTest, undoModeEx2)
 
 TEST_F(ClientTest, getModes)
 {
-const char* const typeList[3] = {
+const char* const typeList[2]= {
                "MODES_TYPE_MODE_NORMAL",
-               "MODES_TYPE_MODE_ONESHOT",
-               "MODES_TYPE_MODE_EXCLUSIVE"
+               "MODES_TYPE_MODE_ONESHOT"
        };
 
        GList *list, *cur;
index c72974427639e1661adf353893676540b3298ee6..f98a592fe43eecbd7b133049cd8fb21753f8adf5 100644 (file)
@@ -62,18 +62,6 @@ TEST_F(ConflictTest, isSavedMode)
        EXPECT_TRUE(careTaker.isSavedMode(modeparser.getModeName()));
 }
 
-TEST_F(ConflictTest, isExclusive)
-{
-       ModeXMLParser modeparser("tizen_conflictErrExclusive_mode.xml", ruleMgr);
-
-       careTaker.pushMode(modeparser.getMode());
-       EXPECT_TRUE(careTaker.isExclusive());
-
-       Mode mode;
-       careTaker.popMode(modeparser.getModeName(), mode);
-       EXPECT_FALSE(careTaker.isExclusive());
-}
-
 TEST_F(ConflictTest, checkConflictAction)
 {
        ModeXMLParser modeparser("tizen_conflictErr_mode.xml", ruleMgr);