Parse optional autorefresh attribute from repoindex.xml
authorMichael Andres <ma@suse.de>
Wed, 14 May 2014 13:22:29 +0000 (15:22 +0200)
committerMichael Andres <ma@suse.de>
Tue, 27 May 2014 14:30:30 +0000 (16:30 +0200)
tests/parser/RepoindexFileReader_test.cc
zypp/parser/RepoindexFileReader.cc

index dd1f25e..34e78dd 100644 (file)
@@ -14,7 +14,7 @@ static string service = "<repoindex>"
   "<repo alias=\"company-foo\" name=\"Company's Foo\""
   "      path=\"products/foo\" distro_target=\"sle-11-i386\" priority=\"20\"/>"
   "<repo alias=\"company-bar\" name=\"Company's Bar\""
-  "      path=\"products/bar\" distro_target=\"sle-11-i386\" enabled=\"true\"/>"
+  "      path=\"products/bar\" distro_target=\"sle-11-i386\" enabled=\"tRUe\" autorefresh=\"FaLsE\"/>"
   "<repo alias=\"company-foo-upd\" name=\"Company's Foo Updates\""
   "      path=\"products/foo/updates\" distro_target=\"sle-11-i386\" priority=\"1\"/>"
   "</repoindex>";
@@ -61,6 +61,8 @@ BOOST_AUTO_TEST_CASE(read_index_file)
     BOOST_CHECK_EQUAL(99, repo.priority());
     // "Repository is explicitly enabled"
     BOOST_CHECK(repo.enabled());
+    // "Repository autorefresh is explicitly disabled"
+    BOOST_CHECK(!repo.autorefresh());
 
 
   }
index 6e4e4d4..6242ea4 100644 (file)
@@ -162,7 +162,13 @@ namespace zypp
         // optional enabled
         s = reader_r->getAttribute("enabled");
         if (s.get()) {
-          info.setEnabled(str::strToTrue(s.asString()));
+          info.setEnabled(str::strToBool( s.asString(), info.enabled() ));
+        }
+
+        // optional autorefresh
+        s = reader_r->getAttribute("autorefresh");
+        if (s.get()) {
+          info.setAutorefresh(str::strToBool( s.asString(), info.autorefresh() ));
         }
 
         DBG << info << endl;