[Release] wrt-installer_0.1.53
[framework/web/wrt-installer.git] / tests / general / ManifestTests.cpp
index 769bfa3..6b76d3a 100644 (file)
@@ -26,6 +26,7 @@
 #include <dpl/test/test_runner.h>
 #include <InstallerWrapper.h>
 #include <ManifestFile.h>
+#include <dpl/log/log.h>
 
 using namespace InstallerWrapper;
 
@@ -41,57 +42,76 @@ Expected: file should be created and installed by wrt-installer. Content should
 */
 RUNNER_TEST(creatingManifestFile)
 {
-    const char * manifestPath = "/opt/share/packages/manifest01.xml";
+    std::string manifestPath = "/opt/share/packages/";
     /* This widget removal should stay here in case previous test run failed
      * (so widget has not been uninstalled) */
-    uninstallByGuid("http://test.samsung.com/widget/manifestTest");
     std::string tizenId;
-    RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/manifest.wgt", tizenId)
-            == InstallerWrapper::Success);
-    RUNNER_ASSERT(WrtUtilFileExists(manifestPath));
+
+    if(install(miscWidgetsStuff + "widgets/manifest.wgt", tizenId)
+            != InstallerWrapper::Success)
+    {
+        uninstall(tizenId);
+        RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/manifest.wgt", tizenId)
+                == InstallerWrapper::Success);
+    }
+
+    RUNNER_ASSERT(WrtUtilFileExists(manifestPath.append(tizenId.substr(0,10)).append(".xml")));
     ManifestFile mf(manifestPath);
 
     Try
     {
+        LogDebug("Package " << mf.getValueByXpath("/p:manifest/@package"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@package")
-                      == "manifest01");
+                      == tizenId.substr(0,10));
+        LogDebug("type " << mf.getValueByXpath("/p:manifest/@type"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@type")
                       == "wgt");
+        LogDebug("version " << mf.getValueByXpath("/p:manifest/@version"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@version")
                       == "1.0");
+        LogDebug("label " << mf.getValueByXpath("/p:manifest/p:label"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:label")
                       == "Manifest Example");
 
+        LogDebug("email " << mf.getValueByXpath("/p:manifest/p:author/@email"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author/@email")
                       == "manifest@misc.test.create.desktop.com");
+        LogDebug("href " << mf.getValueByXpath("/p:manifest/p:author/@href"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author/@href")
                       == "http://misc.test.create.desktop.com");
+        LogDebug("author " << mf.getValueByXpath("/p:manifest/p:author"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author")
                       == "Manifest");
 
+        LogDebug("appid " << mf.getValueByXpath("/p:manifest/p:ui-application/@appid"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@appid")
-                      == "manifest01");
+                      == tizenId);
+        LogDebug("nodisplay " << mf.getValueByXpath("/p:manifest/p:ui-application/@nodisplay"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@nodisplay")
                       == "false");
+        LogDebug("type " << mf.getValueByXpath("/p:manifest/p:ui-application/@type"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@type")
                       == "webapp");
+        LogDebug("extraid " << mf.getValueByXpath("/p:manifest/p:ui-application/@extraid"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@extraid")
                       == "http://test.samsung.com/widget/manifestTest");
+        LogDebug("taskmanage " << mf.getValueByXpath("/p:manifest/p:ui-application/@taskmanage"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@taskmanage")
                       == "true");
 
+        LogDebug("icon " << mf.getValueByXpath("/p:manifest/p:ui-application/p:icon"));
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:icon")
-                      == "manifest01.png");
+                      == (tizenId + ".png"));
 
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[not(@xml:lang)]")
                       == "Manifest Example");
-        RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='de_DE']")
+        RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='de-de']")
                       == "Manifest Beispiel");
-        RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='en_US']")
+        RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='en-us']")
                       == "Manifest Example");
         RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='pl']")
                       == "PrzykĹ‚ad Manifest");
-        RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='pt_PT']")
+        RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='pt-pt']")
                       == "Exemplo manifesto");
     }
     Catch(ManifestFile::ManifestParseError)