Remove getModeName()
authorJinWang An <jinwang.an@samsung.com>
Mon, 11 May 2020 03:37:32 +0000 (12:37 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Mon, 11 May 2020 09:20:46 +0000 (18:20 +0900)
supervisor/ModeParser.h
supervisor/ModeXMLParser.cpp
supervisor/ModeXMLParser.h
supervisor/UndoInfoParser.cpp
supervisor/UndoInfoParser.h
unittest/modes_test_conflict.cpp
unittest/modes_test_generator.cpp
unittest/modes_test_parser.cpp

index 0f318af950e67b811e432a013e18b0112695f339..d32e19e00614f65b49693ff79bd2a6388564333f 100644 (file)
@@ -27,7 +27,6 @@ public:
        virtual ~ModeParser() = default;
 
        virtual Mode getMode() = 0;
-       virtual std::string getModeName() = 0;
        virtual void validateMode(const std::string &syntaxFile) = 0;
 protected:
        ModeParser(RuleManager &rMgr) :ruleMgr(rMgr)
index cebdffce7b503b727fafddc93408ac754d459e43..cdd8f12bb281cd34639ae4666e72eccf26fa8a06 100644 (file)
@@ -39,30 +39,6 @@ Mode ModeXMLParser::getMode()
        return mode;
 }
 
-std::string ModeXMLParser::getModeName()
-{
-       parseModeAttrOnly();
-       return mode.getName();
-}
-
-void ModeXMLParser::parseModeAttrOnly()
-{
-       if (true == isParsedModeAttr)
-               return;
-
-       isParsedModeAttr = true;
-       xmlNodePtr root = getRoot();
-       for (xmlNodePtr cur = root->children; cur; cur = cur->next) {
-               if (xmlIsBlankNode(cur))
-                       continue;
-
-               if (MDS_EQUAL == xmlStrcmp(cur->name, ModesXMLTag::MODE)) {
-                       parseModeAttr(cur);
-                       break;
-               }
-       }
-}
-
 void ModeXMLParser::validateMode(const std::string &xsd)
 {
        try {
index 9bd3a0a5cdd39896f4b2423ae60e84853e036024..1edb0431093e0da9f55847a77ebed84e48833db4 100644 (file)
@@ -28,7 +28,6 @@ public:
        ~ModeXMLParser() = default;
 
        Mode getMode() override;
-       std::string getModeName() override;
        void validateMode(const std::string &xsd) override;
 
 private:
index d316f409dd0d6fa13709d8a4f91948726a6f1eed..4f0ee677eacedf9dab1c88addbe6d1c2358d98af 100644 (file)
@@ -31,20 +31,6 @@ UndoInfoParser::UndoInfoParser(const std::string &file)
 {
 }
 
-std::string UndoInfoParser::getModeName()
-{
-       xmlNodePtr root = getRoot();
-       for (xmlNodePtr cur = root->children; cur; cur = cur->next) {
-               if (xmlIsBlankNode(cur))
-                       continue;
-
-               if (MDS_EQUAL == xmlStrcmp(cur->name, ModesXMLTag::UNDO_INFO))
-                       return extractValueOfTag(cur, ModesXMLTag::NAME);
-       }
-
-       return std::string();
-}
-
 void UndoInfoParser::putUndoInfo(Mode &mode)
 {
        std::list<std::shared_ptr<Action>> actionList = mode.getActionList();
index c6e9e6cfa10ee3c4feb4a24287b2b3fd1d5c6c13..ba7f404ed8b8bf30c582bf26e373a33b4dd0396d 100644 (file)
@@ -27,7 +27,6 @@ public:
        UndoInfoParser(const std::string &file);
        ~UndoInfoParser() = default;
 
-       std::string getModeName();
        void putUndoInfo(Mode &mode);
 private:
        void iterateElement(xmlNodePtr node, const std::list<std::shared_ptr<Action>>& actionList);
index 37bd0bc80752af1b8723ef20d7b4092273a739a4..29cb270e1ca21b001613eff53e161c081f84c250 100644 (file)
@@ -58,8 +58,8 @@ ConflictTest::ConflictTest()
 TEST_F(ConflictTest, isSavedMode)
 {
        ModeXMLParser modeparser("tizen_conflictErrBase_mode.xml", ruleMgr);
-
-       EXPECT_TRUE(careTaker.isSavedMode(modeparser.getModeName()));
+       Mode mode = modeparser.getMode();
+       EXPECT_TRUE(careTaker.isSavedMode(mode.getName()));
 }
 
 TEST_F(ConflictTest, checkConflictAction)
index 14e604e5090d60ef5efa4af32de2a41570961db5..99cf52e57a4f3bfdd55882fb6162f6210da37fd9 100644 (file)
@@ -57,7 +57,7 @@ TEST(XMLGenerator, makeModeXML)
        ModeXMLParser genModeParser("tizen_generatedEx1_mode.xml", broker.ruleMgr);
        Mode genMode = genModeParser.getMode();
 
-       EXPECT_EQ("ex1", genModeParser.getModeName());
+       EXPECT_EQ("ex1", genMode.getName());
        std::list<std::shared_ptr<Action>> actionList = mode.getActionList();
        EXPECT_FALSE(actionList.empty());
 
index 17936540fcf30bc6878117294b06d6fad6159428..8a5d110ce6b54ead17e4efd60f71e5072cd588a5 100644 (file)
@@ -56,13 +56,6 @@ list<shared_ptr<Action>> ParserTest::getActionList(Mode& m)
        return m.actionList;
 }
 
-TEST_F(ParserTest, getModeName)
-{
-       ModeXMLParser modeparser("tizen_normalEx1_mode.xml", ruleMgr);
-
-       EXPECT_EQ("ex1", modeparser.getModeName());
-}
-
 TEST_F(ParserTest, modeGetName)
 {
        ModeXMLParser modeparser("tizen_normalEx2_mode.xml", ruleMgr);